[ https://issues.apache.org/jira/browse/OFBIZ-5339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacques Le Roux closed OFBIZ-5339. ---------------------------------- Backported in R13.07 r1533738 R12.04 r1533739 R11.04 r1533740 > Error in PartyFinancialHistory.groovy calculation of the "totalToBeReceived" > / "totalToBePayed" > ------------------------------------------------------------------------------------------------ > > Key: OFBIZ-5339 > URL: https://issues.apache.org/jira/browse/OFBIZ-5339 > Project: OFBiz > Issue Type: Bug > Components: party > Affects Versions: Release Branch 11.04, SVN trunk, Release Branch 12.04, > Release Branch 13.07 > Reporter: Jacques Le Roux > Assignee: Jacques Le Roux > Priority: Minor > Fix For: SVN trunk > > > Quoting Robert g. on user ML (actually Nabble) > {quote} > 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) > acutally: 1000 - 0-(1200+0) = -200 --> OK, we owe 200$ to the customer > my way: 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. > {quote} -- This message was sent by Atlassian JIRA (v6.1#6144)