@Override protected void onBtnSuspendedClick() throws PresentationLogicException { if (form.btnSuspended().getText().equals(SUSPENDED)) { engine.open(form.getForms().Clinical.EDischargePharmacyApprovalSuspendedDialog); } else if (form.btnSuspended().getText().equals(UNSUSPENDED)) //wdev-13848 { // Update the 'Last Updating Pharmacist' field // - will only be updated if the current user is a HCP updateLastUpdatingPharmacist(); TTAMedicationAndPharmacyVo currentRecord = form.getLocalContext().getEditedRecord(); TTAStatusVoCollection statusHistory = currentRecord.getTTAStatusHistory().sort(SortOrder.DESCENDING); TTAStatusVo newStatus = null; for (int i = 0; i < statusHistory.size(); i++) { if (statusHistory.get(i).equals(currentRecord.getCurrentTTAStatus())) continue; else { newStatus = statusHistory.get(i); updateStatus(newStatus.getStatus()); if (save()) { form.getLocalContext().setMedicationStatusToBeSet(EDischargeComponentStatus.EDITABLE); form.btnSuspended().setText(SUSPENDED); manageStatus(form.getLocalContext().getEditedRecord()); } break; } } } }
@Override protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { if (args != null && args.length > 0) { if (args[0] instanceof TTAStatusVoCollection) { populateDataFromScreen(((TTAStatusVoCollection)args[0]).sort(SortOrder.DESCENDING)); } } }
private void populateDataFromScreen(TTAStatusVoCollection ttaStatusVoCollection) { for (int i = 0; i < ttaStatusVoCollection.size(); i++) { TTAStatusVo status = ttaStatusVoCollection.get(i); grdHistoryRow row = form.grdHistory().getRows().newRow(); row.setColDateTime(status.getStatusDateTimeIsNotNull() ? status.getStatusDateTime().toString() : null); row.setColUser(status.getAuthoringUserIsNotNull() ? status.getAuthoringUser().getName().toString() : null); row.setColStatus(status.getStatusIsNotNull() ? status.getStatus().getText() : null); if (status.getReasonForRejectionIsNotNull()) row.setColReason(status.getReasonForRejection()); else if (status.getReasonForSuspensionIsNotNull()) row.setColReason(status.getReasonForSuspension()); } }
@Override protected void onBtnApproveClick() throws PresentationLogicException { form.getContextMenus().Clinical.hideAllEDischargeMedsSthkMenuMenuItems(); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuViewItem().setVisible((form.getMode().equals(FormMode.VIEW) ? true: false) && form.dyngrdMedication().getSelectedRow() != null ? true : false); if (form.btnApprove().getText().equals(APPROVE)) { if (form.dyngrdMedication().getRows().size() == 0) { form.getLocalContext().setPharmApproveConfirmMsgBoxId(engine.showMessage("The medication grid doesn't contain any records!\nAre you sure you want to approve?", "Please confirm", MessageButtons.YESNO, MessageIcon.QUESTION)); return; } // Update the 'Last Updating Pharmacist' field // - will only be updated if the current user is a HCP updateLastUpdatingPharmacist(); doApprove(); } else if (form.btnApprove().getText().equals(UNAPPROVE)) { TTAMedicationAndPharmacyVo currentRecord = form.getLocalContext().getEditedRecord(); TTAStatusVoCollection statusHistory = currentRecord.getTTAStatusHistory().sort(SortOrder.DESCENDING); TTAStatusVo newStatus = null; for (int i = 0; i < statusHistory.size(); i++) { if (statusHistory.get(i).equals(currentRecord.getCurrentTTAStatus())) { continue; } else { if (statusHistory.get(i).getStatus().equals(TTAStatus.SUBMITTED) || statusHistory.get(i).getStatus().equals(TTAStatus.RESUBMITTED)) { newStatus = statusHistory.get(i); updateStatus(newStatus.getStatus()); // Update the 'Last Updating Pharmacist' field // - will only be updated if the current user is a HCP updateLastUpdatingPharmacist(); if (save()) { form.btnApprove().setText(APPROVE); manageStatus(form.getLocalContext().getEditedRecord()); } break; } } } } }