adamsaghy commented on code in PR #4885: URL: https://github.com/apache/fineract/pull/4885#discussion_r2259820202
########## fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepository.java: ########## @@ -70,4 +72,25 @@ SavingsAccount findByIdAndDepositAccountType(@Param("accountId") Long accountId, @Query("SELECT sa.id FROM SavingsAccount sa WHERE sa.externalId = :externalId") Long findIdByExternalId(@Param("externalId") ExternalId externalId); + + @Query(""" + SELECT new org.apache.fineract.portfolio.savings.data.SavingsAccrualData( + savings.id, + savings.accountNumber, + savings.accruedTillDate, + CASE WHEN apm.financialAccountType = 18 THEN TRUE ELSE FALSE END, + msp.allowOverdraft + ) + FROM SavingsAccount savings + LEFT JOIN SavingsProduct msp ON msp = savings.product + LEFT JOIN ProductToGLAccountMapping apm ON apm.productId = msp.id and (apm.financialAccountType = 18 or apm.financialAccountType IS NULL) + WHERE savings.status = :status + AND (savings.nominalAnnualInterestRate IS NOT NULL AND savings.nominalAnnualInterestRate > 0) + AND msp.accountingRule = :accountingRule + AND ( savings.closedOnDate <= :tillDate OR savings.closedOnDate IS NULL) + AND ( savings.accruedTillDate <= :tillDate OR savings.accruedTillDate IS NULL ) + ORDER BY savings.id + """) + List<SavingsAccrualData> findPeriodicAccrualData(@Param("tillDate") LocalDate tillDate, @Param("savingsId") Long savingsId, Review Comment: Since the accountingRule is coming as parameter, the method name is not correct. Should we remove the "periodic" part? -- 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: commits-unsubscr...@fineract.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org