![]() |
| > Home > Documentation > Latest documentation > Interchange ecommerce functions > Interchange sales tax calculations |
|
Interchange sales tax calculationsInterchange allows you to calculate sales tax using a number of different methods.
Simple "salestax.asc" methodIn this simple taxing method, the SalesTax directive is set to <form> fields whose values will be used as keys to look up the tax rate in a "salestax.asc" file. The "salestax.asc" file is expected to be in the DataDir directory. Sales tax calculation in this simple scheme is performed on a straight percentage basis, with certain items allowed to be tax-exempt. Simply initialise the SalesTax directive to the name of some lookup fields. Those lookup fields are the ones that are available on the final order form and indicate geographical locality. For instance, in the USA, you might use this:
Each line of the "salestax.asc file should contain a code, representing the locality, followed by a one or more whitespace character, and then the desired tax rate. For example:
Based on information given in the user's order form, and given our sample SalesTax setting, Interchange will attempt a tax lookup by zip and state, in that order, and will apply the percentage (if found) to the subtotal of the order. The subtotal will include item prices and, if TaxShipping is set up, the shipping costs. The tax amount will be available for display via the [salestax] tag, and will be added to the total order amount. If no match is found in the "salestax.asc" file, the "DEFAULT" (usually zero) will be applied.
If some items are not taxable, then you must set up a field in your database to indicates the taxable status. The NonTaxableField directive is used to declare the name you have chosen for your "non taxable item" column, in your products table. If the specified column for that item is set to a true value (not zero, not blank and not NULL), sales tax will not be applied to the item. If you want to set a fixed tax rate for all orders, then a SalesTax set to the zip or state codes would not be optimal. The solution could be to introduce an arbitrary variable that, unlike zip or state, does not change from user to user. Then, you would set that variable in user's session to point to a fixed entry in the "salestax.asc" file. Fly taxA series of Interchange Variable settings are read to develop a salestax rate for one or more geographical localities. With this method, you implement the simple SalesTax method explained above, put with only one entry in the "salestax.asc" file. TAXRATE and TAXSHIPPING variables would then be used to build the tax rates. The single entry in "salestax.asc" should be "default", with a value of [fly-tax], as follows:
Multi (VAT)With this method, country and state tables are used to create complex VAT or sales tax rate calculations, possibly with different rates based upon the product type. If the SalesTax directive is set to "multi", then the type of tax to apply will be read from the "country" table's "tax" column. You could display the British standard rate VAT like this:
We've mentioned some hard-coded values above (the "country" table and some column names etc.), but this is all configurable using various website variables, such as MV_COUNTRY_FIELD, MV_COUNTRY_TABLE, MV_COUNTRY_TAX_FIELD, MV_STATE_TABLE, MV_STATE_TAX_FIELD, MV_TAX_CATEGORY_FIELD and MV_TAX_TYPE_FIELD etc. So, with this multi approach, Interchange first performs a lookup in the "country" table. The default key for the lookup is, of course, the value of the "country" variable on the order form (i.e. [value country]). The following rules are applied, based upon the string content of the "tax" column:
The "mv_shipping" field is used to set the tax rate for shipping, if shipping is to be taxed at all. If shipping is taxed only when taxable items are in the cart, as is the case with UK VAT, then use "mv_shipping_when_taxable" instead. Levies and other tax schemesUsing Levies and Levy structure, any or all of the above methods are used in combination to implement the a taxing scheme of truly arbitrary complexity.
|
| Home | Legal nonsense | Privacy policy | Contact us |