adamsaghy commented on code in PR #5849:
URL: https://github.com/apache/fineract/pull/5849#discussion_r3265902813


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/repository/WorkingCapitalLoanTransactionRepository.java:
##########
@@ -37,4 +43,15 @@ public interface WorkingCapitalLoanTransactionRepository 
extends JpaRepository<W
     Optional<WorkingCapitalLoanTransaction> findByWcLoan_IdAndExternalId(Long 
wcLoanId, ExternalId externalId);
 
     boolean existsByExternalId(ExternalId externalId);
+
+    @Query("""
+            SELECT COALESCE(SUM(t.transactionAmount), 0)
+            FROM WorkingCapitalLoanTransaction t
+            WHERE t.wcLoan.id = :loanId
+            AND t.transactionDate BETWEEN :fromDate AND :toDate
+            AND t.reversed = false
+            AND t.transactionType IN :reducingTypes
+            """)
+    BigDecimal sumPaymentsInWindow(@Param("loanId") Long loanId, 
@Param("fromDate") LocalDate fromDate, @Param("toDate") LocalDate toDate,

Review Comment:
   We dont need this. Paid amount is available on the breach schedule already.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to