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

Collection center bill wise detail report bug fix #10375

Merged
merged 7 commits into from
Feb 3, 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
15 changes: 8 additions & 7 deletions src/main/java/com/divudi/bean/common/ReportsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import java.text.SimpleDateFormat;
import java.util.stream.Collectors;
import java.text.DecimalFormat;

import org.apache.poi.xssf.usermodel.XSSFCellStyle;

/**
Expand Down Expand Up @@ -2650,7 +2651,7 @@ public void generateDebtorBalanceReport(final boolean onlyDueBills) {
}

public ReportTemplateRowBundle generateDebtorBalanceReportBills(List<BillTypeAtomic> bts, List<PaymentMethod> billPaymentMethods,
boolean onlyDueBills) {
boolean onlyDueBills) {
Map<String, Object> parameters = new HashMap<>();
String jpql = "SELECT new com.divudi.data.ReportTemplateRow(bill) "
+ "FROM Bill bill "
Expand Down Expand Up @@ -3014,7 +3015,7 @@ public ReportTemplateRowBundle generateCollectingCenterBillWiseBillItems(List<Bi
}

if (department != null) {
jpql += "AND bill.toDepartment = :dep ";
jpql += "AND bill.department = :dep ";
parameters.put("dep", department);
}

Expand Down Expand Up @@ -3330,7 +3331,7 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadSummaryBillIte
parameters.put("bts", bts);
parameters.put("fd", fromDate);
parameters.put("td", toDate);

String jpql = "SELECT new com.divudi.data.ReportTemplateRow(billItem.item.name, SUM(billItem.qty)) "
+ "FROM PatientInvestigation pi "
+ "JOIN pi.billItem billItem "
Expand Down Expand Up @@ -3589,7 +3590,7 @@ public void exportOpdAndInwardOPToPdf() {
table.setWidths(columnWidths);

String[] headers = {"S. No", "Invoice Date", "Invoice No", "Customer Reference No", "MRNO", "Patient Name",
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
for (String header : headers) {
PdfPCell cell = new PdfPCell(new Phrase(header, boldFont));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
Expand Down Expand Up @@ -3812,7 +3813,7 @@ public void exportOpdAndInwardIPToPdf() {
table.setWidths(columnWidths);

String[] headers = {"S. No", "BHT No", "Invoice Date", "Invoice No", "Customer Reference No", "MRNO", "Patient Name",
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
"Gross Amt", "Disc Amt", "Net Amt", "Patient Share", "Sponsor Share", "Due Amt"};
for (String header : headers) {
PdfPCell cell = new PdfPCell(new Phrase(header, boldFont));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
Expand Down Expand Up @@ -4854,8 +4855,8 @@ public void exportDetailedWeeklyOPDReportToPDF() {
}

private void addWeeklyReportSection(Document document, String sectionTitle, List<String> itemList,
List<Integer> daysOfWeek, Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap,
int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException {
List<Integer> daysOfWeek, Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap,
int week, com.itextpdf.text.Font headerFont, com.itextpdf.text.Font regularFont) throws DocumentException {
document.add(new com.itextpdf.text.Paragraph(sectionTitle, headerFont));
document.add(com.itextpdf.text.Chunk.NEWLINE);

Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/divudi/bean/pharmacy/PharmacyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ private void resetFields() {
totalCreditPurchaseValue = 0.0;
totalCashPurchaseValue = 0.0;
totalPurchase = 0.0;
grantIssueQty = 0.0;
}

public void generateConsumptionReportTableByBill(BillType billType) {
Expand Down Expand Up @@ -1036,6 +1037,16 @@ public void generateConsumptionReportTableByBill(BillType billType) {
tmp.put("dept", dept);
}

if (category != null) {
sql += " AND EXISTS (SELECT bi FROM BillItem bi WHERE bi.bill = b AND bi.item.category = :category)";
tmp.put("category", category);
}

if (item != null) {
sql += " AND EXISTS (SELECT bi FROM BillItem bi WHERE bi.bill = b AND bi.item = :item)";
tmp.put("item", item);
}

if (toDepartment != null) {
sql += " AND b.toDepartment = :toDept";
tmp.put("toDept", toDepartment);
Expand Down Expand Up @@ -1287,6 +1298,9 @@ public void generateConsumptionReportTableByDepartmentAndCategoryWise() {
}

public List<DepartmentCategoryWiseItems> generateConsumptionReportTableByDepartmentAndCategoryWise(BillType billType) {
totalSaleValue = 0.0;
qty = 0.0;

Map<String, Object> parameters = new HashMap<>();
String jpql = "SELECT new com.divudi.data.DepartmentCategoryWiseItems("
+ "bi.bill.department, "
Expand Down Expand Up @@ -1404,6 +1418,11 @@ public void generateConsumptionReportTableAsDepartmentSummary(List<DepartmentCat
for (Map.Entry<String, Double> consumptionEntry : consumptionMap.entrySet()) {
String consumptionDepartmentName = consumptionEntry.getKey();
double netTotal = consumptionEntry.getValue();

if (netTotal == 0) {
continue;
}

departmentSummaries.add(new PharmacySummery(null, consumptionDepartmentName, netTotal));
}

Expand Down
Loading