Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
ISTE-229
Browse files Browse the repository at this point in the history
  • Loading branch information
Saloni-eGov committed Aug 9, 2024
1 parent 9f9cf75 commit 587b476
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ private void addPaymentToLedger(List<Map<String, Object>> monthlyRecordList) {
boolean paymentMatched = false;
if(payments!=null)
{
BigDecimal totalPaymentInMonth=BigDecimal.ZERO;
BigDecimal totalBalanceLeftInMonth=BigDecimal.ZERO;
for (Payment payment : payments) {
Long transactionDateLong = payment.getTransactionDate();
LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate();
Expand All @@ -201,22 +203,18 @@ private void addPaymentToLedger(List<Map<String, Object>> monthlyRecordList) {
paymentLedgerReport.setCollectionDate(transactionDateLong);
paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber());
paymentLedgerReport.setPaid(payment.getTotalAmountPaid());
// BigDecimal totalDueAmount=payment.getTotalDue();
// if(totalDueAmount.equals(BigDecimal.ZERO))
// {
paymentLedgerReport.setBalanceLeft(payment.getTotalDue().subtract(paymentLedgerReport.getPaid()));
// }
// else
// {
// paymentLedgerReport.setBalanceLeft(totalDueAmount.subtract(paymentLedgerReport.getPaid()));
// }
paymentLedgerReport.setBalanceLeft(payment.getTotalDue().subtract(paymentLedgerReport.getPaid()));
totalPaymentInMonth=totalPaymentInMonth.add(payment.getTotalAmountPaid());
totalBalanceLeftInMonth=totalBalanceLeftInMonth.add(payment.getTotalDue());
if (ledgerReport.getPayment() == null) {
ledgerReport.setPayment(new ArrayList<>());
}
ledgerReport.getPayment().add(paymentLedgerReport);
paymentMatched = true;
}
}
ledgerReport.setTotalBalanceLeftInMonth(totalPaymentInMonth);
ledgerReport.setTotalPaymentInMonth(totalPaymentInMonth);
}
if (!paymentMatched) {
PaymentLedgerReport defaultPaymentLedgerReport = new PaymentLedgerReport();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -17,4 +18,10 @@ public class LedgerReport

@JsonProperty("payment")
private List<PaymentLedgerReport> payment=new ArrayList<>();

@JsonProperty("totalPaymentInMonth")
private BigDecimal totalPaymentInMonth=BigDecimal.ZERO;

@JsonProperty("totalBalanceLeftInMonth")
private BigDecimal totalBalanceLeftInMonth=BigDecimal.ZERO;
}

0 comments on commit 587b476

Please sign in to comment.