settle report year select

master
yixian 7 years ago
parent 50243843df
commit 116d1d74c4

@ -1,7 +1,7 @@
/**
* Created by yixian on 2017-05-03.
*/
define(['angular', 'decimal','uiRouter','./report/analysis-report'], function (angular,Decimal) {
define(['angular', 'decimal', 'uiRouter', './report/analysis-report'], function (angular, Decimal) {
'use strict';
var app = angular.module('settleReportApp', ['ui.router']);
app.config(['$stateProvider', function ($stateProvider) {
@ -13,6 +13,7 @@ define(['angular', 'decimal','uiRouter','./report/analysis-report'], function (a
}]);
app.controller('settleFinancialReportCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) {
$scope.params = {year: new Date().getFullYear()};
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
$scope.initMonth = function (year) {
$scope.months = [];
for (var i = 1; i < 13; i++) {
@ -38,16 +39,16 @@ define(['angular', 'decimal','uiRouter','./report/analysis-report'], function (a
settlements: resp.data
};
$scope.analysis = {
gross_amount:0,
wechat_settlement:0,
net_amount:0,
royalpay_charge:0
gross_amount: 0,
wechat_settlement: 0,
net_amount: 0,
royalpay_charge: 0
};
angular.forEach($scope.report.settlements,function (settle) {
$scope.analysis.gross_amount = Decimal.add(settle.gross_amount,$scope.analysis.gross_amount).toFixed(2);
$scope.analysis.wechat_settlement = Decimal.add(settle.wechat_settlement,$scope.analysis.wechat_settlement).toFixed(2);
$scope.analysis.net_amount = Decimal.add(settle.net_amount,$scope.analysis.net_amount).toFixed(2);
$scope.analysis.royalpay_charge = Decimal.add(settle.royalpay_charge,$scope.analysis.royalpay_charge).toFixed(2);
angular.forEach($scope.report.settlements, function (settle) {
$scope.analysis.gross_amount = Decimal.add(settle.gross_amount, $scope.analysis.gross_amount).toFixed(2);
$scope.analysis.wechat_settlement = Decimal.add(settle.wechat_settlement, $scope.analysis.wechat_settlement).toFixed(2);
$scope.analysis.net_amount = Decimal.add(settle.net_amount, $scope.analysis.net_amount).toFixed(2);
$scope.analysis.royalpay_charge = Decimal.add(settle.royalpay_charge, $scope.analysis.royalpay_charge).toFixed(2);
});
})
};

@ -1,7 +1,14 @@
<section class="content">
<div class="box box-default">
<div class="box-header" ng-bind="params.year"></div>
<div class="box-header">
<div uib-dropdown>
<button class="btn btn-primary" uib-dropdown-toggle type="button" ng-bind="params.year"></button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu">
<li ng-repeat="year in availableYears" role="menuitem"><a role="button" ng-click="params.year=year" ng-bind="year"></a></li>
</ul>
</div>
</div>
<div class="box-body">
<div class="row">
<div class="col-xs-3" ng-repeat="mon in months">

Loading…
Cancel
Save