Skip to content

Commit

Permalink
Merge branch 'development' into update_the_pharmacy_income_report_wit…
Browse files Browse the repository at this point in the history
…h_new_bill_type_atomics_#9838
  • Loading branch information
DamithDeshan authored Dec 24, 2024
2 parents ca50719 + ba17786 commit ca9044c
Showing 1 changed file with 111 additions and 3 deletions.
114 changes: 111 additions & 3 deletions src/main/java/com/divudi/bean/common/ReportsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public void setSelectedDateType(String selectedDateType) {
this.selectedDateType = selectedDateType;
}


public Investigation getInvestigation() {
return investigation;
}
Expand Down Expand Up @@ -3521,8 +3522,113 @@ public Double calculateDiscountByBills(List<Bill> bills) {
return discount;
}

public Double calculateSubTotal() {
double subTotal = 0.0;
public Double calculateNetAmountNetTotal() {
double netAmountNetTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();

for (Map.Entry<Institution, List<Bill>> entry : billMap.entrySet()) {
List<Bill> bills = entry.getValue();

netAmountNetTotal += calculateNetAmountSubTotalByBills(bills);
}

return netAmountNetTotal;
}

public Double calculateGrossAmountSubTotalByBills(List<Bill> bills) {
Double billTotal = 0.0;

for (Bill bill : bills) {
billTotal += bill.getBillTotal();
}

return billTotal;
}

public Double calculatePatientShareSubTotalByBills(List<Bill> bills) {
Double settledAmountByPatient = 0.0;

for (Bill bill : bills) {
settledAmountByPatient += bill.getSettledAmountByPatient();
}

return settledAmountByPatient;
}

public Double calculateSponsorShareSubTotalByBills(List<Bill> bills) {
Double settledAmountBySponsor = 0.0;

for (Bill bill : bills) {
settledAmountBySponsor += bill.getSettledAmountBySponsor();
}

return settledAmountBySponsor;
}

public Double calculateDueAmountSubTotalByBills(List<Bill> bills) {
Double balance = 0.0;

for (Bill bill : bills) {
balance += bill.getBalance();
}

return balance;
}

public Double calculateGrossAmountNetTotal() {
double grossAmountNetTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();

for (Map.Entry<Institution, List<Bill>> entry : billMap.entrySet()) {
List<Bill> bills = entry.getValue();

grossAmountNetTotal += calculateGrossAmountSubTotalByBills(bills);
}

return grossAmountNetTotal;
}

public Double calculateDiscountNetTotal() {
double discountNetTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();

for (Map.Entry<Institution, List<Bill>> entry : billMap.entrySet()) {
List<Bill> bills = entry.getValue();

discountNetTotal += calculateDiscountSubTotalByBills(bills);
}

return discountNetTotal;
}

public Double calculatePatientShareNetTotal() {
double patientShareNetTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();

for (Map.Entry<Institution, List<Bill>> entry : billMap.entrySet()) {
List<Bill> bills = entry.getValue();

patientShareNetTotal += calculatePatientShareSubTotalByBills(bills);
}

return patientShareNetTotal;
}

public Double calculateDueAmountNetTotal() {
double dueAmountNetTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();

for (Map.Entry<Institution, List<Bill>> entry : billMap.entrySet()) {
List<Bill> bills = entry.getValue();

dueAmountNetTotal += calculateDueAmountSubTotalByBills(bills);
}

return dueAmountNetTotal;
}

public Double calculateSponsorShareNetTotal() {
double sponsorShareNetTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();

for (Map.Entry<Institution, List<Bill>> entry : billMap.entrySet()) {
Expand Down Expand Up @@ -4009,7 +4115,9 @@ public void exportCollectionCenterBillWiseDetailReportToExcel() {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Collection_Center_Report.xlsx");

try (XSSFWorkbook workbook = new XSSFWorkbook(); OutputStream out = response.getOutputStream()) {
try (XSSFWorkbook workbook = new XSSFWorkbook();
OutputStream out = response.getOutputStream()) {


XSSFSheet sheet = workbook.createSheet("Report");
int rowIndex = 0;
Expand Down

0 comments on commit ca9044c

Please sign in to comment.