Advance against PO to Supplier and against Sale Order from Customer

Would it be possible to make the advance received from Customer and paid to Supplier be attached to the respective Sale Order and Purchase Order and subsequently flow into Sale Invoice and Purchase Invoice

This would be help full upgrade

Thanks
Edward