Skip to content

Commit

Permalink
Add blank line
Browse files Browse the repository at this point in the history
  • Loading branch information
mwithi committed Jan 24, 2025
1 parent 544d027 commit 135cd69
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void windowClosing(WindowEvent e) {
printButton.setVisible(true);
selectButton.setEnabled(false);
codeTextField.setEnabled(false);

} else {
saveButton.setVisible(true);
validateButton.setVisible(true);
Expand Down Expand Up @@ -563,13 +563,14 @@ private JButton getSelectedButton() {
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
int choice = MessageDialog.yesNo(frame, "angal.inventory.areyousureyouwantoclosethiswindow.msg");
if (choice == JOptionPane.YES_OPTION) {
frame.dispose();
}
}

@Override
public void windowClosing(WindowEvent e) {
int choice = MessageDialog.yesNo(frame, "angal.inventory.areyousureyouwantoclosethiswindow.msg");
if (choice == JOptionPane.YES_OPTION) {
frame.dispose();
}
}
});
frame.setVisible(true);
});
Expand Down Expand Up @@ -1013,7 +1014,8 @@ private JButton getValidateButton() {
String wardCode = inventory.getDestination();
String lastReference = inventory.getInventoryReference();
LocalDateTime lastDate = inventory.getInventoryDate();
List<MedicalInventoryRow> invRowWithoutRealQty = inventoryRowSearchList.stream().filter(invRow -> invRow.getRealQty() == 0 && invRow.isNewLot()).collect(Collectors.toList());
List<MedicalInventoryRow> invRowWithoutRealQty = inventoryRowSearchList.stream().filter(invRow -> invRow.getRealQty() == 0 && invRow.isNewLot())
.collect(Collectors.toList());
if (!invRowWithoutRealQty.isEmpty()) {
MessageDialog.error(null, "angal.inventory.allinventoryrowswithnewlotshouldhaverealqtygreatterthanzero.msg");
return;
Expand All @@ -1025,7 +1027,7 @@ private JButton getValidateButton() {
}
if (checkParameters(wardCode, chargeCode, dischargeCode, supplierId, lastReference, lastDate)) {
MessageDialog.error(null, "angal.inventory.pleasesaveinventorybeforevalidateit.msg");
return;
return;
}
// validate inventory
try {
Expand Down Expand Up @@ -1057,10 +1059,10 @@ private JButton getValidateButton() {
} else {
try {
inventory.setStatus(InventoryStatus.draft.toString());
statusLabel.setText(InventoryStatus.draft.toString().toUpperCase());
statusLabel.setForeground(Color.GRAY);
inventory = medicalInventoryManager.updateMedicalInventory(inventory, true);
fireInventoryUpdated();
statusLabel.setText(InventoryStatus.draft.toString().toUpperCase());
statusLabel.setForeground(Color.GRAY);
inventory = medicalInventoryManager.updateMedicalInventory(inventory, true);
fireInventoryUpdated();
} catch (OHServiceException ex) {
OHServiceExceptionUtil.showMessages(ex);
}
Expand Down Expand Up @@ -1099,7 +1101,8 @@ private JButton getConfirmButton() {
String wardCode = inventory.getDestination();
String lastReference = inventory.getInventoryReference();
LocalDateTime lastDate = inventory.getInventoryDate();
List<MedicalInventoryRow> invRowWithoutRealQty = inventoryRowSearchList.stream().filter(invRow -> invRow.getRealQty() == 0 && invRow.isNewLot()).collect(Collectors.toList());
List<MedicalInventoryRow> invRowWithoutRealQty = inventoryRowSearchList.stream().filter(invRow -> invRow.getRealQty() == 0 && invRow.isNewLot())
.collect(Collectors.toList());
if (!invRowWithoutRealQty.isEmpty()) {
MessageDialog.error(null, "angal.inventory.allinventoryrowswithnewlotshouldhaverealqtygreatterthanzero.msg");
return;
Expand All @@ -1111,7 +1114,7 @@ private JButton getConfirmButton() {
}
if (checkParameters(wardCode, chargeCode, dischargeCode, supplierId, lastReference, lastDate)) {
MessageDialog.error(null, "angal.inventory.pleasesaveinventorybeforeconfirmation.msg");
return;
return;
}
// confirm inventory
try {
Expand Down Expand Up @@ -1478,6 +1481,7 @@ private Lot askLot(Lot lotToUpdate) {
} while (lot == null);
return lot;
}

private BigDecimal askCost(int qty, BigDecimal lastCost) {
double cost = 0.;
do {
Expand Down Expand Up @@ -2077,23 +2081,23 @@ private void resetVariable() {
}

private boolean checkParameters(String wardCode, String chargeCode, String dischargeCode, Integer supplierId, String reference, LocalDateTime date) {
return !lotsSaved.isEmpty()
|| !inventoryRowListAdded.isEmpty()
|| !lotsDeleted.isEmpty()
|| !inventoryRowsToDelete.isEmpty()
|| (destination != null && isMismatch(destination.getCode(), wardCode))
|| (chargeType != null && isMismatch(chargeType.getCode(), chargeCode))
|| (dischargeType != null && isMismatch(dischargeType.getCode(), dischargeCode))
|| (supplier != null && supplier.getSupId() != supplierId)
|| !isSameDate(date, dateInventory);
}
return !lotsSaved.isEmpty()
|| !inventoryRowListAdded.isEmpty()
|| !lotsDeleted.isEmpty()
|| !inventoryRowsToDelete.isEmpty()
|| (destination != null && isMismatch(destination.getCode(), wardCode))
|| (chargeType != null && isMismatch(chargeType.getCode(), chargeCode))
|| (dischargeType != null && isMismatch(dischargeType.getCode(), dischargeCode))
|| (supplier != null && supplier.getSupId() != supplierId)
|| !isSameDate(date, dateInventory);
}

private boolean isMismatch(String value, String expectedValue) {
return !value.equals(expectedValue);
return !value.equals(expectedValue);
}

private boolean isSameDate(LocalDateTime date1, LocalDateTime date2) {
return date1.toLocalDate().equals(date2.toLocalDate());
return date1.toLocalDate().equals(date2.toLocalDate());
}

private JComboBox<MedicalType> getJComboMedicalType() {
Expand Down

0 comments on commit 135cd69

Please sign in to comment.