Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9867 debtor analysis due reports bugfixes #10141

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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