L
Leaphealth - OSDocs

PDF template editor

Create, preview, publish and maintain the HTML templates behind invoices, receipts, statements and other PDFs, with the full template syntax and bill variables.

Every PDF LeapHealthOS produces, from invoices and receipts to prescriptions and consent forms, is built from an HTML template. The PDF Templates screen lets administrators write those templates, preview them and publish them. This page explains the screen, the template syntax and every variable available to bill documents.

You need some familiarity with HTML to write templates. If you only need to choose which template a document uses, see Invoices, receipts and statements.

Opening the screen

Open SettingsPlatform ConfigurationPDF Templates. The menu is visible only to administrators, and the screen works on desktop and laptop screens.

The list shows each template's Template Name (with its template code underneath), Version, Status (Published or Not Published) and an Actions menu with Edit template, Publish template (only for unpublished templates) and Delete template.

Template codes

The template code says which document a template is for. Your hospital can have one template per code.

Template Code option

Used for

Bill Standard (HOS_BILL_STANDARD)

Invoices

Reciept Standard (HOS_RECEIPT_STANDARD)

Payment receipts (the option is spelled this way on screen)

Statement Standard (HOS_STATEMENT_STANDARD)

Statements for fully paid bills

Prescription Standard (HOS_PRESCRIPTION_STANDARD)

Prescriptions

Report Standard (HOS_REPORT_STANDARD)

Test reports

Discharge Standard (HOS_DISCHARGE_STANDARD)

Discharge summaries

Other document

A code you choose, for documents such as consent forms. Use capital letters, digits and underscores, for example CONSENT_SURGERY.

Because there is only one template per code, change an existing document's look by editing its template rather than creating a new one. The bill, receipt and statement codes used for billing are chosen on the Billing tab of System Settings.

Creating a template

Start a new template

Administrator

Settings > Platform Configuration > PDF Templates

Select Create Template.

Set up the template

Under Template Settings, enter the template name. Choose the Template Code; for Other document, type your own code. Choose Paper Size (A4) and Orientation (Portrait or Landscape). The code cannot be changed later.

Write the HTML

Type or paste your HTML into the HTML Editor. Each {{variable}} you use is listed under Variables.

Check the preview

The Live Preview shows the layout with variables left as placeholders. Variables whose names suggest an image (such as logo, signature, stamp or qr) show a grey placeholder box. The preview is approximate; the final PDF can differ slightly.

Save

Select Save.

Expected result: "Template created" appears. The template is listed as Not Published and is not used yet.

Publish

From the list, open the Actions menu and select Publish template, then confirm.

Expected result: "Template published successfully". The template shows Published and is used for new documents.

Editing a template

Select Edit template, make your changes and select Update. Each save increases the Version number.

  • Editing a published template changes it immediately: every document created after you save uses the new version.
  • A template cannot be unpublished from the screen.

Test after every change

After you save a billing template, create a test bill and check that the invoice (or receipt or statement) appears and looks right. If the document does not appear, ask your implementation team to check and restore the template.

Known gaps in the editor

  • Documents are not created from a template saved in the editor if it contains a repeating section ({{#each …}}) or a {{…}} value that is not listed on this page. The standard bill, receipt and statement templates contain repeating sections, so ask your implementation team to make changes to those templates. If documents stop appearing after you save a template, ask your implementation team to restore it.
  • Opening a template that is not yet published may show an empty editor.
  • Delete template may not work. Published templates cannot be deleted. If you need a template removed, ask your implementation team.

Template syntax

Variables

Write {{variable_name}} where a value should appear, for example {{patient_name}}.

  • Use letters, digits and underscores only, with no spaces inside the braces. {{ patient_name }} is not filled in.
  • Values are inserted as plain text, so any HTML characters in a value are shown as typed.

Repeating sections

To print one row per item, wrap the row in an each block. Inside it, use the row's own fields. Read "Known gaps in the editor" above before you save a template that contains one.

<table>  <tr><th>Item</th><th>Qty</th><th>Rate</th><th>GST</th><th>Amount</th></tr>  {{#each line_items}}  <tr>    <td>{{item_name}}{{#if batch_number}}<br/>Batch {{batch_number}}, exp {{batch_expiry_formatted}}{{/if}}</td>    <td>{{quantity}} {{unit}}</td>    <td>{{unit_price_formatted}}</td>    <td>{{tax_percent_formatted}} {{tax_mode}}</td>    <td>{{line_total_formatted}}</td>  </tr>  {{/each}}</table>

An {{#if field}} inside an each block shows its content only for rows where that field has a value.

Conditional sections

{{#if flag}} … {{/if}} shows the content only when the flag is true. If the flag is not one the document provides, the content is left out.

{{#if hospital_gstin}}<p>GSTIN: {{hospital_gstin}}</p>{{/if}}

Content inside {{#header}} … {{/header}} and {{#footer}} … {{/footer}} is repeated at the top and bottom of every page, and space is reserved for it. Link images in the header or footer by their full web address.

The page has no side margins of its own, so add padding to your page content in your HTML styles.

Signature places

For documents that patients or staff sign, type [[sign here: Patient]] where the signature should go, using a name of your choice for each signer (for example [[sign here: Witness]]). A journey Sign step can then place each signature exactly there. The bracketed text is not printed. See Sign node.

Variables for bill documents

Amounts in the main variables are numbers with two decimals, without the rupee sign (for example 1062.00). Fields ending in _formatted include the rupee sign (for example ₹1062.00). Dates are shown as DD/MM/YYYY.

Available on invoices, receipts and statements

Variable

Value

{{hospital_address}}

The centre's address.

{{hospital_gstin}}

The centre's GSTIN.

{{bill_number}}

The bill number.

{{bill_date}}

The issue date.

{{patient_name}}

Patient's name.

{{patient_dob}}

Patient's date of birth.

{{patient_email}}

Patient's email.

{{subtotal}}

Total before discounts and tax.

{{line_discount}}

Total of line discounts.

{{bill_discount}}

The bill-wide discount.

{{total_discount}}

Line and bill discounts together.

{{total_tax}}

Total GST.

{{effective_tax_percent}}

Overall GST as a percentage of the taxable amount.

{{net_of_tax_amount}}

Total excluding GST.

{{total_amount}}

Bill total.

Receipts only

Variable

Value

{{receipt_number}}

The receipt number.

{{payment_date}}

Date of this payment.

{{payment_method}}

Method used.

{{payment_reference}}

The payment's reference.

{{amount_paid}}

This payment.

{{total_paid_till_date}}

All payments so far.

{{balance_due}}

What is still owed.

Statements only

Variable

Value

{{total_paid}}

Total paid.

{{balance_due}}

Balance (normally 0.00).

{{payment_count}}

Number of payments.

{{settled_date}}

Date the bill was fully paid.

Repeating sections

Section

Available on

Row fields

line_items

All three

item_name, quantity, unit, unit_price_formatted, line_gross_formatted, discount_amount_formatted, taxable_amount_formatted, tax_percent_formatted, tax_mode (Incl. or Excl.), tax_amount_formatted, line_total_formatted, hsn_sac_code, batch_number, batch_expiry_formatted (MM/YYYY)

tax_summary

All three

tax_percent_formatted, taxable_amount_formatted, cgst_amount_formatted, sgst_amount_formatted, tax_amount_formatted

payments

Statements

receipt_number, payment_date, payment_method, payment_reference, amount_formatted

Flags for conditional sections

Flag

True when

hospital_gstin

The centre has a GSTIN.

has_tax_summary

At least one line carries GST.

partial_payment

Receipts only: a balance is still due after this payment.

Prescription, report and discharge templates receive their own sets of values. Ask your implementation team for those lists before you change one of these templates.

Who can do what

Task

Permission

View templates

Read permission on Settings

Create, edit and delete templates

Configure permission on Settings

Publish templates

Publish permission on Settings

PDFtemplatesinvoicereceiptstatementconsentvariables

Was this page helpful?

Last updated on

On this page