private void updateControlState() //WDEV-22796 { EmergencyAttendanceBillingVo currentEmergAttBilling = (form.getLocalContext().getAttendanceDetailsRefIsNotNull() ? domain.getAttendanceBillingByEmergencyAttendance(form.getLocalContext().getAttendanceDetailsRef()) : null); form.btnNew().setVisible(FormMode.VIEW.equals(form.getMode()) && currentEmergAttBilling == null && form.getLocalContext().getAttendanceDetailsRefIsNotNull()); //WDEV-22956 form.btnEdit().setVisible(FormMode.VIEW.equals(form.getMode()) && currentEmergAttBilling != null); form.cmbIsPatientExempt().setRequired(true); form.cmbIsPatientExempt().setEnabled(FormMode.EDIT.equals(form.getMode())); EDAttendanceControlsConfigVoCollection attendanceControlsConfig = domain.getEDAttendanceControlsConfig(EDAttendenceControlType.INV_BILL_CONTROLS); for (int i = 0; attendanceControlsConfig != null && i < attendanceControlsConfig.size(); i++) { EDAttendanceControlsConfigVo controlConfig = attendanceControlsConfig.get(i); if (EXEMPTION_REASON.equals(controlConfig.getControlIMSID())) { form.lblExemptionReason().setVisible(controlConfig.getIsVisible()); form.cmbExemptionReason().setVisible(controlConfig.getIsVisible()); form.cmbExemptionReason().setEnabled(FormMode.EDIT.equals(form.getMode()) && controlConfig.getIsEditable() && !YesNo.NO.equals(form.cmbIsPatientExempt().getValue())); form.cmbExemptionReason().setRequired(controlConfig.getIsRequired() || YesNo.YES.equals(form.cmbIsPatientExempt().getValue())); } else if (EXEMPTION_REASON_OTHER.equals(controlConfig.getControlIMSID())) { form.lblExemptionReasonOther().setVisible(controlConfig.getIsVisible()); form.txtExemptionReasonOther().setVisible(controlConfig.getIsVisible()); form.txtExemptionReasonOther().setEnabled(FormMode.EDIT.equals(form.getMode()) && !YesNo.NO.equals(form.cmbIsPatientExempt().getValue()) && (controlConfig.getIsEditable() || ExemptionReason.EXEMPT_OTHER.equals(form.cmbExemptionReason().getValue()))); form.txtExemptionReasonOther().setRequired(controlConfig.getIsRequired() || ExemptionReason.EXEMPT_OTHER.equals(form.cmbExemptionReason().getValue())); } else if (PAYMENT_MADE.equals(controlConfig.getControlIMSID())) { form.lblPaymentMade().setVisible(controlConfig.getIsVisible()); form.cmbPaymentMade().setVisible(controlConfig.getIsVisible()); form.cmbPaymentMade().setEnabled(FormMode.EDIT.equals(form.getMode()) && controlConfig.getIsEditable() && !YesNo.YES.equals(form.cmbIsPatientExempt().getValue())); form.cmbPaymentMade().setRequired(controlConfig.getIsRequired() || YesNo.NO.equals(form.cmbIsPatientExempt().getValue())); } else if (PAYMENT_TYPE.equals(controlConfig.getControlIMSID())) { form.lblPaymentType().setVisible(controlConfig.getIsVisible()); form.cmbPaymentType().setVisible(controlConfig.getIsVisible()); form.cmbPaymentType().setEnabled(FormMode.EDIT.equals(form.getMode()) && controlConfig.getIsEditable() && !YesNo.NO.equals(form.cmbPaymentMade().getValue())); form.cmbPaymentType().setRequired(controlConfig.getIsRequired() || (YesNo.NO.equals(form.cmbIsPatientExempt().getValue()) && !YesNo.NO.equals(form.cmbPaymentMade().getValue())));//WDEV-17160 } else if (INVOICE_AMOUNT.equals(controlConfig.getControlIMSID())) { form.lblInvoiceAmount().setVisible(controlConfig.getIsVisible()); //WDEV-22795 form.cmbInvoiceAmount().setVisible(controlConfig.getIsVisible()); form.cmbInvoiceAmount().setEnabled(FormMode.EDIT.equals(form.getMode()) && controlConfig.getIsEditable() && !YesNo.YES.equals(form.cmbIsPatientExempt().getValue())); form.cmbInvoiceAmount().setRequired(controlConfig.getIsRequired() || (YesNo.NO.equals(form.cmbIsPatientExempt().getValue()) && !YesNo.NO.equals(form.cmbPaymentMade().getValue())));//WDEV-17160 } else if (REASON_FOR_NON_PAYMENT.equals(controlConfig.getControlIMSID())) { form.lblReasonForNonPayment().setVisible(controlConfig.getIsVisible()); form.cmbReasonForNonPayment().setVisible(controlConfig.getIsVisible()); form.cmbReasonForNonPayment().setEnabled(FormMode.EDIT.equals(form.getMode()) && controlConfig.getIsEditable() && !YesNo.YES.equals(form.cmbIsPatientExempt().getValue()) && !YesNo.YES.equals(form.cmbPaymentMade().getValue())); //WDEV-22955 form.cmbReasonForNonPayment().setRequired(controlConfig.getIsRequired() || (YesNo.NO.equals(form.cmbIsPatientExempt().getValue()) && YesNo.NO.equals(form.cmbPaymentMade().getValue())) && !YesNo.YES.equals(form.cmbPaymentMade().getValue())); } else if (PAYMENT_REFUNDED.equals(controlConfig.getControlIMSID())) { form.lblPaymentRefunded().setVisible(controlConfig.getIsVisible()); form.cmbPaymentRefunded().setVisible(controlConfig.getIsVisible()); form.cmbPaymentRefunded().setEnabled(FormMode.EDIT.equals(form.getMode()) && controlConfig.getIsEditable() && !YesNo.YES.equals(form.cmbIsPatientExempt().getValue())); form.cmbPaymentRefunded().setRequired(controlConfig.getIsRequired()); } } //WDEV-22956 boolean SVUH_FUNCTIONALITY = ConfigFlag.UI.SVUH_MANDATORY_DEMOGRAPHIC_ATTRIBUTES.getValue(); form.btnSave().setVisible(FormMode.EDIT.equals(form.getMode()) && (!Boolean.TRUE.equals(form.getLocalContext().getIsNewAttendance()) || !SVUH_FUNCTIONALITY || Boolean.TRUE.equals(form.getLocalContext().getIsFinalTab()))); form.btnCancel().setVisible(FormMode.EDIT.equals(form.getMode()) && (!Boolean.TRUE.equals(form.getLocalContext().getIsNewAttendance()) || !SVUH_FUNCTIONALITY || Boolean.TRUE.equals(form.getLocalContext().getIsFinalTab()))); form.btnNext().setVisible(FormMode.EDIT.equals(form.getMode()) && !form.btnSave().isVisible()); }