|
|
|
@ -4047,8 +4047,89 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
|
|
|
|
|
app.controller('partnerSettlementCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) {
|
|
|
|
|
$scope.params = {};
|
|
|
|
|
$scope.pagination = {};
|
|
|
|
|
$scope.today = new Date();
|
|
|
|
|
$scope.clients = [];
|
|
|
|
|
$scope.showLevel3Clients = false;
|
|
|
|
|
$scope.isLevel3All = true;
|
|
|
|
|
$scope.clinet = {};
|
|
|
|
|
$scope.isAll = true;
|
|
|
|
|
$scope.initClientInfo = function(){
|
|
|
|
|
$http.get('/sys/partners/'+clientMoniker).then(function (resp) {
|
|
|
|
|
$scope.client = resp.data
|
|
|
|
|
$scope.clients = [$scope.client];
|
|
|
|
|
if ($scope.client.has_children) {
|
|
|
|
|
$scope.params.client_ids = [$scope.client.client_id];
|
|
|
|
|
$http.get('/sys/partners/'+clientMoniker+'/sub_clients').then(function (resp) {
|
|
|
|
|
var clientList = resp.data;
|
|
|
|
|
clientList.forEach(function (client) {
|
|
|
|
|
$scope.clients.push(client);
|
|
|
|
|
});
|
|
|
|
|
$scope.clientIds = [];
|
|
|
|
|
$scope.clients.forEach(function (client) {
|
|
|
|
|
$scope.clientIds.push(client.client_id);
|
|
|
|
|
if (client.level3Clients) {
|
|
|
|
|
client.level3Clients.forEach(function (level3Client) {
|
|
|
|
|
$scope.clientIds.push(level3Client.client_id);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$scope.params.client_ids = angular.copy($scope.clientIds);
|
|
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
$scope.initClientInfo();
|
|
|
|
|
|
|
|
|
|
$scope.exportSettlementLogs = function() {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
var url = '/sys/partners/'+clientMoniker+'/lists_settlements/excel';
|
|
|
|
|
var connectSymbol = '?';
|
|
|
|
|
if (params.datefrom) {
|
|
|
|
|
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
|
|
|
|
|
url += connectSymbol + 'datefrom=' + params.datefrom;
|
|
|
|
|
connectSymbol = '&';
|
|
|
|
|
}
|
|
|
|
|
if (params.dateto) {
|
|
|
|
|
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
|
|
|
|
|
url += connectSymbol + 'dateto=' + params.dateto;
|
|
|
|
|
}
|
|
|
|
|
if (params.client_ids){
|
|
|
|
|
params.client_ids.forEach(function (i) {
|
|
|
|
|
url += connectSymbol + 'client_ids=' + i;
|
|
|
|
|
connectSymbol = '&';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return url;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.chooseClient = function (client) {
|
|
|
|
|
if (client == 'all') {
|
|
|
|
|
$scope.params.client_ids = angular.copy($scope.clientIds);
|
|
|
|
|
$scope.isAll = true;
|
|
|
|
|
$scope.chooseClientId = '';
|
|
|
|
|
$scope.showLevel3Clients = false;
|
|
|
|
|
} else if (client.level3Clients) {
|
|
|
|
|
$scope.chooseClientId = client.client_id;
|
|
|
|
|
$scope.showLevel3Clients = true;
|
|
|
|
|
$scope.level3Clients = client.level3Clients;
|
|
|
|
|
$scope.isAll = false;
|
|
|
|
|
$scope.level3ClientIds = [];
|
|
|
|
|
$scope.level3ClientIds.push(client.client_id);
|
|
|
|
|
client.level3Clients.forEach(function (client) {
|
|
|
|
|
$scope.level3ClientIds.push(client.client_id);
|
|
|
|
|
});
|
|
|
|
|
$scope.chooseLevel3Client("all");
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
$scope.chooseClientId = client.client_id;
|
|
|
|
|
$scope.params.client_ids = [client.client_id];
|
|
|
|
|
$scope.isAll = false;
|
|
|
|
|
$scope.showLevel3Clients = false;
|
|
|
|
|
}
|
|
|
|
|
$scope.loadSettlementLogs();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.today = new Date();
|
|
|
|
|
$scope.chooseToday = function () {
|
|
|
|
|
$scope.params.datefrom = $scope.params.dateto = new Date();
|
|
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
|
@ -4112,16 +4193,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
|
|
|
|
|
size: 'lg'
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
$scope.excelSettlementLogs = function(){
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
if (params.datefrom) {
|
|
|
|
|
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
|
|
|
|
|
}
|
|
|
|
|
if (params.dateto) {
|
|
|
|
|
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
|
|
|
|
|
}
|
|
|
|
|
return '/sys/partners/'+clientMoniker+'/lists_settlements/excel?datefrom='+params.datefrom+'&dateto='+params.dateto
|
|
|
|
|
}
|
|
|
|
|
$scope.chooseLast7Days();
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('partnerSurchargeAccountCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) {
|
|
|
|
|