Kulcare Docs
Test plansClinic app

Test Plan: Billing & Follow-ups (Queue Panel)

Module: Clinic App — Billing Panel from Queue Code Audit Date: 2026-06-17 URL: Queue page → Click "+" (Billing) button on patient row Status: Pending


Code Audit Summary

Billing Panel Sections

SectionComponentPurposeAPI
BillingHeaderBillingHeader.tsxPatient name, phone, doctor—
BillingSummaryCardBillingSummaryCard.tsxTotal services, total paid, balance dueCalculated client-side from services + payments
ServiceSectionServiceSection.tsxAdd/Edit/Delete services, select from catalog, generate billuseServices, useCreateService, useUpdateService, useDeleteService, useFacilityServices, useCreateInvoice
PaymentSectionPaymentSection.tsxAdd/Edit/Delete payments (cash/card/UPI/bank)usePayments, useCreatePayment, useUpdatePayment, useDeletePayment
NextVisitSectionNextVisitSection.tsxSchedule/cancel follow-upuseCreateNextVisit, useCancelNextVisit, useFollowUps
BillsSectionBillsSection.tsxView/bill invoices, download PDFuseInvoices

Permission Gate

  • Billing button visible only when canManageBilling = true
  • Roles: owner, admin, practitioner (not staff)

SECTION 1: Billing Panel — Open & Header

#Test CasePriorityExpectedStatus
BILL-01Open billing panelP0Click "+" on queue row → BillingPanel slides in from rightPending
BILL-02Patient info in headerP0Shows patient name, phone, assigned doctorPending
BILL-03Close billing panelP0Click X or outside → panel closesPending
BILL-04Panel — loading stateP1Loading spinner while services/payments/invoices fetchPending
BILL-05Panel — error stateP1API fails → error message shownPending
BILL-06Panel — empty state (no services/payments)P0New patient: summary shows ₹0, no services/payments listedPending

SECTION 2: Service Management

2.1 Add Service

#Test CasePriorityExpectedStatus
BILL-11Add service — from catalog onlyP0Select service from facility catalog, price auto-filled from catalog, quantity editable✅ PASS
BILL-12Add service — required fieldsP0Leave service empty → validation error✅ PASS
BILL-13Add service — price auto-filledP1Price is auto-filled from the service catalog and locked; Override unlocks it and a reason is required before Add (#1838)Pending
BILL-14Add service — multiple servicesP0Add 3 services → all appear in list, summary updates✅ PASS
BILL-15Add service — duplicate serviceP1Add same service twice → both shown✅ PASS

2.2 Edit Service

#Test CasePriorityExpectedStatus
BILL-20Edit service — nameP0Click edit on service → change name → Save → updatedPending
BILL-21Edit service — quantityP0Change quantity → Save → total recalculatedPending
BILL-22Edit service — priceP0Queue panel: Override → change price → reason required → Update → summary updates. Patient page: change amount → "Reason required" field appears → Update waits for it. Reopen: price unlocked, reason filled in. Enter the catalog price again → saved as catalog, stored reason cleared (#2569)Pending
BILL-23Cancel editP0Open edit → Cancel → no changesPending

2.3 Delete Service

#Test CasePriorityExpectedStatus
BILL-30Delete serviceP0Click delete → confirmation dialog with reason → service removedPending
BILL-31Delete service — cancelP1Open delete dialog → Cancel → service not removedPending
BILL-32Delete service — reason requiredP1Remove with empty reason → validation?Pending

2.4 Service Summary

#Test CasePriorityExpectedStatus
BILL-35Total services amount updatesP0Add services → summary card shows total servicesPending
BILL-36Quantity × price calculationP0Service qty=2, price=500 → shows ₹1000Pending

SECTION 3: Payment Management

3.1 Add Payment

#Test CasePriorityExpectedStatus
BILL-40Add payment — cashP0Select "Cash" method, enter amount → Add✅ PASS
BILL-41Add payment — cardP0Select "Card" method → Add✅ PASS
BILL-42Add payment — UPIP0Select "UPI" method → Add✅ PASS
BILL-43Add payment — bank transferP0Select "Bank Transfer" → Add✅ PASS
BILL-44Add payment — gateway (Razorpay/Cashfree)P0Select "Gateway" → 500 Internal Server ErrorBug #50 ❌
BILL-45Add payment — amount validationP0Enter 0 or negative → error✅ PASS
BILL-46Add payment — multiple paymentsP0Add 2 payments → both listed, summary updates✅ PASS
BILL-47Payment method icon displayedP1Each method shows correct icon✅ PASS

3.2 Edit Payment

#Test CasePriorityExpectedStatus
BILL-50Edit payment — amountP0Change amount → Save → total recalculatedPending
BILL-51Edit payment — methodP1Change method → Save → icon updatesPending
BILL-52Cancel edit paymentP0Open edit → Cancel → no changesPending

3.3 Delete Payment

#Test CasePriorityExpectedStatus
BILL-55Delete paymentP0Click delete → confirmation dialog → payment removed✅ PASS
BILL-56Delete payment — cancelP1Open delete → Cancel → payment stays✅ PASS
BILL-57Delete dialog — reason not cleared on closeP1Click outside to close delete dialog, reopen → previous reason still filledBug #52 ⚠️

3.4 Payment Summary

#Test CasePriorityExpectedStatus
BILL-60Total paid updatesP0Add payment → summary shows total paidPending
BILL-61Balance due calculationP0Services ₹1000, Paid ₹400 → Balance ₹600Pending
BILL-62Overpaid balanceP1Paid more than services → negative balance or 0?Pending
BILL-63Zero balance (fully paid)P1Services = Paid → Balance ₹0Pending

SECTION 4: Bill Generation

4.1 Select Services & Generate Bill

#Test CasePriorityExpectedStatus
BILL-70Select services for billP0Checkbox next to each service → select 2 of 3 servicesPending
BILL-71Generate bill buttonP0Select services → "Generate Bill" button appears/enablesPending
BILL-72Generate bill — successP0Click Generate → invoice created, appears in Bills sectionPending
BILL-73Generate bill — no services selectedP1Click without selecting → error/preventionPending
BILL-74Generate bill — all servicesP0Select all services → bill covers everythingPending

4.2 Bills Section

#Test CasePriorityExpectedStatus
BILL-80Bills section — shows invoicesP0Generated bills appear in collapsible Bills sectionPending
BILL-81Bills section — emptyP0No bills generated → empty statePending
BILL-82Bill — status indicatorP1Each bill shows status dot (paid/unpaid/draft)Pending
BILL-83Download bill PDFP0Click download → PDF generated and downloadedPending
BILL-84View billP1Click view → opens bill detail or PDF previewPending
BILL-85Navigate to bills pageP1"View All Bills" link → navigates to full bills pagePending

SECTION 5: Follow-up / Next Visit

5.1 Schedule Follow-up

#Test CasePriorityExpectedStatus
BILL-90Next visit section — emptyP0No existing follow-up → shows form to schedule✅ PASS
BILL-91Schedule — interval based (weeks)P0Set "7 weeks" → appointment created✅ PASS
BILL-92Schedule — interval based (days)P0Set "3 days" → appointment created✅ PASS
BILL-93Schedule — interval based (months)P0Set "1 month" → appointment created✅ PASS
BILL-94Schedule — specific dateP0Select specific date (e.g., 2026-06-20) → "Appointment time is outside working hours" errorBug #51 ❌
BILL-95Schedule — doctor requiredP0Leave doctor empty → validation error✅ PASS
BILL-96Schedule — past date/intervalP1Past interval → blocked✅ PASS
BILL-97Schedule follow-up — success toastP0Submit → success toast, follow-up appears in section✅ PASS

5.2 Existing Follow-up

#Test CasePriorityExpectedStatus
BILL-100Follow-up — displayP0Shows scheduled date, doctor, notesPending
BILL-101Follow-up — already existsP0Patient already has follow-up → shows existing, no formPending
BILL-102Cancel follow-upP0Click cancel → confirmation dialog → follow-up removedPending
BILL-103Cancel follow-up — reasonP1Enter cancellation reason → savedPending

SECTION 6: Package Association

#Test CasePriorityExpectedStatus
BILL-110Associate package — suggestedP1Based on services, suggested packages shownPending
BILL-111Associate package — modalP1Click associate → package modal opensPending
BILL-112Select package → services addedP1Pick package → services auto-added from packagePending

SECTION 7: Edge Cases (Code Audit)

These were audited from frontend types + backend model validations rather than manual testing.

#Test CasePriorityFindingStatus
BILL-120Large payment amount — no maxP2Backend Payment.amount only validates > 0, no max. Frontend has no input limit either⚠️ No cap
BILL-121Large service price — no maxP2Backend unit_price >= 0, no max limit. Can enter ₹9999999⚠️ No cap
BILL-122Special chars in service nameP2Backend service_name max 255 chars, no character filter. Emojis/special chars pass⚠️ No filter
BILL-123Panel close with unsaved form dataP1Form state is local React state — lost on panel close. No warning⚠️ No warning
BILL-124Refresh — data from APIP1All data fetched from API on open — data persists across panel opens✅ Safe
BILL-125No data leak between patientsP1API calls include patient_facility_id in URL — properly scoped✅ Safe
BILL-126Rapid add/delete — race conditionP2No optimistic locking on services/payments. Two tabs could conflict⚠️ No lock

SECTION 8: Billing — Role-Based Access

#Test CasePriorityExpectedStatus
BILL-130Admin — full billing accessP0Admin can add services, payments, generate bills✅ PASS
BILL-131Doctor — billing accessP0canManageBilling = true for practitioner → panel accessible✅ PASS
BILL-132Staff — no billing accessP0canManageBilling = false for staff → billing button hidden/disabled✅ PASS

Test Summary

SectionTest CasesTestedPassedFailed
1. Panel Open & Header6660
2. Service Management1212120
3. Payment Management1414131
4. Bill Generation1111110
5. Follow-up / Next Visit101091
6. Package Association3330
7. Edge Cases6620
8. Role-Based Access3330
Total6565592

Status: ✅ Complete Last Updated: 2026-06-17


Test Execution Order

  1. Section 1: Panel Open & Header (BILL-01 → BILL-06) — 6 tests
  2. Section 2: Service Management (BILL-10 → BILL-36) — 12 tests
  3. Section 3: Payment Management (BILL-40 → BILL-63) — 14 tests
  4. Section 4: Bill Generation (BILL-70 → BILL-85) — 11 tests
  5. Section 5: Follow-up (BILL-90 → BILL-103) — 12 tests
  6. Section 6: Packages (BILL-110 → BILL-112) — 3 tests
  7. Section 7: Edge Cases (BILL-120 → BILL-125) — 6 tests
  8. Section 8: Role-Based (BILL-130 → BILL-132) — 3 tests

Status: Pending Last Updated: 2026-06-17

On this page