Skip to content

Commit

Permalink
9867 debtor analysis due reports bugfixes (#10141)
Browse files Browse the repository at this point in the history
* debtor analysis due search fix

* Debtor Analysis-Due Search (Credit Company) fix

---------

Co-authored-by: imexh <[email protected]>
  • Loading branch information
ImeshRanawellaSG and imexh authored Jan 20, 2025
1 parent 50358c2 commit ad4d736
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
ajax="false"
value="Process"
icon="fas fa-cogs"
action="#{creditCompanyDueController.createInwardCashDue()}">
action="#{creditCompanyDueController.createInwardCashDueData()}">
</p:commandButton>

<p:commandButton
Expand Down Expand Up @@ -274,7 +274,7 @@
</f:facet>
</p:column>
<p:column headerText="Paid By Patient" style="text-align: right;">
<h:outputLabel value="#{p.finalBill.paidAmount}">
<h:outputLabel value="#{p.finalBill.settledAmountByPatient}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
<f:facet name="footer">
Expand All @@ -295,10 +295,9 @@
</f:facet>
</p:column>


<p:column headerText="Due" style="text-align: right;" >

<h:outputLabel value="#{(p.finalBill.netTotal-(p.finalBill.paidAmount+p.paidByCreditCompany)) gt 0? (p.finalBill.netTotal-(p.finalBill.paidAmount+p.paidByCreditCompany)):0.00}">
<h:outputLabel value="#{(p.finalBill.netTotal-(p.finalBill.settledAmountByPatient+p.paidByCreditCompany)) gt 0? (p.finalBill.netTotal-(p.finalBill.settledAmountByPatient+p.paidByCreditCompany)):0.00}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
<f:facet name="footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
</h:outputLabel>
</p:column>
<p:column style="text-align: right;" rendered="#{!creditCompanyDueController.withOutDueUpdate}" >
<h:outputLabel value="#{b.finalBill.paidAmount}" >
<h:outputLabel value="#{b.finalBill.settledAmountByPatient}" >
<f:convertNumber pattern="#,##0.00" />
</h:outputLabel>
</p:column>
Expand Down

0 comments on commit ad4d736

Please sign in to comment.