Commit 9d58c89
fix(inward): source invoice journal charges by CalculationMethod, not a flat BillItem sum (#22687)
* fix(inward): source invoice journal charges by CalculationMethod, not a flat BillItem sum
The Inpatient Invoice Journal summed every charge type from a single
BillItem query, which only works for the default calculation method.
This left Admission Fee, Room Charges, and Professional/Assisting Fee
permanently at 0 (those types are never stored as BillItem rows), only
showed one credit company when a BHT had several, dropped credit
settlement rows entirely, and double-counted BILL_ITEM charge types
after discharge once the discharge snapshot bills were created.
- Dispatch charge fetching by InwardChargeType.getCalculationMethod(),
mirroring the sourcing already used by InwardChargeTypeDetailController
and InwardChargeTypeBreakdownController for the same report family.
- Read Admission Fee from AdmissionType.admissionFee directly.
- Read Room Charges from PatientRoom's calculated fields plus InwardBill
service items.
- Read Professional/Assisting Charge from BillFee on InwardProfessional
bills, split by Consultant vs non-Consultant staff.
- Switch the BILL_ITEM charge query from a billTypeAtomic blacklist to a
billType whitelist (InwardBill/InwardOutSideBill), which naturally
excludes the discharge-time snapshot bills and fixes the post-discharge
doubling.
- Merge in all EncounterCreditCompany rows for the credit company column,
not just the legacy single PatientEncounter.creditCompany field.
- Group the credit settlement query on BillItem.patientEncounter instead
of Bill.patientEncounter, since the settlement bill itself is never
assigned a patientEncounter.
Verified end-to-end with a synthetic test admission (OPD Card admission
fee, 2 credit companies, room + professional charges, discharge, and
credit settlement) — all 6 reported symptoms confirmed fixed, including
no doubling post-discharge despite discharge creating duplicate snapshot
BillItem/BillFee rows.
Also documents a new Playwright gotcha found while testing (required
Speciality field silently blocking the Add Professional Fee submit).
Closes #22665
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(inward): include bills with a null billTypeAtomic in journal discount totals
SQL evaluates `NULL NOT IN (...)` as unknown, so BillFee rows on legacy
bills without a billTypeAtomic value were silently excluded from the
invoice journal's discount/service-charge totals. Confirmed against the
local DB: 1,194 bills currently have a null billTypeAtomic.
Fixes CodeRabbit review comment on PR #22687.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent 72ad435 commit 9d58c89
2 files changed
Lines changed: 408 additions & 28 deletions
File tree
- developer_docs/testing
- src/main/java/com/divudi/bean/inward
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1465 | 1465 | | |
1466 | 1466 | | |
1467 | 1467 | | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
1468 | 1483 | | |
1469 | 1484 | | |
1470 | 1485 | | |
| |||
0 commit comments