Invoice from Visit
Auto-generate invoices from completed visits including all procedures and tests
Overview
SehaFile can automatically generate invoices from completed visits, capturing all consultation fees, procedures, lab orders, and imaging orders into a single invoice. For patients with active insurance, the system uses the insurance-aware invoicing engine that automatically calculates coverage percentages, copays, and write-off amounts based on the insurer's price list and plan rules.
How Auto-Invoicing Works
- Complete the Visit: Once the doctor finishes the visit (marks it as completed), the system triggers the automatic invoicing process. The visit must have a status of completed to generate an invoice.
- Fee Calculation: The system pulls the doctor's consultation fee from the visit record and includes it as the primary line item. Any procedures, lab orders, or imaging orders associated with the visit are added as additional line items.
- Insurance Detection: The system checks if the patient has an active insurance policy by verifying:
- The patient's insurance_company_id is set
- The insurance_valid_to date has not passed
- Coverage Calculation: For insured patients, the system calls the insurance coverage engine which:
- Looks up each service code in the insurer's price list
- Applies the coverage percentage from the patient's plan
- Calculates insurance share and patient copay per item
- Checks annual ceiling limits and caps if exceeded
- Calculates write-off amounts (difference between clinic price and insurance-approved price)
- Invoice Creation: The invoice is created with:
- Patient and visit IDs linked
- Insurance company association (if applicable)
- Per-item coverage breakdown
- Patient copay calculated and set as the patient's payable amount
- Insurance status set to "pending_claim" for later batch claiming
Manual Trigger from Visit Details
- Open the Visit: Navigate to Visits and open the completed visit record.
- Click Generate Invoice: At the bottom of the visit details, click the Generate Invoice (إنشاء فاتورة) button.
- Review and Confirm: The system pre-fills all line items from the visit. Review the items and click Confirm.
Tip: If the patient's insurance ceiling has been exceeded, the system will show a warning but still create the invoice, capping the insurance share at the remaining ceiling amount and assigning the rest to the patient.
Warning: Auto-invoicing only works for visits with a fee greater than zero. If the visit has a fee of 0 (such as free follow-ups), no invoice is auto-generated.
Visit details page showing the Generate Invoice button and the pre-filled invoice preview with insurance coverage breakdown
Frequently Asked Questions
What if the patient's insurance is expired?
The system treats the patient as self-pay and creates a standard invoice without insurance allocation. The full amount becomes the patient's responsibility.
Can I modify the auto-generated invoice?
The invoice is created in its final form. If adjustments are needed, void the invoice and create a new one manually with the correct items.
Does the auto-invoice include prescribed medications?
Only if medication dispensing is enabled and the prescription is filled from the clinic's pharmacy. External prescription referrals are not included.
How are write-off amounts handled?
If the clinic price exceeds the insurance-approved price, the difference is recorded as a write-off. This amount is neither charged to the patient nor claimed from insurance - it is absorbed by the clinic.
Was this article helpful?
Related Articles
Financial Dashboard
View revenue summaries, outstanding invoices, and treasury status at a glance
🧾Creating Invoices
Create detailed invoices with line items, discounts, taxes, and insurance coverage
💳Recording Payments
Record patient payments with multiple methods including cash, card, and bank transfer