# How to implement country-specific report in Manager

**URL:** <https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543>\
**Category:** Uncategorized\
**Created:** [September 13, 2020, 4:13am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543 "2020-09-13T04:13:01Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Patch](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Patch](https://forum.manager.io/u/Patch)\
**Post date:** [September 23, 2020, 10:44am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/61 "2020-09-23T10:44:07Z")

</div>

Have a look at the Australian “Single touch payroll” localisation which uses custom fields.

---

<div class="post-metadata">

**Author:** ![Davide](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@Davide](https://forum.manager.io/u/Davide)\
**Post date:** [September 23, 2020, 12:42pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/62 "2020-09-23T12:42:54Z")

</div>

ok… {{ e.CustomFields[“44b50444-2340-4473-b691-fd052b34eb08”] }} with the UUID of the custom fields.

Now, more then ever, we need a way to set the same UUID in different Businesses.

---

<div class="post-metadata">

**Author:** ![lubos](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/lubos/32/62798_2.png) [@lubos](https://forum.manager.io/u/lubos)\
**Post date:** [September 24, 2020, 12:01am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/63 "2020-09-24T00:01:30Z")

</div>

@Davide I will be extending this so it will be possible to use either UUID or a name of custom field. This way you won’t need the same UUID across multiple businesses.

---

<div class="post-metadata">

**Author:** ![Davide](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@Davide](https://forum.manager.io/u/Davide)\
**Post date:** [September 24, 2020, 4:07am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/64 "2020-09-24T04:07:53Z")

</div>

Please keep in mind that selection through names should be possible also for tax codes and so on.

BTW I still don’t understand the adversity to bring back the possibility to export and import all settings also locally through a file. Can you please reconsider it? Maybe through a global (at settings level) batch create/update with the possibility also to “clone” UUIDs.

---

<div class="post-metadata">

**Author:** ![lubos](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/lubos/32/62798_2.png) [@lubos](https://forum.manager.io/u/lubos)\
**Post date:** [September 24, 2020, 4:14am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/65 "2020-09-24T04:14:16Z")

</div>

Yeah, it will be supported for tax codes and other items too.

---

<div class="post-metadata">

**Author:** ![Davide](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@Davide](https://forum.manager.io/u/Davide)\
**Post date:** [September 24, 2020, 7:33am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/66 "2020-09-24T07:33:18Z")

</div>

Thanks. In the meantime is it possible to enable batch create/update for custom fields?

It would save us a lot of time.

---

<div class="post-metadata">

**Author:** ![Davide](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@Davide](https://forum.manager.io/u/Davide)\
**Post date:** [September 25, 2020, 7:21am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/67 "2020-09-25T07:21:22Z")

</div>

Is It possible to switch from accrural to cash basis numbers under Report Transformation?

---

<div class="post-metadata">

**Author:** ![Patch](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Patch](https://forum.manager.io/u/Patch)\
**Post date:** [September 28, 2020, 2:41am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/68 "2020-09-28T02:41:06Z")

</div>

@lubos or anyone else who has worked it out.

For completeness, what is the proceedure to access lines in receiptsAndPayments or salesInvoices or purchaseInvoices

The fields are displayed and Lines can be listed but my attempts to access lines data have only given only errors

```auto
{{ receiptsAndPayments | first | fields }}
{% for e in receiptsAndPayments limit:3 %}
   {{ e.Lines | first | fields }}
   {% for f in e.Lines limit:3 %}
      f appears to contain data for a line of a receipt or payment
   {% endfor %}
{% endfor %}

```

The structure appears to be the same for invoice

```auto
{{ salesInvoices | first | fields }}

```

Maybe it is a permissions thing as the lines table is not listed in globals

Ps  
If lines is intended to not be accessed directly, and instead be accessed via transactions, then that’s OK to, I will just stop trying to access it directly.

---

<div class="post-metadata">

**Author:** ![Davide](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@Davide](https://forum.manager.io/u/Davide)\
**Post date:** [September 29, 2020, 4:56am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/69 "2020-09-29T04:56:34Z")

</div>

It doesn’t work for myself to. I think that it is an issue of exposing the variables.

---

<div class="post-metadata">

**Author:** ![Patch](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Patch](https://forum.manager.io/u/Patch)\
**Post date:** [October 1, 2020, 6:55am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/70 "2020-10-01T06:55:50Z")

</div>

Exploring the Report Transformations environment took me some time.  
The following Manager business / Report Transformation, just displays the business’s data. Which I found useful when writing transformations.  
[Test Localisation (2020-10-01) - Display variables.manager](https://forum.manager.io/uploads/short-url/gZbQYRmP8TX1zgPMK0fnjGnTxtj.manager) (100 KB)

---

<div class="post-metadata">

**Author:** ![Davide](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@Davide](https://forum.manager.io/u/Davide)\
**Post date:** [October 1, 2020, 8:42am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/71 "2020-10-01T08:42:11Z")

</div>

Thanks

---

<div class="post-metadata">

**Author:** ![Daniel\_Arthur](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/daniel_arthur/32/15160_2.png) [@Daniel\_Arthur](https://forum.manager.io/u/Daniel_Arthur)\
**Post date:** [October 1, 2020, 10:31am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/72 "2020-10-01T10:31:51Z")

</div>

> [@lubos](#):
>
> This is where all country-specific Manager databases will be stored

I cannot find the localisation for Ghana anymore as it used to be. Can you please add it? @lubos. I will want to contribute by way of submissions. Thank you.

---

<div class="post-metadata">

**Author:** ![Patch](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Patch](https://forum.manager.io/u/Patch)\
**Post date:** [October 1, 2020, 12:17pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/73 "2020-10-01T12:17:19Z")

</div>

> [@Daniel\_Arthur](#):
>
> localisation for Ghana anymore … I will want to contribute by way of submissions

If you have a Manager business in which you have loaded the Ghana tax codes you can delete everything else and use that.

If you then create a localisation using those tax codes it will work with Businesses which used the old localisation. New businesses will be able to load your localisation (with a Report transformation and tax codes) which will include the tax codes.

---

<div class="post-metadata">

**Author:** ![GrahamvdR](https://avatars.discourse-cdn.com/v4/letter/g/51bf81/32.png) [@GrahamvdR](https://forum.manager.io/u/GrahamvdR)\
**Post date:** [October 14, 2020, 9:14pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/74 "2020-10-14T21:14:19Z")

</div>

I have been playing around with report transformations and am very excited about the ways that they’ll help me once I get a few set up. However, I’m having a little difficulty with my first attempt.

I need to generate a report that lists all purchase invoices within a specified period, showing the following columns:

- Date
- Supplier
- Vat number
- Invoice number
- Cost excluding VAT
- VAT amount
- Amount including VAT
- Description of goods/services

I have managed to access the data for all the columns, but not the right amounts. For each line item on each purchase invoice I am getting a row with the VAT amount appearing in all three amounts columns, followed by a row with the tax exclusive amount appearing in all three columns. I want the right amounts as per the headers, and I want to see only a single row for each purchase invoice, not for each line item. Is there a way to group by purchase invoice? Or should I be selecting something other than `tax_inclusive_purchases` from `transactions`?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/manager1/original/3X/b/5/b5e753ff638fbbe8b03ad0ca51cc4c072adc5242.png)

I will also need to create a similar report for the sales invoices, but I think that once I figure this one out that will be easy.

---

<div class="post-metadata">

**Author:** ![Patch](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Patch](https://forum.manager.io/u/Patch)\
**Post date:** [October 14, 2020, 10:32pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/75 "2020-10-14T22:32:49Z")

</div>

> [@GrahamvdR](#):
>
> I want the right amounts as per the headers, and I want to see only a single row for each purchase invoice, not for each line item. Is there a way to group by purchase invoice?

`taxcode:`  
In custom report terminology provides a “Where …” search term  
`between:`  
provides “From Until” functionally (which is actually also a database search so analogous to a “Where …” search term)

Managers accounting is all done at the line item level. That is where rounding to smallest legal tender occurs. Invoices, receipts/payments and all other larger entities are all collections of line items.

Any calculations in Manager are done at the line item level, so could be done within your for loop.

To get sub totals use  
`group_by "salesInvoices" `  
Then a for loop to cycle through the sales invoices  
And a for loop within it to cycle through the line items

Repeat the above for `purchaseInvoices` and `receiptsAndPayments`  
I had posted an example of doing this with [an explanation and figures but it got deleted](https://forum.manager.io/t/jobkeeper-topup-and-stp/27902/15).

I don’t believe it is currently possible to re assemble line items into invoices directly as while all the following are accessible, the `lines` database table is not

- Sales invoices `salesInvoices`
- Purchase invoices `purchaseInvoices`
- Receipts/payments `receiptsAndPayments`

My attempts to display them are in the test system in [this post above](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/70)

> [@GrahamvdR](#):
>
> Or should I be selecting something other than `tax_inclusive_purchases` from `transactions`

That type of filter is really a data display filter with the prior filters determining what is displayed when drilling down.  
The data display you want I think will require some minor calculations and is not a standard display.

---

<div class="post-metadata">

**Author:** ![GrahamvdR](https://avatars.discourse-cdn.com/v4/letter/g/51bf81/32.png) [@GrahamvdR](https://forum.manager.io/u/GrahamvdR)\
**Post date:** [October 15, 2020, 8:00am UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/76 "2020-10-15T08:00:45Z")

</div>

Thanks @Patch.

> [@Patch](#):
>
> To get sub totals use  
> `group_by "salesInvoices" `  
> Then a for loop to cycle through the sales invoices  
> And a for loop within it to cycle through the line items

I’ll have a look at this. If it’s easy for you to write a simple example it might help me understand, and would be greatly appreciated.

I’ve had an idea for a crude method of grouping line items into purchase invoices: For each line item that the loop iterates over, it could check the key for the purchase invoice for that transaction, and if it matches that from the previous item then they’re added together into a running total. If the keys are different, then the previous total is entered as a line on the report as a purchase invoice and the variable is reset to start summing up the new purchase invoice.

Any thoughts on this method or any others are appreciated.

---

<div class="post-metadata">

**Author:** ![Patch](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Patch](https://forum.manager.io/u/Patch)\
**Post date:** [October 15, 2020, 1:16pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/77 "2020-10-15T13:16:41Z")

</div>

A basic core is

```auto
{% assign gst_10 = "8cf9d117-3142-4d9c-82ee-b57a0e22c809" %}
{% assign gst_free = "14f63584-be71-40ca-9028-1a60e2e2cc90" %}
{% assign period = transactions | between: report.From, report.To %}
{% assign GST_Purchases = period | taxcode: gst_10, gst_free %}
{% assign GST_PurchaseInvoices = GST_Purchases | group_by: "PurchaseInvoice" %}
{% for e in GST_PurchaseInvoices %}
   Purchase invoice level information (Note the Key in this group_by: references a PurchaseInvoice)
   {{ e.Key.IssueDate }} {{ e.Key.Description }}
   (Assign subtotal counters = 0 here)
   Purchase invoice line item information 
      {% for f in e.Value %}
      {{ f.GeneralLedgerAccount.Name }} {{ f.AccountAmount }} {{ f.TaxComponent }}
      (add line items to subtotals here)
      {% endfor %}
{% endfor %}

```

A test business for which is [Test Localisation (2020-10-15) Group\_by.manager](https://forum.manager.io/uploads/short-url/lFwCBvFXV6DH1pM5VbtTyEZKCXR.manager) (164 KB)

---

<div class="post-metadata">

**Author:** ![GrahamvdR](https://avatars.discourse-cdn.com/v4/letter/g/51bf81/32.png) [@GrahamvdR](https://forum.manager.io/u/GrahamvdR)\
**Post date:** [October 15, 2020, 1:49pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/78 "2020-10-15T13:49:33Z")

</div>

Thanks very much. That looks like it’ll be helpful. I’ll spend some more time on it this evening, I hope, and will report back.

---

<div class="post-metadata">

**Author:** ![GrahamvdR](https://avatars.discourse-cdn.com/v4/letter/g/51bf81/32.png) [@GrahamvdR](https://forum.manager.io/u/GrahamvdR)\
**Post date:** [October 15, 2020, 11:45pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/79 "2020-10-15T23:45:24Z")

</div>

I have had moderate success.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/manager1/original/3X/2/b/2bbdb86ff32aa3368e161d69a79826c28e184fcd.png)

I used a few crude methods to achieve what I wanted. Any suggestions for improving these would be appreciated:

1. When trying to get the supplier name, I couldn’t find a way to pick it up directly at the transaction level. The `From` field gives the GUID for the supplier, but trying `From.Name` and a few other things didn’t work to give me the supplier’s name. So I created a loop (starting in row 9 in the table) to iterate through all my suppliers and check their GUIDs against the `From` field of the transaction, and when there was a match I could use the properties of that supplier for some of the columns in my report, such as the supplier name and supplier VAT number (a custom field).
2. At the transaction level I couldn’t find properties for the tax exclusive amount and tax amount, so I calculated these from `TransactionAmount`. (I used hard-coded values for the tax rates. I’d like to change this to retrieve the rates from the tax code definitions.)
3. I tried an alternative approach of starting with `purchaseInvoices` instead of `transactions`, but I got stuck very quickly when I couldn’t figure out how to apply something like the `between:` filter for selecting a date range. So I went back to using all transactions and filtering those that I didn’t want by checking to see if transactions had a key after being grouped by purchase invoice (line 17 in the table). Those that don’t are not purchase invoices and so are omitted.

Thanks @Patch for your help above and for your [test localisation](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/70), which I spent a lot of time referencing.

This is what my report creates so far, which is exactly what I want for this section:  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/manager1/original/3X/8/4/844ec48d0812b141ff9407a360102e5457739773.png)  
Now I need to test with more data and expand it to include other currencies, and do the equivalent for sales invoices.

---

<div class="post-metadata">

**Author:** ![Patch](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Patch](https://forum.manager.io/u/Patch)\
**Post date:** [October 16, 2020, 12:33pm UTC](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543/80 "2020-10-16T12:33:23Z")

</div>

> [@GrahamvdR](#):
>
> The `From` field gives the GUID for the supplier, but trying `From.Name` and a few other things didn’t work to give me the supplier’s name.

Liquid does have a weird command set in my opinion. I suspect because it is designed to create a walled garden. Providing easy access to some functionality but blocking other access. Lubos has given widespread access to users data, which when combined with liquid inherent design creates weird hurdles and requires lots of trial and error design. It is however ridiculous easy when used as it was designed to do the things it was designed to do.

Getting back to your question. Liquid uses GUID keys or pointers to access its data structure or objects. The GUID is a 128 bit pointer. The pointers can be converted relatively easily into a hexadecimal string and displayed by using the “.Key” specifier. Unfortunately liquid doesn’t appear to have the inverse function ie conversation of a hexadecimal string to a 128 bit point which can reference objects.  
I think the work around is to get liquid to replicate your explicit search by doing by something like

```auto
{% assign mySupplier = suppliers | where: "Key", e.Key.From | first %}

```

Unfortunately I could not get any liquid where: filter to do anything using Manager v20.10.29

> [@GrahamvdR](#):
>
> I used hard-coded values for the tax rates. I’d like to change this to retrieve the rates from the tax code definitions.

That requires the same function, but this time matching on “Name”.

```auto
{% assign ThisTaxcode = taxCodes | where: "Name", g.TaxComponent | first %}
{{ ThisTaxcode.Rate }}

```

Alternatively you could sum the tax separately within the inner for loop.

Edit  
Deleted my erroneous suggestion to use map: and instead suggest where:

[Previous page](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543.md?page=3)

[Next page](https://forum.manager.io/t/how-to-implement-country-specific-report-in-manager/30543.md?page=5)
