|
|
|
@ -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,7 +13,9 @@ 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.params.year = year;
|
|
|
|
|
$scope.months = [];
|
|
|
|
|
for (var i = 1; i < 13; i++) {
|
|
|
|
|
var mon = '00' + i;
|
|
|
|
@ -21,9 +23,9 @@ define(['angular', 'decimal','uiRouter','./report/analysis-report'], function (a
|
|
|
|
|
$scope.months.push(year + '-' + mon);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
$scope.initMonth($scope.params.year);
|
|
|
|
|
$scope.initMonth(new Date().getFullYear());
|
|
|
|
|
$scope.hasReport = function (mon) {
|
|
|
|
|
var start = '2017-02';
|
|
|
|
|
var start = '2017-02';//todo modify in different country
|
|
|
|
|
var end = $filter('date')(new Date(), 'yyyy-MM');
|
|
|
|
|
return start <= mon && end >= mon
|
|
|
|
|
};
|
|
|
|
@ -38,16 +40,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);
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|