fix(inward): add Service Charge column to Itemized Service Summary (OPD + Inward)#22053
Conversation
…port - Add serviceCharge (BillItem.marginValue) to OpdSaleSummaryDTO via a new delegating constructor (existing constructors untouched) - Select bi.marginValue in fetchItemizedServiceInstanceDTOs; cancellation items already store it negative, so cancellations deduct correctly - Add Service Charge column with footer grand total between Gross Amount and Discount in inward_itemized_service_summary_dto.xhtml - Add getOpdSaleSummaryServiceChargeTotal() following the existing footer-total getters Cancellation deduction (bug 2 of the issue) was fixed by PR #22051; verified end-to-end here together with the new column. Closes #22050 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe itemized service summary now includes service charge in its DTO and billing projection, calculates a total in ChangesService charge reporting
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant BillService
participant OpdSaleSummaryDTO
participant SearchController
participant ItemizedServiceSummary
BillService->>OpdSaleSummaryDTO: Populate serviceCharge from bi.marginValue
OpdSaleSummaryDTO->>SearchController: Provide service charge values
SearchController->>SearchController: Calculate aggregate total
SearchController->>ItemizedServiceSummary: Render row values and footer total
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/com/divudi/core/data/dto/OpdSaleSummaryDTO.java`:
- Around line 32-34: Update OpdSaleSummaryDTO’s serviceCharge field to
initialize to 0.0, and null-coalesce the bi.marginValue assignment in the
per-instance constructor so null margins become 0.0. Preserve the documented
zero value for OPD rows and ensure all constructor paths produce a non-null
serviceCharge.
🪄 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: 9d331b82-0c33-4c3d-9d5b-64e4e9d35b8a
📒 Files selected for processing (4)
src/main/java/com/divudi/bean/common/SearchController.javasrc/main/java/com/divudi/core/data/dto/OpdSaleSummaryDTO.javasrc/main/java/com/divudi/service/BillService.javasrc/main/webapp/inward/inward_itemized_service_summary_dto.xhtml
…22050) Initialize the field and null-coalesce the constructor argument so rows from legacy data with NULL marginValue render 0.00 instead of blank. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Fixes the two bugs reported in #22050 on the Itemized Service Summary - OPD and Inward report (
/inward/inward_itemized_service_summary_dto.xhtml):BillItem.marginValue) between Gross Amount and Discount, with a footer grand total. The Excel export includes it automatically via the existingp:dataExporter target="tbl".BillItems already store negative values and the old aggregated query negated them again). This was fixed by the merged PR Show per-billing rows with billed date in Itemized Service Summary (#21920) #22051, which this branch builds on; verified end-to-end here.Closes #22050
What changed
OpdSaleSummaryDTO: newserviceChargefield + one new delegating constructor (existing constructors untouched, per DTO guidelines)BillService.fetchItemizedServiceInstanceDTOs: selectsbi.marginValue(stored sign used as-is —BillItem.invertValueinvertsmarginValueon cancellation, so cancellations deduct)SearchController:getOpdSaleSummaryServiceChargeTotal()mirroring the existing footer-total gettersNo schema change (no new persisted fields), so no DDL regeneration needed.
Verification (local Payara + browser E2E + DB cross-check)
Exercised on the local
coopDB, Inward department:Inward//26/000466(gross 400.00, service charge 56.00, net 456.00)Inward/INWCAN/36) → report shows a separate negative row (Count −1, Gross −400.00, Service Charge −56.00, Net −456.00) and all grand totals net to 0.00DB cross-check — report rows match
BILLITEMexactly:🤖 Generated with Claude Code
Summary by CodeRabbit