From 92573b854a891967f79ed232073b9584f277b01b Mon Sep 17 00:00:00 2001 From: DamithDeshan Date: Tue, 6 Aug 2024 18:42:11 +0530 Subject: [PATCH] closes#6528 Signed-off-by: DamithDeshan --- .../store/StorePurchaseOrderController.java | 52 +++++-- .../store_purhcase_order_approving.xhtml | 133 ++++++++++++++---- 2 files changed, 149 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/divudi/bean/store/StorePurchaseOrderController.java b/src/main/java/com/divudi/bean/store/StorePurchaseOrderController.java index 6f655231ad..e9a72ff58c 100644 --- a/src/main/java/com/divudi/bean/store/StorePurchaseOrderController.java +++ b/src/main/java/com/divudi/bean/store/StorePurchaseOrderController.java @@ -71,6 +71,8 @@ public class StorePurchaseOrderController implements Serializable { // List pharmaceuticalBillItems; ////////// + private BillItem currentBillItem; + private CommonFunctions commonFunctions; private LazyDataModel searchBills; @@ -96,9 +98,33 @@ public void removeItem(BillItem billItem) { calTotal(); } - private int maxResult = 50; - + + public void addExtraItem() { + if (getCurrentBillItem().getItem() == null) { + JsfUtil.addErrorMessage("Please select and item from the list"); + return; + } + + for (BillItem bi : getBillItems()) { + if (getCurrentBillItem().getItem().equals(bi.getItem())) { + JsfUtil.addErrorMessage("Already added this item"); + return; + } + } + + getCurrentBillItem().setSearialNo(getBillItems().size()); + getCurrentBillItem().getPharmaceuticalBillItem().setPurchaseRateInUnit(getStoreBean().getLastPurchaseRate(getCurrentBillItem().getItem(), getSessionController().getDepartment())); + getCurrentBillItem().getPharmaceuticalBillItem().setRetailRateInUnit(getStoreBean().getLastRetailRate(getCurrentBillItem().getItem(), getSessionController().getDepartment())); + + getBillItems().add(getCurrentBillItem()); + + calTotal(); + + currentBillItem = null; + } + + private int maxResult = 50; public void clearList() { filteredValue = null; @@ -126,7 +152,7 @@ public Date getFromDate() { public void approve() { if (getAprovedBill().getPaymentMethod() == null) { JsfUtil.addErrorMessage("Select Paymentmethod"); - return ; + return; } calTotal(); @@ -140,9 +166,8 @@ public void approve() { printPreview = true; - // return viewRequestedList(); + // return viewRequestedList(); // printPreview = true; - } public String viewRequestedList() { @@ -188,7 +213,6 @@ public void saveBill() { // getAprovedBill().setDeptId(getBillNumberBean().institutionBillNumberGeneratorWithReference(getRequestedBill().getDepartment(), getAprovedBill(), BillType.StoreOrder, BillNumberSuffix.PO)); // getAprovedBill().setInsId(getBillNumberBean().institutionBillNumberGeneratorWithReference(getRequestedBill().getInstitution(), getAprovedBill(), BillType.StoreOrder, BillNumberSuffix.PO)); - getAprovedBill().setDeptId(getBillNumberBean().institutionBillNumberGenerator(getRequestedBill().getDepartment(), BillType.StoreOrderApprove, BillClassType.BilledBill, BillNumberSuffix.PO)); getAprovedBill().setInsId(getBillNumberBean().institutionBillNumberGenerator(getRequestedBill().getInstitution(), BillType.StoreOrderApprove, BillClassType.BilledBill, BillNumberSuffix.PO)); @@ -242,7 +266,7 @@ public void saveBillComponent() { getBillFacade().edit(getAprovedBill()); } - + public String navigateToPurchaseOrderApproval() { printPreview = false; return "/store/store_purhcase_order_approving?faces-redirect=true"; @@ -330,7 +354,7 @@ public StoreBean getStoreBean() { public void setStoreBean(StoreBean storeBean) { this.storeBean = storeBean; } - + public void calTotal() { double tmp = 0; int serialNo = 0; @@ -374,7 +398,6 @@ public void setBillsToApprove(List billsToApprove) { this.billsToApprove = billsToApprove; } - public boolean getPrintPreview() { return printPreview; } @@ -455,4 +478,15 @@ public int getMaxResult() { public void setMaxResult(int maxResult) { this.maxResult = maxResult; } + + public BillItem getCurrentBillItem() { + if(currentBillItem == null){ + currentBillItem = new BillItem(); + } + return currentBillItem; + } + + public void setCurrentBillItem(BillItem currentBillItem) { + this.currentBillItem = currentBillItem; + } } diff --git a/src/main/webapp/store/store_purhcase_order_approving.xhtml b/src/main/webapp/store/store_purhcase_order_approving.xhtml index b0e03141ca..2ae5d6dde3 100644 --- a/src/main/webapp/store/store_purhcase_order_approving.xhtml +++ b/src/main/webapp/store/store_purhcase_order_approving.xhtml @@ -91,40 +91,38 @@
- +
+ + + +
- + - - - #{bi.searialNo} - - - + #{bi.item.name} - - - + + + - - - - + + + - + - - + + @@ -132,30 +130,111 @@ - + - - + + - + - + - - + +
+ +
+
- + +
+ +
+ + + + + + + + + + + + +
+
+ +
+ +
+ + + + + + + + + +
+
+ +
+ + + + + - +