Skip to content

Commit

Permalink
Merge pull request #6475 from hmislk/Issue#6474
Browse files Browse the repository at this point in the history
Issue#6474 Closes #6474
  • Loading branch information
DeshaniPubudu authored Jul 21, 2024
2 parents d6255e2 + c8426c3 commit 60fbfac
Show file tree
Hide file tree
Showing 15 changed files with 2,936 additions and 483 deletions.
2 changes: 1 addition & 1 deletion .github/counter.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8
8
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,6 +16,7 @@
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;
Expand All @@ -32,8 +34,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,6 +67,8 @@ public class FinancialTransactionController implements Serializable {
SearchController searchController;
@Inject
BillSearch billSearch;
@Inject
ConfigOptionApplicationController configOptionApplicationController;
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Class Variables">
Expand Down Expand Up @@ -331,8 +339,6 @@ public void selectNetVoucherTotalDetails() {
paymentsSelected = selectedPayments;
}



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


public void selectRefundedOtherNonCreditDetails() {
List<PaymentMethod> paymentMethods = financialReportByPayments.getPaymentMethodsForRefundedDebitCard();
List<BillTypeAtomic> billTypes = financialReportByPayments.getBillTypesForRefundedDebitCard();
Expand All @@ -362,7 +367,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 +420,7 @@ public void selectFloatHandoverDetails() {
}

public void selectNetFloatDetails() {

List<BillTypeAtomic> billTypes = financialReportByPayments.getBillTypesForFloatCollected();
billTypes.addAll(financialReportByPayments.getBillTypesForFloatHandover());
List<Payment> allPayments = paymentsFromShiftSratToNow;
Expand Down Expand Up @@ -781,6 +785,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 +948,7 @@ private void createPaymentSummery() {

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

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

}
Expand All @@ -968,6 +975,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 @@ -1525,6 +1533,36 @@ public Payment getCurrentPayment() {
return currentPayment;
}

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 = configOptionApplicationController.getDenominations();
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
Loading

0 comments on commit 60fbfac

Please sign in to comment.