This is a patch to a recent checkout of Trunk from SVN.
On AR transactions with nothing paid, the amount paid was being reported
as twice the total amount of the invoice in the AR, Reports, Outstanding
detail report. Transactions which were fully paid were reported
correctly. The amount paid was calculated with:
'a.amount - sum(acs.amount)'
This is correct for AP but for AR it should be:
'a.amount + sum(acs.amount)'
With this change, the amount paid is calculated with:
'a.amount + $ml * sum(acs.amount)'
Where $ml is a local variable set to +1 for customer (AR) and -1 for
vendor (AP). This results in the amount paid being calculated correctly
for both AR and AP.