Skip to content

Commit

Permalink
Merge pull request #6516 from hmislk/Issue#6508
Browse files Browse the repository at this point in the history
Issue#6508 Closes #6508
  • Loading branch information
Irani96 authored Jul 25, 2024
2 parents 46ecd6a + 9ca0ae3 commit 6973337
Show file tree
Hide file tree
Showing 57 changed files with 4,293 additions and 1,772 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.divudi</groupId>

<artifactId>sethma</artifactId>
<artifactId>sethmademo</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>sethma</name>
<name>sethmademo</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -505,48 +505,50 @@ private Bill createBillForChannelReshedule(BillSession bs) {
bill.setPatient(bs.getBill().getPatient());
switch (bs.getBill().getPaymentMethod()) {
case OnCall:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillType(BillType.ChannelOnCall);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_OUT_PAYMENT);
break;

case Cash:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillType(BillType.ChannelCash);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_PAYMENT);
break;

case Card:
bill.setBillType(BillType.ChannelResheduleWithPayment);
bill.setBillType(BillType.ChannelCash);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_PAYMENT);
break;

case Cheque:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_OUT_PAYMENT);
bill.setBillType(BillType.ChannelCash);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_PAYMENT);
break;

case Slip:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_OUT_PAYMENT);
bill.setBillType(BillType.ChannelCash);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_PAYMENT);
break;
case Agent:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_OUT_PAYMENT);
bill.setBillType(BillType.ChannelAgent);
bill.setCreditCompany(institution);
bill.setAgentRefNo(agentRefNo);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_PAYMENT);
break;
case Staff:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillType(BillType.ChannelStaff);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_OUT_PAYMENT);
break;
case Credit:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillType(BillType.ChannelCredit);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_OUT_PAYMENT);
break;
case OnlineSettlement:
bill.setBillType(BillType.ChannelResheduleWithOutPayment);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_OUT_PAYMENT);
bill.setBillType(BillType.ChannelCash);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_BOOKING_WITH_PAYMENT_ONLINE);
break;

case MultiplePaymentMethods:
bill.setBillType(BillType.ChannelResheduleWithPayment);
bill.setBillType(BillType.ChannelCash);
bill.setBillTypeAtomic(BillTypeAtomic.CHANNEL_RESHEDULE_WITH_PAYMENT);
break;
}
Expand All @@ -558,7 +560,7 @@ private Bill createBillForChannelReshedule(BillSession bs) {
bill.setDeptId(deptId);
bill.setInsId(deptId);

bill.setPaidAmount(getSelectedSessionInstanceForRechedule().getOriginatingSession().getTotal());
bill.setPaidAmount(bs.getBill().getPaidAmount());
bill.setPaidAt(new Date());

bill.setBillDate(new Date());
Expand All @@ -581,7 +583,7 @@ private Bill createBillForChannelReshedule(BillSession bs) {
}
return bill;
}

private BillItem createSessionItemForReshedule(Bill bill) {
BillItem bi = new BillItem();
bi.setAdjustedValue(0.0);
Expand Down Expand Up @@ -2891,6 +2893,21 @@ public boolean patientErrorPresent(Patient p) {
JsfUtil.addErrorMessage("Please enter a name");
return true;
}

if (p.getPerson().getPhone() == null) {
JsfUtil.addErrorMessage("Please enter a phone number");
return true;
}

if (p.getPerson().getMobile()== null) {
JsfUtil.addErrorMessage("Please enter a mobile number");
return true;
}

if (p.getPerson().getArea()== null) {
JsfUtil.addErrorMessage("Please enter a area");
return true;
}

return false;
}
Expand Down Expand Up @@ -4539,7 +4556,9 @@ public void fillBillSessions() {
BillType.ChannelCash,
BillType.ChannelOnCall,
BillType.ChannelStaff,
BillType.ChannelCredit
BillType.ChannelCredit,
BillType.ChannelResheduleWithPayment,
BillType.ChannelResheduleWithOutPayment
};
List<BillType> bts = Arrays.asList(billTypes);
String sql = "Select bs "
Expand Down Expand Up @@ -4648,7 +4667,9 @@ public void fillBillSessions(SessionInstance s) {
BillType.ChannelCash,
BillType.ChannelOnCall,
BillType.ChannelStaff,
BillType.ChannelCredit
BillType.ChannelCredit,
BillType.ChannelResheduleWithPayment,
BillType.ChannelResheduleWithOutPayment
};
List<BillType> bts = Arrays.asList(billTypes);
String sql = "Select bs "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ public BillSession settleCreditForOnlinePayments(BillSession bookingBillSession)
bookingBillSession.getBill().setPaidAmount(newSettleBill.getPaidAmount());
bookingBillSession.getBill().setBalance(0.0);
bookingBillSession.getBill().setPaidBill(newSettleBill);
bookingBillSession.setRetired(false);
bookingBillSession.setPaidBillSession(newlyCreatedSettlingBillSession);
getBillFacade().edit(bookingBillSession.getBill());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,9 @@ public void calculateDueFeesOld() {
}

}


public void debugDueFees() {
Date startTime = new Date();

public void debugDueFees() {
Date startTime = new Date();

if (getSpeciality() == null) {
JsfUtil.addErrorMessage("Select Specility");
Expand All @@ -343,7 +342,7 @@ public void debugDueFees() {
+ " and b.fee.feeType=:ftp"
+ " and b.bill.refunded=false "
+ " and b.bill.cancelled=false "
+ " and b.bill.singleBillSession.absent=false"
// + " and b.bill.singleBillSession.absent=false"
+ " and (b.feeValue - b.paidValue) > 0 "
+ " and b.bill.billType in :bt "
+ " and b.staff=:stf ";
Expand All @@ -363,8 +362,11 @@ public void debugDueFees() {
hm.put("ss", getSelectedServiceSession());
}

sql += " and b.bill.singleBillSession.absent=false "
+ " order by b.bill.singleBillSession.serviceSession.sessionDate,"
// sql += " and b.bill.singleBillSession.absent=false "
// + " order by b.bill.singleBillSession.serviceSession.sessionDate,"
// + " b.bill.singleBillSession.serviceSession.sessionTime,"
// + " b.bill.singleBillSession.serialNo ";
sql += " order by b.bill.singleBillSession.serviceSession.sessionDate,"
+ " b.bill.singleBillSession.serviceSession.sessionTime,"
+ " b.bill.singleBillSession.serialNo ";

Expand Down Expand Up @@ -415,7 +417,7 @@ public void debugDueFees() {
nonRefundableBillFees = billFeeFacade.findByJpql(sql, m, TemporalType.TIMESTAMP);
dueBillFees.addAll(nonRefundableBillFees);

}
}

public void calculateDueFees() {
Date startTime = new Date();
Expand Down Expand Up @@ -445,7 +447,7 @@ public void calculateDueFees() {
+ " and b.fee.feeType=:ftp"
+ " and b.bill.refunded=false "
+ " and b.bill.cancelled=false "
+ " and b.bill.singleBillSession.absent=false"
// + " and b.bill.singleBillSession.absent=false"
+ " and (b.feeValue - b.paidValue) > 0 "
+ " and b.bill.billType in :bt "
+ " and b.staff=:stf ";
Expand All @@ -465,8 +467,11 @@ public void calculateDueFees() {
hm.put("ss", getSelectedServiceSession());
}

sql += " and b.bill.singleBillSession.absent=false "
+ " order by b.bill.singleBillSession.serviceSession.sessionDate,"
// sql += " and b.bill.singleBillSession.absent=false "
// + " order by b.bill.singleBillSession.serviceSession.sessionDate,"
// + " b.bill.singleBillSession.serviceSession.sessionTime,"
// + " b.bill.singleBillSession.serialNo ";
sql += " order by b.bill.singleBillSession.serviceSession.sessionDate,"
+ " b.bill.singleBillSession.serviceSession.sessionTime,"
+ " b.bill.singleBillSession.serialNo ";

Expand Down Expand Up @@ -537,14 +542,16 @@ public void calculateSessionDueFees() {
+ " and b.fee.feeType=:ftp"
+ " and b.bill.refunded=false "
+ " and b.bill.cancelled=false "
+ " and b.bill.singleBillSession.absent=false"
// + " and b.bill.singleBillSession.absent=false"
+ " and (b.feeValue - b.paidValue) > 0 "
+ " and b.bill.billType in :bt "
+ " and b.bill.singleBillSession.sessionInstance=:si";
+ " and b.bill.singleBillSession.sessionInstance=:si"
+ " and b.bill.singleBillSession.completed=:com";
sql += " order by b.bill.singleBillSession.serialNo ";
hm.put("si", getSessionInstance());
hm.put("bt", bts);
hm.put("ftp", FeeType.Staff);
hm.put("com", true);
hm.put("class", BilledBill.class);
dueBillFees = billFeeFacade.findByJpql(sql, hm, TemporalType.TIMESTAMP);

Expand All @@ -571,9 +578,8 @@ public void calculateSessionDueFees() {
dueBillFees.addAll(nonRefundableBillFees);

}


public void calculateSessionAllFees() {

public void calculateSessionDoneFees() {
Date startTime = new Date();
if (getSessionInstance() == null) {
JsfUtil.addErrorMessage("Select Specility");
Expand All @@ -587,18 +593,20 @@ public void calculateSessionAllFees() {
+ " FROM BillFee b "
+ " where type(b.bill)=:class "
+ " and b.bill.retired=false "
// + " and b.bill.paidAmount!=0 "
+ " and b.bill.paidAmount!=0 "
+ " and b.fee.feeType=:ftp"
+ " and b.bill.refunded=false "
+ " and b.bill.cancelled=false "
// + " and b.bill.singleBillSession.absent=false"
// + " and (b.feeValue - b.paidValue) > 0 "
// + " and b.bill.billType in :bt "
+ " and b.bill.singleBillSession.sessionInstance=:si";
// + " and b.bill.singleBillSession.absent=false"
+ " and (b.feeValue - b.paidValue) < 1 "
+ " and b.bill.billType in :bt "
+ " and b.bill.singleBillSession.sessionInstance=:si"
+ " and b.bill.singleBillSession.completed=:com";
sql += " order by b.bill.singleBillSession.serialNo ";
hm.put("si", getSessionInstance());
// hm.put("bt", bts);
hm.put("bt", bts);
hm.put("ftp", FeeType.Staff);
hm.put("com", true);
hm.put("class", BilledBill.class);
dueBillFees = billFeeFacade.findByJpql(sql, hm, TemporalType.TIMESTAMP);

Expand All @@ -615,7 +623,7 @@ public void calculateSessionAllFees() {
+ " and b.bill.billType in :bt "
+ " and b.bill.singleBillSession.sessionInstance=:si "
+ " and b.bill.singleBillSession.absent=true "
+ " and b.bill.singleBillSession.sessionInstance.originatingSession.refundable=false ";
+ " and b.bill.singleBillSession.serviceSession.originatingSession.refundable=false ";
sql += " order by b.bill.singleBillSession.serialNo ";
m.put("si", getSessionInstance());
m.put("bt", bts);
Expand All @@ -626,6 +634,32 @@ public void calculateSessionAllFees() {

}

public void calculateSessionAllFees() {
if (getSessionInstance() == null) {
JsfUtil.addErrorMessage("Select Specility");
return;
}

BillType[] billTypes = {BillType.ChannelAgent, BillType.ChannelCash, BillType.ChannelPaid};
List<BillType> bts = Arrays.asList(billTypes);
HashMap<String, Object> hm = new HashMap<>();
String sql = " SELECT b "
+ " FROM BillFee b "
+ " where type(b.bill) in :classes "
+ " and b.bill.retired=false "
+ " and b.fee.feeType=:ftp"
+ " and b.bill.singleBillSession.sessionInstance=:si";
sql += " order by b.bill.singleBillSession.serialNo ";
List<Class<?>> classes = new ArrayList<>();
classes.add(BilledBill.class);

hm.put("si", getSessionInstance());
hm.put("ftp", FeeType.Staff);
hm.put("classes", classes);
System.out.println("sql = " + sql);
System.out.println("hm = " + hm);
dueBillFees = billFeeFacade.findByJpql(sql, hm, TemporalType.TIMESTAMP);
}

public void calculateDueFeesAgency() {
Date startTime = new Date();
Expand Down Expand Up @@ -790,20 +824,20 @@ private Bill createPaymentBill() {

return tmp;
}

public Payment createPaymentProPayment(Bill bill, PaymentMethod pm) {
Payment p = new Payment();
p.setBill(bill);
double valueToSet = 0 - Math.abs(bill.getNetTotal());
p.setPaidValue(valueToSet);
if(pm == null){
if (pm == null) {
pm = bill.getPaymentMethod();
}
setPaymentMethodData(p, pm);
return p;
}
public void setPaymentMethodData(Payment p, PaymentMethod pm) {

public void setPaymentMethodData(Payment p, PaymentMethod pm) {
p.setInstitution(getSessionController().getInstitution());
p.setDepartment(getSessionController().getDepartment());
p.setCreatedAt(new Date());
Expand Down Expand Up @@ -967,13 +1001,13 @@ public void settleBill() {
Bill b = createPaymentBillForSession();
current = b;
getBillFacade().create(b);
createPaymentProPayment(b,paymentMethod);
createPaymentProPayment(b, paymentMethod);
saveBillItemsAndFees(b);
if (sessionController.getDepartmentPreference().isSendSmsOnChannelBookingDocterPayment()) {
sendSmsAfterDocPayment();
}
printPreview = true;
currentStaff=null;
currentStaff = null;
JsfUtil.addSuccessMessage("Successfully Paid");
//////// // System.out.println("Paid");
}
Expand All @@ -984,7 +1018,7 @@ public void settleSessionPaymentBill() {
}
calculateTotalPay();
Bill b = createPaymentBill();

getBillFacade().create(b);
createPaymentProPayment(b, paymentMethod);
List<BillItem> bis = saveBillItemsAndFees(b);
Expand All @@ -998,7 +1032,7 @@ public void settleSessionPaymentBill() {
sendSmsAfterSessionPayment();
}
printPreview = true;
currentStaff=null;
currentStaff = null;
JsfUtil.addSuccessMessage("Successfully Paid");
}

Expand Down
Loading

0 comments on commit 6973337

Please sign in to comment.