Localisation: GST/VAT worksheet programming guide

Developing GST/VAT Worksheet: Step 4 Create arrays of all your tax code totals

This is done by the following code which is likely to be the same for all VAT calculation work sheets, so you can leave it unchanged (or delete the lines your worksheet never uses).

{% assign netSales = objects | select: 'TaxCode.Key', 'netSales' %}
{% assign taxOnSales = objects | select: 'TaxCode.Key', 'taxOnSales' %}
{% assign totalSales = objects | select: 'TaxCode.Key', 'totalSales' %}
{% assign netPurchases = objects | select: 'TaxCode.Key', 'netPurchases' %}
{% assign taxOnPurchases = objects | select: 'TaxCode.Key', 'taxOnPurchases' %}
{% assign totalPurchases = objects | select: 'TaxCode.Key', 'totalPurchases' %}
{% assign taxOnSalesMinusTaxOnPurchases = objects | select: 'TaxCode.Key', 'taxOnSalesMinusTaxOnPurchases' %}

What it does, from the “objects” passed to the localisation, it creates variables containing an array which use each tax codes UUID as an data label and the relevant total as a value. Array elements being of the format [TaxCodeUUID, amountInDollars]

These arrays can then be used to easily access specific totals for each tax code.

For example the following code will now display the net sales for the tax code GST 15%

{{ netSales[GST_15] }}