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


##########
fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/interest/PostingPeriod.java:
##########
@@ -163,30 +188,41 @@ public static PostingPeriod createFromDTO(final 
LocalDateInterval periodInterval
             final LocalDate upToInterestCalculationDate, Collection<Long> 
interestPostTransactions, boolean isInterestTransfer,
             final Money minBalanceForInterestCalculation, final boolean 
isSavingsInterestPostingAtCurrentPeriodEnd,
             final BigDecimal overdraftInterestRateAsFraction, final Money 
minOverdraftForInterestCalculation, boolean isUserPosting,
-            int financialYearBeginningMonth, final boolean isAllowOverdraft) {
+            int financialYearBeginningMonth, final boolean isAllowOverdraft, 
final boolean isEntraceNewValidation) {
 
         final List<EndOfDayBalance> accountEndOfDayBalances = new 
ArrayList<>();
         boolean interestTransfered = false;
         Money openingDayBalance = periodStartingBalance;
         Money closeOfDayBalance = openingDayBalance;
+        Boolean isEndTrasaccion = false;
 
         for (final SavingsAccountTransactionData transaction : 
orderedListOfTransactions) {
 
             if (transaction.fallsWithin(periodInterval)) {
                 // the balance of the transaction falls entirely within this
-                // period so no need to do any cropping/bounding
+                // period so no need to do any cropping/bounding //ENTRA 
CUANDO SON POSITIVOS AQUI
                 final EndOfDayBalance endOfDayBalance = 
transaction.toEndOfDayBalance(openingDayBalance);
                 accountEndOfDayBalances.add(endOfDayBalance);
+                endOfDayBalance.setDecimales(currency.getDigitsAfterDecimal());
 
                 openingDayBalance = endOfDayBalance.closingBalance();
 
             } else if (transaction.spansAnyPortionOf(periodInterval)) {
                 final EndOfDayBalance endOfDayBalance = 
transaction.toEndOfDayBalanceBoundedBy(openingDayBalance, periodInterval,
                         isAllowOverdraft);
                 accountEndOfDayBalances.add(endOfDayBalance);
+                endOfDayBalance.setDecimales(currency.getDigitsAfterDecimal());
 
                 closeOfDayBalance = endOfDayBalance.closingBalance();
                 openingDayBalance = closeOfDayBalance;
+            } else if (!isEntraceNewValidation && !isEndTrasaccion && 
MathUtil.isLessThanZero(transaction.getRunningBalance())
+                    && (DateUtils.isEqual(periodInterval.startDate(), 
transaction
+                            .getDate()) /* 
DateUtils.isEqual(periodInterval.endDate(), transaction.getDate()) */)) {

Review Comment:
   Remove commented code



##########
fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/interest/PostingPeriod.java:
##########
@@ -163,30 +188,41 @@ public static PostingPeriod createFromDTO(final 
LocalDateInterval periodInterval
             final LocalDate upToInterestCalculationDate, Collection<Long> 
interestPostTransactions, boolean isInterestTransfer,
             final Money minBalanceForInterestCalculation, final boolean 
isSavingsInterestPostingAtCurrentPeriodEnd,
             final BigDecimal overdraftInterestRateAsFraction, final Money 
minOverdraftForInterestCalculation, boolean isUserPosting,
-            int financialYearBeginningMonth, final boolean isAllowOverdraft) {
+            int financialYearBeginningMonth, final boolean isAllowOverdraft, 
final boolean isEntraceNewValidation) {
 
         final List<EndOfDayBalance> accountEndOfDayBalances = new 
ArrayList<>();
         boolean interestTransfered = false;
         Money openingDayBalance = periodStartingBalance;
         Money closeOfDayBalance = openingDayBalance;
+        Boolean isEndTrasaccion = false;
 
         for (final SavingsAccountTransactionData transaction : 
orderedListOfTransactions) {
 
             if (transaction.fallsWithin(periodInterval)) {
                 // the balance of the transaction falls entirely within this
-                // period so no need to do any cropping/bounding
+                // period so no need to do any cropping/bounding //ENTRA 
CUANDO SON POSITIVOS AQUI
                 final EndOfDayBalance endOfDayBalance = 
transaction.toEndOfDayBalance(openingDayBalance);
                 accountEndOfDayBalances.add(endOfDayBalance);
+                endOfDayBalance.setDecimales(currency.getDigitsAfterDecimal());
 
                 openingDayBalance = endOfDayBalance.closingBalance();
 
             } else if (transaction.spansAnyPortionOf(periodInterval)) {
                 final EndOfDayBalance endOfDayBalance = 
transaction.toEndOfDayBalanceBoundedBy(openingDayBalance, periodInterval,
                         isAllowOverdraft);
                 accountEndOfDayBalances.add(endOfDayBalance);
+                endOfDayBalance.setDecimales(currency.getDigitsAfterDecimal());
 
                 closeOfDayBalance = endOfDayBalance.closingBalance();
                 openingDayBalance = closeOfDayBalance;
+            } else if (!isEntraceNewValidation && !isEndTrasaccion && 
MathUtil.isLessThanZero(transaction.getRunningBalance())
+                    && (DateUtils.isEqual(periodInterval.startDate(), 
transaction
+                            .getDate()) /* 
DateUtils.isEqual(periodInterval.endDate(), transaction.getDate()) */)) {
+                final EndOfDayBalance endOfDayBalance = 
transaction.toEndOfDayBalanceDates(openingDayBalance, periodInterval);
+                accountEndOfDayBalances.add(endOfDayBalance);
+                openingDayBalance = endOfDayBalance.closingBalance();
+                isEndTrasaccion = true;

Review Comment:
   typo



-- 
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