Skip to content

Commit

Permalink
Merge pull request #5962 from hmislk/Issue#5608
Browse files Browse the repository at this point in the history
Issue#5608 Closed #5608
  • Loading branch information
DeshaniPubudu committed Jun 26, 2024
2 parents 914f482 + b41bdb6 commit 73be61b
Show file tree
Hide file tree
Showing 16 changed files with 1,983 additions and 660 deletions.
4 changes: 1 addition & 3 deletions src/main/java/com/divudi/bean/common/BillSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -615,19 +615,17 @@ public void fillCashierSummery() {
bts.add(BillType.PharmacySale);
bts.add(BillType.PharmacyWholeSale);
bts.add(BillType.InwardPaymentBill);

bts.add(BillType.CollectingCentrePaymentReceiveBill);
bts.add(BillType.PaymentBill);
bts.add(BillType.PatientPaymentReceiveBill);

bts.add(BillType.CollectingCentreBill);
bts.add(BillType.PaymentBill);

bts.add(BillType.ChannelCash);
bts.add(BillType.ChannelPaid);
bts.add(BillType.ChannelAgent);
bts.add(BillType.ChannelProPayment);
bts.add(BillType.ChannelAgencyCommission);
bts.add(BillType.PettyCash);

billSummeries = generateBillSummaries(institution, department, user, bts, billClassType, fromDate, toDate);

Expand Down
19 changes: 14 additions & 5 deletions src/main/java/com/divudi/bean/common/PettyCashBillController.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private void saveBill() {

getCurrent().setInsId(getBillNumberBean().institutionBillNumberGenerator(getSessionController().getInstitution(), BillType.PettyCash, BillClassType.BilledBill, BillNumberSuffix.PTYPAY));
getCurrent().setDeptId(getBillNumberBean().institutionBillNumberGenerator(getSessionController().getDepartment(), BillType.PettyCash, BillClassType.BilledBill, BillNumberSuffix.PTYPAY));

getCurrent().setBillTypeAtomic(BillTypeAtomic.PETTY_CASH_ISSUE);
getCurrent().setBillType(BillType.PettyCash);

getCurrent().setDepartment(getSessionController().getDepartment());
Expand Down Expand Up @@ -308,7 +308,7 @@ public void settleBill() {

saveBill();
saveBillItem();

createPaymentForPettyCashBill(getCurrent(),getCurrent().getPaymentMethod());
WebUser wb = getCashTransactionBean().saveBillCashOutTransaction(getCurrent(), getSessionController().getLoggedUser());
getSessionController().setLoggedUser(wb);
JsfUtil.addSuccessMessage("Bill Saved");
Expand Down Expand Up @@ -340,26 +340,35 @@ public Payment createPaymentForPettyCashBillReturn(Bill rb, PaymentMethod pm) {
setPaymentMethodData(p, pm);
return p;
}

public void createPaymentForPettyCashBill(Bill b, PaymentMethod pm) {
Payment p = new Payment();
p.setBill(b);
p.setPaidValue(0 - Math.abs(b.getNetTotal()));
System.out.println("p = " + p.getPaidValue());
setPaymentMethodData(p, pm);

}

public void setPaymentMethodData(Payment p, PaymentMethod pm) {
p.setInstitution(getSessionController().getInstitution());
p.setDepartment(getSessionController().getDepartment());
p.setCreatedAt(new Date());
p.setCreater(getSessionController().getLoggedUser());
p.setPaymentMethod(pm);

if (p.getBill().getBillType() == BillType.PaymentBill) {
if (p.getBill().getBillType() == BillType.PettyCash) {
p.setPaidValue(p.getBill().getNetTotal());
} else {
p.setPaidValue(p.getBill().getCashPaid());
}

if (p.getId() == null) {
paymentFacade.create(p);
}

}



private Bill createPettyCashReturnBill() {
Bill rb = new RefundBill();
rb.copy(getCurrent());
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/divudi/bean/lab/PatientReportController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,7 @@ public void printPatientReport() {
currentPtIx.setPrintingAt(Calendar.getInstance().getTime());
currentPtIx.setPrintingUser(getSessionController().getLoggedUser());
currentPtIx.setPrintingDepartment(getSessionController().getDepartment());
currentPtIx.setPrinted(true);
getPiFacade().edit(currentPtIx);

currentPatientReport.setPrinted(Boolean.TRUE);
Expand All @@ -1822,6 +1823,29 @@ public void printPatientReport() {
getFacade().edit(currentPatientReport);

}

public String printPatientLabReport() {
if (currentPatientReport == null) {
JsfUtil.addErrorMessage("Nothing to approve");
return"";
}
currentPtIx.setPrinted(true);
currentPtIx.setPrintingAt(Calendar.getInstance().getTime());
currentPtIx.setPrintingUser(getSessionController().getLoggedUser());
currentPtIx.setPrintingDepartment(getSessionController().getDepartment());
currentPtIx.setPrinted(true);
getPiFacade().edit(currentPtIx);

currentPatientReport.setPrinted(Boolean.TRUE);
currentPatientReport.setPrintingAt(Calendar.getInstance().getTime());
currentPatientReport.setPrintingDepartment(getSessionController().getLoggedUser().getDepartment());
currentPatientReport.setPrintingInstitution(getSessionController().getLoggedUser().getInstitution());
currentPatientReport.setPrintingUser(getSessionController().getLoggedUser());
currentPatientReport.setPrinted(true);

getFacade().edit(currentPatientReport);
return"/lab/patient_report_print.xhtml";
}

public void pdfPatientReport() throws DocumentException, com.lowagie.text.DocumentException, IOException {
// long serialVersionUID = 626953318628565053L;
Expand Down
Loading

0 comments on commit 73be61b

Please sign in to comment.