How can we cancel Purchase receipt?

Suggestion:
System has a provision to cancel a Purchase Receipt. Users can click the ‘Cancel’ button on the record feed in the list view.
it should set the status of above transaction should be set as X and should not permit further editing the transaction.
It should only allow to CANCLE the transactions only when Receipt and Return are unconfirmed and there is no detail line item. Also provision to be made to give rights to CANCLE button separately.