Prolab LIS Cloud

Prolab LIS Templates : Invoices

HBS Template Structure

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <title>Facture</title>
    <style>
        /* CSS styles */
    </style>
</head>
<body>
    {{{invoiceHeader}}}
    {{{customerInfo}}}
    
    <table class="params-table">
        <thead>
            <tr>
                <th>Column headers</th>
            </tr>
        </thead>
        <tbody>
            {{{invoiceLines}}}
        </tbody>
    {{{invoiceSummary}}}
    
    {{{paymentTerms}}}
    {{{notes}}}
    {{{termsAndConditions}}}
    {{{footer}}}
</body>
</html>

JSON Structure

{
  "template": "invoice",
  "data": {
    "sectionName": {
      "type": "bloc|collection",
      "template": "HTML with {{variables}}",
      "content": {}
    }
  },
  "outputFormat": "pdf",
  "pageFormat": {
    "format": "A4",
    "margin": { "top": "1.5cm", "right": "1.5cm", "bottom": "1.5cm", "left": "1.5cm" }
  },
  "printOptions": {
    "printBackground": true,
    "displayHeaderFooter": true,
    "margin": { "top": "1.5cm", "right": "1.5cm", "bottom": "1.5cm", "left": "1.5cm" }
  },
  "headerTemplate": "<div>Page header</div>",
  "footerTemplate": "<div>Page <span class='pageNumber'></span> sur <span class='totalPages'></span></div>",
  "css": {
    "additional": ["@page { size: A4; }", "body { font-family: 'Segoe UI'; }"]
  }
}

Section Types

Bloc: Static content block

{
  "type": "bloc",
  "template": "<div>{{variable}}</div>",
  "content": {}
}

Collection: Dynamic list (repeats for each item)

{
  "type": "collection",
  "content": {
    "default_template": "<tr><td>{{variable}}</td></tr>",
    "items": []
  }
}

Variables by Section

invoiceHeader

VariableTypeRequired
companyLogoUrlstringYes
companyNamestringYes
companySubtitlestringNo
companyAddressstringYes
companyPhonestringYes
companyEmailstringYes
companyWebsitestringNo
invoiceNumberstringYes
invoiceDatestringYes
dueDatestringNo
invoiceStatusstringYes
workOrderNumberstringNo
barcodeImagestringNo

customerInfo

VariableTypeRequired
customerNamestringYes
customerEmailstringYes
customerPhonestringYes
customerAddressstringNo

invoiceLines (collection)

VariableTypeRequired
quantitynumber/stringYes
descriptionstringYes
unitPricenumber/stringYes
taxRatenumber/stringNo
discountPercentagenumber/stringNo
lineTotalnumber/stringYes
currencySymbolstringYes

invoiceSummary

VariableTypeRequired
subtotalnumber/stringNo
totalTaxnumber/stringNo
totalDiscountnumber/stringNo
totalnumber/stringYes
amountPaidnumber/stringNo
balanceDuenumber/stringNo
currencySymbolstringYes
totalInWordsFrenchstringNo
totalInWordsEnglishstringNo

Note: Use colspan based on table columns:

  • 6 columns → colspan='5'
  • 4 columns → colspan='3'
  • 5 columns → colspan='4'

paymentTerms

VariableTypeRequired
checkPayeeNamestringNo
bankNamestringNo
bankAccountNumberstringNo

notes

VariableTypeRequired
commentsstringNo

termsAndConditions

VariableTypeRequired
termsAndConditionsstringNo

No variables (static content)

Template Variants

Invoice (invoice.json): 6 columns (Qté, Intitulé, Prix unitaire, Taux TVA, Remise, Total), colspan=’5′

Quote (quote.json): 5 columns (Description, Code, Quantité, Prix unitaire, Total), colspan=’4′

Quote2 (quote2.json): 4 columns (Quantité, Description, Prix unitaire, Total), colspan=’3′, simplified summary

Handlebars Syntax

{{variable}}              // Variable output
{{{section}}}             // Unescaped HTML injection
{{#if variable}}...{{/if}} // Conditional block
{{#if a}}...{{else}}...{{/if}} // If/else