Merge pull request #55 from mifoscontributer/jeacct

Display Journal Transactions by transactionId
This commit is contained in:
Nayan Ambali 2013-08-29 06:04:13 -07:00
commit 0e8fc61e69
7 changed files with 76 additions and 4 deletions

View File

@ -218,6 +218,7 @@
"label.journalentry.comments":"Comments",
"label.save":"Save",
"label.cancel":"Cancel",
"label.journalentry.transaction.number":"Transaction Number #",
"app erros end" :"------------------------------------------------------"

View File

@ -0,0 +1,43 @@
<form ng-controller="ViewTransactionController">
<div class="row alert-block span" >
<h3>{{ 'label.journalentry.transaction.number' | translate }}&nbsp;<b>{{transactionNumber}}</b></h3>
<div class="pull-right">
<div class="btn-group">
<a ng-click="reverseTransaction(transactionNumber)" class="btn btn-primary"><i class="icon-repeat icon-white"></i> Reverse</a>
</div>
</div>
</div>
<div class="row alert-block span" ng-controller="ViewTransactionController">
<table class="table" ui:sortable>
<thead>
<tr>
<th>Transaction Date</th>
<th>Type</th>
<th>Account</th>
<th>TransactionId</th>
<th>Debit</th>
<th>Credit</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="transaction in transactions">
<td>{{transaction.transactionDate}}</td>
<td>{{transaction.glAccountType.value}}</td>
<td>{{transaction.glAccountName}}({{transaction.glAccountCode}})</td>
<td>{{transaction.transactionId}}</td>
<td>
<div ng-show="transaction.entryType.value == 'CREDIT'">
{{transaction.amount}}
</div>
</td>
<td>
<div ng-show="transaction.entryType.value == 'DEBIT'">
{{transaction.amount}}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</form>

View File

@ -73,7 +73,7 @@
}
resourceFactory.journalEntriesResource.save(jeTransaction,function(data){
location.path('/accounting');
location.path('/viewtransactions/'+data.transactionId);
});
}
}

View File

@ -0,0 +1,23 @@
(function(module) {
mifosX.controllers = _.extend(module, {
ViewTransactionController: function(scope, routeParams, resourceFactory, location) {
resourceFactory.journalEntriesResource.get({transactionId : routeParams.transactionId}, function(data){
scope.transactionNumber = routeParams.transactionId;
scope.transactions = data.pageItems;
});
scope.reverseTransaction = function (transactionId) {
resourceFactory.journalEntriesResource.reverse({transactionId : transactionId},function(data){
location.path('/viewtransactions/'+data.transactionId);
});
}
}
});
mifosX.ng.application.controller('ViewTransactionController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.ViewTransactionController]).run(function($log) {
$log.info("ViewTransactionController initialized");
});
}(mifosX.controllers || {}));

View File

@ -40,7 +40,8 @@ define(['underscore', 'mifosX'], function() {
'AccCoaController',
'AccCreateGLAccountContoller',
'AccViewGLAccountContoller',
'AccEditGLAccountController'
'AccEditGLAccountController',
'ViewTransactionController'
],
filters: [
'StatusLookup'

View File

@ -120,6 +120,9 @@
})
.when('/freqposting', {
templateUrl: 'html/accounting/freqposting.html'
})
.when('/viewtransactions/:transactionId', {
templateUrl: 'html/accounting/view_transactions.html'
});
$locationProvider.html5Mode(false);

View File

@ -81,8 +81,9 @@
accountCoaTemplateResource: defineResource(apiVer + "/glaccounts/template", {}, {
get: {method: 'GET', params: {}}
}),
journalEntriesResource: defineResource(apiVer + "/journalentries", {}, {
get: {method: 'GET', params: {}}
journalEntriesResource: defineResource(apiVer + "/journalentries/:trxid", {trxid:'@transactionId'}, {
get: {method: 'GET', params: {transactionId:'@transactionId'}},
reverse: {method: 'POST', params:{command:'reverse'}}
})
};
}];