L
Leaphealth - OSDocs

Billing Settings

Bill generation, PDF templates, approval thresholds, and automated notifications for financial documents.

Billing Settings

Billing settings control how the system generates bills, applies taxes, sends financial documents, and handles approval workflows for high-value transactions.

Where to Find These

These settings are configured at the tenant (hospital) level via the BILLING config type. They apply to all centres uniformly.

General Billing Configuration

The billing config is stored as a JSONB object in the appointment config table with config_type BILLING. When no database entry exists, the system falls back to code defaults.

{  "auto_generate_bills": false,  "auto_email_on_issue": false,  "auto_whatsapp_on_issue": false,  "pdf_template_code": "HOS_BILL_STANDARD",  "bill_consolidation_enabled": false,  "approval_threshold_amount": 100000}

Field Descriptions

Field

Type

Default

What It Does

auto_generate_bills

boolean

false

Automatically create bills when visits complete

auto_email_on_issue

boolean

false

Send bill via email when issued to the patient

auto_whatsapp_on_issue

boolean

false

Send bill via WhatsApp when issued

pdf_template_code

string

HOS_BILL_STANDARD

Which PDF template to use for bill generation

bill_consolidation_enabled

boolean

false

Combine multiple line items into a single bill

approval_threshold_amount

number (paise)

100000 (Rs 1000)

Bills above this amount require manager approval

Currency Format

All monetary values are stored in paise (1/100 of a rupee). For example, 100000 paise = Rs 1,000.

Bill Types

Bill types are tenant-configurable via the bill_types column in tenant types. Each type defines automation rules and display settings.

{  "code": "APT",  "label": "Appointment",  "is_active": true,  "sort_order": 1,  "auto_generate": true,  "trigger_event": "APPOINTMENT_CONFIRMED",  "default_tax_percent": null,  "is_system": true}

Bill Type Fields

Field

Type

What It Does

code

string

Short code used internally (e.g., APT, LAB, RAD)

label

string

Display name shown in the UI

is_active

boolean

Whether this bill type is available for use

sort_order

number

Display ordering in dropdowns and lists

auto_generate

boolean

If true, bills are created automatically on the trigger event

trigger_event

string

Which system event triggers automatic bill creation

default_tax_percent

number or null

Default tax percentage (null = use system default of 0%)

is_system

boolean

System types cannot be deleted by hospital staff

Common bill types: APT (Appointment), LAB (Lab Test), RAD (Radiology), PHR (Pharmacy), PRO (Procedure), PKG (Package), ADM (Admission), MIS (Miscellaneous)

PDF Templates

PDF templates control the layout and content of printed or emailed bills. Each template is an HTML document stored in the database with placeholder variables.

{  "template_code": "HOS_BILL_STANDARD",  "content_html": "<html>...{{hospital_name}}...{{bill_number}}...</html>",  "variables": [    "hospital_name",    "bill_number",    "patient_name",    "line_items_html",    "grand_total"  ],  "variable_map": {},  "paper_size": "A4",  "orientation": "portrait"}

Template Variables

The following variables can be used in bill templates with {{variable_name}} syntax:

Variable

What It Contains

{{hospital_name}}

Name of the hospital

{{hospital_address}}

Full hospital address

{{bill_number}}

Unique bill number (auto-generated)

{{bill_date}}

Date the bill was issued

{{patient_name}}

Patient's full name

{{patient_id}}

Patient ID / UHID number

{{line_items_html}}

Formatted HTML table of all bill items

{{subtotal}}

Amount before tax and discounts

{{total_discount}}

Total discount applied

{{total_tax}}

Total tax amount

{{grand_total}}

Final amount to be paid

{{payment_status}}

Current status (Paid, Pending, etc.)

{{qr_code_url}}

QR code image URL for online payment

Bill Number Sequences

Bill numbers follow a standardized format to ensure uniqueness and traceability across centres:

{CENTRE_CODE}-{BILL_TYPE}-{YYYYMM}-{SEQUENCE}Example: MAIN-APT-202603-000042  MAIN     = Centre code  APT      = Bill type (Appointment)  202603   = Year and month  000042   = 42nd bill of this type at this centre this month
  • Padding: 6 digits (000001, 000002, ...)
  • Reset: Sequence resets at the start of each month
  • Uniqueness: Guaranteed unique across all centres by combining centre code + type + month

What's Next

  • Notification Settings — Configure bill delivery via email and WhatsApp
  • Package Configuration — Set up service packages with billing integration
  • Settings Reference — Complete field-by-field lookup of all settings
billingconfigurationpdf-templatesinvoices

Last updated on

On this page