Excuse my ignorance of C#.
Found following code in relation to tax
public override DSC.OrderTotal GetOrderTotal(Cart cart, TaxLocation taxLocation, List<DSC.OrderTotal> orderTotals) {
decimal taxRate = TaxService.GetProvider().GetTaxRate(taxLocation);
decimal total = 0;
foreach (DSC.OrderTotal orderTotal in orderTotals) {
total += orderTotal.Amount;
}
decimal taxTotal = 0;
if (0 != cart.SubTotal)
taxTotal = Utils.Round(total * cart.TaxableSubTotal / cart.SubTotal * taxRate);
return new DSC.OrderTotal("Tax", taxTotal);
}
What I don't understand is when "total" is not going to equal "cart.SubTotal". If they are always the same, they are superfluous to the formula.
What I believe I need to do is:
1. Add an extra field to the Tax Rules which is a flag to indicate if pricing is inclusive or exclusive of the tax.
2. Test the falue of this field, and if it is inclusive use taxTotal = Utils.Round(total * cart.TaxableSubTotal / cart.SubTotal * taxRate / (1+taxrate));
I need to also add a Text value to the tax table to describe the name of the tax, ie, "Includes GST of"
Not sure what else this impacts yet. Any advice or pointers would be appreciated.
|