Hi everyone!
Version v5.10.30
Environment Docker
I really have a hard time using the template feature in invoice ninja. All i want to achieve is, that i get a pdf which looks exactly the same like a qoute, but instead of the word “Quote” there need to be “Order Confirmation”. It seems the way to go is using templates.
Ideally i would just paste my invoice design to the template and substitute “Quote” with “Order Confirmation” and that would be it. But this seems not how things work. Because it’s not possible to just use
- <table id=“product-table” cellspacing=“0” data-ref=“table”> or
- <div id=“table-totals” cellspacing=“0”>$status_logo
like in designs. For me its hard to understand, but ok. So i redo the whole layout using the template tools described here. Now, nearly finished, i tried to do the “totals table” with sub-total, net amount, discount, tax amount and total. like this:
Using “{{ quote.amount }}” for the total amount works, no problem.
First problem is using “{{ quote.total_taxes }}”. This should be “formatted currency” like mentioned in the documentation, but its not. it looks like “total_taxes_raw” described in the documentation (no currency, no thousands sperator, wrong comma sign).
Second problem: there is no “formatted currency” variable for discount, only the raw value.
Third problem: i can’t calculate with these values. “{{ quote.amount - quote.total_taxes }}” works in the preview where it shows the correct calculated value (where i create my template), but trying to apply the template to a quote, it gets stuck “Processing”. Log says:
[previous exception] [object] (ErrorException(code: 0): A non-numeric value encountered at /var/www/app/vendor/twig/twig/src/Environment.php(391) : eval()'d code:117)
One would think: “just use the raw values”, like this: “{{ quote.amount_raw - quote.total_taxes_raw }}”. Which only shows 0 as calculated value (in preview and in the generated pdf). Aside from that, i don’t know how to show the result in a “formatted currency”-way.
Here is a screenshot of the template in preview:
Which leaves me with two questions:
- Is there a better way to achieve my goal?
- Is there something i dont get or are the described problems bugs?