From 7a31b4a2d71797ab5214b829a828ccd82abc156a Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Sun, 29 Dec 2024 19:16:13 +0530 Subject: [PATCH 01/24] Signed-off-by: SandithP2001 --- src/main/resources/META-INF/persistence.xml | 4 +-- .../inventoryReports/expiry_item.xhtml | 36 +++++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index e250f12e48..65a40bd38e 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -2,7 +2,7 @@ org.eclipse.persistence.jpa.PersistenceProvider - jdbc/coop + jdbc/ruhunu false @@ -14,7 +14,7 @@ - jdbc/coopaudit + jdbc/ruhunuAudit false diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index 6bbaa8f38b..8e4be1396b 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -224,7 +224,12 @@
- + @@ -239,7 +244,8 @@
Expiry Item Report
- - + - + - + - + - + - + - + - + - + - + - + - + - + From c09806638bfdbeae874fac9127a3b73a59f2b370 Mon Sep 17 00:00:00 2001 From: Chinthaka Prasad Date: Sun, 29 Dec 2024 22:03:46 +0530 Subject: [PATCH 02/24] fix:disbursement recieve issues fixed. --- .../pharmacy/TransferIssueController.java | 61 ++++++++++++++++- .../java/com/divudi/ejb/PharmacyBean.java | 6 +- .../com/divudi/ejb/PharmacyCalculation.java | 65 ++++++++++++++----- src/main/java/com/divudi/entity/BillItem.java | 24 +++---- .../pharmacy/pharmacy_transfer_issue.xhtml | 6 +- 5 files changed, 126 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java index 0c50dbbbbc..dda59f315e 100644 --- a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java +++ b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java @@ -106,6 +106,21 @@ public String navigateToPharmacyIssueForRequests() { return "/pharmacy/pharmacy_transfer_issue"; } + public boolean isFullyIssued() { + for (BillItem originalItem : billItems) { + + if (originalItem.getIssuedPhamaceuticalItemQty() == originalItem.getQty()) { + if (originalItem.getPharmaceuticalBillItem().getItemBatch() == null) { + continue; + } + System.out.println(originalItem.getIssuedPhamaceuticalItemQty() + " originalItem.getIssuedPhamaceuticalItemQty " + originalItem.getQty() + " originalItem.getQty()"); + return true; + } + } + + return false; + } + public boolean isFullyIssued(Bill bill) { if (bill == null || bill.getBillItems() == null || bill.getBillItems().isEmpty()) { return false; // Null or empty bills are not considered fully issued @@ -115,6 +130,8 @@ public boolean isFullyIssued(Bill bill) { if (originalItem.getPharmaceuticalBillItem().getQty() > 0) { return false; // If any item's issued quantity is less than its original quantity + }else if(originalItem.getPharmaceuticalBillItem().getItemBatch() == null){ + return false; } } @@ -251,13 +268,14 @@ public void generateBillComponent() { double issuableQty = i.getQty() - (Math.abs(billedIssue) - Math.abs(cancelledIssue)); + //i.setIssuedPhamaceuticalItemQty(i.getQty() - issuableQty); List stockQtys = pharmacyBean.getStockByQty(i.getItem(), issuableQty, getSessionController().getDepartment()); for (StockQty sq : stockQtys) { - if (sq.getQty() == 0) { - continue; - } +// if (sq.getQty() == 0) { +// continue; +// } //Checking User Stock Entity if (!userStockController.isStockAvailable(sq.getStock(), sq.getQty(), getSessionController().getLoggedUser())) { @@ -271,6 +289,15 @@ public void generateBillComponent() { bItem.setReferanceBillItem(i); bItem.setQty(i.getQty()); bItem.setTmpQty(sq.getQty()); + bItem.setIssuedPhamaceuticalItemQty(i.getQty() - sq.getQty()); + + if (stockQtys.size() > 1) { + double billedIssueByItemBatch = getPharmacyCalculation().getBilledIssuedByRequestedItemBatch(i, BillType.PharmacyTransferIssue, sq.getStock().getItemBatch()); + System.out.println(billedIssueByItemBatch + " billedIssueByItemBatch"); + double cancelledIssueByItemBatch = getPharmacyCalculation().getCancelledIssuedByRequestedItemBatch(i, BillType.PharmacyTransferIssue, sq.getStock().getItemBatch()); + System.out.println(cancelledIssueByItemBatch + " cancelledIssueByItemBatch"); + bItem.setIssuedPhamaceuticalItemQty(Math.abs(billedIssueByItemBatch) + Math.abs(cancelledIssueByItemBatch)); + } // s bItem.setTmpSuggession(getSuggession(i.getBillItem().getItem())); // //System.err.println("List "+bItem.getTmpSuggession()); @@ -290,6 +317,15 @@ public void generateBillComponent() { UserStock us = userStockController.saveUserStock(bItem, getSessionController().getLoggedUser(), usc); bItem.setTransUserStock(us); +// double totalIssueAmount = 0; +// +// if (stockQtys.size() > 1) { +// for (StockQty s : stockQtys) { +// totalIssueAmount += s.getQty(); +// } +// bItem.setIssuedPhamaceuticalItemQty(totalIssueAmount); +// +// } getBillItems().add(bItem); flagStockFound = true; @@ -512,6 +548,25 @@ public void settle() { return; } + for (BillItem bi : getBillItems()) { + if (bi.getPharmaceuticalBillItem().getItemBatch() != null) { + if (bi.getPharmaceuticalBillItem().getStock().getStock() < bi.getPharmaceuticalBillItem().getQty()) { + JsfUtil.addErrorMessage("Available quantity is less than issued quantity in " + bi.getPharmaceuticalBillItem().getItemBatch().getItem().getName()); + return; + } + } else if (bi.getPharmaceuticalBillItem().getItemBatch() == null) { + if (bi.getPharmaceuticalBillItem().getQty() > 0) { + JsfUtil.addErrorMessage(bi.getItem().getName() + " is not available in the stock"); + return; + } + } + + if (bi.getReferanceBillItem().getQty() < bi.getPharmaceuticalBillItem().getQty()) { + JsfUtil.addErrorMessage("Issued quantity is higher than requested quantity in " + bi.getItem().getName()); + return; + } + } + saveBill(); for (BillItem i : getBillItems()) { diff --git a/src/main/java/com/divudi/ejb/PharmacyBean.java b/src/main/java/com/divudi/ejb/PharmacyBean.java index abeb463c56..09807631bc 100644 --- a/src/main/java/com/divudi/ejb/PharmacyBean.java +++ b/src/main/java/com/divudi/ejb/PharmacyBean.java @@ -611,9 +611,9 @@ public List deductFromStock(Item item, double qty, Department depa } public List getStockByQty(Item item, double qty, Department department) { - if (qty <= 0) { - return new ArrayList<>(); - } +// if (qty <= 0) { +// return new ArrayList<>(); +// } String sql = ""; Map m = new HashMap(); diff --git a/src/main/java/com/divudi/ejb/PharmacyCalculation.java b/src/main/java/com/divudi/ejb/PharmacyCalculation.java index a9c2a159c9..98a0e826a3 100644 --- a/src/main/java/com/divudi/ejb/PharmacyCalculation.java +++ b/src/main/java/com/divudi/ejb/PharmacyCalculation.java @@ -162,8 +162,8 @@ public double getTotalQty(BillItem b, BillType billType, Bill bill) { //System.err.println("GETTING TOTAL QTY " + value); return value; } - - public double getTotalQtyWithFreeQty(BillItem b, BillType billType, Bill bill) { + + public double getTotalQtyWithFreeQty(BillItem b, BillType billType, Bill bill) { String sql = "Select sum(p.pharmaceuticalBillItem.qty+p.pharmaceuticalBillItem.freeQty) from BillItem p where" + " type(p.bill)=:class and p.creater is not null and" + " p.referanceBillItem=:bt and p.bill.billType=:btp"; @@ -178,7 +178,7 @@ public double getTotalQtyWithFreeQty(BillItem b, BillType billType, Bill bill) { //System.err.println("GETTING TOTAL QTY " + value); return value; } - + public double getTotalFreeQty(BillItem b, BillType billType, Bill bill) { String sql = "Select sum(p.pharmaceuticalBillItem.freeQty) from BillItem p where" + " type(p.bill)=:class and p.creater is not null and" @@ -209,7 +209,7 @@ public double getTotalQty(BillItem b, BillType billType) { //System.err.println("GETTING TOTAL QTY " + value); return value; } - + public double getTotalFreeQty(BillItem b, BillType billType) { String sql = "Select sum(p.pharmaceuticalBillItem.freeQty) from BillItem p where" + " p.creater is not null and" @@ -240,6 +240,26 @@ public double getBilledIssuedByRequestedItem(BillItem b, BillType billType) { return value; } + public double getBilledIssuedByRequestedItemBatch(BillItem b, BillType billType, ItemBatch batch) { + String sql = "Select sum(p.pharmaceuticalBillItem.qty) from BillItem p where" + + " p.creater is not null and type(p.bill)=:class and " + + " p.referanceBillItem=:bt and p.bill.billType=:btp " + + " and p.pharmaceuticalBillItem.itemBatch = :batch"; + + BillItem bb = new BillItem(); + bb.getPharmaceuticalBillItem().getItemBatch(); + + HashMap hm = new HashMap(); + hm.put("bt", b); + hm.put("batch", batch); + hm.put("class", BilledBill.class); + hm.put("btp", billType); + + double value = getPharmaceuticalBillItemFacade().findDoubleByJpql(sql, hm); + + return value; + } + public double getBilledInwardPharmacyRequest(BillItem b, BillType billType) { String sql = "Select sum(p.pharmaceuticalBillItem.qty) from BillItem p where" + " p.creater is not null and type(p.bill)=:class and " @@ -269,6 +289,23 @@ public double getCancelledIssuedByRequestedItem(BillItem b, BillType billType) { return value; } + + public double getCancelledIssuedByRequestedItemBatch(BillItem b, BillType billType, ItemBatch batch) { + String sql = "Select sum(p.pharmaceuticalBillItem.qty) from BillItem p where" + + " p.creater is not null and type(p.bill)=:class and " + + " p.referanceBillItem.referanceBillItem=:bt and p.bill.billType=:btp " + + " and p.pharmaceuticalBillItem.itemBatch = :batch "; + + HashMap hm = new HashMap(); + hm.put("bt", b); + hm.put("batch", batch); + hm.put("class", CancelledBill.class); + hm.put("btp", billType); + + double value = getPharmaceuticalBillItemFacade().findDoubleByJpql(sql, hm); + + return value; + } public double getCancelledInwardPharmacyRequest(BillItem b, BillType billType) { String sql = "Select sum(p.pharmaceuticalBillItem.qty) " @@ -343,7 +380,7 @@ public double getReturnedTotalQty(BillItem b, BillType billType, Bill bill) { return getPharmaceuticalBillItemFacade().findDoubleByJpql(sql, hm); } - + public double getReturnedTotalQtyWithFreeQty(BillItem b, BillType billType, Bill bill) { String sql = "Select sum(p.pharmaceuticalBillItem.qty+p.pharmaceuticalBillItem.freeQty) from BillItem p where" + " type(p.bill)=:class and p.bill.creater is not null and" @@ -357,7 +394,7 @@ public double getReturnedTotalQtyWithFreeQty(BillItem b, BillType billType, Bill return getPharmaceuticalBillItemFacade().findDoubleByJpql(sql, hm); } - + public double getReturnedTotalFreeQty(BillItem b, BillType billType, Bill bill) { String sql = "Select sum(p.pharmaceuticalBillItem.freeQty) from BillItem p where" + " type(p.bill)=:class and p.bill.creater is not null and" @@ -384,7 +421,7 @@ public double getReturnedTotalQty(BillItem b, BillType billType) { return getPharmaceuticalBillItemFacade().findDoubleByJpql(sql, hm); } - + public double getReturnedTotalFreeQty(BillItem b, BillType billType) { String sql = "Select sum(p.pharmaceuticalBillItem.freeQty) from BillItem p where" + " p.bill.creater is not null and" @@ -417,7 +454,7 @@ public double calQty(PharmaceuticalBillItem po) { return (Math.abs(recieveNet) - Math.abs(retuernedNet)); } - + public double calFreeQty(PharmaceuticalBillItem po) { double billed = getTotalFreeQty(po.getBillItem(), BillType.PharmacyGrnBill, new BilledBill()); @@ -442,27 +479,22 @@ public double calQtyInTwoSql(PharmaceuticalBillItem po) { double grns = getTotalQty(po.getBillItem(), BillType.PharmacyGrnBill); double grnReturn = getReturnedTotalQty(po.getBillItem(), BillType.PharmacyGrnReturn); - double netQty = grns - grnReturn; - return netQty; } - + public double calFreeQtyInTwoSql(PharmaceuticalBillItem po) { double grnsFree = getTotalFreeQty(po.getBillItem(), BillType.PharmacyGrnBill); double grnReturnFree = getReturnedTotalFreeQty(po.getBillItem(), BillType.PharmacyGrnReturn); - double netFreeQty = grnsFree - grnReturnFree; - return netFreeQty; } - public double calQty2(BillItem bil) { double returnBill = getTotalQty(bil, BillType.PharmacySale, new RefundBill()); @@ -558,7 +590,7 @@ public double getRemainingQty(PharmaceuticalBillItem ph) { return remainsFree; } - + public double getRemainingFreeQty(PharmaceuticalBillItem ph) { String sql = "Select p from PharmaceuticalBillItem p where p.billItem.id = " + ph.getBillItem().getReferanceBillItem().getId(); @@ -869,7 +901,7 @@ public void calculateRetailSaleValueAndFreeValueAtPurchaseRate(Bill b) { public boolean checkItemBatch(List list) { for (BillItem i : list) { - if (i.getPharmaceuticalBillItem().getQty() != 0.0 ) { + if (i.getPharmaceuticalBillItem().getQty() != 0.0) { if (i.getPharmaceuticalBillItem().getDoe() == null || i.getPharmaceuticalBillItem().getStringValue().trim().equals("")) { return true; } @@ -878,7 +910,6 @@ public boolean checkItemBatch(List list) { } } - } return false; diff --git a/src/main/java/com/divudi/entity/BillItem.java b/src/main/java/com/divudi/entity/BillItem.java index 81f801206e..5cc747ca49 100644 --- a/src/main/java/com/divudi/entity/BillItem.java +++ b/src/main/java/com/divudi/entity/BillItem.java @@ -164,6 +164,16 @@ public class BillItem implements Serializable { private double previousRecieveQtyInUnit; @Transient private double previousRecieveFreeQtyInUnit; + @Transient + private double issuedPhamaceuticalItemQty; + + public double getIssuedPhamaceuticalItemQty() { + return issuedPhamaceuticalItemQty; + } + + public void setIssuedPhamaceuticalItemQty(double issuedPhamaceuticalItemQty) { + this.issuedPhamaceuticalItemQty = issuedPhamaceuticalItemQty; + } // @Transient // private double totalHospitalFeeValueTransient; @@ -171,7 +181,6 @@ public class BillItem implements Serializable { // private double totalDoctorFeeValueTransient; // @Transient // private double totalProcedureFeeValueTransient; - @OneToMany(mappedBy = "billItem", fetch = FetchType.EAGER, cascade = CascadeType.ALL) private List billFees = new ArrayList<>(); @OneToMany(mappedBy = "referenceBillItem", fetch = FetchType.LAZY) @@ -263,7 +272,7 @@ public void copy(BillItem billItem) { vatPlusNetValue = billItem.getVatPlusNetValue(); // referanceBillItem=billItem.getReferanceBillItem(); } - + public void copyWithoutFinancialData(BillItem billItem) { item = billItem.getItem(); sessionDate = billItem.getSessionDate(); @@ -470,7 +479,6 @@ public boolean isRefunded() { // public boolean getRefunded() { // return refunded; // } - public void setRefunded(boolean refunded) { this.refunded = refunded; } @@ -631,7 +639,7 @@ public Double getQty() { } return qty; } - + @Transient public double getQtyAbsolute() { return Math.abs(getQty()); @@ -641,8 +649,6 @@ public void setQty(Double Qty) { this.qty = Qty; } - - public double getRemainingQty() { return remainingQty; @@ -989,8 +995,6 @@ public void setPreviousRecieveFreeQtyInUnit(double previousRecieveFreeQtyInUnit) // } // } // } - - // public double getTotalHospitalFeeValueTransient() { // calculateFeeTotals(); // return totalHospitalFeeValueTransient; @@ -1005,7 +1009,6 @@ public void setPreviousRecieveFreeQtyInUnit(double previousRecieveFreeQtyInUnit) // calculateFeeTotals(); // return totalProcedureFeeValueTransient; // } - public double getOtherFee() { return otherFee; } @@ -1022,7 +1025,6 @@ public void setFeeValue(double feeValue) { this.feeValue = feeValue; } - public PatientInvestigation getPatientInvestigation() { return patientInvestigation; } @@ -1062,7 +1064,5 @@ public Department getPeformedDepartment() { public void setPeformedDepartment(Department peformedDepartment) { this.peformedDepartment = peformedDepartment; } - - } diff --git a/src/main/webapp/pharmacy/pharmacy_transfer_issue.xhtml b/src/main/webapp/pharmacy/pharmacy_transfer_issue.xhtml index e0950385e4..277b511f8d 100644 --- a/src/main/webapp/pharmacy/pharmacy_transfer_issue.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_transfer_issue.xhtml @@ -45,8 +45,12 @@ + + + + - + From f6a783cee36de3cd3de1a9c644502fa996826ebd Mon Sep 17 00:00:00 2001 From: Chinthaka Prasad Date: Sun, 29 Dec 2024 22:06:10 +0530 Subject: [PATCH 03/24] Signed-off-by: Chinthaka Prasad --- .../pharmacy/TransferIssueController.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java index dda59f315e..5b17cd7550 100644 --- a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java +++ b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java @@ -106,20 +106,20 @@ public String navigateToPharmacyIssueForRequests() { return "/pharmacy/pharmacy_transfer_issue"; } - public boolean isFullyIssued() { - for (BillItem originalItem : billItems) { - - if (originalItem.getIssuedPhamaceuticalItemQty() == originalItem.getQty()) { - if (originalItem.getPharmaceuticalBillItem().getItemBatch() == null) { - continue; - } - System.out.println(originalItem.getIssuedPhamaceuticalItemQty() + " originalItem.getIssuedPhamaceuticalItemQty " + originalItem.getQty() + " originalItem.getQty()"); - return true; - } - } - - return false; - } +// public boolean isFullyIssued() { +// for (BillItem originalItem : billItems) { +// +// if (originalItem.getIssuedPhamaceuticalItemQty() == originalItem.getQty()) { +// if (originalItem.getPharmaceuticalBillItem().getItemBatch() == null) { +// continue; +// } +// System.out.println(originalItem.getIssuedPhamaceuticalItemQty() + " originalItem.getIssuedPhamaceuticalItemQty " + originalItem.getQty() + " originalItem.getQty()"); +// return true; +// } +// } +// +// return false; +// } public boolean isFullyIssued(Bill bill) { if (bill == null || bill.getBillItems() == null || bill.getBillItems().isEmpty()) { From 9e7acf66613706670c358cd282f98615aa221ae3 Mon Sep 17 00:00:00 2001 From: Chinthaka Prasad Date: Sun, 29 Dec 2024 22:06:43 +0530 Subject: [PATCH 04/24] Signed-off-by: Chinthaka Prasad --- .../java/com/divudi/bean/pharmacy/TransferIssueController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java index 5b17cd7550..75cf6ffe24 100644 --- a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java +++ b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java @@ -129,7 +129,7 @@ public boolean isFullyIssued(Bill bill) { for (BillItem originalItem : billItems) { if (originalItem.getPharmaceuticalBillItem().getQty() > 0) { - return false; // If any item's issued quantity is less than its original quantity + return false; }else if(originalItem.getPharmaceuticalBillItem().getItemBatch() == null){ return false; } From 6426e986ddd8a568bf7f120e55708fa2dea9567a Mon Sep 17 00:00:00 2001 From: Chinthaka Prasad Date: Sun, 29 Dec 2024 22:41:02 +0530 Subject: [PATCH 05/24] fix: add validation for cant issue more than requested medicine quantity. Signed-off-by: Chinthaka Prasad --- .../java/com/divudi/bean/pharmacy/TransferIssueController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java index 75cf6ffe24..dec1455dec 100644 --- a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java +++ b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java @@ -561,7 +561,7 @@ public void settle() { } } - if (bi.getReferanceBillItem().getQty() < bi.getPharmaceuticalBillItem().getQty()) { + if (bi.getReferanceBillItem().getQty() < (bi.getPharmaceuticalBillItem().getQty()+bi.getIssuedPhamaceuticalItemQty())) { JsfUtil.addErrorMessage("Issued quantity is higher than requested quantity in " + bi.getItem().getName()); return; } From 083fed32cfc6749a1580e88f0b52ccb315c23b3e Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 10:18:42 +0530 Subject: [PATCH 06/24] Signed-off-by: SandithP2001 --- .../reports/inventoryReports/expiry_item.xhtml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index 8e4be1396b..0b64e0f983 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -261,13 +261,13 @@ - + - + - + @@ -303,13 +303,13 @@ - + - + - + From 94e2ab7dae716148a3b8dc9135abde4be816d059 Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 14:40:42 +0530 Subject: [PATCH 07/24] Signed-off-by: SandithP2001 --- src/main/webapp/reports/inventoryReports/expiry_item.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index 0b64e0f983..e9265440a4 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -279,7 +279,7 @@ - + From 79ea94fb289f9d6493e53e5a2c3cfa626edd0ae8 Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 17:40:00 +0530 Subject: [PATCH 08/24] Signed-off-by: SandithP2001 --- src/main/webapp/reports/inventoryReports/expiry_item.xhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index e9265440a4..11b418dcec 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -261,10 +261,10 @@ - + - + From 4a75dfca89c8e45d28afc690e52292f8c0b750c4 Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 17:46:10 +0530 Subject: [PATCH 09/24] Signed-off-by: SandithP2001 --- src/main/webapp/reports/inventoryReports/expiry_item.xhtml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index 11b418dcec..39df5782b5 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -340,4 +340,5 @@ + From 1fa86f0af347fa6ebb39a0518006c2566058e208 Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 19:52:39 +0530 Subject: [PATCH 10/24] Signed-off-by: SandithP2001 --- .../java/com/divudi/bean/report/PharmacyReportController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/divudi/bean/report/PharmacyReportController.java b/src/main/java/com/divudi/bean/report/PharmacyReportController.java index 33da428708..40a6c84dc1 100644 --- a/src/main/java/com/divudi/bean/report/PharmacyReportController.java +++ b/src/main/java/com/divudi/bean/report/PharmacyReportController.java @@ -2172,7 +2172,7 @@ public void processExpiryItemReport() { m.put("td", toDate); jpql = "select s" - + " from StockHistory s " + + " from Stock s " + " where s.itemBatch.dateOfExpire between :fd and :td "; if (institution != null) { jpql += " and s.institution=:ins "; @@ -2194,7 +2194,7 @@ public void processExpiryItemReport() { } jpql += " order by s.createdAt "; - stocks = facade.findByJpql(jpql, m, TemporalType.TIMESTAMP); + stocks = stockFacade.findByJpql(jpql, m, TemporalType.TIMESTAMP); } public void processLabTestWiseCountReport() { From 19e1b7aa62cf2c1c88340f7ad4ee42fe27b5c9b3 Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 19:57:38 +0530 Subject: [PATCH 11/24] Signed-off-by: SandithP2001 --- .../java/com/divudi/bean/report/PharmacyReportController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/divudi/bean/report/PharmacyReportController.java b/src/main/java/com/divudi/bean/report/PharmacyReportController.java index 40a6c84dc1..3b28bce3ea 100644 --- a/src/main/java/com/divudi/bean/report/PharmacyReportController.java +++ b/src/main/java/com/divudi/bean/report/PharmacyReportController.java @@ -2193,7 +2193,7 @@ public void processExpiryItemReport() { m.put("itm", item); } - jpql += " order by s.createdAt "; + jpql += " order by s.id "; stocks = stockFacade.findByJpql(jpql, m, TemporalType.TIMESTAMP); } From 605ac7c14be2cc0bfc709fe36d15c054d95fd47b Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 20:39:05 +0530 Subject: [PATCH 12/24] Signed-off-by: SandithP2001 --- .../bean/report/PharmacyReportController.java | 15 ++++++++++++- .../inventoryReports/expiry_item.xhtml | 22 +++++++++++-------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/divudi/bean/report/PharmacyReportController.java b/src/main/java/com/divudi/bean/report/PharmacyReportController.java index 3b28bce3ea..98f48e003a 100644 --- a/src/main/java/com/divudi/bean/report/PharmacyReportController.java +++ b/src/main/java/com/divudi/bean/report/PharmacyReportController.java @@ -99,6 +99,8 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.hl7.fhir.r5.model.Bundle; +import java.time.temporal.ChronoUnit; + /** * @@ -2196,7 +2198,18 @@ public void processExpiryItemReport() { jpql += " order by s.id "; stocks = stockFacade.findByJpql(jpql, m, TemporalType.TIMESTAMP); } - + +public long calculateDaysRemaining(Date dateOfExpire) { + if (dateOfExpire == null) { + return 0; // Default behavior for null dates + } + // Convert Date to LocalDate + LocalDate today = LocalDate.now(); + LocalDate expiryDate = dateOfExpire.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + + // Calculate the difference in days + return ChronoUnit.DAYS.between(today, expiryDate); +} public void processLabTestWiseCountReport() { String jpql = "select new com.divudi.data.TestWiseCountReport(" + "bi.item.name, " diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index 39df5782b5..07755e5999 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -255,13 +255,13 @@ rowsPerPageTemplate="5,10,15,25,50,100,500,1000"> - + - + @@ -298,10 +298,13 @@ - - - - + + + + + @@ -309,10 +312,10 @@ - + - + @@ -328,6 +331,7 @@ +
@@ -340,5 +344,5 @@ - + From 002dc087b47b6e56932222636ed19f645f06be98 Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 20:44:15 +0530 Subject: [PATCH 13/24] Signed-off-by: SandithP2001 --- .../reports/inventoryReports/expiry_item.xhtml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index 07755e5999..0ab770f3f3 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -298,13 +298,12 @@ - + - - - + + @@ -331,7 +330,7 @@ - + From 6a664d78a17378bb74ed9765d7e97a431ba9aeb8 Mon Sep 17 00:00:00 2001 From: SandithP2001 Date: Mon, 30 Dec 2024 20:46:25 +0530 Subject: [PATCH 14/24] Signed-off-by: SandithP2001 closes #9931 --- src/main/webapp/reports/inventoryReports/expiry_item.xhtml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml index 0ab770f3f3..066598e772 100644 --- a/src/main/webapp/reports/inventoryReports/expiry_item.xhtml +++ b/src/main/webapp/reports/inventoryReports/expiry_item.xhtml @@ -331,7 +331,6 @@ - From 19d530b727a2f951f2225bb0a06b3be16a146697 Mon Sep 17 00:00:00 2001 From: Pubudu-Piyankara Date: Tue, 31 Dec 2024 22:30:29 +0530 Subject: [PATCH 15/24] Signed-off-by: Pubudu-Piyankara --- .../bean/pharmacy/PharmacyController.java | 11 ++++++-- src/main/resources/META-INF/persistence.xml | 28 +++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java b/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java index 022a536bf2..907e7f50b9 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; @@ -893,10 +894,10 @@ public void generateGRNReportTable() { List bt = new ArrayList<>(); if ("detailReport".equals(reportType)) { bt.add(BillType.PharmacyGrnBill); - generateGRNReportTableByBillItem(bt); +// generateGRNReportTableByBillItem(bt); } else if ("returnReport".equals(reportType)) { bt.add(BillType.PharmacyGrnReturn); - generateGRNReportTableByBillItem(bt); +// generateGRNReportTableByBillItem(bt); } else if ("summeryReport".equals(reportType)) { bt.add(BillType.PharmacyGrnBill); bt.add(BillType.PharmacyGrnReturn); @@ -936,10 +937,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/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index 2571764f60..0651d320c3 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -1,24 +1,34 @@ - + org.eclipse.persistence.jpa.PersistenceProvider - jdbc/coopLocal + jdbc/ruhunu false - + + - - + + + + + - jdbc/ruhunuaudit + jdbc/ruhunuAudit false - - - + + + + + + + + + From 244c0f9278f6fd87219c82a97abeb7b42df47ef1 Mon Sep 17 00:00:00 2001 From: Pubudu-Piyankara Date: Tue, 31 Dec 2024 22:50:51 +0530 Subject: [PATCH 16/24] Signed-off-by: Pubudu-Piyankara closed --- .../java/com/divudi/bean/pharmacy/PharmacyController.java | 4 +--- src/main/webapp/reports/inventoryReports/grn_report.xhtml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java b/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java index 907e7f50b9..b959694cdb 100644 --- a/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java +++ b/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java @@ -885,7 +885,7 @@ public String navigateBackToGeneratedGrnDetailedRportTable() { } - public void generateGRNReportTable() { + public void generateGrnReportTable() { bills = null; totalCreditPurchaseValue = 0.0; totalCashPurchaseValue = 0.0; @@ -894,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); 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()}"> From aa78cf87fa4d06e25dc86e222cfa54f60c155be9 Mon Sep 17 00:00:00 2001 From: Geeth Sandaru Madhushan Date: Wed, 1 Jan 2025 22:20:45 +0530 Subject: [PATCH 17/24] Create rh_prod_ci_cd.yml --- .github/workflows/rh_prod_ci_cd.yml | 144 ++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 .github/workflows/rh_prod_ci_cd.yml diff --git a/.github/workflows/rh_prod_ci_cd.yml b/.github/workflows/rh_prod_ci_cd.yml new file mode 100644 index 0000000000..a146551786 --- /dev/null +++ b/.github/workflows/rh_prod_ci_cd.yml @@ -0,0 +1,144 @@ +name: RH-PROD Build & Deployment Pipeline + +on: + push: + branches: + - ruhunu-prod + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Cache Maven Packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Update JDBC Data Sources in persistence.xml + run: | + sed -i 's|${JDBC_DATASOURCE}|jdbc/ruhunu|' src/main/resources/META-INF/persistence.xml + sed -i 's|${JDBC_AUDIT_DATASOURCE}|jdbc/ruhunuAudit|' src/main/resources/META-INF/persistence.xml + + - name: Verify JDBC Data Sources in persistence.xml + run: | + grep '' src/main/resources/META-INF/persistence.xml + + - name: Build with Maven + run: mvn clean package -DskipTests + + - name: Archive Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: target/*.war + + # - name: Run Tests + # run: mvn test + + deploy: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Download Build Artifact + uses: actions/download-artifact@v3 + with: + name: build-artifacts + path: ./ + + - name: Deploy to Payara + env: + SERVER_IP: ${{ secrets.RUHUNU_PROD_SERVER_IP }} + SERVER_USER: ${{ secrets.RUHUNU_PROD_SERVER_USER }} + SSH_PRIVATE_KEY: ${{ secrets.RUHUNU_PROD_SSH_PRIVATE_KEY }} + PAYARA_ADMIN_PASS: ${{ secrets.RUHUNU_PROD_PAYARA_ADMIN_PASS }} + run: | + # Add SSH private key to the SSH agent + echo "$SSH_PRIVATE_KEY" > private_key.pem + chmod 600 private_key.pem + + # Variables + WAR_NAME="rh.war" + WAR_DIR="/home/appuser/app/latest" + APP_NAME="rh" + SUBDOMAIN="rh" + + # Ensure deployment directory exists + ssh -i private_key.pem -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP " + sudo mkdir -p $WAR_DIR + sudo chown -R appuser:appuser /home/appuser/app/latest + sudo su - appuser + cd $WAR_DIR + + # Remove old backup if it exists + if [ -f $WAR_NAME.old ]; then + rm $WAR_NAME.old + fi + + # If the current WAR file exists, back it up + if [ -f $WAR_NAME ]; then + mv $WAR_NAME $WAR_NAME.old + fi + " + + # Copy new WAR file to the server + rsync -aL --progress -e "ssh -i private_key.pem" ./*.war $SERVER_USER@$SERVER_IP:/tmp/$WAR_NAME + + # Move the file to /home/appuser/app/latest/ and set permissions + ssh -i private_key.pem -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP " + sudo mv /tmp/$WAR_NAME $WAR_DIR/ + sudo chown appuser:appuser $WAR_DIR/$WAR_NAME + " + + # Deploy the WAR using asadmin + ssh -i private_key.pem -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP " + sudo su - appuser + echo 'AS_ADMIN_PASSWORD=${{ secrets.DEV_PAYARA_ADMIN_PASS }}' > /tmp/payara-admin-pass.txt + /opt/payara5/bin/asadmin --user admin --passwordfile /tmp/payara-admin-pass.txt undeploy $APP_NAME || true + /opt/payara5/bin/asadmin --user admin --passwordfile /tmp/payara-admin-pass.txt deploy --force=true --contextroot $APP_NAME $WAR_DIR/$WAR_NAME + rm /tmp/payara-admin-pass.txt + " + + # Validate if the application is running + ssh -i private_key.pem -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP " + sudo su - appuser + echo 'AS_ADMIN_PASSWORD=${{ secrets.DEV_PAYARA_ADMIN_PASS }}' > /tmp/payara-admin-pass.txt + if /opt/payara5/bin/asadmin --user admin --passwordfile /tmp/payara-admin-pass.txt list-applications | grep -q '$APP_NAME'; then + echo 'Application is running.' + else + echo 'Application failed to start.' + fi + rm /tmp/payara-admin-pass.txt + " + + # Check if the application is reachable + for i in {1..5}; do + RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://$SUBDOMAIN.carecode.org/$APP_NAME/faces/index1.xhtml) + if [ "$RESPONSE_CODE" == "200" ]; then + echo "Application is reachable and healthy." + break + elif [ "$i" == "5" ]; then + echo "Application is not reachable or unhealthy at https://$SUBDOMAIN.carecode.org/$APP_NAME (HTTP $RESPONSE_CODE)" + break + fi + sleep 10 + done + + # Cleanup + rm -f private_key.pem From 50c2858967c5c0da269eec11ad034072e045a6af Mon Sep 17 00:00:00 2001 From: "Dr. M H B Ariyaratne" Date: Mon, 6 Jan 2025 11:34:26 +0530 Subject: [PATCH 18/24] Pharmacy retail sale bill error (#9944) * Create build.yml * Create deploy.yml * Update build.yml * Update deploy.yml * Delete .github/workflows/deploy.yml * Update and rename build.yml to manual_deployment.yml * Delete .github/workflows/manual_deployment.yml * Create dev_dispatch.yml * Delete .github/workflows/dev_dispatch.yml * Create custom_deployment.yml * Update custom_deployment.yml * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Issue #9942 Signed-off-by: Lawan Samarasekara * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne --------- Signed-off-by: Dr M H B Ariyaratne Signed-off-by: Lawan Samarasekara Co-authored-by: Geeth Sandaru Madhushan Co-authored-by: Lawan Samarasekara --- .../bean/pharmacy/PharmacySaleController.java | 4 - .../resources/META-INF/persistence_pro.xml | 25 ++ .../inward/pharmacy_bill_issue_bht.xhtml | 51 +-- .../pharmacy/pharmacy_reprint_bill_sale.xhtml | 5 +- ...d_direct_issue_bill_five_five_custom_3.css | 167 ++++++++ src/main/webapp/resources/css/pharmacypos.css | 2 +- .../css/sale_bill_five_five_custom_3.css | 89 ++-- ...direct_issue_bill_five_five_custom_3.xhtml | 217 ++++++++++ .../sale_bill_five_five_custom_3.xhtml | 398 +++++++----------- 9 files changed, 647 insertions(+), 311 deletions(-) create mode 100644 src/main/resources/META-INF/persistence_pro.xml create mode 100644 src/main/webapp/resources/css/inward_direct_issue_bill_five_five_custom_3.css create mode 100644 src/main/webapp/resources/pharmacy/inward_direct_issue_bill_five_five_custom_3.xhtml diff --git a/src/main/java/com/divudi/bean/pharmacy/PharmacySaleController.java b/src/main/java/com/divudi/bean/pharmacy/PharmacySaleController.java index 6a36dab3d8..5d31ac906c 100644 --- a/src/main/java/com/divudi/bean/pharmacy/PharmacySaleController.java +++ b/src/main/java/com/divudi/bean/pharmacy/PharmacySaleController.java @@ -2069,10 +2069,6 @@ public List createMultiplePayments(Bill bill, PaymentMethod pm) { } public void settleBillWithPay() { - Date startTime = new Date(); - Date fromDate = null; - Date toDate = null; - editingQty = null; if (sessionController.getApplicationPreference().isCheckPaymentSchemeValidation()) { diff --git a/src/main/resources/META-INF/persistence_pro.xml b/src/main/resources/META-INF/persistence_pro.xml new file mode 100644 index 0000000000..d0db19cf78 --- /dev/null +++ b/src/main/resources/META-INF/persistence_pro.xml @@ -0,0 +1,25 @@ + + + + org.eclipse.persistence.jpa.PersistenceProvider + ${JDBC_DATASOURCE} + false + + + + + + + + + + + ${JDBC_AUDIT_DATASOURCE} + false + + + + + + + diff --git a/src/main/webapp/inward/pharmacy_bill_issue_bht.xhtml b/src/main/webapp/inward/pharmacy_bill_issue_bht.xhtml index 131c8b1360..8e78a97a51 100644 --- a/src/main/webapp/inward/pharmacy_bill_issue_bht.xhtml +++ b/src/main/webapp/inward/pharmacy_bill_issue_bht.xhtml @@ -159,9 +159,9 @@ > -   +   @@ -226,9 +226,9 @@ -   +   @@ -372,35 +372,8 @@ - - - - - -
- - - -
+
@@ -411,16 +384,16 @@
- + - +
- +
@@ -429,6 +402,10 @@
+ + + + diff --git a/src/main/webapp/pharmacy/pharmacy_reprint_bill_sale.xhtml b/src/main/webapp/pharmacy/pharmacy_reprint_bill_sale.xhtml index b3233a99b8..0b16ec7821 100644 --- a/src/main/webapp/pharmacy/pharmacy_reprint_bill_sale.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_reprint_bill_sale.xhtml @@ -85,7 +85,10 @@ - + + + + diff --git a/src/main/webapp/resources/css/inward_direct_issue_bill_five_five_custom_3.css b/src/main/webapp/resources/css/inward_direct_issue_bill_five_five_custom_3.css new file mode 100644 index 0000000000..26b6e03e71 --- /dev/null +++ b/src/main/webapp/resources/css/inward_direct_issue_bill_five_five_custom_3.css @@ -0,0 +1,167 @@ +/* General Container */ +.receipt-container { + font-family: "Courier New", "Liberation Mono", monospace; + font-size: 12px; + line-height: 1.2; + width: 11cm; + height: 14cm; + margin: auto; + padding: 2px; + box-sizing: border-box; + border: 1px solid #000; +} + +/* Header */ +.hospital-name { + font-family: sans-serif !important; + text-align: center!important; + font-weight: normal!important; + font-size: 16px!important; /* Larger font for hospital name */ + text-transform: uppercase!important; +} + +.hospital-details { + text-align: center; + font-size: 12px; + font-family: sans-serif !important; + line-height: 1.2; +} + +/* Line Separator */ +.separator { + border-top: 1px solid #000; + margin: 2px 0; +} + +/* Patient and Bill Info Table */ +.info-table { + width: 100%; + border-collapse: collapse; + margin-bottom: 2px; +} + +.info-table td { + font-size: 12px; + padding: 5px; +} + +.info-table .label { + font-weight: normal!important; + text-align: left; +} + +.info-table .value { + text-align: left; +} + +.info-table .spacer { + width: 10px; /* Adds space between the two columns */ +} + +/* Item Table */ +.receipt-table { + width: 100%; + border-collapse: collapse; + font-size: 12px; + margin-bottom: 2px; +} + +.receipt-table th, +.receipt-table td { + text-align: left; + padding: 2px; + font-family: sans-serif !important; + line-height: 1.2; + /* border-bottom: 1px solid #000;*/ +} + +.receipt-table th { + font-weight: normal!important; + text-transform: uppercase; + font-family: sans-serif !important; + line-height: 1.2; +} + +/* Total Section Table */ +.total-table { + width: 100%; + border-collapse: collapse; + margin-top: 2px; + font-size: 15px; + font-family: sans-serif !important; + line-height: 1.2; +} + +.total-table td { + padding: 2px; + font-family: sans-serif !important; + line-height: 1.2; +} + +.total-table .label { + font-weight: normal!important; + text-align: left; + font-family: sans-serif !important; + line-height: 1.2; +} + +.total-table .value { + text-align: right; + font-weight: normal!important; + font-family: sans-serif !important; + line-height: 1.2; +} + +/* Footer */ +.receipt-footer { + text-align: center; + font-size: 12px; + margin-top: 20px; + font-style: italic; + font-family: sans-serif !important; + line-height: 1.2; +} + +/* Print Styles */ +@media print { + .receipt-container { + border: none; + width: 10cm!important; + height: 9.5cm!important; + margin-left: 0cm!important; + margin-right: 2.5cm!important; + margin-bottom: 1.0cm!important; + margin-top: 2.5cm!important; + font-family: sans-serif !important; + padding-left: 0.25cm; + /* font-family: sans-serif !important; + border: none; + width: 11cm!important; + height: 14cm!important; + margin-left: 0cm!important; + margin-right: 1.5cm!important; + margin-top: 1cm!important; + margin-bottom: 0cm!important; + padding: 2px!important; + line-height: 1.2!important;*/ + } + + .hospital-name { + font-size: 12px; + font-family: sans-serif !important; + line-height: 1.2; + } + + .receipt-table th, + .receipt-table td { + padding: 2px; + font-family: sans-serif !important; + line-height: 1.2; + } + + .separator { + margin: 2px; + font-family: sans-serif !important; + line-height: 1.2; + } +} diff --git a/src/main/webapp/resources/css/pharmacypos.css b/src/main/webapp/resources/css/pharmacypos.css index 026da17d95..1f8af9695b 100644 --- a/src/main/webapp/resources/css/pharmacypos.css +++ b/src/main/webapp/resources/css/pharmacypos.css @@ -133,7 +133,7 @@ position: sticky; top:11.5cm!important; width: 90%; - font-size: 12px; + font-size: 11px!important; color: black; } diff --git a/src/main/webapp/resources/css/sale_bill_five_five_custom_3.css b/src/main/webapp/resources/css/sale_bill_five_five_custom_3.css index 83092fe0a5..26b6e03e71 100644 --- a/src/main/webapp/resources/css/sale_bill_five_five_custom_3.css +++ b/src/main/webapp/resources/css/sale_bill_five_five_custom_3.css @@ -2,39 +2,42 @@ .receipt-container { font-family: "Courier New", "Liberation Mono", monospace; font-size: 12px; - line-height: 1.4; - width: 12cm; + line-height: 1.2; + width: 11cm; height: 14cm; margin: auto; - padding: 10px; + padding: 2px; box-sizing: border-box; border: 1px solid #000; } /* Header */ .hospital-name { - text-align: center; - font-weight: bold; - font-size: 16px; /* Larger font for hospital name */ - text-transform: uppercase; + font-family: sans-serif !important; + text-align: center!important; + font-weight: normal!important; + font-size: 16px!important; /* Larger font for hospital name */ + text-transform: uppercase!important; } .hospital-details { text-align: center; - font-size: 12px; /* Smaller font for address, phone, and email */ + font-size: 12px; + font-family: sans-serif !important; + line-height: 1.2; } /* Line Separator */ .separator { border-top: 1px solid #000; - margin: 10px 0; + margin: 2px 0; } /* Patient and Bill Info Table */ .info-table { width: 100%; border-collapse: collapse; - margin-bottom: 10px; + margin-bottom: 2px; } .info-table td { @@ -43,7 +46,7 @@ } .info-table .label { - font-weight: bold; + font-weight: normal!important; text-align: left; } @@ -60,41 +63,53 @@ width: 100%; border-collapse: collapse; font-size: 12px; - margin-bottom: 10px; + margin-bottom: 2px; } .receipt-table th, .receipt-table td { text-align: left; - padding: 5px; - border-bottom: 1px solid #000; + padding: 2px; + font-family: sans-serif !important; + line-height: 1.2; + /* border-bottom: 1px solid #000;*/ } .receipt-table th { - font-weight: bold; + font-weight: normal!important; text-transform: uppercase; + font-family: sans-serif !important; + line-height: 1.2; } /* Total Section Table */ .total-table { width: 100%; border-collapse: collapse; - margin-top: 10px; - font-size: 12px; + margin-top: 2px; + font-size: 15px; + font-family: sans-serif !important; + line-height: 1.2; } .total-table td { - padding: 5px; + padding: 2px; + font-family: sans-serif !important; + line-height: 1.2; } .total-table .label { - font-weight: bold; + font-weight: normal!important; text-align: left; + font-family: sans-serif !important; + line-height: 1.2; } .total-table .value { text-align: right; - font-weight: bold; + font-weight: normal!important; + font-family: sans-serif !important; + line-height: 1.2; } /* Footer */ @@ -103,26 +118,50 @@ font-size: 12px; margin-top: 20px; font-style: italic; + font-family: sans-serif !important; + line-height: 1.2; } /* Print Styles */ @media print { .receipt-container { border: none; - width: 12cm; - height: 14cm; + width: 10cm!important; + height: 9.5cm!important; + margin-left: 0cm!important; + margin-right: 2.5cm!important; + margin-bottom: 1.0cm!important; + margin-top: 2.5cm!important; + font-family: sans-serif !important; + padding-left: 0.25cm; + /* font-family: sans-serif !important; + border: none; + width: 11cm!important; + height: 14cm!important; + margin-left: 0cm!important; + margin-right: 1.5cm!important; + margin-top: 1cm!important; + margin-bottom: 0cm!important; + padding: 2px!important; + line-height: 1.2!important;*/ } .hospital-name { - font-size: 14px; + font-size: 12px; + font-family: sans-serif !important; + line-height: 1.2; } .receipt-table th, .receipt-table td { - border-bottom: 1px solid #000; + padding: 2px; + font-family: sans-serif !important; + line-height: 1.2; } .separator { - margin: 5px 0; + margin: 2px; + font-family: sans-serif !important; + line-height: 1.2; } } diff --git a/src/main/webapp/resources/pharmacy/inward_direct_issue_bill_five_five_custom_3.xhtml b/src/main/webapp/resources/pharmacy/inward_direct_issue_bill_five_five_custom_3.xhtml new file mode 100644 index 0000000000..20c4c4ba48 --- /dev/null +++ b/src/main/webapp/resources/pharmacy/inward_direct_issue_bill_five_five_custom_3.xhtml @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Patient Name: + + Patient Age/Sex: + +
BHT: + + Room No: + +
Bill Date: + + + + Bill Time: + + + +
Bill No:#{cc.attrs.bill.deptId}Department:Pharmacy
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
NoItem NameRateQtyValue
#{s.index +1} #{item.item.name} + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Total: + + + +
Discount: + + + +
Net Total: + + + +
No of Items: + + + +
+ + + + + + + +
+ + +
+
+ + +
+
+
+ +
+ + + + + + + + +
+ + + +
+ + + +
+ +
+ \ No newline at end of file diff --git a/src/main/webapp/resources/pharmacy/sale_bill_five_five_custom_3.xhtml b/src/main/webapp/resources/pharmacy/sale_bill_five_five_custom_3.xhtml index 5d275895da..b4d4679c98 100644 --- a/src/main/webapp/resources/pharmacy/sale_bill_five_five_custom_3.xhtml +++ b/src/main/webapp/resources/pharmacy/sale_bill_five_five_custom_3.xhtml @@ -7,123 +7,107 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"> - - - - - - - - - - - - - -
-
- - - -
- -
- -
-
- -
-
- -
-
- - -
+ + + + + + + + + + + + + + + + + + +
+ +
+ + +
-
-
- -
-
- -
-
- - - - - - -
-
+ +
- -
-
- -
-
- -
-
- -
-
-
- - -
-
- -
-
- -
-
- -
-
-
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Patient Name: + + Patient Age/Sex: + +
Bill Date: + + + + Bill Time: + + + +
Bill No:#{cc.attrs.bill.deptId}Department:Pharmacy
+ +
-
- - - - - - - - - + +
+ - - - - - + + + + + - - - - - - + + + + + + - - @@ -131,162 +115,90 @@
NOPARTICULARQTYRATEAMOUNTNoItem NameRateQtyValue
#{status.index + 1}#{bip.item.name} - - +
#{s.index +1} #{item.item.name} + + - - + + + - + +
-
- -
-
-
- -
-
- - - - - - - - - - - - -
- - - - - -
- -
- -
-
-
- - - -
- - - -
-
-
-
- - -
- + +
+ + +
+ + + + + + - - - + - - - - - - - - - - - - + -
Total: + + + +
- - - - - + Discount: +
- - - - - - - -
- - - - + Net Total:
-
-
+ - + +
+
+ + + + + + + + + + + + + + + + + + + +
- - - - - - -
- - - - - -
+ -
- + \ No newline at end of file From 82b907a26715c96f31a47fe20c5a4c6076b6cc9a Mon Sep 17 00:00:00 2001 From: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:36:08 +0530 Subject: [PATCH 19/24] 9836 pharmacy disbursement and suplier isses (#9946) * Signed-off-by: Chinthaka Prasad * Signed-off-by: Chinthaka Prasad * Signed-off-by: Chinthaka Prasad --- .../java/com/divudi/bean/pharmacy/SaleReturnController.java | 1 + src/main/webapp/WEB-INF/glassfish-web.xml | 2 +- .../pharmacy_search_pre_bill_for_return_item_and_cash.xhtml | 2 +- .../pharmacy_search_pre_bill_for_return_item_only.xhtml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/SaleReturnController.java b/src/main/java/com/divudi/bean/pharmacy/SaleReturnController.java index 7f4aec76e3..6d42892e1d 100644 --- a/src/main/java/com/divudi/bean/pharmacy/SaleReturnController.java +++ b/src/main/java/com/divudi/bean/pharmacy/SaleReturnController.java @@ -168,6 +168,7 @@ private void savePreReturnBill() { getReturnBill().copy(getBill()); getReturnBill().setBillType(BillType.PharmacyPre); + //getReturnBill().setBillTypeAtomic(BillTypeAtomic.PHARMACY_RETAIL_SALE_RETURN_ITEMS_AND_PAYMENTS); getReturnBill().setBilledBill(getBill()); diff --git a/src/main/webapp/WEB-INF/glassfish-web.xml b/src/main/webapp/WEB-INF/glassfish-web.xml index 8947aba09c..157dde8610 100644 --- a/src/main/webapp/WEB-INF/glassfish-web.xml +++ b/src/main/webapp/WEB-INF/glassfish-web.xml @@ -1,7 +1,7 @@ - /coop + /rh diff --git a/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_and_cash.xhtml b/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_and_cash.xhtml index 2c96160c47..f7442c0f88 100644 --- a/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_and_cash.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_and_cash.xhtml @@ -125,7 +125,7 @@ ajax="false" class="mx-2" value="Return Item and Cash" - action="pharmacy_bill_return_retail" + action="pharmacy_bill_return_retail?faces-redirect=true" disabled="#{bill.cancelled eq true}"> diff --git a/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_only.xhtml b/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_only.xhtml index 2676c25444..22bbb05d7a 100644 --- a/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_only.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_search_pre_bill_for_return_item_only.xhtml @@ -108,7 +108,7 @@ From d0914002f3cfeeae135fa44950f59945a8405c7e Mon Sep 17 00:00:00 2001 From: Pubudu Piyankara <139697238+Pubudu-Piyankara@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:40:32 +0530 Subject: [PATCH 20/24] Issue#9949 disbursement issue receive bill improvements (#9950) * Signed-off-by: Chinthaka Prasad * Signed-off-by: Chinthaka Prasad * Signed-off-by: Pubudu-Piyankara * Signed-off-by: Chinthaka Prasad * Signed-off-by: Pubudu-Piyankara --------- Co-authored-by: Chinthaka Prasad Co-authored-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com> --- .../bean/pharmacy/PharmacyController.java | 44 +++++++------------ .../pharmacy/TransferIssueController.java | 10 +++-- .../pharmacy/TransferReceiveController.java | 2 + .../stock_transfer_report.xhtml | 29 ++++++++++++ 4 files changed, 54 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java b/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java index 701af25dc0..d0dba578c2 100644 --- a/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java +++ b/src/main/java/com/divudi/bean/pharmacy/PharmacyController.java @@ -848,33 +848,34 @@ public void generateGRNReportTableByBillItem(List bt) { } public String navigateToPrinteGeneratedGrnDetailedRportTable() { - if(bills==null){ + if (bills == null) { JsfUtil.addErrorMessage("No Bills"); return null; } - if(bills.isEmpty()){ + if (bills.isEmpty()) { JsfUtil.addErrorMessage("Bill List Empty"); return null; } - for(Bill b:bills){ - if(b.getBillItems()==null || b.getBillItems().isEmpty()){ - b.setBillItems(billService.fetchBillItems(b)); + for (Bill b : bills) { + if (b.getBillItems() == null || b.getBillItems().isEmpty()) { + b.setBillItems(billService.fetchBillItems(b)); } } return "/reports/inventoryReports/grn_report_detail_print?faces-redirect=true"; } + public String navigateToPrinteGeneratedGrnReturnReportTable() { - if(bills==null){ + if (bills == null) { JsfUtil.addErrorMessage("No Bills"); return null; } - if(bills.isEmpty()){ + if (bills.isEmpty()) { JsfUtil.addErrorMessage("Bill List Empty"); return null; } - for(Bill b:bills){ - if(b.getBillItems()==null || b.getBillItems().isEmpty()){ - b.setBillItems(billService.fetchBillItems(b)); + for (Bill b : bills) { + if (b.getBillItems() == null || b.getBillItems().isEmpty()) { + b.setBillItems(billService.fetchBillItems(b)); } } return "/reports/inventoryReports/grn_report_return_print?faces-redirect=true"; @@ -882,9 +883,8 @@ public String navigateToPrinteGeneratedGrnReturnReportTable() { public String navigateBackToGeneratedGrnDetailedRportTable() { return "/reports/inventoryReports/grn_report?faces-redirect=true"; - } - - + } + public void generateGrnReportTable() { bills = null; totalCreditPurchaseValue = 0.0; @@ -986,8 +986,8 @@ private void resetFields() { } public void generateConsumptionReportTableByBill(BillType billType) { - List bt = new ArrayList<>(); - bt.add(BillType.PharmacyIssue); +// List bt = new ArrayList<>(); +// bt.add(BillType.PharmacyIssue); bills = new ArrayList<>(); String sql = "SELECT b FROM Bill b WHERE b.retired = false" @@ -1094,7 +1094,6 @@ public void generateConsumptionReportTableByBillItems(BillType billType) { } } - @Deprecated public void generateConsumptionReportTableAsSummary(BillType billType) { // Initialize bill types List bt = new ArrayList<>(); @@ -1491,6 +1490,7 @@ public List calculateTotalsForBillItems(List billItemLi } public void createStockTransferReport() { + resetFields(); BillType bt; if ("issue".equals(transferType)) { @@ -1500,24 +1500,12 @@ public void createStockTransferReport() { } if ("summeryReport".equals(reportType)) { - - bills = null; - departmentSummaries = null; - issueDepartmentCategoryWiseItems = null; generateConsumptionReportTableAsSummary(bt); } else if ("detailReport".equals(reportType)) { - - billItems = null; - departmentSummaries = null; - issueDepartmentCategoryWiseItems = null; generateConsumptionReportTableByBillItems(bt); } else if ("byBill".equals(reportType)) { - - bills = null; - billItems = null; - issueDepartmentCategoryWiseItems = null; generateConsumptionReportTableByBill(bt); } diff --git a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java index dec1455dec..39be24681a 100644 --- a/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java +++ b/src/main/java/com/divudi/bean/pharmacy/TransferIssueController.java @@ -635,9 +635,13 @@ public void settle() { } getIssuedBill().setInstitution(getSessionController().getInstitution()); - getIssuedBill().setDepartment(getIssuedBill().getFromDepartment()); -// - getIssuedBill().setToInstitution(getIssuedBill().getToDepartment().getInstitution()); + getIssuedBill().setDepartment(getSessionController().getDepartment()); + + getIssuedBill().setFromInstitution(getSessionController().getInstitution()); + getIssuedBill().setFromDepartment(getSessionController().getDepartment()); + + getIssuedBill().setToInstitution(getRequestedBill().getFromInstitution()); + getIssuedBill().setToDepartment(getRequestedBill().getFromDepartment()); getIssuedBill().setCreater(getSessionController().getLoggedUser()); getIssuedBill().setCreatedAt(Calendar.getInstance().getTime()); diff --git a/src/main/java/com/divudi/bean/pharmacy/TransferReceiveController.java b/src/main/java/com/divudi/bean/pharmacy/TransferReceiveController.java index efb7b18e2c..51d390de96 100644 --- a/src/main/java/com/divudi/bean/pharmacy/TransferReceiveController.java +++ b/src/main/java/com/divudi/bean/pharmacy/TransferReceiveController.java @@ -511,6 +511,8 @@ public void saveBill() { getReceivedBill().setFromStaff(getIssuedBill().getToStaff()); getReceivedBill().setFromInstitution(getIssuedBill().getInstitution()); getReceivedBill().setFromDepartment(getIssuedBill().getDepartment()); + getReceivedBill().setToInstitution(sessionController.getInstitution()); + getReceivedBill().setToDepartment(sessionController.getDepartment()); if (getReceivedBill().getId() == null) { getBillFacade().create(getReceivedBill()); diff --git a/src/main/webapp/reports/inventoryReports/stock_transfer_report.xhtml b/src/main/webapp/reports/inventoryReports/stock_transfer_report.xhtml index 5e69e6679b..1d13073e4e 100644 --- a/src/main/webapp/reports/inventoryReports/stock_transfer_report.xhtml +++ b/src/main/webapp/reports/inventoryReports/stock_transfer_report.xhtml @@ -336,6 +336,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From dcfb2ee708c1b5dd6b61c267894f069d2b58279e Mon Sep 17 00:00:00 2001 From: Imesh Ranawella Date: Mon, 6 Jan 2025 12:45:34 +0530 Subject: [PATCH 21/24] Issue#9822 discount report (#9954) * added batch cancel and refund * changed column width --------- Co-authored-by: imexh --- .../divudi/bean/common/ReportsController.java | 18 ++++++++++++------ .../reports/financialReports/discount.xhtml | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/divudi/bean/common/ReportsController.java b/src/main/java/com/divudi/bean/common/ReportsController.java index e2d1e58747..ad77e1ca7f 100644 --- a/src/main/java/com/divudi/bean/common/ReportsController.java +++ b/src/main/java/com/divudi/bean/common/ReportsController.java @@ -3686,16 +3686,22 @@ public void generateDiscountReport() { opdBts.add(BillTypeAtomic.INWARD_SERVICE_BILL_CANCELLATION); opdBts.add(BillTypeAtomic.INWARD_FINAL_BILL); } else if (visitType.equalsIgnoreCase("OP")) { - opdBts.add(BillTypeAtomic.OPD_BILL_WITH_PAYMENT); - opdBts.add(BillTypeAtomic.OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); - opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_WITH_PAYMENT); - opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_PAYMENT_COLLECTION_AT_CASHIER); + opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_WITH_PAYMENT); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_WITH_PAYMENT); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); - opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_CANCELLATION); - opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_CANCELLATION); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_CANCELLATION); + opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_REFUND); + + opdBts.add(BillTypeAtomic.OPD_BILL_WITH_PAYMENT); + opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION); + opdBts.add(BillTypeAtomic.OPD_BILL_REFUND); + + opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_WITH_PAYMENT); + opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_CANCELLATION); + + opdBts.add(BillTypeAtomic.OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); + opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_PAYMENT_COLLECTION_AT_CASHIER); } if (reportType.equalsIgnoreCase("detail")) { diff --git a/src/main/webapp/reports/financialReports/discount.xhtml b/src/main/webapp/reports/financialReports/discount.xhtml index ddf8ebaf30..564112da16 100644 --- a/src/main/webapp/reports/financialReports/discount.xhtml +++ b/src/main/webapp/reports/financialReports/discount.xhtml @@ -347,7 +347,7 @@ - + @@ -417,7 +417,7 @@ - + Date: Mon, 6 Jan 2025 12:46:05 +0530 Subject: [PATCH 22/24] OPD Weekly Report #9886 (#9955) * added opd and cc bills * fixed null pointer exception bug * fixed filter bug --------- Co-authored-by: imexh --- .../divudi/bean/common/ReportsController.java | 74 ++++++++++++------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/divudi/bean/common/ReportsController.java b/src/main/java/com/divudi/bean/common/ReportsController.java index ad77e1ca7f..908680f124 100644 --- a/src/main/java/com/divudi/bean/common/ReportsController.java +++ b/src/main/java/com/divudi/bean/common/ReportsController.java @@ -1834,17 +1834,31 @@ public void generateOPDWeeklyReport() { List opdBts = new ArrayList<>(); - opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_WITH_PAYMENT); - opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_WITH_PAYMENT); - opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); - opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_CANCELLATION); - opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_CANCELLATION); + if (visitType == null || visitType.equalsIgnoreCase("OP")) { + opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_WITH_PAYMENT); + opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_WITH_PAYMENT); + opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); + opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_CANCELLATION); + opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_CANCELLATION); + opdBts.add(BillTypeAtomic.OPD_BILL_WITH_PAYMENT); + opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_WITH_PAYMENT); + opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION); + opdBts.add(BillTypeAtomic.OPD_BILL_REFUND); + } - opdBts.add(BillTypeAtomic.INWARD_SERVICE_BATCH_BILL); - opdBts.add(BillTypeAtomic.INWARD_SERVICE_BILL); - opdBts.add(BillTypeAtomic.INWARD_SERVICE_BATCH_BILL_CANCELLATION); - opdBts.add(BillTypeAtomic.INWARD_SERVICE_BILL_CANCELLATION); - opdBts.add(BillTypeAtomic.INWARD_FINAL_BILL); + if (visitType == null || visitType.equalsIgnoreCase("IP")) { + opdBts.add(BillTypeAtomic.INWARD_SERVICE_BATCH_BILL); + opdBts.add(BillTypeAtomic.INWARD_SERVICE_BILL); + opdBts.add(BillTypeAtomic.INWARD_SERVICE_BATCH_BILL_CANCELLATION); + opdBts.add(BillTypeAtomic.INWARD_SERVICE_BILL_CANCELLATION); + opdBts.add(BillTypeAtomic.INWARD_FINAL_BILL); + } + + if (visitType == null) { + opdBts.add(BillTypeAtomic.CC_BILL); + opdBts.add(BillTypeAtomic.CC_BILL_REFUND); + opdBts.add(BillTypeAtomic.CC_BILL_CANCELLATION); + } System.out.println("bill items"); @@ -1871,7 +1885,7 @@ private void groupBillItemsDaily() { final Date billItemDate = billItem.getBill().getCreatedAt(); - if (billItemDate == null) { + if (billItemDate == null || billItem.getItem() == null) { continue; } @@ -1887,7 +1901,8 @@ private void groupBillItemsDaily() { Map> billItemMap = weeklyBillItemMap7to7.containsKey(weekOfMonth) ? weeklyBillItemMap7to7.get(weekOfMonth) : new HashMap<>(); billItemMap.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0); + .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null ? + billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); weeklyBillItemMap7to7.put(weekOfMonth, billItemMap); } else if (hourOfDay < 13) { @@ -1895,7 +1910,8 @@ private void groupBillItemsDaily() { Map> billItemMap = weeklyBillItemMap7to1.containsKey(weekOfMonth) ? weeklyBillItemMap7to1.get(weekOfMonth) : new HashMap<>(); billItemMap.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0); + .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null ? + billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); weeklyBillItemMap7to1.put(weekOfMonth, billItemMap); } else { @@ -1903,7 +1919,8 @@ private void groupBillItemsDaily() { Map> billItemMap = weeklyBillItemMap1to7.containsKey(weekOfMonth) ? weeklyBillItemMap1to7.get(weekOfMonth) : new HashMap<>(); billItemMap.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0); + .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null ? + billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); weeklyBillItemMap1to7.put(weekOfMonth, billItemMap); } @@ -1979,7 +1996,7 @@ private void groupBillItemsWeekly() { final Date billItemDate = billItem.getBill().getCreatedAt(); - if (billItemDate == null) { + if (billItemDate == null || billItem.getItem() == null) { continue; } @@ -1992,15 +2009,18 @@ private void groupBillItemsWeekly() { if (hourOfDay >= 19 || hourOfDay < 7) { // Between 7 PM to 7 AM billItemMap7to7.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(weekOfMonth, billItemMap7to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0); + .put(weekOfMonth, billItemMap7to7.get(billItem.getItem().getName()) != null ? + billItemMap7to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); } else if (hourOfDay < 13) { // Between 7 AM to 1 PM billItemMap7to1.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(weekOfMonth, billItemMap7to1.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0); + .put(weekOfMonth, billItemMap7to1.get(billItem.getItem().getName()) != null ? + billItemMap7to1.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); } else { // Between 1 PM to 7 PM billItemMap1to7.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(weekOfMonth, billItemMap1to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0); + .put(weekOfMonth, billItemMap1to7.get(billItem.getItem().getName()) != null ? + billItemMap1to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); } } @@ -2069,12 +2089,12 @@ private ReportTemplateRowBundle generateWeeklyBillItems(List bts jpql += "AND bill.billTypeAtomic in :bts "; parameters.put("bts", bts); - if (visitType != null) { - if (visitType.equalsIgnoreCase("IP") || visitType.equalsIgnoreCase("OP")) { - jpql += "AND bill.ipOpOrCc = :type "; - parameters.put("type", visitType); - } - } +// if (visitType != null) { +// if (visitType.equalsIgnoreCase("IP") || visitType.equalsIgnoreCase("OP")) { +// jpql += "AND bill.ipOpOrCc = :type "; +// parameters.put("type", visitType); +// } +// } if (getSearchKeyword().getItemName() != null && !getSearchKeyword().getItemName().trim().isEmpty()) { jpql += "AND ((bill.billPackege.name) like :itemName ) "; @@ -3466,13 +3486,13 @@ private void groupBills() { Bill bill1 = row.getBill(); if (reportType != null && reportType.equalsIgnoreCase("paid")) { - if ((bill1.getNetTotal()-bill1.getPaidAmount()) != 0) { + if ((bill1.getNetTotal() - bill1.getPaidAmount()) != 0) { continue; } } if (reportType != null && reportType.equalsIgnoreCase("due")) { - if ((bill1.getNetTotal()-bill1.getPaidAmount()) == 0) { + if ((bill1.getNetTotal() - bill1.getPaidAmount()) == 0) { continue; } } @@ -3632,7 +3652,7 @@ public Double calculateSponsorShareNetTotal() { return sponsorShareNetTotal; } - + public Double calculateNetAmountSubTotalByBills(List bills) { Double netTotal = 0.0; From 282356165809d2754e50cec2512fa35b5b5c7a52 Mon Sep 17 00:00:00 2001 From: "Dr. M H B Ariyaratne" Date: Mon, 6 Jan 2025 12:48:36 +0530 Subject: [PATCH 23/24] #9960 pharmacy retail sale not available even after starting a new shift (#9961) * Signed-off-by: Buddhika * Signed-off-by: Chinthaka Prasad * Signed-off-by: Chinthaka Prasad * Signed-off-by: Pubudu-Piyankara * Create build.yml * Create deploy.yml * Update build.yml * Update deploy.yml * Delete .github/workflows/deploy.yml * Update and rename build.yml to manual_deployment.yml * Delete .github/workflows/manual_deployment.yml * Create dev_dispatch.yml * Delete .github/workflows/dev_dispatch.yml * Create custom_deployment.yml * Update custom_deployment.yml * Signed-off-by: Chinthaka Prasad * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Issue #9942 Signed-off-by: Lawan Samarasekara * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Buddhika * Signed-off-by: Buddhika * added opd and cc bills * added batch cancel and refund * Signed-off-by: Pubudu-Piyankara * Signed-off-by: Chinthaka Prasad * Signed-off-by: Chinthaka Prasad * Update PharmacyCalculation.java testing commit * changed column width * Signed-off-by: Isuru Ranaweera * fixed null pointer exception bug * Signed-off-by: Isuru Ranaweera * fixed filter bug * Create rh_prod_ci_cd.yml * Signed-off-by: Isuru Ranaweera * Closes #9960 Pharmacy_Retail_Sale_NOT_available_even_after_starting_a_new_Shift Signed-off-by: Buddhika Ariyaratne * Signed-off-by: Buddhika Ariyaratne --------- Signed-off-by: Buddhika Signed-off-by: IsuruUdaraRanaweera Signed-off-by: Dr M H B Ariyaratne Signed-off-by: Lawan Samarasekara Signed-off-by: Isuru Ranaweera Signed-off-by: Buddhika Ariyaratne Co-authored-by: IsuruUdaraRanaweera Co-authored-by: Chinthaka Prasad Co-authored-by: Pubudu-Piyankara Co-authored-by: Geeth Sandaru Madhushan Co-authored-by: Lawan Samarasekara Co-authored-by: imexh Co-authored-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com> --- .github/workflows/custom_deployment.yml | 2 +- .../divudi/bean/common/ReportsController.java | 88 +++++++++++++++---- src/main/java/com/divudi/entity/BillItem.java | 8 ++ src/main/java/com/divudi/entity/Patient.java | 3 +- src/main/java/com/divudi/entity/Person.java | 11 ++- .../pharmacy/PharmaceuticalBillItem.java | 57 +----------- .../com/divudi/ws/channel/ChannelApi.java | 5 ++ .../META-INF/persistence_for_production.xml | 18 ++-- .../pharmacy_purhcase_order_approving.xhtml | 53 ++++++----- .../opd_and_inward_due_report.xhtml | 58 +++++++++++- 10 files changed, 191 insertions(+), 112 deletions(-) diff --git a/.github/workflows/custom_deployment.yml b/.github/workflows/custom_deployment.yml index 39bc8b4244..50aadfe1b2 100644 --- a/.github/workflows/custom_deployment.yml +++ b/.github/workflows/custom_deployment.yml @@ -13,7 +13,7 @@ on: - warning - debug tags: - description: 'Tags for the workflow' + description: 'Tags of the workflow' required: true type: string diff --git a/src/main/java/com/divudi/bean/common/ReportsController.java b/src/main/java/com/divudi/bean/common/ReportsController.java index 908680f124..ab86392838 100644 --- a/src/main/java/com/divudi/bean/common/ReportsController.java +++ b/src/main/java/com/divudi/bean/common/ReportsController.java @@ -337,7 +337,6 @@ public class ReportsController implements Serializable { Map>> weeklyDailyBillItemMap7to1; Map>> weeklyDailyBillItemMap1to7; - private boolean showChart; public String getDischargedStatus() { @@ -404,7 +403,6 @@ public void setSelectedDateType(String selectedDateType) { this.selectedDateType = selectedDateType; } - public Investigation getInvestigation() { return investigation; } @@ -2644,7 +2642,7 @@ public void generateDebtorBalanceReport(final boolean onlyDueBills) { } public ReportTemplateRowBundle generateDebtorBalanceReportBills(List bts, List billPaymentMethods, - boolean onlyDueBills) { + boolean onlyDueBills) { Map parameters = new HashMap<>(); String jpql = "SELECT new com.divudi.data.ReportTemplateRow(bill) " + "FROM Bill bill " @@ -3167,7 +3165,6 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems(List // + "LEFT JOIN PatientInvestigation pi ON pi.billItem = billItem " // + "WHERE bill.billTypeAtomic IN :bts " // + "AND bill.createdAt BETWEEN :fd AND :td "; - String jpql = "SELECT new com.divudi.data.ReportTemplateRow(billItem) " + "FROM PatientInvestigation pi " + "JOIN pi.billItem billItem " @@ -3374,14 +3371,14 @@ public void generateOpdAndInwardDueReport() { // opdBts.add(BillTypeAtomic.INWARD_FINAL_BILL); opdBts.add(BillTypeAtomic.INWARD_FINAL_BILL_PAYMENT_BY_CREDIT_COMPANY); } else if (visitType.equalsIgnoreCase("OP")) { - opdBts.add(BillTypeAtomic.OPD_BILL_WITH_PAYMENT); - opdBts.add(BillTypeAtomic.OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); +// opdBts.add(BillTypeAtomic.OPD_BILL_WITH_PAYMENT); +// opdBts.add(BillTypeAtomic.OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_WITH_PAYMENT); opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_PAYMENT_COLLECTION_AT_CASHIER); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_WITH_PAYMENT); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER); opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_CANCELLATION); - opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION); +// opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_CANCELLATION); opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_CANCELLATION); } @@ -3581,7 +3578,7 @@ public Double calculateDueAmountSubTotalByBills(List bills) { Double balance = 0.0; for (Bill bill : bills) { - balance += bill.getBalance(); + balance += bill.getNetTotal() - bill.getSettledAmountBySponsor() - bill.getSettledAmountByPatient(); } return balance; @@ -3673,7 +3670,6 @@ public Double calculateDiscountSubTotalByBills(List bills) { return discount; } - public Double calculateNetAmountNetTotal() { double netAmountNetTotal = 0.0; Map> billMap = bundle.getGroupedBillItemsByInstitution(); @@ -4030,9 +4026,7 @@ public void exportCollectionCenterBillWiseDetailReportToExcel() { response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader("Content-Disposition", "attachment; filename=Collection_Center_Report.xlsx"); - try (XSSFWorkbook workbook = new XSSFWorkbook(); - OutputStream out = response.getOutputStream()) { - + try (XSSFWorkbook workbook = new XSSFWorkbook(); OutputStream out = response.getOutputStream()) { XSSFSheet sheet = workbook.createSheet("Report"); int rowIndex = 0; @@ -4304,8 +4298,8 @@ public void exportDetailedWeeklyOPDReportToPDF() { } private void addWeeklyReportSection(Document document, String sectionTitle, List itemList, - List daysOfWeek, Map>> weeklyDailyBillItemMap, - int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException { + List daysOfWeek, Map>> weeklyDailyBillItemMap, + int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException { document.add(new com.itextpdf.text.Paragraph(sectionTitle, headerFont)); document.add(com.itextpdf.text.Chunk.NEWLINE); @@ -4408,8 +4402,7 @@ public void exportDetailedWeeklyOPDReportToExcel() { } } - private void populateDataRows(Sheet sheet, int rowIndex, List itemList, List daysOfWeek, Map - >> weeklyDailyBillItemMap, int week) { + private void populateDataRows(Sheet sheet, int rowIndex, List itemList, List daysOfWeek, Map>> weeklyDailyBillItemMap, int week) { for (String item : itemList) { Row dataRow = sheet.createRow(rowIndex++); int colIndex = 0; @@ -4433,8 +4426,7 @@ public void exportRouteAnalysisDetailReportToExcel() { response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader("Content-Disposition", "attachment; filename=Collecting_Center_Monthly_Report.xlsx"); - try (XSSFWorkbook workbook = new XSSFWorkbook(); - OutputStream out = response.getOutputStream()) { + try (XSSFWorkbook workbook = new XSSFWorkbook(); OutputStream out = response.getOutputStream()) { XSSFSheet sheet = workbook.createSheet("Monthly Report"); int rowIndex = 0; @@ -4660,4 +4652,64 @@ public void exportRouteAnalysisSummaryReportToExcel() { e.printStackTrace(); } } + + public Double calculateIpGrossAmountSubTotalByBills(List bills) { + Double billTotal = 0.0; + + for (Bill bill : bills) { + billTotal += bill.getPatientEncounter().getFinalBill().getGrantTotal(); + } + + return billTotal; + } + + public Double calculateIpDiscountSubTotalByBills(List bills) { + Double discount = 0.0; + + for (Bill bill : bills) { + discount += bill.getPatientEncounter().getFinalBill().getDiscount(); + } + + return discount; + } + + public Double calculateIpNetAmountSubTotalByBills(List bills) { + Double netTotal = 0.0; + + for (Bill bill : bills) { + netTotal += bill.getPatientEncounter().getFinalBill().getNetTotal(); + } + + return netTotal; + } + + public Double calculateIpPatientShareSubTotalByBills(List bills) { + Double settledAmountByPatient = 0.0; + + for (Bill bill : bills) { + settledAmountByPatient += bill.getPatientEncounter().getFinalBill().getSettledAmountByPatient(); + } + + return settledAmountByPatient; + } + + public Double calculateIpSponsorShareSubTotalByBills(List bills) { + Double settledAmountBySponsor = 0.0; + + for (Bill bill : bills) { + settledAmountBySponsor += bill.getPatientEncounter().getFinalBill().getSettledAmountBySponsor(); + } + + return settledAmountBySponsor; + } + + public Double calculateIpDueAmountSubTotalByBills(List bills) { + Double balance = 0.0; + + for (Bill bill : bills) { + balance += bill.getPatientEncounter().getFinalBill().getNetTotal() - bill.getPatientEncounter().getFinalBill().getSettledAmountBySponsor() - bill.getPatientEncounter().getFinalBill().getSettledAmountByPatient(); + } + + return balance; + } } diff --git a/src/main/java/com/divudi/entity/BillItem.java b/src/main/java/com/divudi/entity/BillItem.java index 654bc7b6e1..806fef32b1 100644 --- a/src/main/java/com/divudi/entity/BillItem.java +++ b/src/main/java/com/divudi/entity/BillItem.java @@ -500,34 +500,42 @@ public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } + @Override public boolean isRetired() { return retired; } + @Override public void setRetired(boolean retired) { this.retired = retired; } + @Override public WebUser getRetirer() { return retirer; } + @Override public void setRetirer(WebUser retirer) { this.retirer = retirer; } + @Override public Date getRetiredAt() { return retiredAt; } + @Override public void setRetiredAt(Date retiredAt) { this.retiredAt = retiredAt; } + @Override public String getRetireComments() { return retireComments; } + @Override public void setRetireComments(String retireComments) { this.retireComments = retireComments; } diff --git a/src/main/java/com/divudi/entity/Patient.java b/src/main/java/com/divudi/entity/Patient.java index d8dfa44db5..567907cdb5 100644 --- a/src/main/java/com/divudi/entity/Patient.java +++ b/src/main/java/com/divudi/entity/Patient.java @@ -4,6 +4,7 @@ */ package com.divudi.entity; +import com.divudi.bean.common.RetirableEntity; import com.divudi.java.CommonFunctions; import java.io.Serializable; import java.util.Date; @@ -31,7 +32,7 @@ * @author buddhika */ @Entity -public class Patient implements Serializable { +public class Patient implements Serializable, RetirableEntity { static final long serialVersionUID = 1L; @Id diff --git a/src/main/java/com/divudi/entity/Person.java b/src/main/java/com/divudi/entity/Person.java index ce455f6ed6..8ef4200b01 100644 --- a/src/main/java/com/divudi/entity/Person.java +++ b/src/main/java/com/divudi/entity/Person.java @@ -7,6 +7,7 @@ */ package com.divudi.entity; +import com.divudi.bean.common.RetirableEntity; import com.divudi.data.Sex; import com.divudi.data.Title; import com.divudi.entity.membership.MembershipScheme; @@ -36,7 +37,7 @@ * Consultant (Health Informatics) */ @Entity -public class Person implements Serializable { +public class Person implements Serializable, RetirableEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -328,10 +329,12 @@ public void setSex(Sex sex) { this.sex = sex; } + @Override public String getRetireComments() { return retireComments; } + @Override public void setRetireComments(String retireComments) { this.retireComments = retireComments; } @@ -415,26 +418,32 @@ public void setZoneCode(String zoneCode) { this.zoneCode = zoneCode; } + @Override public boolean isRetired() { return retired; } + @Override public void setRetired(boolean retired) { this.retired = retired; } + @Override public Date getRetiredAt() { return retiredAt; } + @Override public void setRetiredAt(Date retiredAt) { this.retiredAt = retiredAt; } + @Override public WebUser getRetirer() { return retirer; } + @Override public void setRetirer(WebUser retirer) { this.retirer = retirer; } diff --git a/src/main/java/com/divudi/entity/pharmacy/PharmaceuticalBillItem.java b/src/main/java/com/divudi/entity/pharmacy/PharmaceuticalBillItem.java index ec468f56aa..2130c0cc53 100644 --- a/src/main/java/com/divudi/entity/pharmacy/PharmaceuticalBillItem.java +++ b/src/main/java/com/divudi/entity/pharmacy/PharmaceuticalBillItem.java @@ -4,12 +4,10 @@ */ package com.divudi.entity.pharmacy; -import com.divudi.bean.common.RetirableEntity; import com.divudi.bean.common.TimeUtils; import com.divudi.entity.BillItem; import com.divudi.entity.Category; import com.divudi.entity.Institution; -import com.divudi.entity.WebUser; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; @@ -28,7 +26,7 @@ * @author Buddhika */ @Entity -public class PharmaceuticalBillItem implements Serializable, RetirableEntity { +public class PharmaceuticalBillItem implements Serializable { @OneToOne(mappedBy = "pbItem") private StockHistory stockHistory; @@ -110,19 +108,6 @@ public class PharmaceuticalBillItem implements Serializable, RetirableEntity { private boolean transThisIsStockOut; @Transient private boolean transThisIsStockIn; - - private boolean retired; - - @ManyToOne - private WebUser retirer; - - @ManyToOne - private WebUser currentHolder; - - @Temporal(javax.persistence.TemporalType.TIMESTAMP) - private Date retiredAt; - - private String retireComments; public String getSerialNo() { return serialNo; @@ -699,46 +684,6 @@ public double getRetailPackValue() { public void setRetailPackValue(double retailPackValue) { this.retailPackValue = retailPackValue; } - - public boolean isRetired() { - return retired; - } - - public void setRetired(boolean retired) { - this.retired = retired; - } - - public WebUser getRetirer() { - return retirer; - } - - public void setRetirer(WebUser retirer) { - this.retirer = retirer; - } - - public WebUser getCurrentHolder() { - return currentHolder; - } - - public void setCurrentHolder(WebUser currentHolder) { - this.currentHolder = currentHolder; - } - - public Date getRetiredAt() { - return retiredAt; - } - - public void setRetiredAt(Date retiredAt) { - this.retiredAt = retiredAt; - } - - public String getRetireComments() { - return retireComments; - } - - public void setRetireComments(String retireComments) { - this.retireComments = retireComments; - } diff --git a/src/main/java/com/divudi/ws/channel/ChannelApi.java b/src/main/java/com/divudi/ws/channel/ChannelApi.java index 84b999e89d..30e11754e8 100644 --- a/src/main/java/com/divudi/ws/channel/ChannelApi.java +++ b/src/main/java/com/divudi/ws/channel/ChannelApi.java @@ -1086,6 +1086,11 @@ public Response createBooking(@Context HttpServletRequest requestContext, Map billList = channelService.findBillFromRefNo(clientsReferanceNo, creditCompany, BillClassType.BilledBill); System.out.println(billList.size()); diff --git a/src/main/resources/META-INF/persistence_for_production.xml b/src/main/resources/META-INF/persistence_for_production.xml index 672eeeee9c..e1279e8abb 100644 --- a/src/main/resources/META-INF/persistence_for_production.xml +++ b/src/main/resources/META-INF/persistence_for_production.xml @@ -1,22 +1,24 @@ - + org.eclipse.persistence.jpa.PersistenceProvider - jdbc/ruhunu + ${JDBC_DATASOURCE} false - - - + + + + + - jdbc/ruhunuAudit + ${JDBC_AUDIT_DATASOURCE} false - - + + diff --git a/src/main/webapp/pharmacy/pharmacy_purhcase_order_approving.xhtml b/src/main/webapp/pharmacy/pharmacy_purhcase_order_approving.xhtml index 983db50520..c8f37ec8b3 100644 --- a/src/main/webapp/pharmacy/pharmacy_purhcase_order_approving.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_purhcase_order_approving.xhtml @@ -16,18 +16,20 @@
- + - +
@@ -84,18 +86,23 @@
- - - + + + diff --git a/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml b/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml index 6b208c1f65..554c157f7f 100644 --- a/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml +++ b/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml @@ -394,7 +394,7 @@ + value="#{bill.netTotal - bill.settledAmountBySponsor - bill.settledAmountByPatient}"> @@ -576,9 +576,6 @@
- - - @@ -611,6 +608,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f9fd29731c29153b732b47c694dddc65ad6447b4 Mon Sep 17 00:00:00 2001 From: Isuru Ranaweera <152675215+IsuruUdaraRanaweera@users.noreply.github.com> Date: Mon, 6 Jan 2025 14:54:39 +0530 Subject: [PATCH 24/24] Issue#9834/opd and inward due report (#9971) * Signed-off-by: Buddhika * Signed-off-by: Chinthaka Prasad * Signed-off-by: Chinthaka Prasad * Signed-off-by: Pubudu-Piyankara * Create build.yml * Create deploy.yml * Update build.yml * Update deploy.yml * Delete .github/workflows/deploy.yml * Update and rename build.yml to manual_deployment.yml * Delete .github/workflows/manual_deployment.yml * Create dev_dispatch.yml * Delete .github/workflows/dev_dispatch.yml * Create custom_deployment.yml * Update custom_deployment.yml * Signed-off-by: Chinthaka Prasad * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Issue #9942 Signed-off-by: Lawan Samarasekara * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Dr M H B Ariyaratne * Signed-off-by: Buddhika * Signed-off-by: Buddhika * added opd and cc bills * added batch cancel and refund * Signed-off-by: Pubudu-Piyankara * Signed-off-by: Chinthaka Prasad * Signed-off-by: Chinthaka Prasad * Update PharmacyCalculation.java testing commit * changed column width * Signed-off-by: Isuru Ranaweera * fixed null pointer exception bug * Signed-off-by: Isuru Ranaweera * fixed filter bug * Create rh_prod_ci_cd.yml * Signed-off-by: Isuru Ranaweera * Closes #9960 Pharmacy_Retail_Sale_NOT_available_even_after_starting_a_new_Shift Signed-off-by: Buddhika Ariyaratne * Signed-off-by: Buddhika Ariyaratne * Signed-off-by: PasinduW99 * closes #9966 Signed-off-by: PasinduW99 * Add to Bill view for Sale1,2,3,4 Signed-off-by: PasinduW99 * Signed-off-by: PasinduW99 * Signed-off-by: PasinduW99 * Signed-off-by: PasinduW99 * Signed-off-by: Isuru Ranaweera * Signed-off-by: Isuru Ranaweera --------- Signed-off-by: Buddhika Signed-off-by: IsuruUdaraRanaweera Signed-off-by: Dr M H B Ariyaratne Signed-off-by: Lawan Samarasekara Signed-off-by: Isuru Ranaweera Signed-off-by: Buddhika Ariyaratne Signed-off-by: PasinduW99 Co-authored-by: Buddhika Co-authored-by: Chinthaka Prasad Co-authored-by: Pubudu-Piyankara Co-authored-by: Geeth Sandaru Madhushan Co-authored-by: Lawan Samarasekara Co-authored-by: imexh Co-authored-by: Chinthaka Prasad Wijerathna <118891516+ChinthakaPrasad@users.noreply.github.com> Co-authored-by: PasinduW99 Co-authored-by: Pasindu Wathsara <113449846+PasinduW99@users.noreply.github.com> --- .../divudi/bean/common/ReportsController.java | 104 +++++++++++++++--- .../divudi/bean/common/SearchController.java | 2 +- src/main/resources/META-INF/persistence.xml | 2 +- .../pharmacy_bill_retail_sale_1.xhtml | 54 +++------ .../pharmacy_bill_retail_sale_2.xhtml | 59 +++------- .../pharmacy_bill_retail_sale_3.xhtml | 51 +++------ .../opd_and_inward_due_report.xhtml | 53 +++++++++ 7 files changed, 188 insertions(+), 137 deletions(-) diff --git a/src/main/java/com/divudi/bean/common/ReportsController.java b/src/main/java/com/divudi/bean/common/ReportsController.java index ab86392838..291a264bb9 100644 --- a/src/main/java/com/divudi/bean/common/ReportsController.java +++ b/src/main/java/com/divudi/bean/common/ReportsController.java @@ -1899,8 +1899,8 @@ private void groupBillItemsDaily() { Map> billItemMap = weeklyBillItemMap7to7.containsKey(weekOfMonth) ? weeklyBillItemMap7to7.get(weekOfMonth) : new HashMap<>(); billItemMap.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null ? - billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); + .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null + ? billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); weeklyBillItemMap7to7.put(weekOfMonth, billItemMap); } else if (hourOfDay < 13) { @@ -1908,8 +1908,8 @@ private void groupBillItemsDaily() { Map> billItemMap = weeklyBillItemMap7to1.containsKey(weekOfMonth) ? weeklyBillItemMap7to1.get(weekOfMonth) : new HashMap<>(); billItemMap.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null ? - billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); + .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null + ? billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); weeklyBillItemMap7to1.put(weekOfMonth, billItemMap); } else { @@ -1917,8 +1917,8 @@ private void groupBillItemsDaily() { Map> billItemMap = weeklyBillItemMap1to7.containsKey(weekOfMonth) ? weeklyBillItemMap1to7.get(weekOfMonth) : new HashMap<>(); billItemMap.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null ? - billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); + .put(dayOfMonth, billItemMap.get(billItem.getItem().getName()) != null + ? billItemMap.get(billItem.getItem().getName()).getOrDefault(dayOfMonth, 0.0) + 1.0 : 1.0); weeklyBillItemMap1to7.put(weekOfMonth, billItemMap); } @@ -2007,18 +2007,18 @@ private void groupBillItemsWeekly() { if (hourOfDay >= 19 || hourOfDay < 7) { // Between 7 PM to 7 AM billItemMap7to7.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(weekOfMonth, billItemMap7to7.get(billItem.getItem().getName()) != null ? - billItemMap7to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); + .put(weekOfMonth, billItemMap7to7.get(billItem.getItem().getName()) != null + ? billItemMap7to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); } else if (hourOfDay < 13) { // Between 7 AM to 1 PM billItemMap7to1.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(weekOfMonth, billItemMap7to1.get(billItem.getItem().getName()) != null ? - billItemMap7to1.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); + .put(weekOfMonth, billItemMap7to1.get(billItem.getItem().getName()) != null + ? billItemMap7to1.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); } else { // Between 1 PM to 7 PM billItemMap1to7.computeIfAbsent(billItem.getItem().getName(), k -> new HashMap<>()) - .put(weekOfMonth, billItemMap1to7.get(billItem.getItem().getName()) != null ? - billItemMap1to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); + .put(weekOfMonth, billItemMap1to7.get(billItem.getItem().getName()) != null + ? billItemMap1to7.get(billItem.getItem().getName()).getOrDefault(weekOfMonth, 0.0) + 1.0 : 1.0); } } @@ -2093,7 +2093,6 @@ private ReportTemplateRowBundle generateWeeklyBillItems(List bts // parameters.put("type", visitType); // } // } - if (getSearchKeyword().getItemName() != null && !getSearchKeyword().getItemName().trim().isEmpty()) { jpql += "AND ((bill.billPackege.name) like :itemName ) "; parameters.put("itemName", "%" + getSearchKeyword().getItemName().trim().toUpperCase() + "%"); @@ -4712,4 +4711,83 @@ public Double calculateIpDueAmountSubTotalByBills(List bills) { return balance; } + + public Double calculateIpGrossAmountNetTotal() { + double grossAmountNetTotal = 0.0; + Map> billMap = bundle.getGroupedBillItemsByInstitution(); + + for (Map.Entry> entry : billMap.entrySet()) { + List bills = entry.getValue(); + + grossAmountNetTotal += calculateIpGrossAmountSubTotalByBills(bills); + } + + return grossAmountNetTotal; + } + + public Double calculateIpDiscountNetTotal() { + double discountNetTotal = 0.0; + Map> billMap = bundle.getGroupedBillItemsByInstitution(); + + for (Map.Entry> entry : billMap.entrySet()) { + List bills = entry.getValue(); + + discountNetTotal += calculateIpDiscountSubTotalByBills(bills); + } + + return discountNetTotal; + } + + public Double calculateIpNetAmountNetTotal() { + double netAmountNetTotal = 0.0; + Map> billMap = bundle.getGroupedBillItemsByInstitution(); + + for (Map.Entry> entry : billMap.entrySet()) { + List bills = entry.getValue(); + + netAmountNetTotal += calculateIpNetAmountSubTotalByBills(bills); + } + + return netAmountNetTotal; + } + + public Double calculateIpPatientShareNetTotal() { + double patientShareNetTotal = 0.0; + Map> billMap = bundle.getGroupedBillItemsByInstitution(); + + for (Map.Entry> entry : billMap.entrySet()) { + List bills = entry.getValue(); + + patientShareNetTotal += calculateIpPatientShareSubTotalByBills(bills); + } + + return patientShareNetTotal; + } + + public Double calculateIpSponsorShareNetTotal() { + double sponsorShareNetTotal = 0.0; + Map> billMap = bundle.getGroupedBillItemsByInstitution(); + + for (Map.Entry> entry : billMap.entrySet()) { + List bills = entry.getValue(); + + sponsorShareNetTotal += calculateIpSponsorShareSubTotalByBills(bills); + + } + + return sponsorShareNetTotal; + } + + public Double calculateIpDueAmountNetTotal() { + double dueAmountNetTotal = 0.0; + Map> billMap = bundle.getGroupedBillItemsByInstitution(); + + for (Map.Entry> entry : billMap.entrySet()) { + List bills = entry.getValue(); + + dueAmountNetTotal += calculateIpDueAmountSubTotalByBills(bills); + } + + return dueAmountNetTotal; + } } diff --git a/src/main/java/com/divudi/bean/common/SearchController.java b/src/main/java/com/divudi/bean/common/SearchController.java index 8e1eebeb49..1cddbc3fad 100644 --- a/src/main/java/com/divudi/bean/common/SearchController.java +++ b/src/main/java/com/divudi/bean/common/SearchController.java @@ -4265,7 +4265,7 @@ public void createPharmacyAdjustmentBillItemTable() { sql += " order by bi.id desc"; - billItems = getBillItemFacade().findByJpql(sql, m, TemporalType.TIMESTAMP, 50); + billItems = getBillItemFacade().findByJpql(sql, m, TemporalType.TIMESTAMP); } diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index d8df0ddc77..e1279e8abb 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -1,7 +1,7 @@ - org.eclipse.persistence.jpa.PersistenceProvider + org.eclipse.persistence.jpa.PersistenceProvider ${JDBC_DATASOURCE} false diff --git a/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_1.xhtml b/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_1.xhtml index 748e7ab0a7..697e219326 100644 --- a/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_1.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_1.xhtml @@ -672,62 +672,36 @@ - - +
- - - - +

- - - - +
- -
- - - -
-
- -
- - - -
+ + - -
- - - -
+ + + + + + + + +
- - - - - diff --git a/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_2.xhtml b/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_2.xhtml index b83bf791a2..8c6313fbb4 100644 --- a/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_2.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_2.xhtml @@ -620,10 +620,6 @@ - - - - @@ -683,62 +679,35 @@ - - +
- - - - +

- - - - +
- -
- - - -
-
- -
- - - -
+ + - -
- - - -
-
+ + + + + + + + +
- - - - - diff --git a/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_3.xhtml b/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_3.xhtml index 4f47f85453..2dca0457cd 100644 --- a/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_3.xhtml +++ b/src/main/webapp/pharmacy/pharmacy_bill_retail_sale_3.xhtml @@ -669,58 +669,35 @@ - - +
- - - - +

- - - - +
- -
- - - -
-
- -
- - - -
+ + - -
- - - -
+ + + + + + + + +
- - diff --git a/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml b/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml index 554c157f7f..87bef1e94e 100644 --- a/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml +++ b/src/main/webapp/reports/financialReports/opd_and_inward_due_report.xhtml @@ -662,6 +662,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +