Skip to content

11527 need to improve inward doctor payment summary #11581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

buddhika75
Copy link
Member

@buddhika75 buddhika75 commented Apr 4, 2025

Closes #11527

Summary by CodeRabbit

  • New Features

    • Enhanced professional payment processing with dynamic income aggregation and improved withholding tax calculations.
    • Updated report handling to maintain user session data, ensuring persistent state across interactions.
  • User Interface Enhancements

    • Redesigned payment summary page with an expanded layout, additional data columns, and refined sorting/filtering controls.
    • Standardized menu icons for a consistent, modern look.
    • Consolidated form structure within interactive panels to streamline data entry and submission.

@buddhika75 buddhika75 linked an issue Apr 4, 2025 that may be closed by this pull request
3 tasks
Copy link
Contributor

coderabbitai bot commented Apr 4, 2025

Walkthrough

The pull request introduces new methods and fields for aggregating professional payment data in the inward payment controller, along with enhancements to tax configuration handling. Changes in the core data classes add financial tracking fields. The report controller’s scope was updated to better preserve session state. In addition, several UI modifications have been made, including a redesigned payment summary table, updated menu icons, and consolidated form structures. Overall, the changes affect business logic, backend data handling, and user interface presentation.

Changes

Files Change Summary
src/main/java/com/divudi/bean/inward/InwardStaffPaymentBillController.java
src/main/java/com/divudi/core/data/IncomeBundle.java
src/main/java/com/divudi/core/data/IncomeRow.java
Added new fields (bundle, netTotal, paidTotal) and methods to aggregate professional payment data and manage financial totals; modifications to tax configuration logic via getter methods.
src/main/java/com/divudi/bean/report/MdInwardReportController.java Changed bean scope from @RequestScoped to @SessionScoped by updating the annotations and imports.
src/main/webapp/inward/inward_reports.xhtml
src/main/webapp/inward/report_doctor_payment_summery.xhtml
src/main/webapp/resources/ezcomp/menu.xhtml
src/main/webapp/resources/ezcomp/midding_data_fields.xhtml
Updated UI layout and styling: modified accordion and panel grid components, restructured the data table to include new columns with sorting/filtering, standardized menu icons, and consolidated nested forms into a single form wrapping the accordion panel.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant Controller as InwardStaffPaymentBillController
    participant DB
    participant Bundle as IncomeBundle

    User->>UI: Select professional payment filter (Discharged/Added)
    UI->>Controller: fillProfessionalPaymentsByDischargedDate()/fillProfessionalPaymentsByAddedDate()
    Controller->>DB: Execute JPQL query for BillFee records with filters
    DB-->>Controller: Return aggregated payment data
    Controller->>Bundle: Update IncomeBundle with totals (netTotal & paidTotal)
    Controller->>Controller: Retrieve latest withholding tax status via getWithholdingTaxCalculationStatus()
    Controller-->>UI: Return updated payment summary data
Loading

Assessment against linked issues

Objective Addressed Explanation
Display net paid amount excluding cancelled amounts (#11527) UI now shows “Net Total” and “Paid Total” but no clear calculation change to exclude cancelled amounts is evident.
Add search functionality for Doctor's name (#11527) No search box or filtering logic for Doctor's name was added in the changes.
Update UI layout for Inward Doctor Payment Summary as per design (#11527) The report layout was restructured to an 8-column panel grid with updated table columns and styling.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (9)
src/main/java/com/divudi/core/data/IncomeRow.java (2)

141-141: Consider using BigDecimal for monetary amounts.
You introduced private double paidTotal; to store paid totals. While using double is convenient, floating-point rounding may lead to inaccuracies when dealing with real currency.


897-898: Remove or justify extra blank lines.
These newly added blank lines appear unnecessary. Removing them keeps the file compact and more consistent.

897-    
898-    
src/main/java/com/divudi/core/data/IncomeBundle.java (1)

43-45: Consider BigDecimal for new financial fields.
Fields netTotal and paidTotal are introduced as double. For monetary values, using BigDecimal helps avoid floating-point rounding errors.

src/main/webapp/inward/report_doctor_payment_summery.xhtml (3)

47-48: BHT Type selection.
"BHT" type is presumably a domain-specific admission detail. Confirm the user has enough context to accurately choose among the options.


61-63: Bootstrap row and col usage.
You introduced .row and .col-12. Ensure the appropriate spacing for the parent container, if any.


120-122: Typographical error in facet header.
You labeled the header as "Processional Payments." If you meant "Professional Payments," please correct the wording.

-<h:outputText value="Processional Payments" />
+<h:outputText value="Professional Payments" />
src/main/java/com/divudi/bean/inward/InwardStaffPaymentBillController.java (1)

716-801: Aggregating BillFee data and building an IncomeBundle.
The approach of iterating over each BillFee and storing aggregates in a map keyed by Staff works. Consider using a grouped JPQL query to sum fee values and paid values, which can improve performance by offloading aggregation to the database.

src/main/webapp/resources/ezcomp/menu.xhtml (2)

615-620: Lab Analytics Icon Change:
The Lab Analytics menu item has been updated to include the new "pi pi-chart-bar" icon, which standardizes the appearance across analytics-related entries.

Note: Verify that the privilege check #{webUserController.hasPrivilege('LabSummeries')} is correctly spelled and intentional, as it might be a typographical error for “LabSummaries”.


1209-1214: Channel Analytics Icon Update:
The Channel Analytics menu item now includes the "pi pi-chart-bar" icon. This improves the overall visual consistency for analytics items.

Note: Please double-check whether the rendered condition #{webUserController.hasPrivilege('ChannelSummery')} is intentionally spelled as “Summery” or if it should be “Summary”.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0be3f5 and a1f03ac.

📒 Files selected for processing (8)
  • src/main/java/com/divudi/bean/inward/InwardStaffPaymentBillController.java (11 hunks)
  • src/main/java/com/divudi/bean/report/MdInwardReportController.java (2 hunks)
  • src/main/java/com/divudi/core/data/IncomeBundle.java (2 hunks)
  • src/main/java/com/divudi/core/data/IncomeRow.java (3 hunks)
  • src/main/webapp/inward/inward_reports.xhtml (1 hunks)
  • src/main/webapp/inward/report_doctor_payment_summery.xhtml (1 hunks)
  • src/main/webapp/resources/ezcomp/menu.xhtml (7 hunks)
  • src/main/webapp/resources/ezcomp/midding_data_fields.xhtml (4 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/main/java/com/divudi/bean/inward/InwardStaffPaymentBillController.java (2)
src/main/java/com/divudi/core/data/IncomeBundle.java (1)
  • IncomeBundle (20-1537)
src/main/java/com/divudi/core/data/IncomeRow.java (1)
  • IncomeRow (17-1229)
🔇 Additional comments (40)
src/main/webapp/inward/inward_reports.xhtml (1)

15-17: UI enhancement with improved styling

Adding the CSS classes m-1 w-100 to the accordion panel improves the UI by providing a small margin and ensuring the panel takes up the full width of its container. This change aligns with the overall session state preservation improvement mentioned in the PR summary.

src/main/webapp/resources/ezcomp/midding_data_fields.xhtml (1)

15-147: Form structure improvement for better state management

Restructuring by moving the <h:form> tag to wrap the entire accordion panel consolidates multiple forms into a single form. This is a good change that:

  1. Ensures all form inputs across tabs will be submitted together
  2. Simplifies the AJAX behavior as all fields are within the same form context
  3. Improves state preservation across tab switches

This change will work better with session-scoped controllers and supports the new professional payment functionalities mentioned in the PR summary.

src/main/java/com/divudi/bean/report/MdInwardReportController.java (1)

48-48: Appropriate scope change from RequestScoped to SessionScoped.

The controller has been changed from request-scoped to session-scoped, allowing state (report parameters, calculation results) to persist throughout a user's session. This is a beneficial change for report generation workflows as it maintains the user's report configuration between requests, providing a better user experience when working with inward payment summaries.

Also applies to: 58-58

src/main/java/com/divudi/core/data/IncomeRow.java (1)

1219-1226: Verify financial calculations with new getters and setters.
The getters and setters for paidTotal look fine functionally. If you intend to sum or manipulate these values across multiple threads or contexts, ensure concurrency safety and consider potential rounding issues.

src/main/java/com/divudi/core/data/IncomeBundle.java (1)

1519-1534: Validate new summarization fields.
The new getters and setters for netTotal and paidTotal align with the added financial tracking. Ensure that any aggregation logic (like populateSummaryRow()) references these fields consistently.

src/main/webapp/inward/report_doctor_payment_summery.xhtml (20)

24-29: Check p:calendar styling classes.
Updating these classes can affect component spacing and alignment. Confirm that the user experience remains smooth on different screen sizes.


34-35: AutoComplete changes look fine.
No issues spotted. Ensure that specialityController.completeSpeciality properly handles partial matches for large data sets.


40-45: Admission Type dropdown updates.
Referring to admissionTypeController.items. Verify that the default "All Admission Types" case is handled in the controller logic.


53-54: Credit company filtering.
Ensure that "All Credit Companies" behaviors are tested when no specific institution is selected.


58-58: PanelGrid closure.
No functional changes noted. Confirm that the layout is valid.


64-70: New button for filling professional payments by added date.
Looks correct. Confirm that fillProfessionalPaymentsByAddedDate() is covered by tests if the logic is significant.


71-75: New button for filling professional payments by discharge date.
Implementation is consistent with the added-date version. Again, consider adding unit tests.


78-85: Hidden command button for paid professional payments by added date.
This is rendered as false. If you intend to use it later, ensure the method references remain valid.


86-91: Hidden command button for paid professional payments by completed discharge date.
Similar to the above. The button is hidden, so no immediate effect.


92-95: Print feature.
The p:printer targeting tbl is straightforward. No concerns.


97-100: Excel export.
The p:dataExporter usage is correct. No performance issues expected.


102-105: Spacing changes.
These new lines mainly improve visual spacing. Looks fine.


107-119: Data table configuration changes.
You introduced rowKey="#{ir.uuid}" and adjusted pagination. Confirm that each IncomeRow always has a unique UUID for stable rowKey usage.


124-130: Additional column: Speciality.
No functional issues. Checking for NPE if ir.staff or ir.staff.speciality is null might be important.


132-138: Additional column: Name.
Same caution about potential null references for ir.staff.person.


140-155: New Net Total column.
Columns with numeric filtering and sorting are a good addition. Confirm data type formatting is consistent with other columns.


157-171: New Paid Total column.
Ensures display of ir.paidTotal. The approach is consistent with the net total column.


175-175: Footer update.
No concerns. The table ends properly.


31-32:

❓ Verification inconclusive

Confirm date range consistency.
You’re using the same date pattern for both from-date and to-date. Ensure the system logic prohibits invalid ranges (e.g. from-date after to-date).


🏁 Script executed:

#!/bin/bash
# Searching for date range validations in controller or xhtml
rg "fromDate" -A 5
rg "toDate" -A 5

Length of output: 68123


Date Range Consistency & Validation Check

The date fields throughout the application consistently use the long date/time format defined by #{sessionController.applicationPreference.longDateTimeFormat}. Please confirm that the corresponding controller logic (for example, within inwardStaffPaymentBillController or other related controllers) properly validates the date range—ensuring that a "from-date" is not set later than the "to-date." This check is crucial to prevent invalid input despite the consistent UI formatting.


19-22:

❓ Verification inconclusive

Ensure that the expanded panel grid columns match desired layout.
Changing columns to 8 can significantly alter the UI. Double-check the layout in all target viewports for responsiveness.


🏁 Script executed:

#!/bin/bash
# Searching for references to this xhtml to ensure it's included in the correct layout or template
rg "report_doctor_payment_summery.xhtml" -A 3

Length of output: 45


Verify Responsive Layout of 8-Column Panel Grid

The current change in src/main/webapp/inward/report_doctor_payment_summery.xhtml sets the panel grid to 8 columns, which could significantly affect the UI’s appearance and responsiveness. Automated searches for this file's usage did not yield further context, so please manually verify that the new grid layout adapts correctly across all target viewports. If any issues are found, consider revising the column count or the overall layout as needed.

src/main/java/com/divudi/bean/inward/InwardStaffPaymentBillController.java (10)

16-17: Imports are correct and consistent.
No issues found with these new import statements.


66-66: EJB references appear valid.
The newly introduced EJB fields (BillFacade, BillItemFacade, BillNumberGenerator, StaffFacade) are properly annotated and match your usage patterns.

Also applies to: 82-90


91-98: Dependency injection is properly declared.
SessionController, ConfigOptionApplicationController, and DrawerController are injected correctly.


99-105: Added class fields are consistent with the overall design.
Your new lists, numeric totals, and reference fields (e.g., bills, billComponents, selectedItems, bundle, etc.) align with the rest of the controller’s logic. Make sure to remove any fields that are never accessed to keep the class maintainable.

Also applies to: 114-119, 129-130, 133-136, 137-147, 151-160, 162-168


170-179: No functional changes in these folding or comment lines.


277-279: Ensure withholdings are initialized before view navigation.
Calling fetchWithholdingDetailConfiguration() prior to returning the new page is a good approach to ensure the UI has correct default settings.


281-304: Withholding tax configuration method looks good.
This method adequately initializes withholding tax calculation statuses from your configuration. The code is straightforward; ensure you’ve tested the dependent keys.


307-307: No substantive change.
These lines appear to be empty lines, closing braces, or single-line calls with no notable effect on functionality.

Also applies to: 340-340, 367-367, 394-394, 631-631, 707-709


710-715: Methods delegate to fillProfessionalPayments effectively.
Using separate shortcuts for discharge date vs. added date is clean and readable.


2080-2087: Getter/Setter for bundle are well-defined.
These methods align with the usage in fillProfessionalPayments(...). The naming and logic are consistent with the rest of the class.

src/main/webapp/resources/ezcomp/menu.xhtml (5)

269-273: OPD Analytics Icon Update:
The menu item for OPD Analytics now uses the new icon "pi pi-chart-bar". This change improves visual consistency with other analytics items and aligns with the updated design guidelines.


441-447: Inward Analytics Icon Addition:
An icon="pi pi-chart-bar" attribute has been added to the Inward Analytics menu item. This update ensures the iconography is consistent with the rest of the application while preserving the existing action and rendered conditions.


945-950: Pharmacy Analytics Icon Update:
The Pharmacy Analytics item has been revised to use the "pi pi-chart-bar" icon, bringing it in line with the current UI aesthetic. The functional behavior and privilege check (#{webUserController.hasPrivilege('PharmacySummaryViews')}) remain unchanged.


1062-1068: Theatre Analytics Icon Replacement:
The Theatre Analytics menu item now features the "pi pi-chart-bar" icon. This change enhances the consistency of analytics icons across different modules (OPD, Lab, Pharmacy, etc.).


1125-1130: Store Analytics Icon Addition:
The Store Analytics menu item has been updated to display the new "pi pi-chart-bar" icon. This update appears to be a straightforward visual change without impacting the underlying functionality.

@GSMgeeth GSMgeeth merged commit aa1a5a7 into development Apr 4, 2025
3 checks passed
@GSMgeeth GSMgeeth deleted the 11527-need-to-improve-inward-doctor-payment-summary branch April 4, 2025 04:50
@buddhika75
Copy link
Member Author

The others will be added later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to improve Inward Doctor Payment Summary
2 participants