Cancel Purchase order

How to cancel an approved Purchase order in both cases quantity not received at all and partial quantity received. Or how to foreclose a Purchase order

Not quite sure what your question is.
If you have purchase orders, which have been partial received then you need to Invoice the received quantity before you can delete it. Or reverse the receipts.