diff --git a/src/main/java/org/isf/medicalstock/gui/MovStockMultipleCharging.java b/src/main/java/org/isf/medicalstock/gui/MovStockMultipleCharging.java index a4d6c1750f..c3d11f6ae1 100644 --- a/src/main/java/org/isf/medicalstock/gui/MovStockMultipleCharging.java +++ b/src/main/java/org/isf/medicalstock/gui/MovStockMultipleCharging.java @@ -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(); @@ -542,7 +549,7 @@ protected double askTotalCost() { return total; } - protected Lot askLot() { + protected Lot askLot(Medical med) { LocalDateTime preparationDate; LocalDateTime expiringDate; Lot lot = null; @@ -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;