Skip to content

Commit

Permalink
Fix when medical has no previous lots
Browse files Browse the repository at this point in the history
  • Loading branch information
mwithi committed Oct 29, 2024
1 parent b24196c commit 2a54222
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,17 @@ private JTextField getJTextFieldSearch() {
do {
lot = chooseLot(med);
if (lot == null) {
lot = askLot();
lot = askLot(med);
if (lot == null) {
return;
}
if (GeneralData.LOTWITHCOST) {
BigDecimal cost = askCost(qty);
if (cost.compareTo(new BigDecimal(0)) == 0) {
return;
}
lot.setCost(cost);
}
}
// Lot Cost
BigDecimal cost = lot.getCost();
Expand Down Expand Up @@ -542,7 +549,7 @@ protected double askTotalCost() {
return total;
}

protected Lot askLot() {
protected Lot askLot(Medical med) {
LocalDateTime preparationDate;
LocalDateTime expiringDate;
Lot lot = null;
Expand Down Expand Up @@ -585,6 +592,7 @@ protected Lot askLot() {
expiringDate = expireDateChooser.getDateEndOfDay();
preparationDate = preparationDateChooser.getDateStartOfDay();
lot = new Lot(lotName, preparationDate, expiringDate);
lot.setMedical(med);
}
} else {
return null;
Expand Down

0 comments on commit 2a54222

Please sign in to comment.