Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] Calculation Rounding



Title: Calculation Rounding
In order to calculate the Value Added Tax(VAT) we use the following Minivend calculation tag;

[currency][calc]
  ([subtotal noformat=1]+[shipping noformat=1])*([salestax noformat=1] / [subtotal noformat=1])
 [/calc][/currency]

In this first example, if the calculation is performed using a calculator VAT works out at "6.56775"  which we would expect to see as "6.57" - And so it is.
 
 1 @ £34.03 = £34.03
Shipping £3.50
 Subtotal £37.53
Value Added Tax £6.57
TOTAL £44.10

In a second example, if the calculation is performed using a calculator VAT works out at "38.2165" which we would expect to see as "38.22" - And it isn't.

 4 @ £34.03 = £136.12
 2 @ £30.63 = £61.26
Shipping £21.00
 Subtotal £218.38
Value Added Tax £38.21
TOTAL £256.59

Can anyone come up with a better way of calculating the VAT based a subtotal that includes total of all line items + shipping.

Regards

Paul Burden

Search for: Match: Format: Sort by: