diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index d16f91eaa..f83d56d68 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -1183,7 +1183,7 @@
-
+
@@ -5334,6 +5352,99 @@ Request Body:
+
+
+
+
Generate Individual Collection Sheet
+
This Api retrieves repayment details of all individual loans under a office as on a specified meeting date.
+
+
+ POST https://Domain Name/api/v1/collectionsheet?command=generateCollectionSheet
+ POST collectionsheet?command=generateCollectionSheet
+Content-Type: application/json
+Request Body:
+{
+ "dateFormat":"dd MMMM yyyy",
+ "locale":"en",
+ "transactionDate":"15 January 2015",
+ "officeId":3
+}
+
+
+{
+ "dueDate": [
+ 2015,
+ 1,
+ 15
+ ],
+ "clients": [
+ {
+ "clientId": 74,
+ "clientName": "guarantee test",
+ "loans": [
+ {
+ "loanId": 307,
+ "accountId": "000000307",
+ "accountStatusId": 300,
+ "productShortName": "pr",
+ "productId": 60,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "inMultiplesOf": 0,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "principalDue": 1126.23,
+ "principalPaid": 8873.77,
+ "interestDue": 0,
+ "interestPaid": 504.95,
+ "totalDue": 1126.23
+ }
+ ],
+ "savings": [
+ {
+ "savingsId": 213,
+ "accountId": "000000213",
+ "accountStatusId": 300,
+ "productName": "11",
+ "productId": 30,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "inMultiplesOf": 0,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "dueAmount": 2000
+ }
+ ]
+ }
+ ],
+ "paymentTypeOptions": [
+ {
+ "id": 19,
+ "name": "receipt",
+ "position": 1,
+ "description": "rec"
+ },
+ {
+ "id": 20,
+ "name": "check",
+ "position": 2,
+ "description": "che"
+ }
+ ]
+}
+
+
+
+
+
@@ -5364,17 +5475,55 @@ Request Body:
"changes": {
"locale": "en",
"dateFormat": "dd MMMM yyyy",
- "bulkTransations": {
- "loanId": 10,
- "transactionAmount": 1221.36,
- "transactionDate": [2014,5,4]
- }
+ "loanTransactions": [10],
+ "SavingsTransactions": []
+ }
+}
+
+
+
+
+
+
+
+
Save Collection Sheet
+
This Api allows the loan officer to perform bulk repayments of individual loans and deposit of mandatory savings on a given meeting date.
+
+
+ POST https://Domain Name/api/v1/collectionsheet?command=saveCollectionSheet
+ POST collectionsheet?command=saveCollectionSheet
+{
+ "dateFormat": "dd MMMM yyyy",
+ "locale": "en",
+ "transactionDate": "04 May 2014",
+ "actualDisbursementDate": "04 May 2014",
+ "bulkDisbursementTransactions": [],
+ "bulkRepaymentTransactions": [{
+ "loanId": 10,
+ "transactionAmount": 1221.36,
+ "paymentTypeId":19,
+ "receiptNumber":"1245356"
+ }],
+ "bulkSavingsDueTransactions":[]
+}
+
+
+{
+ "groupId": 10,
+ "resourceId": 10,
+ "changes": {
+ "locale": "en",
+ "dateFormat": "dd MMMM yyyy",
+ "loanTransactions": [15],
+ "SavingsTransactions": []
+
}
}
+
diff --git a/api-docs/apidocs.css b/api-docs/apidocs.css
index 94a995115..837a7ff7b 100644
--- a/api-docs/apidocs.css
+++ b/api-docs/apidocs.css
@@ -192,7 +192,7 @@ body {
.flybar-nav {
display: block;
float: left;
- width: 90px;
+ min-width: 90px;
position: relative;
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
index 6f780412d..c13f419ff 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
@@ -697,6 +697,11 @@ public class CommandWrapper {
public boolean isCollectionSheetResource() {
return this.entityName.equals("COLLECTIONSHEET");
}
+
+ public boolean isSaveIndividualCollectionSheet() {
+ return isCollectionSheetResource() && this.actionName.equalsIgnoreCase("SAVE");
+ }
+
public boolean isCenterResource() {
return this.entityName.equalsIgnoreCase("CENTER");
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
index 9d48fda87..6fafeaf2e 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
@@ -1425,6 +1425,13 @@ public class CommandWrapperBuilder {
this.href = "/groups/" + groupId + "?command=saveCollectionSheet";
return this;
}
+
+ public CommandWrapperBuilder saveIndividualCollectionSheet() {
+ this.actionName = "SAVE";
+ this.entityName = "COLLECTIONSHEET";
+ this.href = "/collectionsheet?command=saveCollectionSheet";
+ return this;
+ }
public CommandWrapperBuilder deleteGroup(final Long groupId) {
this.actionName = "DELETE";
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
index 8a36c5c06..58d182c13 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
@@ -280,15 +280,15 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else if (wrapper.isDelete()) {
handler = this.applicationContext.getBean("deleteTellerCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isAllocateCashier()) {
- handler = this.applicationContext.getBean("allocateCashierToTellerCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("allocateCashierToTellerCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isUpdateCashierAllocation()) {
- handler = this.applicationContext.getBean("updateCashierAllocationCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("updateCashierAllocationCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isDeleteCashierAllocation()) {
- handler = this.applicationContext.getBean("deleteCashierAllocationCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("deleteCashierAllocationCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isAllocateCashToCashier()) {
- handler = this.applicationContext.getBean("allocateCashToCashierCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("allocateCashToCashierCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isSettleCashFromCashier()) {
- handler = this.applicationContext.getBean("settleCashFromCashierCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("settleCashFromCashierCommandHandler", NewCommandSourceHandler.class);
} else {
throw new UnsupportedCommandException(wrapper.commandName());
}
@@ -755,6 +755,8 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else if (wrapper.isCollectionSheetResource()) {
if (wrapper.isUpdate()) {
handler = this.applicationContext.getBean("updateCollectionSheetCommandHandler", NewCommandSourceHandler.class);
+ } else if (wrapper.isSaveIndividualCollectionSheet()) {
+ handler = this.applicationContext.getBean("saveIndividualCollectionSheetCommandHandler", NewCommandSourceHandler.class);
} else {
throw new UnsupportedCommandException(wrapper.commandName());
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java
index 5dc4a3b4b..037eef161 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java
@@ -9,6 +9,8 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+import org.mifosplatform.portfolio.paymentdetail.PaymentDetailConstants;
+
public class CollectionSheetConstants {
public static final String COLLECTIONSHEET_RESOURCE_NAME = "collectionsheet";
@@ -23,6 +25,8 @@ public class CollectionSheetConstants {
public static final String bulkSavingsDueTransactionsParamName = "bulkSavingsDueTransactions";
public static final String noteParamName = "note";
public static final String calendarIdParamName = "calendarId";
+ public static final String officeIdParamName = "officeId";
+ public static final String staffIdParamName = "staffId";
// attendance parameters
public static final String clientsAttendanceParamName = "clientsAttendance";
@@ -35,5 +39,16 @@ public class CollectionSheetConstants {
public static final Set
COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
- bulkDisbursementTransactionsParamName, noteParamName, calendarIdParamName, clientsAttendanceParamName, bulkSavingsDueTransactionsParamName));
+ bulkDisbursementTransactionsParamName, noteParamName, calendarIdParamName, clientsAttendanceParamName,
+ bulkSavingsDueTransactionsParamName, PaymentDetailConstants.paymentTypeParamName,
+ PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
+ PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
+ PaymentDetailConstants.bankNumberParamName));
+
+ public static final Set INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
+ dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
+ bulkDisbursementTransactionsParamName, noteParamName, bulkSavingsDueTransactionsParamName));
+
+ public static final Set INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS = new HashSet<>(Arrays.asList(transactionDateParamName,
+ localeParamName, dateFormatParamName, officeIdParamName, staffIdParamName));
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/api/CollectionSheetApiResourse.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/api/CollectionSheetApiResourse.java
new file mode 100755
index 000000000..c5bc63119
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/api/CollectionSheetApiResourse.java
@@ -0,0 +1,89 @@
+/**
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.mifosplatform.portfolio.collectionsheet.api;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.commons.lang.StringUtils;
+import org.mifosplatform.commands.domain.CommandWrapper;
+import org.mifosplatform.commands.service.CommandWrapperBuilder;
+import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService;
+import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper;
+import org.mifosplatform.infrastructure.core.api.JsonQuery;
+import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
+import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
+import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
+import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
+import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
+import org.mifosplatform.portfolio.collectionsheet.CollectionSheetConstants;
+import org.mifosplatform.portfolio.collectionsheet.data.IndividualCollectionSheetData;
+import org.mifosplatform.portfolio.collectionsheet.service.CollectionSheetReadPlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import com.google.gson.JsonElement;
+
+@Path("/collectionsheet")
+@Component
+@Scope("singleton")
+public class CollectionSheetApiResourse {
+
+ private final CollectionSheetReadPlatformService collectionSheetReadPlatformService;
+ private final ToApiJsonSerializer