Skip to content

Commit

Permalink
Merge branch 'master' into Issue#6494
Browse files Browse the repository at this point in the history
  • Loading branch information
Pubudu-Piyankara authored Jul 21, 2024
2 parents e8a4530 + 93c17ea commit 52519e6
Show file tree
Hide file tree
Showing 41 changed files with 3,797 additions and 833 deletions.
2 changes: 1 addition & 1 deletion .github/counter.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3
16
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ Developed using Java Enterprise Edition, the system offers both a web applicatio

## Current Version

Current Version: 3.0.0.20240721.3 (This line will be automatically updated to reflect the latest version)

Current Version: 3.0.0.20240721.16 (This line will be automatically updated to reflect the latest version)



## History

Expand Down
2 changes: 1 addition & 1 deletion nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ That way multiple projects can share the same settings (useful for formatting ru
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>pfv5ee8</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<netbeans.compile.on.save>none</netbeans.compile.on.save>
<org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>false</org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>

</properties>
</project-shared-configuration>
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,11 @@
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>

<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>9.0.83</version> <!-- or the version compatible with your setup -->
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.HashMap;
import com.divudi.bean.common.BillController;
import com.divudi.bean.common.BillSearch;
import com.divudi.bean.common.ConfigOptionApplicationController;
import com.divudi.bean.common.SearchController;
import com.divudi.bean.common.SessionController;
import com.divudi.data.BillClassType;
Expand All @@ -15,12 +16,14 @@
import com.divudi.data.AtomicBillTypeTotals;
import com.divudi.data.BillFinanceType;
import com.divudi.data.BillTypeAtomic;
import com.divudi.data.Denomination;
import com.divudi.data.FinancialReport;
import com.divudi.data.PaymentMethod;
import com.divudi.data.PaymentMethodValues;

import com.divudi.data.ReportTemplateRow;
import com.divudi.data.ReportTemplateRowBundle;
import com.divudi.data.dataStructure.PaymentMethodData;
import com.divudi.entity.WebUser;
import com.divudi.java.CommonFunctions;
import javax.inject.Named;
Expand All @@ -32,8 +35,12 @@
import java.util.Map;
import java.util.stream.Collectors;
import javax.ejb.EJB;
import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.event.ValueChangeEvent;
import javax.inject.Inject;
import javax.persistence.TemporalType;
import org.json.JSONArray;
import org.json.JSONObject;

/**
*
Expand Down Expand Up @@ -61,11 +68,14 @@ public class FinancialTransactionController implements Serializable {
SearchController searchController;
@Inject
BillSearch billSearch;
@Inject
ConfigOptionApplicationController configOptionApplicationController;
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Class Variables">
private Bill currentBill;
private Payment currentPayment;
private PaymentMethodData paymentMethodData;
private Payment removingPayment;
private List<Payment> currentBillPayments;
private List<Bill> currentBills;
Expand Down Expand Up @@ -331,8 +341,6 @@ public void selectNetVoucherTotalDetails() {
paymentsSelected = selectedPayments;
}



public void selectCollectedOtherNonCreditDetails() {
List<PaymentMethod> paymentMethods = financialReportByPayments.getPaymentMethodsForCollectedDebitCard();
List<BillTypeAtomic> billTypes = financialReportByPayments.getBillTypesForCollectedDebitCard();
Expand All @@ -347,7 +355,6 @@ public void selectCollectedOtherNonCreditDetails() {
paymentsSelected = selectedPayments;
}


public void selectRefundedOtherNonCreditDetails() {
List<PaymentMethod> paymentMethods = financialReportByPayments.getPaymentMethodsForRefundedDebitCard();
List<BillTypeAtomic> billTypes = financialReportByPayments.getBillTypesForRefundedDebitCard();
Expand All @@ -362,7 +369,6 @@ public void selectRefundedOtherNonCreditDetails() {
paymentsSelected = selectedPayments;
}


public void selectNetOtherNonCreditTotalDetails() {
List<PaymentMethod> paymentMethods = financialReportByPayments.getPaymentMethodsForBankDeposits();
List<BillTypeAtomic> billTypes = financialReportByPayments.getBillTypesForBankDeposits();
Expand Down Expand Up @@ -416,7 +422,7 @@ public void selectFloatHandoverDetails() {
}

public void selectNetFloatDetails() {

List<BillTypeAtomic> billTypes = financialReportByPayments.getBillTypesForFloatCollected();
billTypes.addAll(financialReportByPayments.getBillTypesForFloatHandover());
List<Payment> allPayments = paymentsFromShiftSratToNow;
Expand Down Expand Up @@ -644,6 +650,9 @@ public void addPaymentToInitialFundBill() {
getCurrentBillPayments().add(currentPayment);
calculateInitialFundBillTotal();
currentPayment = null;
getCurrentPayment();
getCurrentPayment().setCurrencyDenominations(null);
getCurrentPayment().setCurrencyDenominationsJson("");
}

public void addPaymentToFundTransferBill() {
Expand Down Expand Up @@ -781,6 +790,8 @@ public String settleInitialFundBill() {
p.setBill(currentBill);
p.setDepartment(sessionController.getDepartment());
p.setInstitution(sessionController.getInstitution());
// Serialize denominations before saving
p.serializeDenominations();
paymentController.save(p);
}
return "/cashier/initial_fund_bill_print?faces-redirect=true";
Expand Down Expand Up @@ -942,6 +953,7 @@ private void createPaymentSummery() {

return row;
}).collect(Collectors.toList());

getPaymentSummaryBundle().getReportTemplateRows().addAll(rows);

}
Expand All @@ -968,6 +980,7 @@ public String navigateToViewStartToEndOfSelectedShiftStartSummaryBill(Bill start
JsfUtil.addErrorMessage("No Start Bill");
return null;
}

endBill = startBill.getReferenceBill();
nonClosedShiftStartFundBill = startBill;
fillPaymentsFromShiftStartToEnd(startBill, endBill, startBill.getCreater());
Expand Down Expand Up @@ -1522,9 +1535,53 @@ public Payment getCurrentPayment() {
if (currentPayment == null) {
currentPayment = new Payment();
}
if (currentPayment.getCurrencyDenominations() == null) {
currentPayment.setCurrencyDenominations(configOptionApplicationController.getDenominations());
}
return currentPayment;
}

public PaymentMethodData getPaymentMethodData() {
if (paymentMethodData == null) {
paymentMethodData = new PaymentMethodData();
}
return paymentMethodData;
}

public void setPaymentMethodData(PaymentMethodData paymentMethodData) {
this.paymentMethodData = paymentMethodData;
}

public void updateCashDenominations(AjaxBehaviorEvent event) {
System.out.println("updateCashDenominations called");

if (currentPayment == null) {
System.out.println("currentPayment is null");
return;
}

double total = 0;
List<Denomination> denominations = currentPayment.getCurrencyDenominations();
for (Denomination denomination : denominations) {
int value = denomination.getCount();
System.out.println("Processing denomination: " + denomination.getValue() + " with count: " + value);
total += denomination.getValue() * value;
}
currentPayment.setPaidValue(total);
System.out.println("Total value calculated: " + total);

// Serialize updated denominations to JSON
JSONArray jsonArray = new JSONArray();
for (Denomination denomination : denominations) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("value", denomination.getValue());
jsonObject.put("count", denomination.getCount());
jsonArray.put(jsonObject);
}
currentPayment.setCurrencyDenominationsJson(jsonArray.toString());
System.out.println("Updated currencyDenominationsJson: " + currentPayment.getCurrencyDenominationsJson());
}

public void setCurrentPayment(Payment currentPayment) {
this.currentPayment = currentPayment;
}
Expand Down Expand Up @@ -1926,6 +1983,7 @@ public List<Bill> getShiaftStartBills() {

public void setShiaftStartBills(List<Bill> shiaftStartBills) {
this.shiaftStartBills = shiaftStartBills;

}

public List<Payment> getPaymentsSelected() {
Expand Down
78 changes: 72 additions & 6 deletions src/main/java/com/divudi/bean/channel/BookingController.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ public class BookingController implements Serializable, ControllerWithPatient {
SecurityController securityController;
@Inject
private CommonController commonController;
/**
* Properties
*/

// * Properties
// */
private Speciality speciality;
private Staff staff;
private Staff toStaff;
Expand Down Expand Up @@ -556,7 +556,8 @@ public void markSessionInstanceAsStarted() {
JsfUtil.addErrorMessage("No session selected");
return;
}
if (!selectedSessionInstance.isArrived()) {

if(!selectedSessionInstance.isArrived()){
markAsArrived();
}
selectedSessionInstance.setStarted(true);
Expand Down Expand Up @@ -624,7 +625,7 @@ public void markSessionInstanceAsCompleted() {
JsfUtil.addSuccessMessage("Session Completed");
sendSmsOnChannelMissingChannelBookings();
}

public void sendChannellingStatusUpdateNotificationSms(BillSession methodBillSession) {
if (methodBillSession == null) {
JsfUtil.addErrorMessage("Nothing to send");
Expand Down Expand Up @@ -670,7 +671,7 @@ public void sendChannellingStatusUpdateNotificationSms(BillSession methodBillSes

JsfUtil.addSuccessMessage("SMS Sent");
}

public String smsBody(BillSession r) {
String securityKey = sessionController.getApplicationPreference().getEncrptionKey();
if (securityKey == null || securityKey.trim().equals("")) {
Expand All @@ -688,6 +689,71 @@ public String smsBody(BillSession r) {
return b;
}

// ALREADY DEFIENED in line 629

// public void sendChannellingStatusUpdateNotificationSms(BillSession methodBillSession) {
// if (methodBillSession == null) {
// JsfUtil.addErrorMessage("Nothing to send");
// return;
// }
// if (methodBillSession.getSessionInstance() == null) {
// JsfUtil.addErrorMessage("No Session");
// return;
// }
// if (methodBillSession.getSessionInstance().getOriginatingSession() == null) {
// JsfUtil.addErrorMessage("No Originating Session");
// return;
// }
// if (methodBillSession.getBill() == null) {
// JsfUtil.addErrorMessage("No Bill");
// return;
// }
// if (methodBillSession.getBill().getPatient() == null) {
// JsfUtil.addErrorMessage("No Bill");
// return;
// }
//
// if (!methodBillSession.getBill().getPatient().getPerson().getSmsNumber().trim().equals("")) {
// Sms e = new Sms();
// e.setCreatedAt(new Date());
// e.setCreater(sessionController.getLoggedUser());
// e.setBill(methodBillSession.getBill());
// e.setCreatedAt(new Date());
// e.setSmsType(MessageType.ChannelStatusUpdate);
// e.setCreater(sessionController.getLoggedUser());
// e.setReceipientNumber(methodBillSession.getBill().getPatient().getPerson().getSmsNumber());
// e.setSendingMessage(smsBody(methodBillSession));
// e.setDepartment(getSessionController().getLoggedUser().getDepartment());
// e.setInstitution(getSessionController().getLoggedUser().getInstitution());
// e.setPending(false);
// getSmsFacade().create(e);
//
// Boolean sent = smsManager.sendSms(e);
// e.setSentSuccessfully(sent);
// getSmsFacade().edit(e);
//
// }
//
// JsfUtil.addSuccessMessage("SMS Sent");
// }
//
// public String smsBody(BillSession r) {
// String securityKey = sessionController.getApplicationPreference().getEncrptionKey();
// if (securityKey == null || securityKey.trim().equals("")) {
// sessionController.getApplicationPreference().setEncrptionKey(securityController.generateRandomKey(10));
// sessionController.savePreferences(sessionController.getApplicationPreference());
// }
// Calendar c = Calendar.getInstance();
// c.add(Calendar.DATE, 2);
// String temId = securityController.encryptAlphanumeric(r.getId().toString(), securityKey);
// String url = commonController.getBaseUrl() + "faces/requests/cbss.xhtml?id=" + temId;
// String b = "Your session of "
// + r.getSessionInstance().getOriginatingSession().getName()
// + " Started. "
// + url;
// return b;
// }

public String navigateToAddBooking() {
if (staff == null) {
JsfUtil.addErrorMessage("Please select a Docter");
Expand Down
Loading

0 comments on commit 52519e6

Please sign in to comment.