fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/2] incubator-fineract git commit: commit for FINERACT-61 (Incorrect penalty and fee charges amount inserted into the 'm_loan_arrears_aging' table)
Date Mon, 01 Aug 2016 07:41:09 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop 0a390f7a0 -> ada9ced9a


commit for FINERACT-61 (Incorrect penalty and fee charges amount inserted into the 'm_loan_arrears_aging'
table)


Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/31a3d161
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/31a3d161
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/31a3d161

Branch: refs/heads/develop
Commit: 31a3d16170f06055f1741a299e17d42849d26dcb
Parents: 5ac0da0
Author: Emmanuel Nnaa <emmanuelnnaa@musoni.eu>
Authored: Mon Jul 25 14:20:31 2016 +0200
Committer: Emmanuel Nnaa <emmanuelnnaa@musoni.eu>
Committed: Mon Jul 25 14:20:31 2016 +0200

----------------------------------------------------------------------
 .../service/LoanArrearsAgingServiceImpl.java    | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/31a3d161/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java
index e482395..f1db739 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java
@@ -94,23 +94,23 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService,
Bus
         this.jdbcTemplate.execute("truncate table m_loan_arrears_aging");
 
         final StringBuilder updateSqlBuilder = new StringBuilder(900);
+        final String principalOverdueCalculationSql = "SUM(ifnull(mr.principal_amount, 0)
- ifnull(mr.principal_completed_derived, 0) - ifnull(mr.principal_writtenoff_derived, 0))";
+        final String interestOverdueCalculationSql = "SUM(ifnull(mr.interest_amount, 0) -
ifnull(mr.interest_writtenoff_derived, 0) - ifnull(mr.interest_waived_derived, 0) - "
+                + "ifnull(mr.interest_completed_derived, 0))";
+        final String feeChargesOverdueCalculationSql = "SUM(ifnull(mr.fee_charges_amount,
0) - ifnull(mr.fee_charges_writtenoff_derived, 0) - "
+                + "ifnull(mr.fee_charges_waived_derived, 0) - ifnull(mr.fee_charges_completed_derived,
0))";
+        final String penaltyChargesOverdueCalculationSql = "SUM(ifnull(mr.penalty_charges_amount,
0) - ifnull(mr.penalty_charges_writtenoff_derived, 0) - "
+                + "ifnull(mr.penalty_charges_waived_derived, 0) - ifnull(mr.penalty_charges_completed_derived,
0))";
 
         updateSqlBuilder
                 .append("INSERT INTO m_loan_arrears_aging(`loan_id`,`principal_overdue_derived`,`interest_overdue_derived`,`fee_charges_overdue_derived`,`penalty_charges_overdue_derived`,`total_overdue_derived`,`overdue_since_date_derived`)");
         updateSqlBuilder.append("select ml.id as loanId,");
-        updateSqlBuilder
-                .append("SUM((ifnull(mr.principal_amount,0) - ifnull(mr.principal_completed_derived,
0))) as principal_overdue_derived,");
-        updateSqlBuilder
-                .append("SUM((ifnull(mr.interest_amount,0)  - ifnull(mr.interest_completed_derived,
0))) as interest_overdue_derived,");
-        updateSqlBuilder
-                .append("SUM((ifnull(mr.fee_charges_amount,0)  - ifnull(mr.fee_charges_completed_derived,
0))) as fee_charges_overdue_derived,");
-        updateSqlBuilder
-                .append("SUM((ifnull(mr.penalty_charges_amount,0)  - ifnull(mr.penalty_charges_completed_derived,
0))) as penalty_charges_overdue_derived,");
-        updateSqlBuilder.append("SUM((ifnull(mr.principal_amount,0) - ifnull(mr.principal_completed_derived,
0))) +");
-        updateSqlBuilder.append("SUM((ifnull(mr.interest_amount,0)  - ifnull(mr.interest_completed_derived,
0))) +");
-        updateSqlBuilder.append("SUM((ifnull(mr.fee_charges_amount,0)  - ifnull(mr.fee_charges_completed_derived,
0))) +");
-        updateSqlBuilder
-                .append("SUM((ifnull(mr.penalty_charges_amount,0)  - ifnull(mr.penalty_charges_completed_derived,
0))) as total_overdue_derived,");
+        updateSqlBuilder.append(principalOverdueCalculationSql + " as principal_overdue_derived,");
+        updateSqlBuilder.append(interestOverdueCalculationSql + " as interest_overdue_derived,");
+        updateSqlBuilder.append(feeChargesOverdueCalculationSql + " as fee_charges_overdue_derived,");
+        updateSqlBuilder.append(penaltyChargesOverdueCalculationSql + " as penalty_charges_overdue_derived,");
+        updateSqlBuilder.append(principalOverdueCalculationSql + "+" + interestOverdueCalculationSql
+ "+");
+        updateSqlBuilder.append(feeChargesOverdueCalculationSql + "+" + penaltyChargesOverdueCalculationSql
+ " as total_overdue_derived,");
         updateSqlBuilder.append("MIN(mr.duedate) as overdue_since_date_derived ");
         updateSqlBuilder.append(" FROM m_loan ml ");
         updateSqlBuilder.append(" INNER JOIN m_loan_repayment_schedule mr on mr.loan_id =
ml.id ");


Mime
View raw message