diff --git a/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java b/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java index c577bee323..701af25dc0 100644 --- a/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java +++ b/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java @@ -791,6 +791,7 @@ public String generateFileNameForReport(String reportName) { return reportName.trim(); } + @Deprecated public void generateGRNReportTableByBillItem(List bt) { bills = null; totalCreditPurchaseValue = 0.0; @@ -884,7 +885,7 @@ public String navigateBackToGeneratedGrnDetailedRportTable() { } - public void generateGRNReportTable() { + public void generateGrnReportTable() { bills = null; totalCreditPurchaseValue = 0.0; totalCashPurchaseValue = 0.0; @@ -893,10 +894,8 @@ public void generateGRNReportTable() { List bt = new ArrayList<>(); if ("detailReport".equals(reportType)) { bt.add(BillType.PharmacyGrnBill); - generateGRNReportTableByBillItem(bt); } else if ("returnReport".equals(reportType)) { bt.add(BillType.PharmacyGrnReturn); - generateGRNReportTableByBillItem(bt); } else if ("summeryReport".equals(reportType)) { bt.add(BillType.PharmacyGrnBill); bt.add(BillType.PharmacyGrnReturn); @@ -936,10 +935,14 @@ public void generateGRNReportTable() { tmp.put("pm", paymentMethod); } - if (fromInstitution != null) { + if (fromInstitution != null && "detailReport".equals(reportType)) { sql += " AND b.fromInstitution = :supplier"; tmp.put("supplier", fromInstitution); } + if (fromInstitution != null && "returnReport".equals(reportType)) { + sql += " AND b.toInstitution = :supplier"; + tmp.put("supplier", fromInstitution); + } sql += " order by b.id desc"; diff --git a/src/main/webapp/reports/inventoryReports/grn_report.xhtml b/src/main/webapp/reports/inventoryReports/grn_report.xhtml index 4d33069b18..26243bdf7a 100644 --- a/src/main/webapp/reports/inventoryReports/grn_report.xhtml +++ b/src/main/webapp/reports/inventoryReports/grn_report.xhtml @@ -147,7 +147,7 @@ icon="fas fa-cogs" ajax="false" value="Process" - action="#{pharmacyController.generateGRNReportTable()}"> + action="#{pharmacyController.generateGrnReportTable()}">