Repository: incubator-fineract Updated Branches: refs/heads/develop f59dacbfc -> 254d25970
FINERACT-360 : Individual Collection Sheet is not considering Installment Fee during payment Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/254d2597 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/254d2597 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/254d2597 Branch: refs/heads/develop Commit: 254d2597053bac316d89ab7e3e0f83dc1d39d7f0 Parents: f59dacb Author: nazeer1100126 <nazeer.sh...@confluxtechnologies.com> Authored: Mon Mar 27 15:30:11 2017 +0530 Committer: nazeer1100126 <nazeer.sh...@confluxtechnologies.com> Committed: Mon Mar 27 15:36:42 2017 +0530 ---------------------------------------------------------------------- .../IndividualCollectionSheetLoanFlatData.java | 18 ++++++++++++++++-- .../data/JLGCollectionSheetFlatData.java | 16 ++++++++++++++-- .../collectionsheet/data/LoanDueData.java | 17 +++++++++++++++-- .../CollectionSheetReadPlatformServiceImpl.java | 17 ++++++++++++----- 4 files changed, 57 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/254d2597/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualCollectionSheetLoanFlatData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualCollectionSheetLoanFlatData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualCollectionSheetLoanFlatData.java index d37c254..7eb996d 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualCollectionSheetLoanFlatData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualCollectionSheetLoanFlatData.java @@ -42,11 +42,14 @@ public class IndividualCollectionSheetLoanFlatData { private BigDecimal interestDue = BigDecimal.ZERO; private BigDecimal interestPaid = BigDecimal.ZERO; private BigDecimal chargesDue = BigDecimal.ZERO; + private BigDecimal feeDue = BigDecimal.ZERO; + private BigDecimal feePaid = BigDecimal.ZERO; public IndividualCollectionSheetLoanFlatData(final String clientName, final Long clientId, final Long loanId, final String accountId, final Integer accountStatusId, final String productShortName, final Long productId, final CurrencyData currency, final BigDecimal disbursementAmount, final BigDecimal principalDue, final BigDecimal principalPaid, - final BigDecimal interestDue, final BigDecimal interestPaid, final BigDecimal chargesDue) { + final BigDecimal interestDue, final BigDecimal interestPaid, final BigDecimal chargesDue, final BigDecimal feeDue, + final BigDecimal feePaid) { this.clientName = clientName; this.clientId = clientId; this.loanId = loanId; @@ -61,6 +64,8 @@ public class IndividualCollectionSheetLoanFlatData { this.interestDue = interestDue; this.interestPaid = interestPaid; this.chargesDue = chargesDue; + this.feeDue = feeDue; + this.feePaid = feePaid; } public String getClientName() { @@ -121,11 +126,20 @@ public class IndividualCollectionSheetLoanFlatData { public LoanDueData getLoanDueData() { return new LoanDueData(this.loanId, this.accountId, this.accountStatusId, this.productShortName, this.productId, this.currency, - this.disbursementAmount, this.principalDue, this.principalPaid, this.interestDue, this.interestPaid, this.chargesDue); + this.disbursementAmount, this.principalDue, this.principalPaid, this.interestDue, this.interestPaid, this.chargesDue, + this.feeDue, this.feePaid); } public IndividualClientData getClientData() { return IndividualClientData.instance(this.clientId, this.clientName); } + + public BigDecimal getFeeDue() { + return this.feeDue; + } + + public BigDecimal getFeePaid() { + return this.feePaid; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/254d2597/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGCollectionSheetFlatData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGCollectionSheetFlatData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGCollectionSheetFlatData.java index b476357..6b7fb32 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGCollectionSheetFlatData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGCollectionSheetFlatData.java @@ -50,13 +50,15 @@ public class JLGCollectionSheetFlatData { private BigDecimal interestPaid = BigDecimal.ZERO; private BigDecimal chargesDue = BigDecimal.ZERO; private final EnumOptionData attendanceType; + private BigDecimal feeDue = BigDecimal.ZERO; + private BigDecimal feePaid = BigDecimal.ZERO; public JLGCollectionSheetFlatData(final String groupName, final Long groupId, final Long staffId, final String staffName, final Long levelId, final String levelName, final String clientName, final Long clientId, final Long loanId, final String accountId, final Integer accountStatusId, final String productShortName, final Long productId, final CurrencyData currency, final BigDecimal disbursementAmount, final BigDecimal principalDue, final BigDecimal principalPaid, final BigDecimal interestDue, final BigDecimal interestPaid, final BigDecimal chargesDue, - final EnumOptionData attendanceType) { + final EnumOptionData attendanceType, final BigDecimal feeDue, final BigDecimal feePaid) { this.groupName = groupName; this.groupId = groupId; this.staffId = staffId; @@ -78,6 +80,8 @@ public class JLGCollectionSheetFlatData { this.interestPaid = interestPaid; this.chargesDue = chargesDue; this.attendanceType = attendanceType; + this.feeDue = feeDue; + this.feePaid = feePaid; } public String getGroupName() { @@ -162,7 +166,8 @@ public class JLGCollectionSheetFlatData { public LoanDueData getLoanDueData() { return new LoanDueData(this.loanId, this.accountId, this.accountStatusId, this.productShortName, this.productId, this.currency, - this.disbursementAmount, this.principalDue, this.principalPaid, this.interestDue, this.interestPaid, this.chargesDue); + this.disbursementAmount, this.principalDue, this.principalPaid, this.interestDue, this.interestPaid, this.chargesDue, + this.feeDue, this.feePaid); } public JLGClientData getClientData() { @@ -174,4 +179,11 @@ public class JLGCollectionSheetFlatData { return JLGGroupData.instance(this.groupId, this.groupName, this.staffId, this.staffName, this.levelId, this.levelName); } + public BigDecimal getFeeDue() { + return this.feeDue; + } + + public BigDecimal getFeePaid() { + return this.feePaid; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/254d2597/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/LoanDueData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/LoanDueData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/LoanDueData.java index 7a598e8..bea9706 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/LoanDueData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/LoanDueData.java @@ -41,10 +41,13 @@ public class LoanDueData { private BigDecimal interestPaid = BigDecimal.ZERO; private BigDecimal chargesDue = BigDecimal.ZERO; private BigDecimal totalDue = BigDecimal.ZERO; + private BigDecimal feeDue = BigDecimal.ZERO; + private BigDecimal feePaid = BigDecimal.ZERO; public LoanDueData(final Long loanId, final String accountId, final Integer accountStatusId, final String productShortName, final Long productId, final CurrencyData currency, final BigDecimal disbursementAmount, final BigDecimal principalDue, - final BigDecimal principalPaid, final BigDecimal interestDue, final BigDecimal interestPaid, final BigDecimal chargesDue) { + final BigDecimal principalPaid, final BigDecimal interestDue, final BigDecimal interestPaid, final BigDecimal chargesDue, + final BigDecimal feeDue, final BigDecimal feePaid) { this.loanId = loanId; this.accountId = accountId; this.accountStatusId = accountStatusId; @@ -57,7 +60,9 @@ public class LoanDueData { this.interestDue = interestDue; this.interestPaid = interestPaid; this.chargesDue = chargesDue; - this.totalDue = this.totalDue.add(principalDue).add(interestDue); + this.feeDue = feeDue; + this.feePaid = feePaid; + this.totalDue = this.totalDue.add(principalDue).add(interestDue).add(feeDue); } public Long getLoanId() { @@ -107,5 +112,13 @@ public class LoanDueData { public BigDecimal getChargesDue() { return this.chargesDue; } + + public BigDecimal getFeeDue() { + return this.feeDue; + } + + public BigDecimal getFeePaid() { + return this.feePaid; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/254d2597/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java index 247d426..8432d36 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java @@ -34,7 +34,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.service.CodeValueReadPlatformService; import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService; import org.apache.fineract.infrastructure.core.api.JsonQuery; @@ -66,7 +65,6 @@ import org.apache.fineract.portfolio.group.service.GroupReadPlatformService; import org.apache.fineract.portfolio.loanproduct.data.LoanProductData; import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService; import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceEnumerations; -import org.apache.fineract.portfolio.paymentdetail.PaymentDetailConstants; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.apache.fineract.portfolio.savings.data.SavingsProductData; @@ -239,6 +237,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe .append("ln.principal_repaid_derived As principalPaid, ") .append("sum(ifnull(if(ln.loan_status_id = 300, ls.interest_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.interest_completed_derived, 0.0), 0.0)) As interestDue, ") .append("ln.interest_repaid_derived As interestPaid, ") + .append("sum(ifnull(if(ln.loan_status_id = 300, ls.fee_charges_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.fee_charges_completed_derived, 0.0), 0.0)) As feeDue, ") + .append("ln.fee_charges_repaid_derived As feePaid, ") .append("ca.attendance_type_enum as attendanceTypeId ") .append("FROM m_group gp ") .append("LEFT JOIN m_office of ON of.id = gp.office_id AND of.hierarchy like :officeHierarchy ") @@ -308,13 +308,15 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe final BigDecimal interestDue = rs.getBigDecimal("interestDue"); final BigDecimal interestPaid = rs.getBigDecimal("interestPaid"); final BigDecimal chargesDue = rs.getBigDecimal("chargesDue"); + final BigDecimal feeDue = rs.getBigDecimal("feeDue"); + final BigDecimal feePaid = rs.getBigDecimal("feePaid"); final Integer attendanceTypeId = rs.getInt("attendanceTypeId"); final EnumOptionData attendanceType = AttendanceEnumerations.attendanceType(attendanceTypeId); return new JLGCollectionSheetFlatData(groupName, groupId, staffId, staffName, levelId, levelName, clientName, clientId, loanId, accountId, accountStatusId, productShortName, productId, currencyData, disbursementAmount, principalDue, principalPaid, - interestDue, interestPaid, chargesDue, attendanceType); + interestDue, interestPaid, chargesDue, attendanceType, feeDue, feePaid); } } @@ -740,7 +742,9 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe sb.append("sum(ifnull(if(ln.loan_status_id = 300, ls.principal_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.principal_completed_derived, 0.0), 0.0)) As principalDue, "); sb.append("ln.principal_repaid_derived As principalPaid, "); sb.append("sum(ifnull(if(ln.loan_status_id = 300, ls.interest_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.interest_completed_derived, 0.0), 0.0)) As interestDue, "); - sb.append("ln.interest_repaid_derived As interestPaid "); + sb.append("ln.interest_repaid_derived As interestPaid, "); + sb.append("sum(ifnull(if(ln.loan_status_id = 300, ls.fee_charges_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.fee_charges_completed_derived, 0.0), 0.0)) As feeDue, "); + sb.append("ln.fee_charges_repaid_derived As feePaid "); sb.append("FROM m_loan ln "); sb.append("JOIN m_client cl ON cl.id = ln.client_id "); sb.append("LEFT JOIN m_office of ON of.id = cl.office_id AND of.hierarchy like :officeHierarchy "); @@ -794,9 +798,12 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe final BigDecimal interestDue = rs.getBigDecimal("interestDue"); final BigDecimal interestPaid = rs.getBigDecimal("interestPaid"); final BigDecimal chargesDue = rs.getBigDecimal("chargesDue"); + final BigDecimal feeDue = rs.getBigDecimal("feeDue"); + final BigDecimal feePaid = rs.getBigDecimal("feePaid"); return new IndividualCollectionSheetLoanFlatData(clientName, clientId, loanId, accountId, accountStatusId, productShortName, - productId, currencyData, disbursementAmount, principalDue, principalPaid, interestDue, interestPaid, chargesDue); + productId, currencyData, disbursementAmount, principalDue, principalPaid, interestDue, interestPaid, chargesDue, + feeDue, feePaid); } }