Hi Paul, This is very enlightening, with flowthrough accumulated rundoff it is guaranteed the overall rounding is always within half a cent. This will guarantee a consistent result in both systems.
Awesome, we'll try this. Many thanks. Cheng |-----Original Message----- |From: Paul Heinz [mailto:p...@accredo.co.nz] |Sent: Friday, 12 November 2010 1:00 p.m. |To: Cheng Wei (FMI) |Cc: NZ Borland Developers Group - Delphi List |Subject: RE: MYOB Rounding Issue - MYOB Data File Attached | |Hi Cheng Wei | |> Please find attached a zip file containing: |> |> - A company data file (AccountRight Enterprice v19+); |> - A sample invoice pdf generated by our system; |> - An MYOB Item Sales import file generated by our system, containing |> line items of the invoice. |> |> Invoice Number: GR2115 | |Very interesting. As it turns out, from that invoice it would appear |that MYOB uses the same GST rounding model that we use in our product, |Accredo. | |Our algorithm is a line-by-line GST calculation rounding to nearest BUT |with flowthrough accumulated roundoff. The result of this algorithm is |that you get exact whole cents on each line which is ideal for |accounting analysis but the resulting total GST is also consistent with |rounding the whole document total just once. | |To get an idea of how this algorithm works on a line by line basis: | |The 1st line is $272.16, add 15% = $312.894, rounds to $312.89 and |0.004 difference. | |The 2nd line is $28.88, add 15% = $33.212 + 0.004 diff = $33.216, |rounds to 33.22 and -0.004 difference. | |The 3rd line is $80.00, add 15% = $92.00 - 0.004 diff = $91.996, rounds |to $92.00 and -0.004 difference. | |The 4th line is $589.50, add 15% = $677.925 - 0.004 diff = $677.921, |rounds to $677.92 and +.001 difference. | |The 5th line is $58.95, add 15% = $67.7925 + 0.001 diff = $67.7935, |rounds to $67.79 and +0.0035 difference. | |The 6th line is $60.55, add 15% = $69.6325 + 0.0035 diff = $69.636, |rounds to $69.64 and -0.004 difference. | |The overall GST total = $163.51. | |Note that this result is the same as taking $1090.04, add 15% = |$1253.546, rounds to $1254.55 and -0.004 difference. | |In each of the above examples, I'm showing the inclusive total which is |how MYOB stores it per invoice line but you can also just calculate GST |at 15% and round that with the flowthrough model which is what Accredo |does since they are mathematically equivalent. | |I'm not sure if MYOB also handles negative documents consistently and |rounds exact half cents _down_ for credits which is something we also |factor into the algorithm in Accredo. | |We like our negative invoices to give the exact same figures as an |equivalent positive invoice with just the signs flipped. |If you use standard IEEE round-to-nearest, you won't get that for |documents with lines that have exact half cents of GST. | |I'd need an example of an equivalent credit document to confirm MYOB's |behaviour in that case. | |Cheers, | Paul. | | | | ##################################################################################### Scanned by MailMarshal - M86 Security's comprehensive email content security solution. Download a free evaluation of MailMarshal at www.m86security.com ##################################################################################### _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe