What I’m struggling to find however is an overview of all field variables which can be used in the template. $account.name for example can be used for the Company Name, but what about the others? Is there a complete list of all available variables somewhere? I was unable to find this in the docs.
I am close to the solution. For the address I had to change the format from S(tructured) to K(ombined), as Invoiceninja does not split up the address1 field. This is fine though.
Some of the fields can be accessed using variables, but I’m struggling with two fields:
The country: I was only able to get the $account.country_id, which shows the value 756 (for Switzerland) but I need “CH”. I can workaround that by hardcoding “CH” into the QR field as invoices are only sent from one account.
The currency: So far I’ve not been able to retrieve the “CHF” or “EUR” value of an invoice’s currency. Here I cannot do a hard-coded workaround as invoice currencies depend on the customer. I tried it with $client.currency_id but the value is empty.
Only the currency is left until the QR code contains the needed data.
Update: Actually the amount is also not correctly showing up. In the custom template editor $invoice.balance showed 0.00 but it doesnt seem correct. So the correct variable name is needed here, too.
Sorry but I came across a problem with the invoice amount. It seems that $balanceAmount cuts the amount to nnn.n if the second decimal is a 0.
More precise with an example: This outputs the amount of 120.5 instead of 120.50.
According to the Swiss QR-Bill standard this is invalid:
The element amount has to be shown without leading zeroes inlcuding decimal separator and two decimal elements. As decimal separator only a dot (.) is valid.
Do you know which variable to use for this purpose?
@napsty Thank you so much for your work and your written tutorial!
I want to achieve the same implementation you have done, but I am struggling to get the QR code to be shown
It works in header, content etc, but not in the footer template.
I tried removing all styles and columns, but it still does not show up
Version is v.4.5.19
4.5.18 here and the QR codes show up fine. Not sure if there was something between 4.5.18 and 4.5.19 which would break this…
But during the implementation I also noticed that the template “preview” sometimes didn’t show the changes correctly. So in between I created a new invoice to see the result in the generated PDF of that invoice. Maybe this helps.
Hi Napsty,
it seems you forget one graphical detail in swiss QR code definition.
The famous swiss cross, you can find the image here: https://www.paymentstandards.ch/dam/downloads/swiss-cross.zip
Tell me if you found a idea to implement this image on invoice template.
Greetings
Franck