Skip to content

Reset footer totals in navigateToDepartmentViceStockReport() for clean state #18324

@coderabbitai

Description

@coderabbitai

Description

The navigateToDepartmentViceStockReport() method in ReportsStock.java currently only clears the departmentViceStockDtos list but does not reset the session-scoped footer totals. Because the bean is @SessionScoped, these totals can remain stale when navigating to the report before clicking "Process".

Affected Fields

The following totals should be reset to 0.0 when navigating to the report:

  • totalDepartmentViceStockQuantity
  • totalDepartmentViceStockPurchaseValue
  • totalDepartmentViceStockRetailValue
  • totalDepartmentViceStockCostValue

Suggested Fix

Add reset statements in the navigation method:

public String navigateToDepartmentViceStockReport() {
    departmentViceStockDtos = new ArrayList<>();
    totalDepartmentViceStockQuantity = 0.0;
    totalDepartmentViceStockPurchaseValue = 0.0;
    totalDepartmentViceStockRetailValue = 0.0;
    totalDepartmentViceStockCostValue = 0.0;
    return "/pharmacy/pharmacy_report_department_vice_stock?faces-redirect=true";
}

Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions