Skip to content

Commit

Permalink
OP-1195 | Print ward Inventory (#2119)
Browse files Browse the repository at this point in the history
* Print inventory ward report

* fix bug
  • Loading branch information
JantBogard authored Jan 15, 2025
1 parent 8de1b12 commit a38556b
Show file tree
Hide file tree
Showing 7 changed files with 516 additions and 2 deletions.
1 change: 1 addition & 0 deletions bundle/language_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ angal.hospital.visitstarthour.txt
angal.lab.allnegative.txt = All negative.
angal.invetory.allmedicaladdedsuccessfully.msg = All medicals are added successfully.
angal.inventory.allproduct.btn = All products
angal.inventory.askforrealquantityempty.msg = Do you want to print without the real quantity?
angal.inventory.canceled = Canceled
angal.inventory.cancelednoteditable.msg = A canceled inventory can not be modified.
angal.inventory.cannotcreateanotherinventorywithotherinprogressinthisward.msg = Cannot create another inventory with other in progress in this ward.
Expand Down
Binary file added rpt_base/InventoryWard.jasper
Binary file not shown.
404 changes: 404 additions & 0 deletions rpt_base/InventoryWard.jrxml

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions rpt_base/InventoryWard.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#Generated by Eclipse Messages Editor (Eclipse Babel)

Inventory = Inventory

Code = Code

Status = Status

Reference = Reference

InventoryDate = Inventory Date

WardInventoryID = Ward INVENTORY ID

Designation = Designation

LotCode= Lot Code

DueDate = Due Date

TheoreticQuantity = Theoretic Quantity

RealQuantity = Real Quantity


25 changes: 25 additions & 0 deletions rpt_base/InventoryWard_en.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#Generated by Eclipse Messages Editor (Eclipse Babel)

Inventory = Inventory

Code = Code

Status = Status

Reference = Reference

InventoryDate = Inventory Date

WardInventoryID = WARD INVENTORY ID

Designation = Designation

LotCode= Lot Code

DueDate = Due Date

TheoreticQuantity = Theoretic Quantity

RealQuantity = Real Quantity


17 changes: 15 additions & 2 deletions src/main/java/org/isf/medicalinventory/gui/InventoryWardEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
import org.isf.medicalstockward.model.MedicalWard;
import org.isf.menu.manager.Context;
import org.isf.menu.manager.UserBrowsingManager;
import org.isf.stat.gui.report.GenericReportPharmaceuticalInventory;
import org.isf.stat.manager.JasperReportsManager;
import org.isf.utils.db.NormalizeString;
import org.isf.utils.exception.OHServiceException;
import org.isf.utils.exception.gui.OHServiceExceptionUtil;
Expand Down Expand Up @@ -213,6 +215,7 @@ private void fireInventoryInserted() {
private MovWardBrowserManager movWardBrowserManager = Context.getApplicationContext()
.getBean(MovWardBrowserManager.class);
private MovStockInsertingManager movStockInsertingManager = Context.getApplicationContext().getBean(MovStockInsertingManager.class);
private JasperReportsManager jasperReportsManager = Context.getApplicationContext().getBean(JasperReportsManager.class);

public InventoryWardEdit() {
mode = "new";
Expand Down Expand Up @@ -837,8 +840,18 @@ private BigDecimal askCost(BigDecimal lastCost) {
private JButton getPrintButton() {
printButton = new JButton(MessageBundle.getMessage("angal.common.print.btn"));
printButton.setMnemonic(MessageBundle.getMnemonic("angal.common.print.btn.key"));
return printButton;
}
printButton.setEnabled(true);

printButton.addActionListener(e -> {
int printRealQty = 0;
int response = MessageDialog.yesNo(this, "angal.inventory.askforrealquantityempty.msg");
if (response == JOptionPane.YES_OPTION) {
printRealQty = 1;
}
new GenericReportPharmaceuticalInventory(inventory, "InventoryWard", printRealQty);
});
return printButton;
}

private JButton getCloseButton() {
closeButton = new JButton(MessageBundle.getMessage("angal.common.close.btn"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Open Hospital (www.open-hospital.org)
* Copyright © 2006-2024 Informatici Senza Frontiere ([email protected])
*
* Open Hospital is a free and open source software for healthcare data management.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* https://www.gnu.org/licenses/gpl-3.0-standalone.html
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.isf.stat.gui.report;

import org.isf.medicalinventory.model.MedicalInventory;
import org.isf.menu.manager.Context;
import org.isf.stat.dto.JasperReportResultDto;
import org.isf.stat.manager.JasperReportsManager;
import org.isf.utils.jobjects.MessageDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GenericReportPharmaceuticalInventory extends DisplayReport {

private static final Logger LOGGER = LoggerFactory.getLogger(GenericReportPharmaceuticalInventory.class);
private JasperReportsManager jasperReportsManager = Context.getApplicationContext().getBean(JasperReportsManager.class);

public GenericReportPharmaceuticalInventory(MedicalInventory medicalInventory, String jasperFileName, int printRealQty) {
try {
JasperReportResultDto jasperReportResultDto = jasperReportsManager.getInventoryReportPdf(medicalInventory, jasperFileName, printRealQty);
showReport(jasperReportResultDto);
} catch (Exception e) {
LOGGER.error("", e);
MessageDialog.error(null, "angal.inventory.printing.error.msg");
}
}
}

0 comments on commit a38556b

Please sign in to comment.