diff --git a/src/main/java/com/divudi/bean/common/UserNotificationController.java b/src/main/java/com/divudi/bean/common/UserNotificationController.java index 070bbd6650..afdc2fffda 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) { @@ -170,17 +167,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 9e1427ae26..3acb01707b 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/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 @@
- +