Dumb question time...

How do I scale/round in a .bsh script? I need to mangle some reports to handle VAT/GST and I need to work with values significant to 2 decimal places. This has got to be obvious, but not to me in my bleary eyed state...

For example, I want calculate an item's GST to 2 decimal places I will display the GST on an invoice and sum a series of these "itemGSTs" to calculate a tax subtotal, and naturally, I want the displayed values and the subtotal not to exhibit any discrepancies.

Currently I'm using things like

<#assign itemGST=(invoiceItem.quantity?double * invoiceItem.amount?double * 0.10)>

to calculate, and

<@ofbizCurrency amount=itemGST isoCode=invoice.currencyUomId?if_exists/>

to display the values. Obviously, the latter is applying some scaling/rounding rules, and I want to apply the same rules to my running totals to make sure things add up.

Assistance appreciated...

Cheers, Iain


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/732 - Release Date: 24/03/2007 
4:36 PM

Reply via email to