Skip to content

Commit

Permalink
Merge pull request #6610 from hmislk/Issue#6551
Browse files Browse the repository at this point in the history
Issue#6551 Closes #6551
  • Loading branch information
Irani96 authored Jul 26, 2024
2 parents 12030a8 + 0d93a47 commit 8ddd311
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 193 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,76 @@ public ReportTemplateRowBundle addChannellingByCategories(
return bundle;
}



public ReportTemplateRowBundle addProfessionalPayments(
ReportTemplateType type,
List<BillTypeAtomic> 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<BillTypeAtomic> inBts = BillTypeAtomic.findByCountedServiceType(CountedServiceType.OPD_IN);
List<BillTypeAtomic> 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<BillTypeAtomic> btas,
Expand Down Expand Up @@ -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<BillTypeAtomic> btas = null;
Date paramDate = null;
Date paramFromDate = null;
Expand Down Expand Up @@ -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);

}

Expand Down
41 changes: 29 additions & 12 deletions src/main/java/com/divudi/bean/common/BillSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public class BillSearch implements Serializable {
CommonFunctionsController commonFunctionsController;
@Inject
PharmacyBillSearch pharmacyBillSearch;

@Inject
ConfigOptionApplicationController configOptionApplicationController;
/**
Expand All @@ -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;
Expand Down Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -1398,14 +1399,18 @@ public void setBillFees(List<BillFee> 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;
}
Expand Down Expand Up @@ -2852,9 +2857,8 @@ public String navigateViewBillByBillTypeAtomic() {

case CHANNEL_REFUND:
return "";

case CHANNEL_PAYMENT_FOR_BOOKING_BILL:


}

Expand Down Expand Up @@ -2891,7 +2895,7 @@ public String navigateToRefundOpdBill() {
JsfUtil.addErrorMessage("Nothing to cancel");
return "";
}
paymentMethod = bill.getPaymentMethod();
paymentMethod = getBill().getPaymentMethod();
try {
createBillItemsAndBillFeesForOpdRefund();
} catch (IllegalAccessException ex) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
25 changes: 15 additions & 10 deletions src/main/java/com/divudi/data/BillTypeAtomic.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -218,7 +223,7 @@ public static List<BillTypeAtomic> findByServiceType(ServiceType serviceType) {
.filter(e -> e.getServiceType() == serviceType)
.collect(Collectors.toList());
}

// Method to find BillTypeAtomic by ServiceType
public static List<BillTypeAtomic> findByCountedServiceType(CountedServiceType counterServiceType) {
return Arrays.stream(BillTypeAtomic.values())
Expand All @@ -232,7 +237,7 @@ public static List<BillTypeAtomic> 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<BillTypeAtomic> findBillTypeAtomic(ServiceType serviceType, BillCategory billCategory) {
return Arrays.stream(BillTypeAtomic.values())
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/divudi/data/CountedServiceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/divudi/data/ServiceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
public enum ServiceType {

OPD("Outpatient Department"),
PROFESSIONAL_PAYMENT("Professional Payment"),
PHARMACY("Pharmacy"),
STORE("Store"),
CHANNELLING("Channelling"),
Expand Down
Loading

0 comments on commit 8ddd311

Please sign in to comment.