Skip to content

Commit

Permalink
Merge pull request #6848 from hmislk/Issue##6847
Browse files Browse the repository at this point in the history
Issue##6847 Closes #6847
  • Loading branch information
Irani96 authored Aug 21, 2024
2 parents 3746847 + d8ebc39 commit 5179408
Show file tree
Hide file tree
Showing 67 changed files with 1,207 additions and 1,068 deletions.
6 changes: 3 additions & 3 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>demo</artifactId>
<artifactId>horizon</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>demo</name>
<name>horizon</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
Expand Down Expand Up @@ -200,7 +200,7 @@
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>13.0.10</version>
<version>14.0.3</version>
<type>jar</type>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ public void processShiftEndReport() {
WebUser paramUser = nonClosedShiftStartFundBill.getCreater();
Institution paramCreditCompany = null;
Long paramStartId = nonClosedShiftStartFundBill.getId();
Long paramEndId = nonClosedShiftStartFundBill.getReferenceBill().getId();
Long paramEndId=null;
if(nonClosedShiftStartFundBill.getReferenceBill()!=null){
paramEndId = nonClosedShiftStartFundBill.getReferenceBill().getId();
}


ReportTemplateRowBundle tmpChannellingBundle = addChannellingByCategories(
channelingType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ public class BookingControllerViewScope implements Serializable, ControllerWithP
private boolean listCompleted;
private boolean listAll;
private boolean sessionInstanceStartedEdited;

boolean billingStarted=false;

public void sessionReschedule() {
if (getSelectedSessionInstanceForRechedule() == null) {
Expand Down Expand Up @@ -3087,22 +3089,33 @@ private boolean paymentMethodErrorPresent() {
}

public void addNormalChannelBooking() {
if(billingStarted){
return;
}
billingStarted=true;
if (selectedSessionInstance == null) {
JsfUtil.addErrorMessage("Please select a Session");
billingStarted=false;
return;
}
addChannelBooking(false);
fillBillSessions();
billingStarted=false;
}

public void addReservedChannelBooking() {
if(billingStarted){
return;
}
billingStarted=true;
if (selectedSessionInstance == null) {
JsfUtil.addErrorMessage("Please select a Session Instance");
return;
}
boolean reservedBooking = true;
addChannelBooking(reservedBooking);
fillBillSessions();
billingStarted=false;
}

public void addChannelBooking(boolean reservedBooking) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import com.divudi.facade.BillSessionFacade;
import com.divudi.facade.DepartmentFacade;
import com.divudi.facade.ServiceSessionFacade;
import com.divudi.facade.SessionInstanceFacade;
import com.divudi.facade.StaffFacade;
import com.divudi.facade.WebUserFacade;
import com.divudi.java.CommonFunctions;
Expand Down Expand Up @@ -87,6 +88,7 @@ public class ChannelReportTemplateController implements Serializable {
private double repayTotalFee;
private double taxTotal;
private double total;
private List<SessionInstance> sessionInstances;
///////
private List<BillSession> billSessions;
private List<BillSession> billSessionsBilled;
Expand Down Expand Up @@ -195,6 +197,9 @@ public class ChannelReportTemplateController implements Serializable {
@EJB
ArrivalRecordFacade arrivalRecordFacade;

@EJB
SessionInstanceFacade sessionInstanceFacade;

public void clearAll() {
billedBills = new ArrayList<>();
cancelBills = new ArrayList<>();
Expand Down Expand Up @@ -605,6 +610,115 @@ public void fillDailySessionCounts() {

}

public void fillBillSessions(SessionInstance sessionInstance) {
BillType[] billTypes = {
BillType.ChannelAgent,
BillType.ChannelCash,
BillType.ChannelOnCall,
BillType.ChannelStaff,
BillType.ChannelCredit,
BillType.ChannelResheduleWithPayment,
BillType.ChannelResheduleWithOutPayment
};
List<BillType> bts = Arrays.asList(billTypes);
String sql = "Select bs "
+ " From BillSession bs "
+ " where bs.retired=false"
+ " and bs.bill.billType in :bts"
+ " and type(bs.bill)=:class "
+ " and bs.sessionInstance=:ss "
+ " order by bs.serialNo ";
HashMap<String, Object> hh = new HashMap<>();
hh.put("bts", bts);
hh.put("class", BilledBill.class);
hh.put("ss", sessionInstance);
billSessions = getBillSessionFacade().findByJpql(sql, hh, TemporalType.DATE);

// Initialize counts
long bookedPatientCount = 0;
long paidPatientCount = 0;
long completedPatientCount = 0;
long cancelPatientCount = 0;
long refundedPatientCount = 0;
long onCallPatientCount = 0;
long reservedBookingCount = 0;

if (billSessions == null || billSessions.isEmpty()) {
sessionInstance.setBookedPatientCount(0L);
sessionInstance.setPaidPatientCount(0L);
sessionInstance.setCompletedPatientCount(0L);
sessionInstance.setRemainingPatientCount(0L);
sessionInstanceFacade.edit(sessionInstance);
return;
}

// Loop through billSessions to calculate counts
for (BillSession bs : billSessions) {
if (bs == null) {
continue;
}

bookedPatientCount++; // Always increment if bs is not null

if (Boolean.TRUE.equals(bs.isReservedBooking())) {
reservedBookingCount++;
}

if (Boolean.TRUE.equals(bs.isCompleted())) {
completedPatientCount++;
}

if (bs.getPaidBillSession() != null) {
paidPatientCount++;
}

if (bs.getBill() != null) {
if (Boolean.TRUE.equals(bs.getBill().isCancelled())) {
cancelPatientCount++;
}

if (Boolean.TRUE.equals(bs.getBill().isRefunded())) {
refundedPatientCount++;
}

if (bs.getPaidBillSession() == null && !Boolean.TRUE.equals(bs.getBill().isCancelled())) {
onCallPatientCount++;
}
}
}

// Set calculated counts to sessionInstance
sessionInstance.setBookedPatientCount(bookedPatientCount);
sessionInstance.setPaidPatientCount(paidPatientCount);
sessionInstance.setCompletedPatientCount(completedPatientCount);
sessionInstance.setCancelPatientCount(cancelPatientCount);
sessionInstance.setRefundedPatientCount(refundedPatientCount);
sessionInstance.setOnCallPatientCount(onCallPatientCount);
sessionInstance.setReservedBookingCount(reservedBookingCount);

// Assuming remainingPatientCount is calculated as booked - completed
sessionInstance.setRemainingPatientCount(bookedPatientCount - completedPatientCount);
sessionInstanceFacade.edit(sessionInstance);
}

public void processAndfillDailySessionCounts() {
String j;
Map m = new HashMap();
rows = new ArrayList<>();
j = "select si "
+ " from SessionInstance si "
+ " where si.retired=false "
+ " and si.sessionDate between :fd and :td ";
if (institution != null) {
m.put("ins", institution);
j += " and si.institution=:ins ";
}
sessionInstances = sessionInstanceFacade.findByJpql(j, m);
for (SessionInstance si : sessionInstances) {
fillBillSessions(si);
}
}

public void fillCategorySessionCounts() {
bundle = new ReportTemplateRowBundle();
String j;
Expand Down Expand Up @@ -6007,6 +6121,14 @@ public void setCategories(List<Category> categories) {
this.categories = categories;
}

public List<SessionInstance> getSessionInstances() {
return sessionInstances;
}

public void setSessionInstances(List<SessionInstance> sessionInstances) {
this.sessionInstances = sessionInstances;
}

public class DocPage {

List<AvalabelChannelDoctorRow> table1;
Expand Down Expand Up @@ -7523,6 +7645,4 @@ public void setDoctorDayChannelCounts(List<DoctorDayChannelCount> doctorDayChann
this.doctorDayChannelCounts = doctorDayChannelCounts;
}



}
8 changes: 6 additions & 2 deletions src/main/java/com/divudi/bean/common/EnumController.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.divudi.data.FeeType;
import com.divudi.data.InvestigationItemType;
import com.divudi.data.InvestigationItemValueType;
import com.divudi.data.InvestigationReportType;
import com.divudi.data.ItemBarcodeGenerationStrategy;
import com.divudi.data.ItemListingStrategy;
import com.divudi.data.ItemType;
Expand Down Expand Up @@ -147,6 +148,10 @@ public List<PaymentMethod> getPaymentMethodsForChanneling() {
return paymentMethodsForChanneling;
}

public List<InvestigationReportType> getInvestigationReportTypes() {
return Arrays.asList(InvestigationReportType.values());
}

public List<PaymentMethod> getPaymentMethodsForChannelSettling() {
if (paymentMethodsForChannelSettling == null) {
fillPaymentMethodsForChannelSettling();
Expand Down Expand Up @@ -221,8 +226,7 @@ public <E extends Enum<E>> E getEnumValue(Class<E> enumType, String enumName) {
return null; // Return null if no match is found
}


public List<Priority> getPriorities() {
public List<Priority> getPriorities() {
return Arrays.asList(Priority.values());
}

Expand Down
Loading

0 comments on commit 5179408

Please sign in to comment.