Hi. I strongly suggest you go through the ERPNext manual. It covers almost all your questions. However, here’s quick update
Use period closing voucher. Else you can also do Tally method of passing a final P&L entry. However this will allow users to be able to do backdated entry. Period closing voucher will block it. Also check accounting settings for further control.
There’s 1 account for Debtor and 1 account for creditor. Customer and Supplier links it to proper ledger. You just need to create a customer ot supplier. Don’t need to make individual debtor or creditor account for each party. Make a Sales or Purchase for proper accounting.
Orders are auto closed when delivery note of total quantity is made for each order. You can manually close it customer has been supplied for lesser quantity and rest of quantity will not be supplied.
Invoice is marked as Paid (closed) when payment entries of total value of invoice is made. You can also use JV for invoice payment but that’s a bit longer process. Payment Entry will pass ledger entry and it’s straightforward.
Don’t think there’s any systemic calculation method. You can write a custom script or have your code in a separate app for sales commission.
Thanks so much for your reply. I am going through the docs & understanding the working process of it.
But I also want to understand how it works under the hood, because I might need to change the logic. We are creating an accounting system for agents, which is a bit more complex than this. As in that case, every transaction would include 3 parties, rather than 2.
So any writeup on the architecture, etc… would be really helpful. Even somebody can guide me to the meaningful areas of the code, where this is handled, it would be really helpful.