From 7882759dbb217f1d06690dbc4aa6f2cc98133e02 Mon Sep 17 00:00:00 2001 From: Thiwanka Madushan Date: Sat, 20 Apr 2024 01:22:29 +0530 Subject: [PATCH] Signed-off-by: Thiwanka Madushan --- .../common/UserNotificationController.java | 31 +++++++++---------- .../bean/pharmacy/PharmacyBillSearch.java | 13 ++++++++ src/main/resources/META-INF/persistence.xml | 2 +- src/main/resources/VERSION.txt | 2 +- .../Notification/user_notifications.xhtml | 2 +- ...d_pharmacy_reprint_bht_issue_request.xhtml | 31 ++++++++++++++++--- 6 files changed, 58 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/divudi/bean/common/UserNotificationController.java b/src/main/java/com/divudi/bean/common/UserNotificationController.java index 3bd2a5f193..885f9d87f0 100644 --- a/src/main/java/com/divudi/bean/common/UserNotificationController.java +++ b/src/main/java/com/divudi/bean/common/UserNotificationController.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import javax.ejb.EJB; @@ -80,7 +81,6 @@ public class UserNotificationController implements Serializable { @Inject SmsManagerEjb smsManager; - public String navigateToRecivedNotification() { return "/Notification/user_notifications"; } @@ -88,22 +88,19 @@ public String navigateToRecivedNotification() { public String navigateToSentNotification() { return "/Notification/sent_notifications"; } - - public void clearCanceledRequestsNotification(){ - fillLoggedUserNotifications(); - if (items==null) { - return; + + public void clearCanceledRequestsNotification() { + if (items == null) { + return ; } - - for (UserNotification item : items) { - if (item.getNotification()==null) { - return; - } - if (item.getNotification().getBill().isCancelled()) { - items.remove(item); + for(UserNotification un : items){ + if (un.getNotification().getBill().isCancelled()) { + un.setRetired(true); + un.setRetiredAt(new Date()); + getFacade().edit(un); } } - + fillLoggedUserNotifications(); } public void save(UserNotification userNotification) { @@ -171,17 +168,19 @@ public List fillLoggedUserNotifications() { + " from UserNotification un " + " where un.seen=:seen " + " and un.webUser=:wu " - + " and un.notification.completed=:com"; + + " and un.notification.completed=:com" + + " and un.retired=:ret"; Map m = new HashMap(); m.put("seen", false); m.put("com", false); + m.put("ret", false); m.put("wu", sessionController.getLoggedUser()); items = getFacade().findByJpql(jpql, m); return items; } public String navigateToCurrentNotificationRequest(UserNotification un) { - Department toDepartmentFromNotification=un.getNotification().getBill().getToDepartment(); + Department toDepartmentFromNotification = un.getNotification().getBill().getToDepartment(); if (!toDepartmentFromNotification.equals(sessionController.getLoggedUser().getDepartment())) { JsfUtil.addErrorMessage("You can't Access On Current Department !"); return ""; diff --git a/src/main/java/com/divudi/bean/pharmacy/PharmacyBillSearch.java b/src/main/java/com/divudi/bean/pharmacy/PharmacyBillSearch.java index 77dfee4c38..2e56e9f977 100644 --- a/src/main/java/com/divudi/bean/pharmacy/PharmacyBillSearch.java +++ b/src/main/java/com/divudi/bean/pharmacy/PharmacyBillSearch.java @@ -143,6 +143,19 @@ public class PharmacyBillSearch implements Serializable { InwardBeanController inwardBean; @Inject PharmacySaleController pharmacySaleController; + + public String cancelInwardPharmacyRequestBill(){ + if (bill==null) { + JsfUtil.addErrorMessage("Not Bill Found !"); + return ""; + } + CancelledBill cb=pharmacyCreateCancelBill(); + cb.setBillItems(getBill().getBillItems()); + bill.setCancelled(true); + bill.setCancelledBill(cb); + billFacade.edit(bill); + return "/ward/ward_pharmacy_bht_issue_request_bill_search?faces-redirect=true"; + } public void markAsChecked() { if (bill == null) { diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index 2b40a19d63..c5c51af6f6 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/arogyaNew + jdbc/arogya false diff --git a/src/main/resources/VERSION.txt b/src/main/resources/VERSION.txt index 1bca19c190..3f14ec73d3 100644 --- a/src/main/resources/VERSION.txt +++ b/src/main/resources/VERSION.txt @@ -1 +1 @@ -3.0.0.20240419.9 +3.0.0.20240419.4 diff --git a/src/main/webapp/Notification/user_notifications.xhtml b/src/main/webapp/Notification/user_notifications.xhtml index 233df24791..2a664f16e9 100644 --- a/src/main/webapp/Notification/user_notifications.xhtml +++ b/src/main/webapp/Notification/user_notifications.xhtml @@ -19,7 +19,7 @@ action="#{userNotificationController.clearCanceledRequestsNotification()}"/> -
+
diff --git a/src/main/webapp/ward/ward_pharmacy_reprint_bht_issue_request.xhtml b/src/main/webapp/ward/ward_pharmacy_reprint_bht_issue_request.xhtml index 9ff8b8a440..d749fb5ae6 100644 --- a/src/main/webapp/ward/ward_pharmacy_reprint_bht_issue_request.xhtml +++ b/src/main/webapp/ward/ward_pharmacy_reprint_bht_issue_request.xhtml @@ -13,13 +13,36 @@ - + - - + + + + + + + +

Are you sure you want to cancel the request?

+ + + +
+ +
@@ -59,7 +82,7 @@
- +