diff --git a/.github/counter.txt b/.github/counter.txt index 1e8b314962..00750edc07 100644 --- a/.github/counter.txt +++ b/.github/counter.txt @@ -1 +1 @@ -6 +3 diff --git a/.github/last_date.txt b/.github/last_date.txt index 444c7cbae4..25c4636413 100644 --- a/.github/last_date.txt +++ b/.github/last_date.txt @@ -1 +1 @@ -20240804 +20240805 diff --git a/README.md b/README.md index ebb5dcfb76..f829146bf4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Developed using Java Enterprise Edition, the system offers both a web applicatio -Current Version: 3.0.0.20240804.6 (This line will be automatically updated to reflect the latest version) +Current Version: 3.0.0.20240805.3 (This line will be automatically updated to reflect the latest version) diff --git a/pom.xml b/pom.xml index d47b8e5cf0..716e938d03 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ ruhunuDemo 3.0.0 war - ruhunu + ruhunuDemo ${project.build.directory}/endorsed diff --git a/src/main/java/com/divudi/bean/common/BillSearch.java b/src/main/java/com/divudi/bean/common/BillSearch.java index 0be95d9e11..01f0c2e606 100644 --- a/src/main/java/com/divudi/bean/common/BillSearch.java +++ b/src/main/java/com/divudi/bean/common/BillSearch.java @@ -79,6 +79,8 @@ import com.divudi.data.ServiceType; import com.divudi.entity.Doctor; import com.divudi.facade.FeeFacade; +import com.divudi.facade.PatientFacade; +import com.divudi.facade.StaffFacade; import com.divudi.java.CommonFunctions; import com.divudi.light.common.BillLight; import java.io.Serializable; @@ -157,6 +159,8 @@ public class BillSearch implements Serializable { private EmailFacade emailFacade; @EJB FeeFacade feeFacade; + @EJB + private StaffFacade staffFacade; /** * Controllers */ @@ -1267,9 +1271,9 @@ public boolean calculateRefundTotalForOpdBill() { double refundingValue = 0; for (BillFee rbf : i.getBillFees()) { - System.out.println("rbf.getFeeValue() name = " + rbf.getFee().getName()); - System.out.println("rbf.getFeeValue() = " + rbf.getFeeValue()); - System.out.println("rbf.getFeeValue() fee = " + rbf.getFee().getFee()); + //System.out.println("rbf.getFeeValue() name = " + rbf.getFee().getName()); + //System.out.println("rbf.getFeeValue() = " + rbf.getFeeValue()); + //System.out.println("rbf.getFeeValue() fee = " + rbf.getFee().getFee()); refundingValue += rbf.getFeeValue(); } i.setNetValue(refundingValue); @@ -1569,6 +1573,13 @@ public String refundOpdBill() { JsfUtil.addErrorMessage("One or more bill Item you are refunding has been already paid to Service Provider. Can not refund again."); return ""; } + + if (paymentMethod == PaymentMethod.Staff) { + if (getBill().getToStaff() == null) { + JsfUtil.addErrorMessage("Can't Select Staff Method"); + return ""; + } + } if (refundingBill.getBillItems() != null) { for (BillItem bi : refundingBill.getBillItems()) { @@ -1602,23 +1613,36 @@ public String refundOpdBill() { Payment p = getOpdPreSettleController().createPaymentForCancellationsAndRefunds(refundingBill, paymentMethod); //TODO: Create Payments for Bill Items - if (getBill().getPaymentMethod() == PaymentMethod.Credit) { - if (getBill().getToStaff() != null) { - staffBean.updateStaffCredit(getBill().getToStaff(), 0 - (getBill().getNetTotal() + getBill().getVat())); - JsfUtil.addSuccessMessage("Staff Credit Updated"); - } else if (getBill().getCreditCompany() != null) { - //TODO : Update Credit COmpany Bill - } + if (getBill().getPaymentMethod() == PaymentMethod.Staff) { + //System.out.println("PaymentMethod - Staff"); + + //System.out.println("Before Balance = " + getBill().getToStaff().getCurrentCreditValue()); + getBill().getToStaff().setCurrentCreditValue(getBill().getToStaff().getCurrentCreditValue() - Math.abs(getRefundingBill().getNetTotal())); + + //System.out.println("After Balance = " + getBill().getToStaff().getCurrentCreditValue()); + staffFacade.edit(getBill().getToStaff()); + //System.out.println("Staff Credit Updated"); + } else if (getBill().getPaymentMethod() == PaymentMethod.PatientDeposit) { - //TODO: Update Patient Deposit + //System.out.println("Before Balance = " + bill.getPatient().getRunningBalance()); + if (bill.getPatient().getRunningBalance() == null) { + //System.out.println("Null"); + bill.getPatient().setRunningBalance(Math.abs(bill.getNetTotal())); + } else { + //System.out.println("Not Null - Add BillValue"); + bill.getPatient().setRunningBalance(bill.getPatient().getRunningBalance() + Math.abs(bill.getNetTotal())); + } + patientFacade.edit(bill.getPatient()); + //System.out.println("After Balance = " + bill.getPatient().getRunningBalance()); } - //TODO - Update Bill Payment Values - //TODO - Update Bill Paid Value printPreview = true; return ""; } + @EJB + private PatientFacade patientFacade; + public boolean sampleHasBeenCollected(Bill rf) { boolean oneItemIsSampled = false; for (BillItem bi : rf.getBillItems()) { @@ -2162,6 +2186,13 @@ public void cancelOpdBill() { } } + if (paymentMethod == PaymentMethod.Staff) { + if (getBill().getToStaff() == null) { + JsfUtil.addErrorMessage("Can't Select Staff Method"); + return; + } + } + if (!getWebUserController().hasPrivilege("OpdCancel")) { JsfUtil.addErrorMessage("You have no privilege to cancel OPD bills. Please contact System Administrator."); return; @@ -2972,7 +3003,7 @@ public String navigateViewOpdBillByBillTypeAtomic() { case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_RETURN: case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_SESSION: return navigateToViewChannelingProfessionalPaymentBill(); - + case OPD_BATCH_BILL_TO_COLLECT_PAYMENT_AT_CASHIER: case OPD_BATCH_BILL_PAYMENT_COLLECTION_AT_CASHIER: case OPD_BATCH_BILL_CANCELLATION: @@ -2981,7 +3012,7 @@ public String navigateViewOpdBillByBillTypeAtomic() { case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_OPD_SERVICES: case PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_OPD_SERVICES_RETURN: return navigateToViewOpdProfessionalPaymentBill(); - + } JsfUtil.addErrorMessage("Wrong Bill Type"); return ""; @@ -4090,6 +4121,22 @@ public void setReferredBy(Doctor referredBy) { this.referredBy = referredBy; } + public PatientFacade getPatientFacade() { + return patientFacade; + } + + public void setPatientFacade(PatientFacade patientFacade) { + this.patientFacade = patientFacade; + } + + public StaffFacade getStaffFacade() { + return staffFacade; + } + + public void setStaffFacade(StaffFacade staffFacade) { + this.staffFacade = staffFacade; + } + public class PaymentSummary { private long idCounter = 0; diff --git a/src/main/java/com/divudi/bean/common/OpdPreSettleController.java b/src/main/java/com/divudi/bean/common/OpdPreSettleController.java index cbe22fdc56..64f44820cd 100644 --- a/src/main/java/com/divudi/bean/common/OpdPreSettleController.java +++ b/src/main/java/com/divudi/bean/common/OpdPreSettleController.java @@ -54,6 +54,7 @@ import com.divudi.facade.PaymentFacade; import com.divudi.facade.PersonFacade; import com.divudi.facade.PharmaceuticalBillItemFacade; +import com.divudi.facade.StaffFacade; import com.divudi.facade.TokenFacade; import java.io.Serializable; @@ -122,6 +123,9 @@ public OpdPreSettleController() { TokenFacade tokenFacade; @EJB StaffBean staffBean; + @EJB + private StaffFacade staffFacade; + ///////////////////////// Item selectedAlternative; @@ -1703,26 +1707,36 @@ public Payment createPaymentForCancellationsforOPDBill(Bill bill, PaymentMethod p.setCreater(getSessionController().getLoggedUser()); p.setPaymentMethod(pm); - System.out.println("pm = " + pm); + //System.out.println("pm = " + pm); if (pm == PaymentMethod.PatientDeposit) { - System.out.println("Before Balance = " + bill.getPatient().getRunningBalance()); + //System.out.println("Before Balance = " + bill.getPatient().getRunningBalance()); if (bill.getPatient().getRunningBalance() == null) { - System.out.println("Null"); + //System.out.println("Null"); bill.getPatient().setRunningBalance(Math.abs(bill.getNetTotal())); } else { - System.out.println("Not Null - Add BillValue"); + //System.out.println("Not Null - Add BillValue"); bill.getPatient().setRunningBalance(bill.getPatient().getRunningBalance() + Math.abs(bill.getNetTotal())); } patientFacade.edit(bill.getPatient()); - System.out.println("After Balance = " + bill.getPatient().getRunningBalance()); + //System.out.println("After Balance = " + bill.getPatient().getRunningBalance()); + } + + if (pm == PaymentMethod.Staff) { + //System.out.println("PaymentMethod - Staff"); + //System.out.println("Before Balance = " + bill.getToStaff().getCurrentCreditValue()); + bill.getToStaff().setCurrentCreditValue( bill.getToStaff().getCurrentCreditValue() - Math.abs(bill.getNetTotal())); + //System.out.println("After Balance = " + bill.getToStaff().getCurrentCreditValue()); + staffFacade.edit(bill.getToStaff()); + //System.out.println("Staff Credit Updated"); } - System.out.println("001"); + + //System.out.println("001"); if (p.getId() == null) { getPaymentFacade().create(p); } getPaymentFacade().edit(p); - System.out.println("End Payment"); + //System.out.println("End Payment"); return p; } @@ -2017,4 +2031,12 @@ public void setForeigner(boolean foreigner) { this.foreigner = foreigner; } + public StaffFacade getStaffFacade() { + return staffFacade; + } + + public void setStaffFacade(StaffFacade staffFacade) { + this.staffFacade = staffFacade; + } + } diff --git a/src/main/java/com/divudi/bean/pharmacy/GrnController.java b/src/main/java/com/divudi/bean/pharmacy/GrnController.java index 0917b9ca19..6abd653fd8 100644 --- a/src/main/java/com/divudi/bean/pharmacy/GrnController.java +++ b/src/main/java/com/divudi/bean/pharmacy/GrnController.java @@ -1078,12 +1078,15 @@ public void onEdit(RowEditEvent event) { } public void checkQty(BillItem bi) { + if (bi.getTmpQty() < 0.0) { bi.setTmpQty(0.0); } + if (bi.getTmpFreeQty() < 0.0) { bi.setTmpFreeQty(0.0); } + onEdit(bi); } @@ -1091,21 +1094,11 @@ public void onEdit(BillItem tmp) { setBatch(tmp); double remains = getPharmacyCalculation().getRemainingQty(tmp.getPharmaceuticalBillItem()); -// System.err.println("1 " + tmp.getTmpQty()); -// System.err.println("2 " + tmp.getQty()); -// System.err.println("3 " + tmp.getPharmaceuticalBillItem().getQty()); -// System.err.println("4 " + tmp.getPharmaceuticalBillItem().getQtyInUnit()); -//System.out.println("remains = " + remains); -// System.out.println("tmp.getPharmaceuticalBillItem().getQtyInUnit() = " + tmp.getPharmaceuticalBillItem().getQtyInUnit()); + if (remains < tmp.getPharmaceuticalBillItem().getQtyInUnit()) { tmp.setTmpQty(remains); JsfUtil.addErrorMessage("You cant Change Qty than Remaining qty"); } -// System.out.println("tmp.getPreviousRecieveQtyInUnit() = " + tmp.getPreviousRecieveQtyInUnit()); -// if(tmp.getPreviousRecieveQtyInUnit() < tmp.getPharmaceuticalBillItem().getQtyInUnit()){ -// tmp.setTmpQty(tmp.getPreviousRecieveQtyInUnit()); -// JsfUtil.addErrorMessage("You cant Order Qty than Remaining qty to recieve"); -// } if (tmp.getPharmaceuticalBillItem().getPurchaseRate() > tmp.getPharmaceuticalBillItem().getRetailRate()) { tmp.getPharmaceuticalBillItem().setRetailRate(getRetailPrice(tmp.getPharmaceuticalBillItem().getBillItem())); @@ -1119,8 +1112,6 @@ public void onEdit(BillItem tmp) { // return; } } -// manually set Wholesale Rate************** -// tmp.getPharmaceuticalBillItem().setWholesaleRate((tmp.getPharmaceuticalBillItem().getPurchaseRate() * 1.08)* (tmp.getPharmaceuticalBillItem().getQtyInUnit())/(tmp.getPharmaceuticalBillItem().getQtyInUnit() + tmp.getPharmaceuticalBillItem().getFreeQtyInUnit()) ); calGrossTotal(); calDifference(); @@ -1133,21 +1124,6 @@ public void onEditPurchaseRate(BillItem tmp) { } -// private List getSuggession(Item item) { -// List suggessions = new ArrayList<>(); -// -// if (item instanceof Amp) { -// suggessions = getPharmacyBillBean().findItem((Amp) item, suggessions); -// } else if (item instanceof Ampp) { -// suggessions = getPharmacyBillBean().findItem((Ampp) item, suggessions); -// } else if (item instanceof Vmp) { -// suggessions = getPharmacyBillBean().findItem((Vmp) item, suggessions); -// } else if (item instanceof Vmpp) { -// suggessions = getPharmacyBillBean().findItem((Vmpp) item, suggessions); -// } -// -// return suggessions; -// } public void calGrossTotal() { double tmp = 0.0; int serialNo = 0; diff --git a/src/main/java/com/divudi/bean/store/StoreAdjustmentController.java b/src/main/java/com/divudi/bean/store/StoreAdjustmentController.java index bbd2be82d1..1a4b01e99a 100644 --- a/src/main/java/com/divudi/bean/store/StoreAdjustmentController.java +++ b/src/main/java/com/divudi/bean/store/StoreAdjustmentController.java @@ -7,6 +7,7 @@ import com.divudi.bean.common.SessionController; import com.divudi.bean.common.util.JsfUtil; +import com.divudi.bean.pharmacy.ConsumableCategoryController; import com.divudi.data.BillClassType; import com.divudi.data.BillNumberSuffix; import com.divudi.data.BillType; @@ -627,5 +628,58 @@ public YearMonthDay getYearMonthDay() { public void setYearMonthDay(YearMonthDay yearMonthDay) { this.yearMonthDay = yearMonthDay; } + private List stk; + public void fillSelectStock() { + List items = new ArrayList<>(); + if (stock == null) { + stk = items; + return; + } + String sql; + Map m = new HashMap<>(); + + sql = "select i " + + " from Stock i " + + " where i.department=:d " + + " and i.itemBatch.item.code=:stationary " + + " order by i.stock desc"; + + m.put("d", sessionController.getDepartment()); + m.put("stationary", stock.getItemBatch().getItem().getCode()); // Assuming stk contains the item + + items = getStockFacade().findByJpql(sql, m); + + if (items != null) { + stk = items; + } + } + + public List getStk() { + return stk; + } + + public void setStk(List stk) { + this.stk = stk; + } + + + + + + public void fillSelectStock(){ + List items = new ArrayList<>(); + + String sql; + Map m = new HashMap(); + sql = "select i " + + " from Stock i " + + " where i.department=:d " + + " order by i.stock desc"; + m.put("d", sessionController.getDepartment()); + + items = getStockFacade().findByJpql(sql, m); + + + } } diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index 010d01ff02..19c35b09ad 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -1,24 +1,22 @@ - - org.eclipse.persistence.jpa.PersistenceProvider - jdbc/arogya - false - - - - - - - - jdbc/arogyaAudit - com.divudi.entity.AuditEvent - true - - - - - - + + jdbc/arogya + false + + + + + + + + jdbc/arogyaAudit + false + + + + + + diff --git a/src/main/resources/VERSION.txt b/src/main/resources/VERSION.txt index d8f4ba115e..bc1411f5ef 100644 --- a/src/main/resources/VERSION.txt +++ b/src/main/resources/VERSION.txt @@ -1 +1 @@ -3.0.0.20240804.6 +3.0.0.20240805.3 diff --git a/src/main/webapp/collecting_centre/bill.xhtml b/src/main/webapp/collecting_centre/bill.xhtml index 21cfb7b8a4..b38024a897 100644 --- a/src/main/webapp/collecting_centre/bill.xhtml +++ b/src/main/webapp/collecting_centre/bill.xhtml @@ -305,6 +305,8 @@ icon="fa fa-check" action="#{collectingCentreBillController.settleBill}" ajax="false" + onclick="if (!confirm('Are you sure you want to Settle This Bill ?')) + return false;" class="ui-button-success "> - + diff --git a/src/main/webapp/resources/ezcomp/menu.xhtml b/src/main/webapp/resources/ezcomp/menu.xhtml index b1d2237c9f..a0f7278372 100644 --- a/src/main/webapp/resources/ezcomp/menu.xhtml +++ b/src/main/webapp/resources/ezcomp/menu.xhtml @@ -1088,7 +1088,7 @@ - + diff --git a/src/main/webapp/store/store_adjustment_department.xhtml b/src/main/webapp/store/store_adjustment_department.xhtml index 494049e982..b4f8380b88 100644 --- a/src/main/webapp/store/store_adjustment_department.xhtml +++ b/src/main/webapp/store/store_adjustment_department.xhtml @@ -9,7 +9,6 @@ - @@ -31,6 +30,10 @@ var="i" itemLabel="#{i.itemBatch.item.name}" itemValue="#{i}" > + @@ -72,6 +75,44 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -176,11 +217,7 @@ - - - -