Introduction
Calculation Rule AssignmentsThe calculation codes (in the CALCODE table) have been broken up to represent the different Canadian tax categories: GST, PST, HST, and QST. The significance of breaking up tax categories into isolated calculation codes resolves complications resulting from having to deal with multiple tax categories (GST, PST, HST and QST). This breakup can be applied to any jurisdiction tax system such as the American tax system where levels are distinguished by COUNTRY, TERRITORY, STATE, CITY, LOCAL, SECONDARY STATE, SECONDARY LOCAL, and so on. Each jurisdiction level can have their own isolated tax rate or exemption. The ship-to address that qualifies for a particular order item resolves to a distinct set of jurisdiction levels. For the example illustrated in this paper, all Canadian tax rules have been defined by distinguished jurisdiction level values. Four calculation codes created, each having a CALCODE.GROUPBY value of 8 to allow for OrderItems with different shipping addresses to be grouped separately. Each calculation code is then associated with four tax categories. At a more fine-grained level, several calculation rules are assigned for PST. The split for PST is as follows:
- Calculation rule for PST rate for Prince Edward Island jurisdiction
- Calculation rule for PST rate for Ontario jurisdiction
- Calculation rule for PST rate for Manitoba jurisdiction
- Calculation rule for PST rate for Saskatchewan jurisdiction
- Calculation rule for PST rate for British Columbia jurisdiction
This sample demonstrates how to load the Canadian Tax Configuration into a Commerce database and test it using a modified JSP page.
From the JSP page, you will need to update the MultiAddressCheckout.jsp and SingleAddressCheckout.jsp to show Canadian Tax as follows:
<% orderTax = orderBean.getTaxes(); Hashtable orderTaxExample = orderTax.getCategorizedAmountsAndNames(); String nameTx, valueTx; if (orderTaxExample!=null) { for (Enumeration eTx=orderTaxExample.keys(); eTx.hasMoreElements();) { nameTx = (String)eTx.nextElement(); MonetaryAmount amtTx = (MonetaryAmount)orderTaxExample.get(nameTx); if (amtTx!=null) { if (amtTx.getValue().compareTo(new BigDecimal("0.0"))!=0) { FormattedMonetaryAmountDataBean amtDBTx = new FormattedMonetaryAmountDataBean(new MonetaryAmount(amtTx.getValue(), amtTx.getCurrency()),orderTax.getStoreAccessBean(),orderTax.getLangId()); %> <tr> <td align="right" colspan="5"> <font class="price"><b><%=nameTx%> </b></font></td> <td align="right" valign="top"> <font class="price"><%=amtDBTx.toString()%> </font> </td> </tr><% } } } } %>
The following section will allow you to execute a Canadian tax implementation for:
- The FashionFlow sample store on WebSphere Commerce Professional Edition Version 5.5
- The consumer direct starter store in WebSphere Commerce Version 5.6
You will need to:
- Install JSP files to the test WebSphere Commerce Server
- Run ID Resolver on the tax.xml file
- Run Massload on the resolved tax.xml file
- Test following the above tax matrix
Steps
- Extract the CanadianTax.zip file into a temporary directory.
- Change the extracted directory to the corresponding subdirectory to represent your WebSphere Commerce version:
- for WebSphere Commerce v5.5 for FashionFlow, change to the v5.5_JSP_files/FashionFlow directory
- for WebSphere Commerce v5.6 for ConsumerDirect, change to the v5.6_JSP_files/ConsumerDirect directory
- Copy the JSP files from the store directory in the previous step into your WebSphere Commerce or WebSphere Application Server directory
- for WebSphere Commerce Server, change to the WAS_installdir\installedApps\cell_name\WC_instance_name.ear directory
- for Studio or Toolkit, change to the workspace_dir\installedApps\cell_name\WC_instance_name.ear\Stores.war directory
- Change directory to the extracted zip directory and locate the env.bat file
- Update the env.bat file to match your WebSphere Commerce Server environment
- Set DBNAME to represent the database user of the WebSphere Commerce Server
- Set DBUSER to represent the database user of the WebSphere Commerce Server
- Set DBPWD to represent the database password of the WebSphere Commerce Server
- Set RESGENFILE to represent the output resolved file
- Set INPUTFILE to represent the input file tax.xml
- Set processType to represent the target type. For WebSphere Commerce v5.6 Toolkit, set processType=toolkit. For all others, set processType=server.
- Set TOOLKITDIR to represent the target toolkit install directory for WebSphere Commerce v5.6 Toolkit
- Set WCSHOME to represent the path of the WebSphere Commerce Server
- Set PATH use to update the PATH to add the WCSHOME parameter
- Open the tax.xml file and replace all references to @storeent_id_1 to the STOREENT_ID value from the database you want to update.
- From the opened tax.xml file, replace all references to @ffmcenter_id_1 to the FFMCENTER_ID value from the database you want to update.
- From the opened tax.xml file, replace the wcs.dtd path with the path of your WebSphere Commerce Server wcs.dtd file:
<!DOCTYPE import SYSTEM "E:\WebSphere\CommerceStudio55\Commerce\schema\xml\wcs.dtd"> - Run the batch file "Step1-idresgen.bat" (in a Windows environment).
- Run the batch file "Step2-massload.bat" (in a Windows environment).
- Once the data is loaded, test a shopping flow against the following Canadian tax matrix:
Province
Name of Relevant Statute
General Rate of Tax
Display
Base for PST Including GST
Newfoundland
HST
15% (GST incl.)
HST only
Nova Scotia
HST
15% (GST incl.)
HST only
New Brunswick
HST
15% (GST incl.)
HST only
Prince Edward Island
Revenue Tax Act
10%
GST and PST
Yes (PST charged on GST)
Ontario
Retail Sales Tax Act
8%
GST and PST
No
Manitoba
Retail Sales Tax Act
7%
GST and PST
No
Saskatchewan
Education and Health Tax Act
6%
GST and PST
No
British Columbia
Social Service Tax Act
7%
GST and PST
No
Quebec
QST - refer to the QST Manual
7.5% (tax on GST as well, so therefore closer to 8.03%)
GST and VAT
Yes (VAT on GST)
Alberta
No PST
GST only
Yukon
No PST
GST only
N.W.T.
No PST
GST only
Resources
- Download the ZIP file containing all the code related to this article.