[if {{document.subTotalPrice}} > 0] {{template.name}} [else] Credit note [/if]

[if {{logo}}] [/if]
To:

{{document.customerTo}}
{{document.formattedAddress|nl2br}} [assign recipientOrg = document.customerId | entity:Contact] [if {{recipientOrg.vatNo}}]
VAT no.: {{recipientOrg.vatNo}} [/if]


[if {{document.reference}}] [/if]
Number: {{document.number}}
Date: {{document.date|date:d-m-Y}}
Reference: {{document.reference}}
Invoiced by: [assign businessOrg = business.contactId | entity:Contact]

{{businessOrg.name}}
[assign bAddress = businessOrg.addresses | filter:type:"postal" | first] [if !{{bAddress}}] [assign bAddress = businessOrg.addresses | first] [/if] {{bAddress.formatted|nl2br}}

[assign orgEmail = businessOrg.emailAddresses | sort:type:"work" | first | prop:email] [if {{orgEmail}}] [/if] [assign orgNumber = businessOrg.phoneNumbers | sort:type:"work" | first | prop:number] [if {{orgNumber}}] [/if]
e-mail: {{orgEmail}}
tel: {{orgNumber}}

Bank: {{businessOrg.nameBank}}
IBAN: {{businessOrg.IBAN}}
BIC: {{businessOrg.BIC}}

VAT no.: {{businessOrg.vatNo}}
Company no.: {{businessOrg.registrationNumber}}


[if {{document.showPricePerLine}}] [else] [/if] [each itemGroup in document.itemGroups] [if {{itemGroup.showAs}} != "hidden"] [if {{itemGroup.showAs}} == "single"] [if {{document.showPricePerLine}}] [else] [/if] [else] [if {{itemGroup.title}}] [/if] [each item in itemGroup.items] [if {{document.showPricePerLine}}] [assign rowTotal = {{item.unitPrice}} * {{item.quantity}} ] [else] [/if] [/each] [if {{itemGroup.showAs}} == "groupwithtotal"] [/if] [/if] [/if] [/each] [if {{document.showTotals}}] [if {{document.vatTotals|count}} > 0] [if {{document.showPricePerLine}}] [/if] [/if] [if {{document.vatReverseCharge}}] [else] [each vatTotal in document.vatTotals] [/each] [/if] [/if]
Quantity DescriptionDescription[if {{document.showPricePerLine}}]Price[/if]
1 {{itemGroup.title}} {{book.currency}} {{itemGroup.subTotalPrice|number}}{{itemGroup.title}}
{{itemGroup.title}}
{{item.quantity|number}} {{item.description|nl2br}}{{book.currency}} {{rowTotal|number}}{{item.description|nl2br}}
[if {{document.showPricePerLine}}]Total[else]Price[/if]: {{book.currency}} {{itemGroup.subTotalPrice|number}}
Subtotal: {{book.currency}} {{document.subTotalPrice|number}}
VAT Reverse charge (0%): {{book.currency}} 0.00
VAT {{vatTotal.rate|number}}%: {{book.currency}} {{vatTotal.price|number}}
Total: {{book.currency}} {{document.totalPrice|number}}

Terms
[assign outstanding = {{document.totalPrice}} - {{document.paidAmount}}] [if {{document.subTotalPrice}} < 0] [if {{outstanding}} < 0 ] We will pay you the amount of {{book.currency}} {{outstanding|number}} within 14 days. [else] Everything is paid. [/if] [else] [if {{outstanding}} > 0 ] Please pay the outstanding amount of {{book.currency}} {{outstanding|number}} within 14 days. It's important that you mention your invoice number at your payment. [else] Thank you for your payment! [/if] [/if]