diff --git a/src/main/java/com/divudi/bean/cashTransaction/FinancialTransactionController.java b/src/main/java/com/divudi/bean/cashTransaction/FinancialTransactionController.java index 7beb004efc..b5120ee028 100644 --- a/src/main/java/com/divudi/bean/cashTransaction/FinancialTransactionController.java +++ b/src/main/java/com/divudi/bean/cashTransaction/FinancialTransactionController.java @@ -277,6 +277,76 @@ public ReportTemplateRowBundle addChannellingByCategories( return bundle; } + + + public ReportTemplateRowBundle addProfessionalPayments( + ReportTemplateType type, + List btas, + Date paramDate, + Date paramFromDate, + Date paramToDate, + Institution paramInstitution, + Department paramDepartment, + Institution paramFromInstitution, + Department paramFromDepartment, + Institution paramToInstitution, + Department paramToDepartment, + WebUser paramUser, + Institution paramCreditCompany, + Long paramStartId, + Long paramEndId) { + System.out.println("addOpdByDepartments"); + + ReportTemplateRowBundle bundle; + List inBts = BillTypeAtomic.findByCountedServiceType(CountedServiceType.OPD_IN); + List outBts = BillTypeAtomic.findByCountedServiceType(CountedServiceType.OPD_OUT); + + ReportTemplateRowBundle ins = reportTemplateController.generateReport( + type, + inBts, + paramDate, + paramFromDate, + paramToDate, + paramInstitution, + paramDepartment, + paramFromInstitution, + paramFromDepartment, + paramToInstitution, + paramToDepartment, + paramUser, + paramCreditCompany, + paramStartId, + paramEndId); + + System.out.println("ins = " + ins.getReportTemplateRows().size()); + + ReportTemplateRowBundle outs = reportTemplateController.generateReport( + type, + outBts, + paramDate, + paramFromDate, + paramToDate, + paramInstitution, + paramDepartment, + paramFromInstitution, + paramFromDepartment, + paramToInstitution, + paramToDepartment, + paramUser, + paramCreditCompany, + paramStartId, + paramEndId); + + System.out.println("outes = " + outs.getReportTemplateRows().size()); + + bundle = combineBundlesByItemDepartment(ins, outs); + + return bundle; + } + + + + public ReportTemplateRowBundle addOpdByDepartments( ReportTemplateType type, List btas, @@ -346,6 +416,8 @@ public void processShiftEndReport() { shiftEndBundles = new ArrayList<>(); ReportTemplateType channelingType = ReportTemplateType.ITEM_CATEGORY_SUMMARY_BY_BILL; ReportTemplateType opdType = ReportTemplateType.ITEM_DEPARTMENT_SUMMARY_BY_BILL_ITEM; + ReportTemplateType paymentsType = ReportTemplateType.BILL_TYPE_ATOMIC_SUMMARY_USING_BILLS; + List btas = null; Date paramDate = null; Date paramFromDate = null; @@ -397,11 +469,32 @@ public void processShiftEndReport() { paramStartId, paramEndId ); + + ReportTemplateRowBundle tmpPaymentBundle + = addProfessionalPayments( + paymentsType, + btas, + paramDate, + paramFromDate, + paramToDate, + paramInstitution, + paramDepartment, + paramFromInstitution, + paramFromDepartment, + paramToInstitution, + paramToDepartment, + paramUser, + paramCreditCompany, + paramStartId, + paramEndId + ); tmpChannellingBundle.setName("Channelling"); - tmpOpdBundle.setName("OPD Bundle"); + tmpOpdBundle.setName("OPD"); + tmpPaymentBundle.setName("Payments"); shiftEndBundles.add(tmpChannellingBundle); shiftEndBundles.add(tmpOpdBundle); + shiftEndBundles.add(tmpPaymentBundle); } diff --git a/src/main/java/com/divudi/bean/common/BillSearch.java b/src/main/java/com/divudi/bean/common/BillSearch.java index 6bd05e389e..776a32ddd5 100644 --- a/src/main/java/com/divudi/bean/common/BillSearch.java +++ b/src/main/java/com/divudi/bean/common/BillSearch.java @@ -166,7 +166,7 @@ public class BillSearch implements Serializable { CommonFunctionsController commonFunctionsController; @Inject PharmacyBillSearch pharmacyBillSearch; - + @Inject ConfigOptionApplicationController configOptionApplicationController; /** @@ -181,6 +181,7 @@ public class BillSearch implements Serializable { private BillLight billLight; private Bill printingBill; private PaymentMethod paymentMethod; + private PaymentMethod refundMethod; private RefundBill billForRefund; @Temporal(TemporalType.TIME) private Date fromDate; @@ -241,10 +242,10 @@ public class BillSearch implements Serializable { public String navigateToBillPaymentOpdBill() { return "bill_payment_opd?faces-redirect=true"; } - - public void fillBillFees(){ - for(BillItem bi : getRefundingBill().getBillItems()){ - for(BillFee bfee : bi.getBillFees()){ + + public void fillBillFees() { + for (BillItem bi : getRefundingBill().getBillItems()) { + for (BillFee bfee : bi.getBillFees()) { bfee.setFeeValue(bfee.getReferenceBillFee().getFeeValue()); } } @@ -1398,14 +1399,18 @@ public void setBillFees(List billFees) { public void setSessionController(SessionController sessionController) { this.sessionController = sessionController; } - + public PaymentMethod getPaymentMethod() { if (paymentMethod != null) { - paymentMethod = PaymentMethod.Cash; + if (configOptionApplicationController.getBooleanValueByKey("Set the Original Bill PaymentMethod to Cancelation Bill")) { + paymentMethod = getBill().getPaymentMethod(); + } else { + paymentMethod = PaymentMethod.Cash; + } } return paymentMethod; } - + public void setPaymentMethod(PaymentMethod paymentMethod) { this.paymentMethod = paymentMethod; } @@ -2852,9 +2857,8 @@ public String navigateViewBillByBillTypeAtomic() { case CHANNEL_REFUND: return ""; - + case CHANNEL_PAYMENT_FOR_BOOKING_BILL: - } @@ -2891,7 +2895,7 @@ public String navigateToRefundOpdBill() { JsfUtil.addErrorMessage("Nothing to cancel"); return ""; } - paymentMethod = bill.getPaymentMethod(); + paymentMethod = getBill().getPaymentMethod(); try { createBillItemsAndBillFeesForOpdRefund(); } catch (IllegalAccessException ex) { @@ -2906,7 +2910,7 @@ public String navigateToRefundOpdBill() { JsfUtil.addErrorMessage(ex.getMessage()); return ""; } - if(configOptionApplicationController.getBooleanValueByKey("To Refunded the Full Value of the Bill")){ + if (configOptionApplicationController.getBooleanValueByKey("To Refunded the Full Value of the Bill")) { fillBillFees(); } printPreview = false; @@ -3958,6 +3962,19 @@ public void setReferredBy(Doctor referredBy) { this.referredBy = referredBy; } + public PaymentMethod getRefundMethod() { + if(configOptionApplicationController.getBooleanValueByKey("Set the Original Bill PaymentMethod to Refunded Bill")){ + refundMethod = getBill().getPaymentMethod(); + }else{ + refundMethod = PaymentMethod.Cash; + } + return refundMethod; + } + + public void setRefundMethod(PaymentMethod refundMethod) { + this.refundMethod = refundMethod; + } + public class PaymentSummary { private long idCounter = 0; diff --git a/src/main/java/com/divudi/data/BillTypeAtomic.java b/src/main/java/com/divudi/data/BillTypeAtomic.java index 4b6e48a62a..3aaeabd5c2 100644 --- a/src/main/java/com/divudi/data/BillTypeAtomic.java +++ b/src/main/java/com/divudi/data/BillTypeAtomic.java @@ -5,8 +5,8 @@ import java.util.stream.Collectors; /** - * Enumerates types of bills for atomic billing purposes. - * Includes categorization by service type and finance type. + * Enumerates types of bills for atomic billing purposes. Includes + * categorization by service type and finance type. */ public enum BillTypeAtomic { @@ -120,7 +120,8 @@ public enum BillTypeAtomic { OPD_BILL_CANCELLATION("Opd Bill Cancellation", BillCategory.CANCELLATION, ServiceType.OPD, BillFinanceType.CASH_OUT, CountedServiceType.OPD_OUT), OPD_BILL_CANCELLATION_DURING_BATCH_BILL_CANCELLATION("Opd Bill Cancellation with Batch Bill", BillCategory.CANCELLATION, ServiceType.OPD, BillFinanceType.CASH_OUT, CountedServiceType.OPD_OUT), OPD_BILL_REFUND("Opd Bill Refund", BillCategory.REFUND, ServiceType.OPD, BillFinanceType.CASH_OUT, CountedServiceType.OPD_OUT), - OPD_PROFESSIONAL_PAYMENT_BILL("OPD Professional Payment bill", BillCategory.BILL, ServiceType.OPD, BillFinanceType.CASH_OUT, CountedServiceType.OPD_PROFESSIONAL_PAYMENT), + OPD_PROFESSIONAL_PAYMENT_BILL("OPD Professional Payment bill", BillCategory.PAYMENTS, ServiceType.OPD, BillFinanceType.CASH_OUT, CountedServiceType.OPD_PROFESSIONAL_PAYMENT), + OPD_PROFESSIONAL_PAYMENT_BILL_RETURN("OPD Professional Payment bill", BillCategory.PAYMENTS, ServiceType.OPD, BillFinanceType.CASH_IN, CountedServiceType.OPD_PROFESSIONAL_PAYMENT_RETURN), @Deprecated OPD_BILL_WITH_PAYMENT_UNDER_BATCH_BILL("OPD Bill with payment under batch bill", BillCategory.BILL, ServiceType.OPD, BillFinanceType.NO_FINANCE_TRANSACTIONS, CountedServiceType.OPD_IN), // PACKAGES @@ -154,11 +155,15 @@ public enum BillTypeAtomic { FUND_WITHDRAWAL_BILL("Withdrawal Fund Bill", BillCategory.BILL, ServiceType.OTHER, BillFinanceType.BANK_IN, CountedServiceType.OTHER), FUND_WITHDRAWAL_BILL_CANCELLED("Withdrawal Fund Bill - Cancelled", BillCategory.CANCELLATION, ServiceType.OTHER, BillFinanceType.BANK_OUT, CountedServiceType.OTHER), // PROFESSIONAL PAYMENTS - PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_INWARD_SERVICE("Inward Payment for Staff", BillCategory.PAYMENTS, ServiceType.INWARD, BillFinanceType.CASH_IN, CountedServiceType.INWARD), - PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE("Channelling Payment for Staff", BillCategory.PAYMENTS, ServiceType.CHANNELLING, BillFinanceType.CASH_OUT, CountedServiceType.CHANNELLING), - PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_SESSION("Channelling session Payment for Staff", BillCategory.PAYMENTS, ServiceType.CHANNELLING, BillFinanceType.CASH_OUT, CountedServiceType.CHANNELLING), - PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_FOR_AGENCIES("Channelling Payment for Staff for agencies", BillCategory.PAYMENTS, ServiceType.OTHER, BillFinanceType.CASH_IN, CountedServiceType.OTHER), - PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_OPD_SERVICES("OPD Professional Payment bill", BillCategory.PAYMENTS, ServiceType.OPD, BillFinanceType.CASH_OUT, CountedServiceType.OPD_IN), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_INWARD_SERVICE("Inward Payment for Staff", BillCategory.PAYMENTS, ServiceType.INWARD, BillFinanceType.CASH_IN, CountedServiceType.INWARD_PROFESSIONAL_PAYMENT), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE("Channelling Payment for Staff", BillCategory.PAYMENTS, ServiceType.CHANNELLING, BillFinanceType.CASH_OUT, CountedServiceType.CHANNELLING_PROFESSIONAL_PAYMENT), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_SESSION("Channelling session Payment for Staff", BillCategory.PAYMENTS, ServiceType.CHANNELLING, BillFinanceType.CASH_OUT, CountedServiceType.CHANNELLING_PROFESSIONAL_PAYMENT), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_FOR_AGENCIES("Channelling Payment for Staff for agencies", BillCategory.PAYMENTS, ServiceType.OTHER, BillFinanceType.CASH_IN, CountedServiceType.OTHER_PROFESSIONAL_PAYMENT), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_OPD_SERVICES("OPD Professional Payment bill", BillCategory.PAYMENTS, ServiceType.OPD, BillFinanceType.CASH_OUT, CountedServiceType.OPD_PROFESSIONAL_PAYMENT_RETURN), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_INWARD_SERVICE_RETURN("Inward Payment for Staff - Return and Cancellation", BillCategory.PAYMENTS, ServiceType.INWARD, BillFinanceType.CASH_OUT, CountedServiceType.INWARD_PROFESSIONAL_PAYMENT_RETURN), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_RETURN("Channelling Payment for Staff - Return and Cancellation", BillCategory.PAYMENTS, ServiceType.CHANNELLING, BillFinanceType.CASH_IN, CountedServiceType.CHANNELLING_PROFESSIONAL_PAYMENT_RETURN), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_CHANNELING_SERVICE_FOR_AGENCIES_RETURN("Channelling Payment for Staff for agencies - Return and Cancellation", BillCategory.PAYMENTS, ServiceType.OTHER, BillFinanceType.CASH_OUT, CountedServiceType.OTHER), + PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_OPD_SERVICES_RETURN("OPD Professional Payment bill - Return and Cancellation", BillCategory.PAYMENTS, ServiceType.OPD, BillFinanceType.CASH_IN, CountedServiceType.OPD_PROFESSIONAL_PAYMENT_RETURN), PETTY_CASH_ISSUE("Petty Cash Issue", BillCategory.PAYMENTS, ServiceType.OTHER, BillFinanceType.CASH_OUT, CountedServiceType.OTHER), PETTY_CASH_RETURN("Petty Cash Return", BillCategory.BILL, ServiceType.OTHER, BillFinanceType.CASH_IN, CountedServiceType.OTHER), IOU_CASH_ISSUE("Iou Cash Issue", BillCategory.BILL, ServiceType.OTHER, BillFinanceType.CASH_OUT, CountedServiceType.OTHER), @@ -218,7 +223,7 @@ public static List findByServiceType(ServiceType serviceType) { .filter(e -> e.getServiceType() == serviceType) .collect(Collectors.toList()); } - + // Method to find BillTypeAtomic by ServiceType public static List findByCountedServiceType(CountedServiceType counterServiceType) { return Arrays.stream(BillTypeAtomic.values()) @@ -232,7 +237,7 @@ public static List findByServiceTypeAndFinanceType(ServiceType s .filter(e -> e.getServiceType() == serviceType && e.getBillFinanceType() == financeType) .collect(Collectors.toList()); } - + // Method to find BillTypeAtomic by ServiceType and BillCategory public static List findBillTypeAtomic(ServiceType serviceType, BillCategory billCategory) { return Arrays.stream(BillTypeAtomic.values()) diff --git a/src/main/java/com/divudi/data/CountedServiceType.java b/src/main/java/com/divudi/data/CountedServiceType.java index cbcebd617c..a93cff776d 100644 --- a/src/main/java/com/divudi/data/CountedServiceType.java +++ b/src/main/java/com/divudi/data/CountedServiceType.java @@ -8,13 +8,22 @@ public enum CountedServiceType { OPD_IN("Outpatient Department - Collection"), OPD_OUT("Outpatient Department - Cancellation or Refunds"), OPD_PROFESSIONAL_PAYMENT("Outpatient Department - Professional Payment"), + OPD_PROFESSIONAL_PAYMENT_RETURN("Outpatient Department - Professional Payment Cancellation or Returns"), NONE("NONE"), PHARMACY("Pharmacy"), STORE("Store"), CHANNELLING("Channelling"), + CHANNELLING_PROFESSIONAL_PAYMENT("Channelling Professional Payment"), + CHANNELLING_PROFESSIONAL_PAYMENT_RETURN("Channelling Professional Payment Cancellation or Returns"), + INWARD("Inward"), + INWARD_PROFESSIONAL_PAYMENT("Inward Professional Payment"), + INWARD_PROFESSIONAL_PAYMENT_RETURN("Inward Professional Payment Cancellation or Returns"), COLLECTING_CENTRE("Colelcting Centre"), OTHER("Other"), - INWARD("Inward"); + OTHER_PROFESSIONAL_PAYMENT("Channelling Professional Payment"), + OTHER_PROFESSIONAL_PAYMENT_RETURN("Channelling Professional Payment Cancellation or Returns"), + + ; private final String label; diff --git a/src/main/java/com/divudi/data/ServiceType.java b/src/main/java/com/divudi/data/ServiceType.java index 13cb3d99fb..6bf3e2d242 100644 --- a/src/main/java/com/divudi/data/ServiceType.java +++ b/src/main/java/com/divudi/data/ServiceType.java @@ -6,6 +6,7 @@ public enum ServiceType { OPD("Outpatient Department"), + PROFESSIONAL_PAYMENT("Professional Payment"), PHARMACY("Pharmacy"), STORE("Store"), CHANNELLING("Channelling"), diff --git a/src/main/webapp/cashier/shift_end_report_bill_of_selected_user.xhtml b/src/main/webapp/cashier/shift_end_report_bill_of_selected_user.xhtml index bbdf25d67b..207feecce3 100644 --- a/src/main/webapp/cashier/shift_end_report_bill_of_selected_user.xhtml +++ b/src/main/webapp/cashier/shift_end_report_bill_of_selected_user.xhtml @@ -152,175 +152,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Service - - Collected - - Refunds - - Payments - - Net -
- Channelling on site - - - - - - - - - - - - - - - - -
- Channelling by agent - - - - - - - - - - - - - - - - -
- Channelling by Online - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
+ - #{financialTransactionController.opdByDepartment.reportTemplateRows} + diff --git a/src/main/webapp/opd/bill_refund.xhtml b/src/main/webapp/opd/bill_refund.xhtml index 91b54a1f95..40f176d645 100644 --- a/src/main/webapp/opd/bill_refund.xhtml +++ b/src/main/webapp/opd/bill_refund.xhtml @@ -56,7 +56,6 @@ - diff --git a/src/main/webapp/opd/opd_bill.xhtml b/src/main/webapp/opd/opd_bill.xhtml index 7d9a379d7a..ee04ecb2d6 100644 --- a/src/main/webapp/opd/opd_bill.xhtml +++ b/src/main/webapp/opd/opd_bill.xhtml @@ -916,7 +916,7 @@ - + diff --git a/src/main/webapp/resources/ezcomp/prints/A4_paper_with_headings.xhtml b/src/main/webapp/resources/ezcomp/prints/A4_paper_with_headings.xhtml index 6e74ca68b6..c146eda08b 100644 --- a/src/main/webapp/resources/ezcomp/prints/A4_paper_with_headings.xhtml +++ b/src/main/webapp/resources/ezcomp/prints/A4_paper_with_headings.xhtml @@ -392,6 +392,13 @@ + + +
+ + +
+
+ + +
+ + +
+
+ + +
+ + +
+
+ + +
+ + +
+
+ + +
+ + +
+
+ + +
+ + +
+