diff --git a/pom.xml b/pom.xml
index 19d1e8a40a..f86332e775 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,10 +2,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.divudi
- rh
+ ruhunu
3.0.0
war
- rh
+ ruhunu
${project.build.directory}/endorsed
diff --git a/src/main/java/com/divudi/bean/common/CommonFunctionsController.java b/src/main/java/com/divudi/bean/common/CommonFunctionsController.java
index f27874c9cd..e56d2a17c5 100644
--- a/src/main/java/com/divudi/bean/common/CommonFunctionsController.java
+++ b/src/main/java/com/divudi/bean/common/CommonFunctionsController.java
@@ -4,6 +4,8 @@
import com.divudi.data.Title;
import com.divudi.data.dataStructure.DateRange;
import com.divudi.data.dataStructure.YearMonthDay;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
import javax.enterprise.context.ApplicationScoped;
@@ -59,6 +61,13 @@ public String capitalizeFirstLetter(String str) {
}
return result.toString().trim();
}
+
+ public static String getDateTimeFormat(Date date) {
+ String s = "";
+ DateFormat d = new SimpleDateFormat("YYYY-MM-dd hh:mm:ss a");
+ s = d.format(date);
+ return s;
+ }
public DateRange getDateRangeForOT(Date date) {
DateRange dateRange = new DateRange();
diff --git a/src/main/java/com/divudi/bean/common/PdfController.java b/src/main/java/com/divudi/bean/common/PdfController.java
index bc219465ac..805f40c183 100644
--- a/src/main/java/com/divudi/bean/common/PdfController.java
+++ b/src/main/java/com/divudi/bean/common/PdfController.java
@@ -111,6 +111,8 @@ public class PdfController {
CommonReportItemController commonReportItemController;
@Inject
PatientInvestigationController patientInvestigationController;
+ @Inject
+ SearchController searchController;
/**
* Creates a new instance of PdfController
@@ -760,7 +762,7 @@ public StreamedContent createPdfForBundle(ReportTemplateRowBundle rootBundle) th
// Set the downloading file
return DefaultStreamedContent.builder()
- .name("bundle_report.pdf")
+ .name("Bundle_Report.pdf")
.contentType("application/pdf")
.stream(() -> inputStream)
.build();
@@ -772,7 +774,7 @@ private void addDataToPdf(Document document, ReportTemplateRowBundle addingBundl
}
// Create a new Table for each call
- Table table = new Table(new float[]{10, 40, 15, 15, 10, 10});
+ Table table = new Table(new float[]{10, 40, 15, 15, 10, 10});
table.setWidth(200);
switch (type) {
@@ -818,8 +820,11 @@ private void addDataToPdf(Document document, ReportTemplateRowBundle addingBundl
case "netCash":
populateTitleBundleForPdf(document, addingBundle);
break;
- case "income_breakdown_by_category":
- populateTableForIncomeByCategory(document, addingBundle);
+ case "income_breakdown_by_category_with_professional_fee":
+ populateTableForIncomeByCategoryWithProfessionalFee(document, addingBundle);
+ break;
+ case "income_breakdown_by_category_with_out_professional_fee":
+ populateTableForIncomeByCategoryWithoutProfessionalFee(document, addingBundle);
break;
default:
table.addCell(new Cell().add(new Paragraph("Data for unknown type"))); // Default handling for unknown types
@@ -1160,12 +1165,15 @@ private void populateTableForItemSummaryGroupedByCategory(Document document, Rep
document.add(noDataParagraph);
}
}
-
- private void populateTableForIncomeByCategory(Document document, ReportTemplateRowBundle addingBundle) {
+ @Inject
+ CommonFunctionsController commonFunctionsController;
+
+ private void populateTableForIncomeByCategoryWithProfessionalFee(Document document, ReportTemplateRowBundle addingBundle) {
if (addingBundle.getReportTemplateRows() != null && !addingBundle.getReportTemplateRows().isEmpty()) {
-
+
document.add(new Paragraph(addingBundle.getName()));
-
+ document.add(new Paragraph(commonFunctionsController.getDateTimeFormat(searchController.getFromDate()) + " to " + commonFunctionsController.getDateTimeFormat(searchController.getToDate())));
+
Table table = new Table(new float[]{55, 20, 25, 25, 25, 25, 25});
table.setWidth(UnitValue.createPercentValue(100));
@@ -1174,7 +1182,8 @@ private void populateTableForIncomeByCategory(Document document, ReportTemplateR
for (String header : headers) {
table.addHeaderCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(header)));
}
-
+
+ table.addFooterCell(new com.itextpdf.layout.element.Cell(1, 6).add(new Paragraph("Total")));
table.addFooterCell(new Paragraph(String.format("%.2f", addingBundle.getTotal())));
// Populate table with data rows
@@ -1204,6 +1213,50 @@ private void populateTableForIncomeByCategory(Document document, ReportTemplateR
}
}
+
+ private void populateTableForIncomeByCategoryWithoutProfessionalFee(Document document, ReportTemplateRowBundle addingBundle) {
+ if (addingBundle.getReportTemplateRows() != null && !addingBundle.getReportTemplateRows().isEmpty()) {
+
+ document.add(new Paragraph(addingBundle.getName()));
+ document.add(new Paragraph(commonFunctionsController.getDateTimeFormat(searchController.getFromDate()) + " to " + commonFunctionsController.getDateTimeFormat(searchController.getToDate())));
+
+ Table table = new Table(new float[]{55, 20, 25, 25, 25, 25});
+ table.setWidth(UnitValue.createPercentValue(100));
+
+ // Add headers
+ String[] headers = {"Category", "Count", "Gross Value", "Hospital Fee", "Discount", "Net Amount"};
+ for (String header : headers) {
+ table.addHeaderCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(header)));
+ }
+
+ table.addFooterCell(new com.itextpdf.layout.element.Cell(1, 5).add(new Paragraph("Total")));
+ table.addFooterCell(new Paragraph(String.format("%.2f", addingBundle.getTotal())));
+
+ // Populate table with data rows
+ for (ReportTemplateRow row : addingBundle.getReportTemplateRows()) {
+ table.addCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(
+ row.getCategory() != null ? row.getCategory().getName() : "")));
+ table.addCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(
+ String.valueOf(row.getItemCount()))));
+ table.addCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(
+ String.format("%.2f", row.getItemTotal())))); // Format as string
+ table.addCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(
+ String.format("%.2f", row.getItemHospitalFee())))); // Format as string
+ table.addCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(
+ String.format("%.2f", row.getItemDiscountAmount())))); // Format as string
+ table.addCell(new com.itextpdf.layout.element.Cell().add(new Paragraph(
+ String.format("%.2f", row.getItemNetTotal())))); // Format as string
+ }
+
+ // Add the table to the document
+ document.add(table);
+ } else {
+ // Add a paragraph for no data
+ Paragraph noDataParagraph = new Paragraph("No Data for " + addingBundle.getName());
+ document.add(noDataParagraph);
+ }
+ }
+
private void populateTableForDepartmentCollection(Document document, ReportTemplateRowBundle addingBundle) {
if (addingBundle.getReportTemplateRows() == null || addingBundle.getReportTemplateRows().isEmpty()) {
// If no data, add a paragraph stating this
diff --git a/src/main/java/com/divudi/bean/common/SearchController.java b/src/main/java/com/divudi/bean/common/SearchController.java
index 2af22decf8..b360e33f38 100644
--- a/src/main/java/com/divudi/bean/common/SearchController.java
+++ b/src/main/java/com/divudi/bean/common/SearchController.java
@@ -12853,7 +12853,11 @@ public void createItemizedSalesReportOpd() {
}
public void createIncomeBreakdownByCategory() {
- bundle = generateIncomeBreakdownByCategory();
+ if(withProfessionalFee){
+ bundle = generateIncomeBreakdownByCategoryWithProfessionalFee();
+ }else{
+ bundle = generateIncomeBreakdownByCategoryWithOutProfessionalFee();
+ }
}
public void generateDailyReturn() {
@@ -14070,7 +14074,7 @@ public void billItemsToItamizedSaleSummary(ReportTemplateRowBundle rtrb, List {
@@ -14224,33 +14228,35 @@ public ReportTemplateRowBundle generateIncomeBreakdownByCategory() {
return oiBundle;
}
- @Deprecated
- public ReportTemplateRowBundle generateIncomeBreakdownByCategoryOpdWithoutProfessionalFee() {
+ public ReportTemplateRowBundle generateIncomeBreakdownByCategoryWithOutProfessionalFee() {
ReportTemplateRowBundle oiBundle = new ReportTemplateRowBundle();
String jpql = "select bi "
+ " from BillItem bi "
+ " where bi.bill.retired=:br "
+ " and bi.bill.createdAt between :fd and :td ";
- Map m = new HashMap<>();
+ Map m = new HashMap();
m.put("br", false);
m.put("fd", fromDate);
m.put("td", toDate);
- List btas = new ArrayList<>();
+ List btas = new ArrayList();
List obtas = BillTypeAtomic.findByServiceType(ServiceType.OPD);
List ibtas = BillTypeAtomic.findByServiceType(ServiceType.INWARD);
- if (visitType != null) {
+ if (null != visitType) {
switch (visitType) {
case "Any":
+ System.out.println("Any");
btas.addAll(obtas);
btas.addAll(ibtas);
break;
case "OP":
+ System.out.println("OPD");
btas.addAll(obtas);
break;
case "IP":
+ System.out.println("IP");
btas.addAll(ibtas);
break;
default:
@@ -14264,58 +14270,66 @@ public ReportTemplateRowBundle generateIncomeBreakdownByCategoryOpdWithoutProfes
m.put("bts", btas);
}
- // Define credit and non-credit payment methods
- List creditPaymentMethods = Arrays.asList(
- PaymentMethod.Credit,
- PaymentMethod.Staff
- // Add any other credit payment methods used in your system
- );
+ List creditPaymentMethods = enumController.getPaymentTypeOfPaymentMethods(PaymentType.CREDIT);
+ List nonCreditPaymentMethods = enumController.getPaymentTypeOfPaymentMethods(PaymentType.NON_CREDIT);
- List nonCreditPaymentMethods = Arrays.asList(
- PaymentMethod.Cash,
- PaymentMethod.Card,
- PaymentMethod.Cheque,
- PaymentMethod.Slip,
- PaymentMethod.ewallet,
- PaymentMethod.Voucher,
- PaymentMethod.Agent,
- PaymentMethod.PatientDeposit,
- PaymentMethod.PatientPoints,
- PaymentMethod.OnlineSettlement,
- PaymentMethod.YouOweMe
- // Add any other non-credit payment methods
- );
-
- System.out.println("methodType = " + methodType);
- System.out.println("visitType = " + visitType);
-
- if (methodType != null) {
- switch (methodType) {
- case "Any":
- // No additional conditions needed
- break;
- case "Credit":
-// jpql += " AND ("
-// + " (bi.bill.paymentMethod in :cpm) "
-// + " OR "
-// + " (bi.bill.patientEncounter is not null AND bi.bill.patientEncounter.paymentMethod in :cpm) "
-// + ")";
+ List allMethods = new ArrayDeque();
+ allMethods.addAll(creditPaymentMethods);
+ allMethods.addAll(nonCreditPaymentMethods);
- jpql += " AND bi.bill.paymentMethod in :cpm ";
+ if ("Any".equals(methodType)) {
+ System.out.println("Any");
+ } else if ("Credit".equals(methodType)) {
+ System.out.println("Credit");
- m.put("cpm", creditPaymentMethods);
- break;
- case "NonCredit":
- jpql += " AND ("
- + " (bi.bill.paymentMethod in :ncpm) "
- + " OR "
- + " (bi.bill.patientEncounter is not null AND bi.bill.patientEncounter.paymentMethod in :ncpm) "
- + ")";
- m.put("ncpm", nonCreditPaymentMethods);
- break;
- default:
- break;
+ if (null != visitType) {
+ switch (visitType) {
+ case "Any":
+ System.out.println("Credit Any");
+ jpql += " AND (bi.bill.paymentMethod in :apm OR bi.bill.patientEncounter.paymentMethod in :apm)";
+ m.put("apm", allMethods);
+ break;
+ case "OP":
+ System.out.println("Credit OP");
+ jpql += " AND bi.bill.paymentMethod in :cpm ";
+ m.put("cpm", creditPaymentMethods);
+ break;
+ case "IP":
+ System.out.println("Credit IP");
+ jpql += " AND bi.bill.patientEncounter.paymentMethod in :cpm ";
+ m.put("cpm", creditPaymentMethods);
+ break;
+ default:
+ break;
+ }
}
+
+ } else if ("NonCredit".equals(methodType)) {
+ System.out.println("Non Credit");
+
+ if (null != visitType) {
+ switch (visitType) {
+ case "Any":
+ System.out.println("Credit Any");
+ System.out.println("Credit Any");
+ jpql += " AND (bi.bill.paymentMethod in :apm OR bi.bill.patientEncounter.paymentMethod in :apm)";
+ m.put("apm", allMethods);
+ break;
+ case "OP":
+ System.out.println("Credit OP");
+ jpql += " AND bi.bill.paymentMethod in :ncpm ";
+ m.put("ncpm", nonCreditPaymentMethods);
+ break;
+ case "IP":
+ System.out.println("Credit IP");
+ jpql += " AND bi.bill.patientEncounter.paymentMethod in :ncpm ";
+ m.put("ncpm", nonCreditPaymentMethods);
+ break;
+ default:
+ break;
+ }
+ }
+
}
if (department != null) {
@@ -14334,7 +14348,6 @@ public ReportTemplateRowBundle generateIncomeBreakdownByCategoryOpdWithoutProfes
jpql += " and bi.item.category=:cat ";
m.put("cat", category);
}
-
System.out.println("jpql = " + jpql);
System.out.println("m = " + m);
@@ -14352,10 +14365,10 @@ public ReportTemplateRowBundle generateIncomeBreakdownByCategoryOpdWithoutProfes
}
}
- summarizeBillItemsToIncomeByCategoryWithoutProfessionalFee(oiBundle, bis);
+ summarizeBillItemsToIncomeByCategory(oiBundle, bis);
- oiBundle.setName("Income Breakdown By Category Without Professional Fee");
- oiBundle.setBundleType("income_breakdown_by_category");
+ oiBundle.setName("Income Breakdown By Category - Without Professional Fee");
+ oiBundle.setBundleType("income_breakdown_by_category_with_out_professional_fee");
oiBundle.getReportTemplateRows().stream()
.forEach(rtr -> {
@@ -14369,6 +14382,7 @@ public ReportTemplateRowBundle generateIncomeBreakdownByCategoryOpdWithoutProfes
return oiBundle;
}
+
public ReportTemplateRowBundle generateOpdProfessionalFees(String paymentStatusStr) {
PaymentStatus paymentStatus = PaymentStatus.ALL;
if (paymentStatusStr != null) {
diff --git a/src/main/java/com/divudi/ws/common/ApplicationConfig.java b/src/main/java/com/divudi/ws/common/ApplicationConfig.java
index 433b4b84a9..ec4f672704 100644
--- a/src/main/java/com/divudi/ws/common/ApplicationConfig.java
+++ b/src/main/java/com/divudi/ws/common/ApplicationConfig.java
@@ -38,7 +38,6 @@ public Set> getClasses() {
private void addRestResourceClasses(Set> resources) {
resources.add(com.divudi.ws.channel.ChannelApi.class);
resources.add(com.divudi.ws.channel.CorsResponseFilter.class);
- resources.add(com.divudi.ws.common.ApiMembership.class);
resources.add(com.divudi.ws.common.ConfigResource.class);
resources.add(com.divudi.ws.fhir.Fhir.class);
resources.add(com.divudi.ws.finance.Finance.class);
diff --git a/src/main/resources/META-INF/.LCKpersistence.xml~ b/src/main/resources/META-INF/.LCKpersistence.xml~
new file mode 100644
index 0000000000..56bd8f6b4c
--- /dev/null
+++ b/src/main/resources/META-INF/.LCKpersistence.xml~
@@ -0,0 +1 @@
+D:\CC\hmis\src\main\resources\META-INF\persistence.xml
\ No newline at end of file
diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml
index 2f3b123fe5..843440cd1f 100644
--- a/src/main/resources/META-INF/persistence.xml
+++ b/src/main/resources/META-INF/persistence.xml
@@ -13,7 +13,7 @@
- jdbc/ruhunuaudit
+ jdbc/ruhunuAudit
false
diff --git a/src/main/webapp/reports/financialReports/income_breakdown_by_category.xhtml b/src/main/webapp/reports/financialReports/income_breakdown_by_category.xhtml
index 17bf92cca5..5d08d8ce4c 100644
--- a/src/main/webapp/reports/financialReports/income_breakdown_by_category.xhtml
+++ b/src/main/webapp/reports/financialReports/income_breakdown_by_category.xhtml
@@ -156,16 +156,6 @@
-
-
-
-
-