Billing a customer

hello , our company buy produce from farmers but before we buy we do give these farmers ,input like fertilizer ., loans and other services and after harvest they supply us and we need to deduct the money from the total amount of money we pay them …I know in erpnext they are our suppliers .how do we deduct these monies from from the total amount we have to pay them with erpnext ?

Welcome back!

Your best bet is to setup each Farmer as both a Customer and as a Supplier. You all the stuff you sell them as a customer and just before harvest you pass a Journal Entry and transfer the balances to the Supplier Account. You can also accomplish this by doing some scripting and or customization. Now as you buy from the farmer and the AP report will show you how much money you owe the farmer. Or the farmer owes you.

Hope this helps.