Multi-Page Invoice

A multi-page invoice with a calculated Total and calculated Payment Due Date.

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.

This example in detail

This example uses Docmosis repeating rows, calculations, and number formatting.

The invoice also uses a header and footer, and describes how to use a table header row.

Dynamic table

The data has an array of "items" to define the Qty/Item/Amount (JSON example):

  "items":[{
    "qty":"3",
    "ItemName":"ACP101 Accounting Package",
    "itemDescription":"Annual Subscription to Premier Version with Tax, Inventory and Payroll Plugins",
    "amt":"1350.00"
  },
  {  etc...

Rows will be dynamically added to the table to match the number of "items" in the data.

The <<rr_  repeating rows directive and the <<er_ directive will be removed from the final document and the rows between them are the ones that will be repeated.

Shading the <<rr_ repeating rows and the next row in different colors will trigger Docmosis to use alternating row colors.

Headers and footers

This template uses the header and footer feature found within Microsoft Word/LibreOffice.

The header incorporates a simple table with invisible borders to position the 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.

Calculations and number formatting

Numbers in the data are not formatted (JSON Example):

  "amt":"1350.00"

In the template, the numFormat function is used to display a leading dollar sign, comma separated thousands, and two digits after the decimal point:

  $1,350.00

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.

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.

In Microsoft Word, select "Repeat as header row at the top of each page" in the Table Properties.

In LibreOffice, select "Repeat heading" in the Table Properties.

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam. Please also consider contacting support@docmosis.com if you need help with this article.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input