scope.routeToTxn = function(){
route.reload();
var items= scope.initPage().items;
routeParams.fromDate=filter('date')(scope.formData.fromDate, 'dd MMM yyyy');
routeParams.toDate=filter('date')(scope.formData.toDate, 'dd MMM yyyy');
return function( items ) {
var filtered=[];
var txnstartDate = routeParams.fromDate;
var txnendDate = routeParams.toDate;
angular.forEach(items, function(item) {
if(items.txnDate > txnstartDate && items.txnDate < txnendDate) {
filtered.push(item);
}
});
return filtered;
};
};
<a ng-click="routeToTxn()" class="btn btn-primary">{{'label.button.cashier.showtxn' | translate}} </a>
<tr dir-paginate="txn in cashierTransactions | orderBy:'txn.txnDate' |filter:filterText | itemsPerPage: txnPerPage" total-items="totaltxn">
点击(routeToTxn)按钮后,交易数据应基于2个日期进行过滤。
scope.routeToTxn = function(){
route.reload();
routeParams.fromDate=filter('date')(scope.formData.fromDate, 'dd MMM yyyy');
routeParams.toDate=filter('date')(scope.formData.toDate, 'dd MMM yyyy');
return function( items ) {
var filtered=[];
var txnstartDate = routeParams.fromDate;
var txnendDate = routeParams.toDate;
angular.forEach(items, function(item) {
if(items.txnDate > txnstartDate && items.txnDate < txnendDate) {
filtered.push(item);
}
});
return filtered;
};
};
<a ng-click="routeToTxn()" class="btn btn-primary">{{'label.button.cashier.showtxn' | translate}} </a>
<tr dir-paginate="txn in cashierTransactions | orderBy:'txn.txnDate' |filter:filterText | itemsPerPage: txnPerPage" total-items="totaltxn">
交易数据是从后端导入的。
scope.initPage = function () {
var items = resourceFactory.tellerCashierSummaryAndTxnsResource.getCashierSummaryAndTransactions({
tellerId: routeParams.tellerId,
cashierId: routeParams.cashierId,
fromDate: routeParams.fromDate,
toDate: routeParams.toDate,
currencyCode: routeParams.currencyCode,
offset:0,
limit: scope.txnPerPage
}, function (data) {
scope.cashierSummaryAndTxns = data;
scope.totaltxn = data.cashierTransactions.totalFilteredRecords;
scope.cashierTransactions = data.cashierTransactions.pageItems;
});
}