Customizing Tax Calculation

Like the Shipping Calculations, the Tax behavior is implemented as a method on the busInvoice object in the CalculateTax method. By default this method returns a simple tax calculation based on the state and taxrate that you entered in the store's configuration.

The basic behavior is as follows (from busInvoice):

public virtual decimal CalculateTax()
{
	if (this.ShipInfo.UseInvoiceFields) 
	{	
		this.ShipInfo.LoadFromInvoice(Invoice);
	}

	if (this.ShipInfo.State != App.Configuration.TaxState)
		return (decimal) 0.00;

	return this.SubTotal * App.Configuration.TaxRate;
}

Like in the Shipping Calculation the ShipInfo is used in the calculations. Be sure you don't access the invoice fields directly as an invoice may not actually exist yet.

This calculation might be all you need. If you need more perform more tasks override the method in a custom subclass of the busInvoice object which takes the form of:

public override decimal CalculateTax()
{
	... your code here
	return 0.00;
}

© West Wind Technologies, 1996-2018 • Updated: 12/28/03
Comment or report problem with topic