diff --git a/src/main/java/org/isf/accounting/gui/PatientBillEdit.java b/src/main/java/org/isf/accounting/gui/PatientBillEdit.java index 4923780d49..23349004c3 100644 --- a/src/main/java/org/isf/accounting/gui/PatientBillEdit.java +++ b/src/main/java/org/isf/accounting/gui/PatientBillEdit.java @@ -845,11 +845,13 @@ private JButton getJButtonTrashPatient() { jButtonTrashPatient.setPreferredSize(new Dimension(25, 25)); jButtonTrashPatient.setIcon(new ImageIcon("rsc/icons/remove_patient_button.png")); jButtonTrashPatient.setToolTipText(MessageBundle.getMessage("angal.newbill.removethepatientassociatedwiththisbill.tooltip")); + if (thisBill.getBillPatient() == null) { + jButtonTrashPatient.setEnabled(false); + } jButtonTrashPatient.addActionListener(actionEvent -> { // BILL thisBill.setBillPatient(null); thisBill.setIsPatient(false); - thisBill.getBillPatient().setCode(0); thisBill.setPatName(""); //$NON-NLS-1$ thisBill.setAdmission(null); // INTERFACE @@ -895,6 +897,9 @@ private void setJButtonPickPatient() { jButtonPickPatient.setText(MessageBundle.getMessage("angal.newbill.changepatient.btn")); jButtonPickPatient.setMnemonic(MessageBundle.getMnemonic("angal.newbill.changepatient.btn.key")); jButtonPickPatient.setToolTipText(MessageBundle.getMessage("angal.newbill.changethepatientassociatedwiththisbill.tooltip")); + if (jButtonTrashPatient != null) { + jButtonTrashPatient.setEnabled(true); + } } }