Skip to main content

PDF Templates

How it works

PDF generation for invoices, statements, and work tickets is done using the handlebars library. Using HTML and embedding variables in {{my_variable}} format, you can customize the PDF templates to your liking.

How to update the default PDF templates

  1. Go to the PDF Templates section in the settings.
  2. Click on the template you want to update.
  3. Update the template with your custom HTML and using the variables we provide.
  4. Click on Save.

How to use handlebars syntax

Nested variables

To access nested variables, use the dot (.) notation. For example, to access the case_number variable in the Work Ticket template, you would use {{case.case_number}}.

Arrays

To access variables in an array, iterate over the array using the #each function. For example, to access the variables in the case_line_items array in the Work Ticket template, you would use:

{{#each case.case_line_items}}
<tr>
<td>{{this.name}}</td>
<td>{{this.quantity}}</td>
<td>{{this.notation}}</td>
<td>{{this.shade}}</td>
</tr>
{{/each}}

Work ticket template

Algorithm

If the page is over 750px, then we find the section at the 750px mark and put every section at that location and below onto the next page (right side of the page). If the right side of the page overflows, then we put the overflow onto the next page. A section is defined as any <div></div> being a direct child of the parent <div class="ticket-left" id="content-left"> that wraps the whole left side of the Work Ticket page.

Work ticket variables

Case

  • case_number

    • Get the QR Code of the case number with <div id="qrcode"></div>.
  • patient_name = patient

  • pan_number = casePan

  • due_date

  • ship_date = shippedDate

  • order_date = createdAt

  • status

  • billing_lab

    • name
  • doctor

    • name
    • preferences
  • office

    • name
    • address
  • case_line_items (array)

    • description
    • notation
    • quantity
    • shade

Organization

  • logo

Invoices template

Invoice variables

  • case_number

  • patient_name = patient

  • balance

  • discount_amount

  • tax_amount

  • total_amount

  • status (paid = balance = 0 or past due = based on payment terms)

  • terms

  • invoice_date

  • invoice_due_date

  • office

    • name

    • address

  • doctor

    • name
  • case_line_items (array)

    • description (product_description)

    • notation

    • rate = product rate

    • subtotal = net

  • organization

    • logo

    • name

    • address

Statement template

Statement variables

  • start_date

  • end_date

  • due_date

  • previous_balance

  • balance

  • total_invoiced

  • total_credited

  • total_paid

  • total_unapplied

  • has_credits

  • credit_balance

  • doctor

    • name
  • office

    • name
    • address
  • statement_lines (array)

    • date
    • type
    • reference
    • amount
    • running_balance
    • invoice
      • case
        • patient_name
      • doctor
        • name
  • invoices (array)

    • case_number
    • status
    • invoice_date
    • invoice_due_date
    • balance
    • tax_amount
    • discount_amount
    • total_amount
    • doctor
      • name
    • office
      • name
      • address
    • case_line_items (array)
      • notation
      • quantity
      • rate
  • organization

    • logo
    • name
    • address
    • phone