private void updateControlsState() { form.getContextMenus().getFluidBalanceNEW_FLUIDItem().setVisible(true); form.getContextMenus().getFluidBalanceUPDATE_FLUIDItem().setVisible(form.grdDetails().getValue() instanceof FluidBalanceInstanceVo); form.getContextMenus().getFluidBalanceCONFIRMItem().setVisible(form.grdDetails().getValue() instanceof SignatoryShiftDetailsVo); //Cant be a student nurse MemberOfStaffShortVo mos = (MemberOfStaffShortVo)domain.getMosUser(); if (mos != null && mos.getHcpIsNotNull()) { if (mos.getHcp() instanceof NurseVo) { if (HcpDisType.STUDENTNURSE.equals(((NurseVo) mos.getHcp()).getNurseType())) form.getContextMenus().getFluidBalanceCONFIRMItem().setVisible(false); } } //Check is already confirmed if (form.grdDetails().getValue() instanceof SignatoryShiftDetailsVo && ((SignatoryShiftDetailsVo)form.grdDetails().getValue()).getDateTimeSignedIsNotNull()) form.getContextMenus().getFluidBalanceCONFIRMItem().setVisible(false); }
private boolean checkExistingTime(DailyFluidBalanceVo voDaily, FluidBalanceInstanceVo voFluidBalInst) { FluidBalanceInstanceVoCollection voFluidBalInstances = voDaily.getFluidBalanceInstances(); boolean result = false; if(voFluidBalInstances != null) { for(int x=0; x<voFluidBalInstances.size(); x++) { FluidBalanceInstanceVo voFluidBalInstance = voFluidBalInstances.get(x); Time existingTime = voFluidBalInstance.getStartTime(); Time newTime = voFluidBalInst.getStartTime(); if(newTime.isLessOrEqualThan(existingTime)) { result = true; break; } } return result; } return result; }
private void populateDataFromScreen() { SignatoryShiftDetailsVo voChosenSignatoryShiftDetails = form.getGlobalContext().Core.getChosenSignatoryShiftDetailsVo(); DailyFluidBalanceVo voDFB = form.getGlobalContext().Core.getCurrentDailyFluidBalanceVo(); DateTime dtNow = new DateTime(); voChosenSignatoryShiftDetails.setSignedOffBy(form.qmbConfirmed().getValue()); voChosenSignatoryShiftDetails.setDateTimeSigned(dtNow); for (int i = 0 ; i < voDFB.getFluidBalanceInstances().size() ; i++) { if (voDFB.getFluidBalanceInstances().get(i).getSignatoryShiftIsNotNull() && voDFB.getFluidBalanceInstances().get(i).getSignatoryShift().equals(voChosenSignatoryShiftDetails)) { FluidBalanceInstanceVo voFluid = voDFB.getFluidBalanceInstances().get(i); voFluid.setConfirmingDateTime(dtNow); voFluid.setConfirmingHCP(form.qmbConfirmed().getValue()); voFluid.setIsConfirmed(Boolean.TRUE); voDFB.getFluidBalanceInstances().set(i, voFluid); } } form.getLocalContext().setCurrentDailyFluidBalanceVo(voDFB); }
private void updateFluid() { if (form.grdDetails().getValue() instanceof FluidBalanceInstanceVo) { form.getGlobalContext().Core.setCurrentDailyFluidBalanceInstanceVo((FluidBalanceInstanceVo)form.grdDetails().getSelectedRow().getValue()); form.getGlobalContext().Core.setCurrentDailyFluidBalanceVo((DailyFluidBalanceVo)form.grdDetails().getSelectedRow().getParentRow().getParentRow().getValue()); engine.open(form.getForms().Core.FluidBalanceDetails); } }
private boolean isFluidBalanceInThisShift(SignatoryShiftDetailsVo voShift, FluidBalanceInstanceVo voFluidBalInstance) { DailyPatternConfigVo configVo = form.getGlobalContext().Core.getCurrentDailyPatternConfigVo(); if (configVo.getSignatoryPeriodIsNotNull()) { for (int j = 0 ; j < configVo.getSignatoryPeriod().size() ; j++) { SignatoryPeriodConfigVo voPeriod = configVo.getSignatoryPeriod().get(j); if (voPeriod.getTimePeriodsIsNotNull()) { for (int i = 0 ; i < voPeriod.getTimePeriods().size() ; i++) { if (voShift.getStartTimeIsNotNull() && voShift.getStartTime().equals(voPeriod.getTimePeriods().get(i))) { //Shift Found now see if the FluidBalanceInstanceVo is in this shift for (int k = 0 ; k < voPeriod.getTimePeriods().size() ; k++) { if (voFluidBalInstance.getTimePeriodIsNotNull() && voFluidBalInstance.getTimePeriod().equals(voPeriod.getTimePeriods().get(k))) return true; } } } } } } return false; }
private Integer calculateTotalOutput(FluidBalanceInstanceVo voFluidBal) { Integer totalOut = form.getLocalContext().getCurrentTotalOutput(); if(voFluidBal.getTotalOutputIsNotNull()) { int newTotal = voFluidBal.getTotalOutput().intValue(); if(totalOut != null) newTotal += totalOut.intValue(); form.getLocalContext().setCurrentTotalOutput(new Integer(newTotal)); } return form.getLocalContext().getCurrentTotalOutput(); }
private Integer calculateTotalInput(FluidBalanceInstanceVo voFluidBal) { Integer totalInput = form.getLocalContext().getCurrentTotalInput(); if(voFluidBal.getTotalIntakeIsNotNull()) { int newTotal = voFluidBal.getTotalIntake().intValue(); if(totalInput != null) newTotal += totalInput.intValue(); form.getLocalContext().setCurrentTotalInput(new Integer(newTotal)); } return form.getLocalContext().getCurrentTotalInput(); }
private String createMissingPeriodsMessage(FluidBalanceInstanceVoCollection fluidBalanceInstances) { SignatoryPeriodConfigVo voPeriod = form.getLocalContext().getCurrentSignatoryPeriodConfigVo(); StringBuffer bfr = new StringBuffer(); if(voPeriod!=null) for (int periods = 0 ; periods < voPeriod.getTimePeriods().size() ; periods++) { boolean bFound = false; for (int i = 0 ; i < fluidBalanceInstances.size() ; i++) { FluidBalanceInstanceVo voFluidBalInst = fluidBalanceInstances.get(i); if (voPeriod.getTimePeriods().get(periods).equals(voFluidBalInst.getTimePeriod()) ) bFound = true; } if (!bFound) { bfr.append(getConfiguredTime(voPeriod.getTimePeriods().get(periods))); bfr.append(", "); } } if (bfr.length() == 0) return ""; else return "<B>Note: There are no Fluid Balance records recorded for " + bfr.toString().substring(0, bfr.length() - 2) + "</B>"; }
private boolean isFluidBalanceInThisShift(SignatoryShiftDetailsVo voShift, FluidBalanceInstanceVo voFluidBalInstance) { DailyPatternConfigVo configVo = form.getGlobalContext().Core.getCurrentDailyPatternConfigVo(); if (configVo.getSignatoryPeriodIsNotNull()) { for (int j = 0 ; j < configVo.getSignatoryPeriod().size() ; j++) { SignatoryPeriodConfigVo voPeriod = configVo.getSignatoryPeriod().get(j); if (voPeriod.getTimePeriodsIsNotNull()) { for (int i = 0 ; i < voPeriod.getTimePeriods().size() ; i++) { if (voShift.getStartTimeIsNotNull() && voShift.getStartTime().equals(voPeriod.getTimePeriods().get(i))) { //This is the correct configured Shift, save it to use creating the missing periods message if (form.getLocalContext().getCurrentSignatoryPeriodConfigVo() == null) form.getLocalContext().setCurrentSignatoryPeriodConfigVo(voPeriod); //Shift Found now see if the FluidBalanceInstanceVo is in this shift for (int k = 0 ; k < voPeriod.getTimePeriods().size() ; k++) { if (voFluidBalInstance.getTimePeriodIsNotNull() && voFluidBalInstance.getTimePeriod().equals(voPeriod.getTimePeriods().get(k))) return true; } } } } } } return false; }