A multi-page invoice with a calculated Total and calculated Payment Due Date.
Page Size: US Letter.
The table will "grow" as data is injected and if the table runs over the page the table header row will appear at the top of each new page.
1) Dynamic table that expands to match the data.
The data has an array of "items" to define the Qty/Item/Amount (JSON example):
"ItemName":"ACP101 Accounting Package",
"itemDescription":"Annual Subscription to Premier Version with Tax, Inventory and Payroll Plugins",
Rows will be dynamically added to the table to match the number of "items" in the data.
The rows <<rr_ (Repeat Rows) and <<er_ (End Repeat) will be removed from the final document and the rows between them are the ones that will be repeated.
Shading the <<rr_ row and the next row in different colours will trigger Docmosis to use alternating row colours.
2) Headers and Footers.
This template uses the header and footer feature found within Microsoft Word/LibreOffice.
The header incorporates and a simple table with invisible borders to position tha static logo image and the invoice details (invoice number, date and purchase order) which show at the top of each page.
The footer section of the invoice uses the inbuilt page numbering feature of Microsoft Word/LibreOffice.
2) Calculations and Number Formatting.
Numbers in the data are not formatted (JSON Example):
In the template the numFormat function is used to display: A leading dollar sign, comma separated thousands and two digits after the decimal point:
The "$total" is a Docmosis variable. As Docmosis loops through the items the "amt" is added to the "$total". After all the items have been displayed the $total is formatted to display the Total.
The Payment Due By date is calculated by adding 14 days to the invoiceDate.
2) Table Header Row.
The first row is set to repeat as a header row at the top of each page.
This is achieved using a Table Properties setting available in Microsoft Word or LibreOffice that Docmosis will recognize and obey.