19655 inward reports rename charge type summary add bht level charge type breakdown detail report#19656
Conversation
…-level-charge-type-breakdown-detail-report' of https://github.com/hmislk/hmis.git into 19655-inward-reports-rename-charge-type-summary-add-bht-level-charge-type-breakdown-detail-report
Complete — 6 files changed Step 1 — CalculationMethod.java (NEW) 6-value enum: BILL_ITEM, PHARMACY_BILL, STORE_BILL, PATIENT_ROOM, BILL_FEE, ADMISSION_FEE Step 2 — InwardChargeType.java (MODIFIED) - Added private CalculationMethod calculationMethod field - Added new 2-arg constructor (existing 1-arg untouched) - Added getCalculationMethod() with null-safe default → BILL_ITEM - Updated 12 constants: RoomCharges, MOCharges, NursingCharges, LinenCharges, AdministrationCharge, MedicalCareICU, MaintainCharges → PATIENT_ROOM; Medicine → PHARMACY_BILL; GeneralIssuing → STORE_BILL; ProfessionalCharge, DoctorAndNurses → BILL_FEE; AdmissionFee → ADMISSION_FEE Step 3 — InwardChargeTypeBreakdownController.java (NEW) Branches on selectedChargeType.getCalculationMethod() across 6 cases, each producing a List<BhtBreakdownRow> + columnKeys/columnLabels/columnTotals. Step 4 — inward_report_inward_charge_type_breakdown.xhtml (NEW) ui:repeat-based HTML pivot table — dynamic columns for items/staff, blank cells for missing values, footer totals. Step 5 — inward_report_inward_charge_type_detail.xhtml (MODIFIED) Panel header renamed to "Inward Charge Type Summary by BHT Report". Step 6 — inward_reports.xhtml (MODIFIED) Button renamed to "Inward Charge Type Summary by BHT"; new "Inward Charge Type Breakdown by BHT" button added immediately below it. Signed-off-by: Dr M H B Ariyaratne <buddhika.ari@gmail.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 18 minutes and 55 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a new session-scoped report controller that generates an "Inward Charge Type Breakdown by BHT" pivot report, introduces a CalculationMethod enum, augments InwardChargeType with calculation methods, adds a new JSF view for the breakdown, and updates navigation and a small panelGrid attribute. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant UI as Inward Report Page
participant Controller as InwardChargeTypeBreakdownController
participant Strategy as Calculation Method Handler
participant Facade as Data Facade(s)
participant DB as Database
User->>UI: Select filters & charge type
User->>UI: Click Generate
UI->>Controller: generateReport()
Controller->>Controller: validate inputs (dates, required charge type, discharge-date rules)
alt validation fails
Controller->>UI: set errorMessage
UI-->>User: display error
else
Controller->>Strategy: select strategy by selectedChargeType.getCalculationMethod()
Strategy->>Facade: execute JPQL queries (appendEncounterFilters)
Facade->>DB: run queries
DB-->>Facade: return rows
Facade-->>Strategy: return results
Strategy->>Strategy: group by BHT, aggregate per-column, compute totals
Strategy-->>Controller: return columnKeys,columnLabels,rows,columnTotals
Controller->>UI: populate report fields
UI-->>User: render pivot table
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f64912fc22
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.java`:
- Around line 633-642: In completeInwardChargeType, getInwardChargeTypeLabel(ct)
can return null leading to NPE when calling label.toLowerCase(); fix by
null-safing the label lookup (e.g., treat null as "" or skip the label-based
check), compute a safe lower-case string (labelLower) before using contains, and
then continue to check ct.name().toLowerCase() — update references in the method
(completeInwardChargeType and getInwardChargeTypeLabel usage) so no direct calls
to toLowerCase() on a possibly null label remain.
In `@src/main/webapp/inward/inward_report_inward_charge_type_breakdown.xhtml`:
- Around line 290-303: The footer is missing the grand total for the "Total"
column; update the final empty <td> in the tfoot row to render the grand total
using a controller property or computed value (e.g., expose
inwardChargeTypeBreakdownController.grandTotal or getGrandTotal()) and format it
with <f:convertNumber minFractionDigits="2" maxFractionDigits="2" /> to match
other column totals; ensure the value corresponds to the per-row rowTotal
aggregation used in the rows so the footer shows the sum of all rowTotal values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 005f8926-9424-42f5-aea2-937b2f9d018b
📒 Files selected for processing (7)
src/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.javasrc/main/java/com/divudi/core/data/inward/CalculationMethod.javasrc/main/java/com/divudi/core/data/inward/InwardChargeType.javasrc/main/webapp/inward/inward_bill_final_break_down.xhtmlsrc/main/webapp/inward/inward_report_inward_charge_type_breakdown.xhtmlsrc/main/webapp/inward/inward_report_inward_charge_type_detail.xhtmlsrc/main/webapp/inward/inward_reports.xhtml
src/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.java`:
- Around line 191-206: The switch in InwardChargeTypeBreakdownController on
admissionStatus is missing the
AdmissionStatus.DISCHARGED_BUT_FINAL_BILL_NOT_COMPLETED branch; add a case for
DISCHARGED_BUT_FINAL_BILL_NOT_COMPLETED that appends the same predicates as the
DISCHARGED_AND_FINAL_BILL_COMPLETED branch but sets params.put("dis", true) and
params.put("pf", false) (use encAlias when building jpql and the existing params
map) so discharged=true and paymentFinalized=false are applied to the query.
- Around line 488-503: The JPQL in buildFromBillFees() selects BillFee rows for
InwardProfessional bills but lacks the inwardChargeType filter used elsewhere;
update the jpql StringBuilder (in buildFromBillFees) to include "and
bf.billItem.inwardChargeType = :ct" and add the parameter to the params map
(params.put("ct", selectedChargeType)) so the query filters by the currently
selectedChargeType before calling billFeeFacade.findByJpql(...).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bb5f5ea7-f288-43a9-88ca-ff4105ad831f
📒 Files selected for processing (2)
src/main/java/com/divudi/bean/inward/BhtPaymentSummaryReportController.javasrc/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.java
src/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.java
Show resolved
Hide resolved
src/main/java/com/divudi/bean/inward/InwardChargeTypeBreakdownController.java
Show resolved
Hide resolved
- Null-safe label lookup in completeInwardChargeType (Comment 1) - Add grandTotal field and expose getter; show grand total in XHTML footer (Comment 2) - Add DISCHARGED_BUT_FINAL_BILL_NOT_COMPLETED case in appendEncounterFilters (Comment 3) Closes #19655 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary by CodeRabbit
New Features
UI
Bug Fixes