did not see this till after I sent my reply. I might suggest 1) when payment for a invoice is posted check the agreements for discounts 2) apply discount as a credit to the payment as a transaction 3) do not change the invoice 4) create a statements that show the invoice with credit for timely payment per agreement. this covers the discount and proper audit of the invoice discount in transactions. Need to change the invoice screen to show any transaction payments and credits with a balance
PS did not get to ofbiz first time this is a second send aray sent the following on 9/21/2010 5:06 AM:
I haven't quite finished the implementation since got pulled into something else. However, my general approach is to (taking the same example I shared earlier) 1. Test an incoming payment and see if it fulfills the pre-payment criteria. If it does then subtract the discounted amount from the invoice and compare to the payment and see if it meets the outstanding invoice amount after the adjustment. If it does then auto create a dummy payment with the discounted amount and then apply the same as well to clear off entire outstanding invoice amount. 2. The discounted amount payment should get credited to a trade or bill discount account. So, essentially this solves the problem that we have but may not necessarily be the best way of doing this. One can think of applying the discount directly to the invoice at the time of payment and preserving that sate. This is something that we may end up doing once we go past the basic implementation. - Aray
