Skip to content

Commit

Permalink
Merge pull request #9784 from hmislk/#9769_CalCulation_Error
Browse files Browse the repository at this point in the history
#9769 Calculation Error UPCR Investigation Closes #9769
  • Loading branch information
Irani96 authored Dec 23, 2024
2 parents 6600958 + 47bf2c6 commit 19f1897
Show file tree
Hide file tree
Showing 17 changed files with 6,046 additions and 342 deletions.
83 changes: 38 additions & 45 deletions src/main/java/com/divudi/bean/common/ReportsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import com.divudi.service.BillService;
import com.divudi.service.PatientInvestigationService;
import org.primefaces.model.StreamedContent;
import org.primefaces.model.charts.line.LineChartModel;
import org.primefaces.model.file.UploadedFile;

import javax.ejb.EJB;
Expand Down Expand Up @@ -316,16 +315,16 @@ public class ReportsController implements Serializable {
private String dischargedStatus;

private String selectedDateType = "invoice";

private boolean showChart;
private Investigation investigation;


// Map<Week, Map<ItemName, Map<dayOfMonth, Count>>>
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap7to7;
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap7to1;
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap1to7;


private boolean showChart;

public String getDischargedStatus() {
return dischargedStatus;
Expand Down Expand Up @@ -390,7 +389,8 @@ public String getSelectedDateType() {

public void setSelectedDateType(String selectedDateType) {
this.selectedDateType = selectedDateType;

}

public Investigation getInvestigation() {
return investigation;
}
Expand Down Expand Up @@ -1598,14 +1598,6 @@ public void setGroupedRouteWiseBillsMonthly(Map<Route, Map<YearMonth, Bill>> gro
this.groupedRouteWiseBillsMonthly = groupedRouteWiseBillsMonthly;
}

public boolean isShowChart() {
return showChart;
}

public void setShowChart(boolean showChart) {
this.showChart = showChart;
}

public void generateSampleCarrierReport() {
System.out.println("generateSampleCarrierReport = " + this);
bundle = new ReportTemplateRowBundle();
Expand Down Expand Up @@ -1662,7 +1654,7 @@ private ReportTemplateRowBundle generateSampleCarrierBillItems(List<BillTypeAtom
}

if (staff != null) {
jpql += "AND pi.sampleTransportedToLabByStaff.person.name = :staff ";
jpql += "AND billItem.patientInvestigation.barcodeGeneratedBy.webUserPerson.name = :staff ";
parameters.put("staff", staff.getPerson().getName());
}

Expand Down Expand Up @@ -2253,6 +2245,38 @@ public void generateRouteAnalysisReport() {
}
}

public Map<YearMonth, Double> getSampleCountChartData() {
Map<YearMonth, Double> data = new HashMap<>();

if (reportType.equalsIgnoreCase("detail")) {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, getCollectionCenterWiseTotalSampleCount(yearMonth) / calculateCollectionCenterWiseBillCount(yearMonth));
}
} else {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, calculateRouteWiseTotalSampleCount(yearMonth) / calculateRouteWiseBillCount(yearMonth));
}
}

return data;
}

public Map<YearMonth, Double> getServiceAmountChartData() {
Map<YearMonth, Double> data = new HashMap<>();

if (reportType.equalsIgnoreCase("detail")) {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, getCollectionCenterWiseTotalServiceAmount(yearMonth) / calculateCollectionCenterWiseBillCount(yearMonth));
}
} else {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, calculateRouteWiseTotalServiceAmount(yearMonth) / calculateRouteWiseBillCount(yearMonth));
}
}

return data;
}

private void groupRouteWiseBillsMonthly() {
Map<Route, Map<YearMonth, Bill>> map = new HashMap<>();
List<YearMonth> yearMonths = new ArrayList<>();
Expand Down Expand Up @@ -2398,38 +2422,6 @@ public double calculateRouteWiseTotalServiceAmount(YearMonth yearmonth) {
return total;
}

public Map<YearMonth, Double> getSampleCountChartData() {
Map<YearMonth, Double> data = new HashMap<>();

if (reportType.equalsIgnoreCase("detail")) {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, getCollectionCenterWiseTotalSampleCount(yearMonth) / calculateCollectionCenterWiseBillCount(yearMonth));
}
} else {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, calculateRouteWiseTotalSampleCount(yearMonth) / calculateRouteWiseBillCount(yearMonth));
}
}

return data;
}

public Map<YearMonth, Double> getServiceAmountChartData() {
Map<YearMonth, Double> data = new HashMap<>();

if (reportType.equalsIgnoreCase("detail")) {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, getCollectionCenterWiseTotalServiceAmount(yearMonth) / calculateCollectionCenterWiseBillCount(yearMonth));
}
} else {
for (YearMonth yearMonth : yearMonths) {
data.put(yearMonth, calculateRouteWiseTotalServiceAmount(yearMonth) / calculateRouteWiseBillCount(yearMonth));
}
}

return data;
}

public ReportTemplateRowBundle generateCollectingCenterWiseBillItems(List<BillTypeAtomic> bts) {
Map<String, Object> parameters = new HashMap<>();
String jpql = "SELECT new com.divudi.data.ReportTemplateRow(bill) "
Expand Down Expand Up @@ -3774,4 +3766,5 @@ public ReportTemplateRowBundle generateDiscountBillItems(List<BillTypeAtomic> bt
b.calculateTotalsWithCredit();
return b;
}

}
Loading

0 comments on commit 19f1897

Please sign in to comment.