Advance allocation for purchases

I always keep some balance with suppliers suppose with supplier A I have an advance paid balance of 5000. I place a purchase order of 19600 with this supplier. I paid another 15000 (round figure payment) against above PO and rest 4600 supplier deducted from my outstanding cash balance of 5000. How do I allocate this 4600 against above PO. Please note

  1. 5000 balance available with supplier before this PO
  2. Allocation of 4600 from previous balance of 5000 &15K through advance payment after PO.
  3. Total 19600 allocation against P.O. to enter in ERPNext and after completing payment like above new balance with supplier is 400 which I will use for future PO.
    Please help how can I enter these transactions in ERNEst?

You first need to create an advance payment entry.

After you’ve created the appropriate purchase invoices, you can use the payment reconciliation tool to sync up your balance with your supplier.

Btw, this works for customers too if they are giving you payments in advance and you can sync up your balance after the appropriate sales invoices have been created.

Edit: also check out this post from several hours ago.