I played a little around and found in PartyFinancialHistory.groovy the calculation of "totalToBeReceived" / "totalToBePayed"
I believe, that these are the amounts that the company owe to the customer or the customer owe to the company... if so, I think there is a misscalculation (cause I do not get correct amounts there) your code: transferAmount = totalInvSaApplied.add(totalInvSaNotApplied).subtract(totalInvPuApplied.add(totalInvPuNotApplied)).subtract(totalPayInApplied.add(totalPayInNotApplied).*add*(totalPayOutApplied.add(totalPayOutNotApplied))); my opinion: transferAmount = totalInvSaApplied.add(totalInvSaNotApplied).subtract(totalInvPuApplied.add(totalInvPuNotApplied)).subtract(totalPayInApplied.add(totalPayInNotApplied).*subtract*(totalPayOutApplied.add(totalPayOutNotApplied))); in easier looking: your code: Sales Invoices - purchase invoices - (incomming payments + outgoing payments) my code: Sales Invoices - purchase invoices - (incomming payments - outgoing payments) So lets test the cases: *1. customer payed and we refund items * payment 1000$ sales invoices (applied and unapplied) = 1000$ purchase invoice (refund) = 100$ (item refund) refund payment 100$ acutally: 1000 - 100-(1000+100) = -100 --> Wrong, because we allready payed and invoiced back my way: 1000 - 100 -(1000-100) = 0 --> OK 2. customer payed more than he should (1200 instead of 1000) but we have not refunded it (same amounts) 1000 - 0 - (1200 - 0) = -200 --> OK, we owe 200$ to the customer what do you think, am I wrong? otherwise I do not understand the meaning of the field value. -- View this message in context: http://ofbiz.135035.n4.nabble.com/Credit-note-Refund-Item-price-tp4643993p4644052.html Sent from the OFBiz - User mailing list archive at Nabble.com.
