PatoLab’s invoicing module is fully integrated into the specimen registration flow — every time a new specimen is created, a fiscal invoice is automatically generated, assigned a sequential number from the active CAI range, rendered to PDF using Browsershot, and stored in the system. Staff can view, filter, edit, and export invoices from the dedicated invoices list page. The module also supports deferred payment via credits and recurring charges via rentals.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lerichardv/patolab-platform/llms.txt
Use this file to discover all available pages before exploring further.
Invoice Fields
TheInvoice model’s $fillable array covers the complete lifecycle of a billing record. Fields are grouped below by their logical function.
Invoice Identifiers
| Field | Type | Description |
|---|---|---|
full_invoice_number | string | Complete formatted number including CAI prefix (e.g. 001-001-01-00000001) |
invoice_number | string | Zero-padded sequential portion (e.g. 00000001) |
cai_range_id | integer (FK) | The CAI range this invoice was issued against |
invoice_type | string | Invoice classification (standard, rental, etc.) |
Parties
| Field | Type | Description |
|---|---|---|
customer_id | integer (FK) | The billed customer / patient |
specimen_id | integer (FK) | The specimen this invoice covers (nullable for group/rental invoices) |
rental_id | integer (FK) | Rental record, if invoice_type is a rental |
Amounts
| Field | Type | Description |
|---|---|---|
quantity | integer | Number of units billed |
amount | decimal(2) | Unit price |
discount | decimal(2) | Total discount applied |
subtotal | decimal(2) | amount × quantity − discount |
exempt_amount | decimal(2) | Amount exempt from ISV |
tax_exempt_amount | decimal(2) | ISV-exempt taxable base |
taxable_amount_15 | decimal(2) | Base subject to 15% ISV |
taxable_amount_18 | decimal(2) | Base subject to 18% ISV |
isv_15 | decimal(2) | Calculated 15% ISV |
isv_18 | decimal(2) | Calculated 18% ISV |
total | decimal(2) | Final amount due |
total_paid | decimal(2) | Amount already collected |
custom_amount | decimal(2) | Supplementary charge separate from the base price |
custom_amount_reason | string | Explanation for the custom amount |
age_discount_type | string | third or fourth (age-based discount category) |
age_discount_amount | decimal(2) | Value of the age discount |
Payment Fields
| Field | Type | Description |
|---|---|---|
payment_type | string | cash, credit card, bank transfer, check, or credit |
payment_method_date | date | Date the payment was received |
cash_value | decimal(2) | Amount paid in cash |
check_number | string | Cheque number |
check_value | decimal(2) | Amount on the cheque |
card_last_4 | string | Last 4 digits of the card |
card_value_charged | decimal(2) | Amount charged to card |
card_authorization_code | string | Card terminal authorization code |
transfer_bank_id | integer (FK) | Bank the wire transfer came from |
transfer_value | decimal(2) | Transfer amount |
transfer_authorization_code | string | Bank transfer reference number |
credit_payment_id | integer (FK) | Linked Credit record when payment_type = credit |
proof_of_payment | string | Storage path to the uploaded payment voucher file |
invoice_file | string | Storage path to the generated invoice PDF |
Group Invoicing
| Field | Type | Description |
|---|---|---|
is_group | boolean | True when this invoice covers a specimen group |
group_id | integer (FK) | The SpecimenGroup this invoice belongs to |
description | string | Free-text description (used for rental invoices) |
Payment Types
PatoLab supports five payment types on invoice creation:Cash
Record the
cash_value received. No proof of payment file is required for cash transactions.Credit Card
Store
card_last_4, card_value_charged, and card_authorization_code. A proof-of-payment file (voucher) is required.Bank Transfer
Link to the source
transfer_bank_id and store transfer_value and transfer_authorization_code. A proof-of-payment file is required.Check
Record
check_number and check_value. A proof-of-payment file is required.Credit record. An optional initial partial payment can be collected at registration time using any of the four methods above.
Invoices List
| Parameter | Description |
|---|---|
search | Searches by invoice number, customer name, customer RTN/ID, or specimen code |
payment_type | Filter by payment method |
customer_id | Filter by customer |
has_credit | yes or no — filter by credit status |
invoice_type | Filter by invoice type |
date_from / date_to | Date range (YYYY-MM-DD) |
sort_field | date, customer, payment_method, credit, specimen_code, total, total_paid |
sort_direction | asc or desc |
date_filter_invoices_user_{id}).
Updating an Invoice
invoices.manage permission. On save, the invoice PDF is automatically regenerated unless regenerate_pdf=false is passed. For group invoices, individual group_specimens sub-line updates are also accepted in the same request.
Credits
When a specimen is invoiced withpayment_type = credit, a Credit record is created tracking credit_amount, amount_paid, and amount_remaining.
amount_remaining accordingly.
Rentals
Rental invoices represent recurring charges not tied to a specimen.Export
Every invoice is tied to an active CAI range (
cai_ranges table). The CAI (Código de Autorización de Impresión) is a fiscal control number required by Honduran tax authorities. When the last_used_number on a range reaches end_number, the range is automatically marked exhausted and a new range must be configured before further invoices can be issued. See Sequences & CAI Configuration for setup instructions.