master
yuan 7 years ago
parent 40a0078132
commit e00d2bf155

@ -16,6 +16,34 @@ define(['angular','decimal'], function (angular,decimal) {
$scope.today = new Date(); $scope.today = new Date();
$scope.pagination = {}; $scope.pagination = {};
$scope.today = new Date(); $scope.today = new Date();
$scope.isAll = true;
$scope.clients = [$scope.currentUser.client];
if ($scope.currentUser.client.has_children) {
$scope.params.client_ids = [$scope.currentUser.client.client_id];
$http.get('/client/partner_info/sub_partners').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);
});
$scope.params.client_ids = angular.copy($scope.clientIds);
})
};
$scope.chooseClient = function (clientId) {
if (clientId == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
} else {
$scope.chooseClientId = clientId;
$scope.params.client_ids = [clientId];
$scope.isAll = false;
}
$scope.loadTradeLogs(1);
};
$scope.chooseToday = function () { $scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date(); $scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadTradeLogs(1); $scope.loadTradeLogs(1);
@ -62,7 +90,9 @@ define(['angular','decimal'], function (angular,decimal) {
$http.get('/partner/invoice/trans_flow', {params: params}).then(function (resp) { $http.get('/partner/invoice/trans_flow', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data; $scope.tradeLogs = resp.data.data;
$scope.tradeLogs.forEach(function (log) { $scope.tradeLogs.forEach(function (log) {
log.total_surcharge = decimal.add(log.total_surcharge,log.tax_amount).toFixed(2); if(log.total_surcharge){
log.total_surcharge = decimal.add(log.total_surcharge,log.tax_amount).toFixed(2);
}
}); });
$scope.pagination = resp.data.pagination; $scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis; $scope.analysis = resp.data.analysis;

@ -87,7 +87,21 @@
</div> </div>
</div> </div>
<button class="btn btn-success" type="button" ng-click="loadTradeLogs()"> <div class="form-group col-xs-12" ng-if="currentUser.client.has_children">
<label class="control-label col-xs-4 col-sm-2">Sub Partner</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}"
ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub.client_id)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<button class="btn btn-success" type="button" ng-click="loadTradeLogs(1)">
<i class="fa fa-search"></i> Search <i class="fa fa-search"></i> Search
</button> </button>
<!--<a ng-if="pagination.totalCount>0" class="btn btn-success" style="float: right"--> <!--<a ng-if="pagination.totalCount>0" class="btn btn-success" style="float: right"-->

Loading…
Cancel
Save