Bug in calculating "allocatedAmount" for Invoices?

Hi,

Is anyone else seeing this as a bug?

To reproduce, I do a credit adjustment (or credit) to a customer account (say $20), formulate an invoice (say $200), and then process a payment ($180). At this point, the ${allocatedAmount} field in invoice.jrxml is coming through as $200. We've had a couple customers complain that they didn't get their discount, or had to pay the full amount. Usually showing them the receipt calms them down, but the invoice should probably reflect the actual payment here.

Cheers, Paul

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Bug in calculating "allocatedAmount" for Invoices?

The allocatedAmount node is used to keep a running balance. In your case, the invoice has been fully allocated by the credit and payment. For this reason, its probably not appropriate to use to determine the amount paid.

I can't think of a straight forward way to do this at present. It might require passing the payment or just its total to the invoice report.

-Tim

Re: Bug in calculating "allocatedAmount" for Invoices?

Hi Tim,

I see -- was trying to trace in the code. Where are these values passed to the report?

Thanks, Paul

Re: Bug in calculating "allocatedAmount" for Invoices?

When you finalise an invoice, its printed from the ChargeCRUDWindow.onPosted() method.

Changing the code here to pass the paid amount as a parameter the report will be insufficient as an invoice can be reprinted in the Customer -> Accounts workspace where the paid amount cannot be determined.

The main issue is that when you make a payment, the payment will be used to pay any unpaid/part paid prior invoice before the current invoice. It may be necessary to introduce a relationship between payments and the invoice. This way, the paid amount can be determined by summing each of the payment totals.

-Tim

Re: Bug in calculating "allocatedAmount" for Invoices?

Thanks Tim,

I see... makes sense. maybe the path of least resistance here is to just change the invoice to say "AMOUNT PAID (plus credits)"?

Paul

Re: Bug in calculating "allocatedAmount" for Invoices?

Yep. Not ideal, but the easiest approach at the moment.

I've raised https://openvpms.atlassian.net/browse/OVPMS-1117 to track this.

-Tim

Syndicate content