diff --git a/src/main/java/com/divudi/bean/common/CreditCompanyDueController.java b/src/main/java/com/divudi/bean/common/CreditCompanyDueController.java index f8fd595696..730f3c666d 100644 --- a/src/main/java/com/divudi/bean/common/CreditCompanyDueController.java +++ b/src/main/java/com/divudi/bean/common/CreditCompanyDueController.java @@ -1052,6 +1052,65 @@ public void createInwardCashDue() { } } + public void createInwardCashDueData() { + Date startTime = new Date(); + + HashMap m = new HashMap(); + String sql = " Select b from PatientEncounter b" + + " JOIN b.finalBill fb" + + " where b.retired=false " + + " and b.paymentFinalized=true " + + " and b.dateOfDischarge between :fd and :td " + + " and (abs(b.finalBill.netTotal)-(abs(b.finalBill.paidAmount)+abs(b.creditPaidAmount))) > 0.1 "; + + if (admissionType != null) { + sql += " and b.admissionType =:ad "; + m.put("ad", admissionType); + } + if (institution != null) { + sql += " and b.creditCompany =:ins "; + m.put("ins", institution); + } + + if (paymentMethod != null) { + sql += " and b.paymentMethod =:pm "; + m.put("pm", paymentMethod); + } + + if (institutionOfDepartment != null) { + sql += "AND fb.institution = :insd "; + m.put("insd", institutionOfDepartment); + } + + if (department != null) { + sql += "AND fb.department = :dep "; + m.put("dep", department); + } + + if (site != null) { + sql += "AND fb.department.site = :site "; + m.put("site", site); + } + + sql += " order by b.dateOfDischarge"; + + m.put("fd", fromDate); + m.put("td", toDate); + patientEncounters = patientEncounterFacade.findByJpql(sql, m, TemporalType.TIMESTAMP); + + if (patientEncounters == null) { + return; + } + billed = 0; + paidByPatient = 0; + paidByCompany = 0; + for (PatientEncounter p : patientEncounters) { + billed += p.getFinalBill().getNetTotal(); + paidByPatient += p.getFinalBill().getSettledAmountByPatient(); + paidByCompany += p.getPaidByCreditCompany(); + } + } + double billed; double paidByPatient; double paidByCompany; diff --git a/src/main/webapp/reports/financialReports/inward_due_search.xhtml b/src/main/webapp/reports/financialReports/inward_due_search.xhtml index d2ff091eeb..995e0d09cf 100644 --- a/src/main/webapp/reports/financialReports/inward_due_search.xhtml +++ b/src/main/webapp/reports/financialReports/inward_due_search.xhtml @@ -207,7 +207,7 @@ ajax="false" value="Process" icon="fas fa-cogs" - action="#{creditCompanyDueController.createInwardCashDue()}"> + action="#{creditCompanyDueController.createInwardCashDueData()}"> - + @@ -295,10 +295,9 @@ - - + diff --git a/src/main/webapp/reports/financialReports/inward_due_search_credit_company.xhtml b/src/main/webapp/reports/financialReports/inward_due_search_credit_company.xhtml index 0543a65e88..a9c3c8bf32 100644 --- a/src/main/webapp/reports/financialReports/inward_due_search_credit_company.xhtml +++ b/src/main/webapp/reports/financialReports/inward_due_search_credit_company.xhtml @@ -163,7 +163,7 @@ - +