Localisation: GST/VAT worksheet programming guide

Business information access

Only information passed by Manager to the localisation is accessible from within the localisation (due to Liquids design philosophy). Most of the localisation specific information is passed in a variable called “objects” the contents of which varies with the localisation type. “business” and “report” specific information is also visible when the localisation is run.

Variables are of dynamic size. So if the your business has not used or defined some thing, variables referencing it will be empty.

Variable definition and behaviour is actually harder to describe than they are to use. So if you find this overview confusing, create a test localisation, leave the calculation section blank and experiment displaying the content of the variables. The content will change as you enter transactions and define values else where in the Manager business.

Data is mostly stored in variables consisting of an array of elements of the format [dataLable, dataContent]. The dot “.” operator can be used to select a particular value of a array. For example assuming
MyVariable = [apples, 5.5][oranges, 10.2]
Then

{{ MyVariable.oranges }}

would print 10.2

Data is mostly accessed via a pointer or UUID. Complex data structures are build by having a pointer (UUID) in the dataContent. When a structure is displayed containing a UUID, then “DotLiquid.Hash” rather than the pointer value or referenced structure is displayed. However if a specific UUID is specified, the referenced data structure will be displayed.

To illustrate, in a test business with several tax codes defined and two transactions entered
Receipt into Sales account, amount 100, with tax code “GST 15%”
Receipt into Sales account, amount 1000, with tax code “GST 0%”

Then in a localisation of type “Tax Summary” and nothing entered in the Script section. The following code in the Layout

{{ objects }}

Will display

DotLiquid.HashDotLiquid.Hash

Consistent with the variable “objects” containing information about the two used tax codes.

The contents of the “objects” array can be displayed by

{% for objectRow in objects  %}
  {{ objectRow }}	
{% endfor %}

Which will display

[TaxCode, DotLiquid.Hash][netSales, 1000.00][taxOnSales, 0][totalSales, 1000.00][netPurchases, 0][taxOnPurchases, 0][totalPurchases, 0][taxOnSalesMinusTaxOnPurchases, 0] 
[TaxCode, DotLiquid.Hash][netSales, 86.96][taxOnSales, 13.04][totalSales, 100.00][netPurchases, 0][taxOnPurchases, 0][totalPurchases, 0][taxOnSalesMinusTaxOnPurchases, 13.04]

Which is the actual data Manager calculated from the current business and passed to the localisation.

The data above contains the UUID of each of the tax codes used in the business, labelled “TaxCode” and displayed as “DotLiquid.Hash”. That data element can be referenced using the dot operator and specifying the “TaxCode” data label.

{% for objectRow in objects  %}
  {{ objectRow }}
  {{ objectRow.TaxCode }}
{% endfor %}

Which displays:

[TaxCode, DotLiquid.Hash][netSales, 1000.00][taxOnSales, 0][totalSales, 1000.00][netPurchases, 0][taxOnPurchases, 0][totalPurchases, 0][taxOnSalesMinusTaxOnPurchases, 0] 
[Name, GST 0%][Notes, ][Rate, DotLiquid.Hash][TaxRate, ZeroRate][TaxRateType, SingleRate][HasFlatRate, DotLiquid.Hash][FlatRate, DotLiquid.Hash][Archived, DotLiquid.Hash][IsReverseCharged, DotLiquid.Hash][ReverseChargedRate, DotLiquid.Hash][CustomSalesInvoiceTitle, DotLiquid.Hash][SalesInvoiceTitle, Tax Invoice][CustomCreditNoteTitle, DotLiquid.Hash][CreditNoteTitle, ][Key, 1a88fd08-a595-4e12-97d3-85fc165eecdc]     
   
[TaxCode, DotLiquid.Hash][netSales, 86.96][taxOnSales, 13.04][totalSales, 100.00][netPurchases, 0][taxOnPurchases, 0][totalPurchases, 0][taxOnSalesMinusTaxOnPurchases, 13.04] 
[Name, GST 15%][Notes, ][Rate, DotLiquid.Hash][TaxRate, CustomRate][TaxRateType, SingleRate][HasFlatRate, DotLiquid.Hash][FlatRate, DotLiquid.Hash][Archived, DotLiquid.Hash][IsReverseCharged, DotLiquid.Hash][ReverseChargedRate, DotLiquid.Hash][CustomSalesInvoiceTitle, DotLiquid.Hash][SalesInvoiceTitle, Tax Invoice][CustomCreditNoteTitle, DotLiquid.Hash][CreditNoteTitle, ][Key, ee8cacde-58da-48ec-8aa9-aa6acba9c32f] 

From which more useful data can be selected, for example

{% for objectRow in objects  %}
  Tax Code name  {{ objectRow.TaxCode.name }}
  Tax Code UUID  {{ objectRow.TaxCode.key }}
  Localisation data {{ objectRow }}
{% endfor %}

Entered into a localisation layout
My%2021%20debug%20objectRow

Which when viewing the localisation displays

Similarly the contents of the variables “report” and “business” can be displayed by

{{ report }}
{{ business }}

An example of the printout from this for “report” is

[From, 01/01/0001 ][To, 15/08/2019 ][Description, ][Key, 69394879-fd35-4143-bf4b-33ea6de86443]

And “business” where a custom field has been added but accounting Basis not defined

[Name, My Test Business name][Address, My test Businesses Address line 1 Address line 2][CustomFields, System.Collections.Generic.Dictionary`2[System.String,System.String]][Key, 38cf4712-6e95-4ce1-b53a-bff03edad273]