diff --git a/app/scripts/controllers/accounting/ViewAccRuleController.js b/app/scripts/controllers/accounting/ViewAccRuleController.js
new file mode 100644
index 00000000..65535942
--- /dev/null
+++ b/app/scripts/controllers/accounting/ViewAccRuleController.js
@@ -0,0 +1,21 @@
+(function(module) {
+ mifosX.controllers = _.extend(module, {
+ ViewAccRuleController: function(scope, resourceFactory, routeParams, location) {
+
+ resourceFactory.accountingRulesResource.getById({accountingRuleId:routeParams.id}, function(data){
+ scope.rule = data;
+ });
+
+ scope.deleteRule = function (){
+ resourceFactory.accountingRulesResource.delete({accountingRuleId:routeParams.id}, {}, function(data){
+ location.path('/accounting_rules');
+ });
+ };
+
+
+ }
+ });
+ mifosX.ng.application.controller('ViewAccRuleController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.ViewAccRuleController]).run(function($log) {
+ $log.info("ViewAccRuleController initialized");
+ });
+}(mifosX.controllers || {}));
\ No newline at end of file
diff --git a/app/scripts/controllers/organization/AddHolController.js b/app/scripts/controllers/organization/AddHolController.js
index 84937539..9960a41a 100644
--- a/app/scripts/controllers/organization/AddHolController.js
+++ b/app/scripts/controllers/organization/AddHolController.js
@@ -22,7 +22,7 @@
newholiday.offices.push(temp);
}
resourceFactory.holValueResource.save(newholiday,function(data){
- location.path('/managehol');
+ location.path('/holidays');
});
};
}
diff --git a/app/scripts/controllers/organization/ViewHolController.js b/app/scripts/controllers/organization/ViewHolController.js
index bb49dbd0..5f95a918 100644
--- a/app/scripts/controllers/organization/ViewHolController.js
+++ b/app/scripts/controllers/organization/ViewHolController.js
@@ -1,13 +1,9 @@
(function(module) {
mifosX.controllers = _.extend(module, {
ViewHolController: function(scope,routeParams, resourceFactory) {
- scope.holidays = [];
- scope.officehols = [];
- resourceFactory.holResource.getAllHols({officeId:1},function(data){
- scope.holidays = data;
- });
+
resourceFactory.holValueResource.getholvalues({officeId:1,holId: routeParams.id} , function(data) {
- scope.officehols = data;
+ scope.holiday = data;
});
}
});
diff --git a/app/scripts/controllers/reports/RunReportsController.js b/app/scripts/controllers/reports/RunReportsController.js
new file mode 100644
index 00000000..56cf922c
--- /dev/null
+++ b/app/scripts/controllers/reports/RunReportsController.js
@@ -0,0 +1,197 @@
+(function(module) {
+ mifosX.controllers = _.extend(module, {
+
+ RunReportsController: function(scope, routeParams, resourceFactory, location) {
+
+ scope.isCollapsed = false; //displays options div on startup
+ scope.hideTable = true; //hides the results div on startup
+ scope.hidePentahoReport = true; //hides the results div on startup
+ scope.formData = {};
+ scope.reportParams = new Array();
+ scope.reportDateParams = new Array();
+ scope.reqFields = new Array();
+ scope.reportData = {};
+ scope.reportData.columnHeaders = [];
+ scope.reportData.data = [];
+ scope.baseURL="#";
+
+ scope.reportName = routeParams.name;
+ scope.reportType = routeParams.type;
+ scope.pentahoReportDetail=[];
+
+ resourceFactory.runReportsResource.getReport({reportSource: 'FullParameterList', parameterType : true, R_reportListing: "'"+routeParams.name+"'"}, function(data){
+
+ for (var i in data.data ) {
+ var temp = {
+ name: data.data[i].row[0],
+ variable: data.data[i].row[1],
+ label: data.data[i].row[2],
+ displayType: data.data[i].row[3],
+ formatType: data.data[i].row[4],
+ defaultVal: data.data[i].row[5],
+ selectOne: data.data[i].row[6],
+ selectAll: data.data[i].row[7],
+ parentParameterName: data.data[i].row[8],
+ inputName: "R_"+ data.data[i].row[1] //model name
+ };
+ scope.reqFields.push(temp);
+ if (temp.displayType == 'select' && temp.parentParameterName == null) {
+ intializeParams(temp,{});
+ } else if (temp.displayType == 'date') {
+ scope.reportDateParams.push(temp);
+ }
+ }
+ });
+
+ if (scope.reportType == 'Pentaho') {
+ resourceFactory.runReportsResource.getReport({reportSource: 'FullReportDetails', parameterType : true, R_reportName: routeParams.name}, function(data){
+
+ var prevId = -1;
+ var currId;
+ var tmpParameters;
+ for (var i in data.data )
+ {
+ currId = data.data[i].row[0]
+ if (currId != prevId)
+ {
+ tmpParameters = [];
+ if (!(data.data[i].row[5] == null))
+ {
+ tmpParam = [];
+ tmpParam.push(data.data[i].row[6]);
+ tmpParam.push(data.data[i].row[7]);
+ tmpParameters.push(tmpParam);
+ }
+ tmpRow = {
+ id: data.data[i].row[0],
+ name: data.data[i].row[1],
+ type: data.data[i].row[2],
+ subtype: data.data[i].row[3],
+ category: data.data[i].row[4],
+ parameters: tmpParameters
+ }
+ scope.pentahoReportDetail.push(tmpRow);
+ prevId = currId;
+
+ }
+ else
+ {
+ tmpParam = [];
+ tmpParam.push(data.data[i].row[6]);
+ tmpParam.push(data.data[i].row[7]);
+ scope.pentahoReportDetail[(scope.pentahoReportDetail.length - 1)].parameters.push(tmpParam);
+ }
+ }
+ });
+ }
+
+ function getSuccuessFunction (paramData) {
+ var tempDataObj = new Object();
+ var successFunction = function(data) {
+ var selectData = [];
+ var isExistedRecord = false;
+ for (var i in data.data ) {
+ selectData.push({id: data.data[i].row[0], name: data.data[i].row[1]});
+ }
+ for (var i in scope.reportParams ) {
+ if (scope.reportParams[i].name == paramData.name) {
+ scope.reportParams[i].selectOptions = selectData;
+ isExistedRecord = true;
+ }
+ }
+ if (!isExistedRecord) {
+ paramData.selectOptions = selectData;
+ scope.reportParams.push(paramData);
+ }
+ };
+ return successFunction;
+ }
+
+ function intializeParams (paramData, params) {
+ params.reportSource = paramData.name;
+ params.parameterType = true;
+ var successFunction = getSuccuessFunction(paramData);
+ resourceFactory.runReportsResource.getReport(params, successFunction);
+ }
+
+ scope.getDependencies = function (paramData) {
+ for (var i = 0; i < scope.reqFields.length; i++) {
+ var temp = scope.reqFields[i];
+ if (temp.parentParameterName == paramData.name) {
+ if (temp.displayType == 'select') {
+ var parentParamValue = this.formData[paramData.inputName];
+ if (parentParamValue != undefined) {
+ eval("var params={};params." + paramData.inputName + "='" + parentParamValue + "';");
+ intializeParams(temp, params);
+ }
+ } else if (temp.displayType == 'date') {
+ scope.reportDateParams.push(temp);
+ }
+ }
+ }
+ };
+
+ scope.checkStatus = function () {
+ var collapsed = false;
+ if (scope.isCollapsed) {
+ collapsed = true;
+ }
+ return collapsed;
+ };
+
+ function buildReportParms() {
+ var paramCount = 1;
+ var reportParams = "";
+ for (var i = 0; i < scope.reqFields.length; i++) {
+ var reqField = scope.reqFields[i];
+ for (var j = 0; j < scope.pentahoReportDetail.length; j++) {
+ var tempParam = scope.pentahoReportDetail[j];
+ for (var k = 0; k < tempParam.parameters.length; k++) {
+ if (reqField.name == tempParam.parameters[k][1]) {
+ var paramName = "R_"+tempParam.parameters[k][0];
+ if (paramCount > 1) reportParams += "&"
+ reportParams += encodeURIComponent(paramName) + "=" + encodeURIComponent(scope.formData[scope.reqFields[i].inputName]);
+ paramCount = paramCount + 1;
+ }
+ }
+ }
+ }
+ return reportParams;
+ }
+
+ scope.runReport = function (){
+ scope.isCollapsed=true;
+
+ switch(scope.reportType)
+ {
+ case "Table":
+ scope.hideTable=false;
+ scope.hidePentahoReport = true;
+ scope.formData.reportSource = scope.reportName;
+ resourceFactory.runReportsResource.getReport(scope.formData, function(data){
+ scope.reportData.columnHeaders = data.columnHeaders;
+ scope.reportData.data = data.data;
+ });
+ break;
+
+ case "Pentaho":
+
+ scope.hideTable=true;
+ scope.hidePentahoReport = false;
+ scope.baseURL = "https://demo.openmf.org/mifosng-provider/api/v1/runreports/" + encodeURIComponent(scope.reportName);
+ scope.baseURL += "?output-type="+encodeURIComponent(scope.formData.outputType)+"&tenantIdentifier=default";
+ var inQueryParameters = buildReportParms();
+ if (inQueryParameters > "") scope.baseURL += "&" + inQueryParameters;
+ break;
+
+ default:
+ alert("System Error: Unknown Report Type: " + scope.reportType);
+ }
+
+ };
+ }
+ });
+ mifosX.ng.application.controller('RunReportsController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.RunReportsController]).run(function($log) {
+ $log.info("RunReportsController initialized");
+ });
+}(mifosX.controllers || {}));
diff --git a/app/scripts/controllers/reports/ViewReportsController.js b/app/scripts/controllers/reports/ViewReportsController.js
new file mode 100644
index 00000000..b677590a
--- /dev/null
+++ b/app/scripts/controllers/reports/ViewReportsController.js
@@ -0,0 +1,51 @@
+(function(module) {
+ mifosX.controllers = _.extend(module, {
+
+ ViewReportsController: function(scope, routeParams, resourceFactory, location) {
+
+ scope.reports = [];
+
+ if (routeParams.type == 'all') {
+ resourceFactory.runReportsResource.get({reportSource: 'FullReportList', parameterType : true, genericResultSet : false}, function(data){
+ scope.reports = scope.getReports(data);
+ });
+ } else if (routeParams.type == 'clients') {
+ resourceFactory.runReportsResource.get({reportSource: 'reportCategoryList', R_reportCategory:'Client', parameterType : true, genericResultSet : false}, function(data){
+ scope.reports = scope.getReports(data);
+ });
+ } else if (routeParams.type == 'loans') {
+ resourceFactory.runReportsResource.get({reportSource: 'reportCategoryList', R_reportCategory:'Loan', parameterType : true, genericResultSet : false}, function(data){
+ scope.reports = scope.getReports(data);
+ });
+ } else if (routeParams.type == 'funds') {
+ resourceFactory.runReportsResource.get({reportSource: 'reportCategoryList', R_reportCategory:'Fund', parameterType : true, genericResultSet : false}, function(data){
+ scope.reports = scope.getReports(data);
+ });
+ } else if (routeParams.type == 'accounting') {
+ resourceFactory.runReportsResource.get({reportSource: 'reportCategoryList', R_reportCategory:'Accounting', parameterType : true, genericResultSet : false}, function(data){
+ scope.reports = scope.getReports(data);
+ });
+ }
+
+ // Remove the duplicate entries from the array. The reports api returns same report multiple times if it have more than one parameter.
+ scope.getReports = function(data){
+ var prevId = -1;
+ var currId;
+ var reports = [];
+ for (var i = 0; i < data.length; i++) {
+ currId = data[i].report_id;
+ if (currId != prevId) {
+ reports.push(data[i]);
+ };
+ prevId = currId;
+ }
+ return reports;
+ };
+
+
+ }
+ });
+ mifosX.ng.application.controller('ViewReportsController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.ViewReportsController]).run(function($log) {
+ $log.info("ViewReportsController initialized");
+ });
+}(mifosX.controllers || {}));
diff --git a/app/scripts/controllers/system/AddCodeController.js b/app/scripts/controllers/system/AddCodeController.js
new file mode 100644
index 00000000..95f89c23
--- /dev/null
+++ b/app/scripts/controllers/system/AddCodeController.js
@@ -0,0 +1,17 @@
+
+(function(module) {
+ mifosX.controllers = _.extend(module, {
+ AddCodeController: function(scope, resourceFactory, location) {
+
+ scope.submit = function() {
+ resourceFactory.codeResources.save(this.formData,function(data){
+ location.path('/viewcode/'+data.resourceId);
+ });
+ };
+ }
+ });
+ mifosX.ng.application.controller('AddCodeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AddCodeController]).run(function($log) {
+ $log.info("AddCodeController initialized");
+ });
+}(mifosX.controllers || {}));
+
diff --git a/app/scripts/controllers/system/ViewCodeController.js b/app/scripts/controllers/system/ViewCodeController.js
new file mode 100644
index 00000000..548bdc1a
--- /dev/null
+++ b/app/scripts/controllers/system/ViewCodeController.js
@@ -0,0 +1,22 @@
+(function(module) {
+ mifosX.controllers = _.extend(module, {
+ ViewCodeController: function(scope, routeParams , resourceFactory, location ) {
+ scope.codevalues = [];
+ resourceFactory.codeResources.get({codeId: routeParams.id} , function(data) {
+ scope.code = data;
+ });
+ resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id} , function(data) {
+ scope.codevalues = data;
+ });
+ scope.delcode = function(){
+ resourceFactory.codeResources.remove({codeId: routeParams.id},this.code,function(data){
+ location.path('/codes');
+
+ });
+ }
+ }
+ });
+ mifosX.ng.application.controller('ViewCodeController', ['$scope', '$routeParams','ResourceFactory','$location', mifosX.controllers.ViewCodeController]).run(function($log) {
+ $log.info("ViewCodeController initialized");
+ });
+}(mifosX.controllers || {}));
diff --git a/app/scripts/mifosXComponents.js b/app/scripts/mifosXComponents.js
index 9aa0e8b0..97406f0a 100644
--- a/app/scripts/mifosXComponents.js
+++ b/app/scripts/mifosXComponents.js
@@ -45,7 +45,20 @@ define(['underscore', 'mifosX'], function() {
'accounting/ViewTransactionController',
'accounting/JournalEntryController',
'accounting/SearchTransactionController',
- 'accounting/AccountingClosureController'
+ 'accounting/AccountingClosureController',
+ 'accounting/AccountingRuleController',
+ 'accounting/AccCreateRuleController',
+ 'accounting/AccEditRuleController',
+ 'accounting/ViewAccRuleController',
+ 'system/CodeController',
+ 'system/EditCodeController',
+ 'system/ViewCodeController',
+ 'system/AddCodeController',
+ 'organization/HolController',
+ 'organization/ViewHolController',
+ 'organization/AddHolController',
+ 'reports/ViewReportsController',
+ 'reports/RunReportsController'
],
filters: [
'StatusLookup'
diff --git a/app/scripts/routes.js b/app/scripts/routes.js
index d23bf83f..62fb8034 100644
--- a/app/scripts/routes.js
+++ b/app/scripts/routes.js
@@ -138,6 +138,45 @@
})
.when('/closedaccountingDetails/:officeId', {
templateUrl: 'views/accounting/view_close_accounting.html'
+ })
+ .when('/accounting_rules', {
+ templateUrl: 'views/accounting/accounting_rules.html'
+ })
+ .when('/viewaccrule/:id', {
+ templateUrl: 'views/accounting/view_acc_rule.html'
+ })
+ .when('/add_accrule', {
+ templateUrl: 'views/accounting/add_acc_rule.html'
+ })
+ .when('/editaccrule/:id', {
+ templateUrl: 'views/accounting/edit_acc_rule.html'
+ })
+ .when('/viewcode/:id', {
+ templateUrl: 'views/system/viewcode.html'
+ })
+ .when('/addcode', {
+ templateUrl: 'views/system/addcode.html'
+ })
+ .when('/codes', {
+ templateUrl: 'views/system/codes.html'
+ })
+ .when('/editcode/:id', {
+ templateUrl: 'views/system/editcode.html'
+ })
+ .when('/holidays', {
+ templateUrl: 'views/organization/holidays.html'
+ })
+ .when('/createholiday', {
+ templateUrl: 'views/organization/createholiday.html'
+ })
+ .when('/viewholiday/:id', {
+ templateUrl: 'views/organization/viewholiday.html'
+ })
+ .when('/reports/:type', {
+ templateUrl: 'views/reports/view_reports.html'
+ })
+ .when('/run_report/:name', {
+ templateUrl: 'views/reports/run_reports.html'
});
$locationProvider.html5Mode(false);
diff --git a/app/scripts/services/ResourceFactoryProvider.js b/app/scripts/services/ResourceFactoryProvider.js
index b7c5d0f4..b4aa1d84 100644
--- a/app/scripts/services/ResourceFactoryProvider.js
+++ b/app/scripts/services/ResourceFactoryProvider.js
@@ -126,13 +126,8 @@
getAllHols: {method: 'GET', params: {}, isArray: true}
}),
holValueResource: defineResource(apiVer + "/holidays/:holId", {holId:'@holId'}, {
- getholvalues: {method: 'GET', params: {}, isArray:true},
-
+ getholvalues: {method: 'GET', params: {}}
})
-
-
-
-
};
}];
}
diff --git a/app/views/accounting/accounting_rules.html b/app/views/accounting/accounting_rules.html
new file mode 100644
index 00000000..61386c25
--- /dev/null
+++ b/app/views/accounting/accounting_rules.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+ Name
+ Office
+
+
+
+
+ {{rule.name}}
+ {{rule.officeName}}
+
+
+
+
\ No newline at end of file
diff --git a/app/views/accounting/add_acc_rule.html b/app/views/accounting/add_acc_rule.html
new file mode 100644
index 00000000..42d5ba68
--- /dev/null
+++ b/app/views/accounting/add_acc_rule.html
@@ -0,0 +1,95 @@
+
+
diff --git a/app/views/accounting/edit_acc_rule.html b/app/views/accounting/edit_acc_rule.html
new file mode 100644
index 00000000..597c67f7
--- /dev/null
+++ b/app/views/accounting/edit_acc_rule.html
@@ -0,0 +1,98 @@
+
diff --git a/app/views/accounting/view_acc_rule.html b/app/views/accounting/view_acc_rule.html
new file mode 100644
index 00000000..e8d7492d
--- /dev/null
+++ b/app/views/accounting/view_acc_rule.html
@@ -0,0 +1,54 @@
+
+
+
+
+
+
{{rule.name}}
+
{{ 'label.office' | translate }} {{rule.officeName}}
+
{{ 'label.description' | translate }} {{rule.description}}
+
+
+
+ {{ 'label.credit.account.details' | translate }}
+ {{ 'label.debit.account.details' | translate }}
+
+
+
+
+
+
+ {{crAccount.name}}({{crAccount.glCode}})
+
+
+ {{creditTag.tag.name}}
+
+
+
+
+
+
+ {{dbAccount.name}}({{dbAccount.glCode}})
+
+
+ {{debitTag.tag.name}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organization/createholiday.html b/app/views/organization/createholiday.html
new file mode 100644
index 00000000..922a7241
--- /dev/null
+++ b/app/views/organization/createholiday.html
@@ -0,0 +1,80 @@
+
+
diff --git a/app/views/organization/holidays.html b/app/views/organization/holidays.html
new file mode 100644
index 00000000..9723a0bd
--- /dev/null
+++ b/app/views/organization/holidays.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ Holiday Name
+ Start Date
+ End Date
+ Alternate Working Day
+
+
+
+
+ {{holiday.name}}
+ {{holiday.fromDate}}
+ {{holiday.toDate}}
+ {{holiday.repaymentsScheduleTO}}
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organization/viewholiday.html b/app/views/organization/viewholiday.html
new file mode 100644
index 00000000..85e6d75f
--- /dev/null
+++ b/app/views/organization/viewholiday.html
@@ -0,0 +1,32 @@
+
+
{{holiday.name}}
+
Include Description Here
+
+
+ {{ 'label.holiday.name' | translate }}
+ {{holiday.name}}
+
+
+ {{ 'label.holiday.fromdate' | translate }}
+ {{holiday.fromDate}}
+
+
+ {{ 'label.holiday.todate' | translate }}
+ {{holiday.toDate}}
+
+
+ {{ 'label.holiday.repaymentsheduleto' | translate }}
+ {{holiday.repaymentsScheduleTO}}
+
+
+
+
+
+ {{ 'label.holiday.applicableoffices' | translate }}
+
+
+
+ Include applicable offices here
+
+
+
\ No newline at end of file
diff --git a/app/views/reports/run_reports.html b/app/views/reports/run_reports.html
new file mode 100644
index 00000000..722aa22c
--- /dev/null
+++ b/app/views/reports/run_reports.html
@@ -0,0 +1,58 @@
+
\ No newline at end of file
diff --git a/app/views/reports/view_reports.html b/app/views/reports/view_reports.html
new file mode 100644
index 00000000..b6653095
--- /dev/null
+++ b/app/views/reports/view_reports.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+ Name
+ Type
+ Category
+
+
+
+
+ {{report.report_name}}
+ {{report.report_type}}
+ {{report.report_category}}
+
+
+
+
\ No newline at end of file
diff --git a/app/views/system/addcode.html b/app/views/system/addcode.html
new file mode 100644
index 00000000..652055ff
--- /dev/null
+++ b/app/views/system/addcode.html
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/app/views/system/codes.html b/app/views/system/codes.html
new file mode 100644
index 00000000..80d5d278
--- /dev/null
+++ b/app/views/system/codes.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ CodeName
+ System Defined
+
+
+
+
+ {{code.name}}
+ {{code.systemDefined}}
+
+
+
+
+
+
+
+
diff --git a/app/views/system/editcode.html b/app/views/system/editcode.html
new file mode 100644
index 00000000..3fbc3bce
--- /dev/null
+++ b/app/views/system/editcode.html
@@ -0,0 +1,24 @@
+
+
+
{{'label.editcode' | translate}}
+
+
+
+
{{ 'error.delete.failed' | translate }}
+
+
+
\ No newline at end of file
diff --git a/app/views/system/viewcode.html b/app/views/system/viewcode.html
new file mode 100644
index 00000000..77d39f91
--- /dev/null
+++ b/app/views/system/viewcode.html
@@ -0,0 +1,36 @@
+
+
+
+
+
{{code.name}}
+
+
+
+
+ {{ 'label.name1' | translate }}
+ {{ 'label.position' | translate }}
+
+
+
+
+ {{codevalue.name}}
+ {{codevalue.position}}
+
+
+
+
+
+
+
\ No newline at end of file