|
|
@@ -586,7 +586,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
}
|
|
|
return fn;
|
|
|
};
|
|
|
- app.controller('SaleOrderCtrl', function($scope, $filter, PurcOrderItem, ngTableParams,
|
|
|
+ app.controller('SaleOrderCtrl', function($scope, $filter, PurcOrderItem, PurcOrder, ngTableParams,
|
|
|
toaster, ReportService, BaseService, PurcOrderItemHis){
|
|
|
$scope.active = 'todo';
|
|
|
$scope.dateZoneText = '一个月内';
|
|
|
@@ -612,6 +612,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
page : 1,
|
|
|
count : 5,
|
|
|
sorting: {
|
|
|
+ display: 'desc',
|
|
|
date: 'desc'
|
|
|
}
|
|
|
}, {
|
|
|
@@ -678,7 +679,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ //打印
|
|
|
$scope.print = function(order) {
|
|
|
+ PurcOrder.printCount({id: order.id},{});//增加打印此次
|
|
|
+ if(order.display == 1) $scope.setDisplay('setRead', order.id);//设置为已查看状态
|
|
|
ReportService.print(order.enUU, 'purchase', '{purc_orders.pu_id}=' + order.id, '销售订单-' + order.code);
|
|
|
};
|
|
|
|
|
|
@@ -743,6 +747,31 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
$scope.onSearch = function() {
|
|
|
$scope.tableParams.reload();
|
|
|
};
|
|
|
+ //设置为已查看
|
|
|
+ $scope.setDisplay = function(state, orderId) {
|
|
|
+ if(orderId) {//设置单个
|
|
|
+ PurcOrder[state].call({}, {ids: '' + orderId}, function(){
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '错误', "设置失败");
|
|
|
+ });
|
|
|
+ } else {//设置已勾选的
|
|
|
+ var str = null;
|
|
|
+ angular.forEach($scope.tableParams.data, function(order) {
|
|
|
+ if(order.$selected == true) {
|
|
|
+ if(str != null && str != '') str += ',';
|
|
|
+ str += order.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(str != null && str != '') {
|
|
|
+ PurcOrder[state].call({}, {ids: '' + str}, function(){
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '错误', "设置失败");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
});
|
|
|
app.controller('SaleOrderDetailCtrl', function($scope, $stateParams, PurcOrder, PurcOrderItem, toaster, ReportService){
|
|
|
var loadData = function() {
|
|
|
@@ -753,6 +782,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
sum += item.qty * item.price;
|
|
|
});
|
|
|
$scope.order.total = sum;
|
|
|
+ if($scope.order.display == 1) {//未查看的设为已查看
|
|
|
+ $scope.setDisplay('setRead', $scope.order.id);
|
|
|
+ }
|
|
|
});
|
|
|
};
|
|
|
loadData();
|
|
|
@@ -790,8 +822,36 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
};
|
|
|
|
|
|
$scope.print = function(order) {
|
|
|
+ PurcOrder.printCount({id: order.id},{});//增加打印此次
|
|
|
ReportService.print(order.enUU, 'purchase', '{purc_orders.pu_id}=' + order.id, '销售订单-' + order.code);
|
|
|
};
|
|
|
+
|
|
|
+ //设置为已查看
|
|
|
+ $scope.setDisplay = function(state, orderId) {
|
|
|
+ console.log(PurcOrder);
|
|
|
+ if(orderId) {//设置单个
|
|
|
+ PurcOrder[state].call({}, {ids: '' + orderId}, function(){
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '错误', "设置失败");
|
|
|
+ });
|
|
|
+ } else {//设置已勾选的
|
|
|
+ var str = null;
|
|
|
+ angular.forEach($scope.tableParams.data, function(order) {
|
|
|
+ if(order.$selected == true) {
|
|
|
+ if(str != null && str != '') str += ',';
|
|
|
+ str += order.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(str != null && str != '') {
|
|
|
+ PurcOrder[state].call({}, {ids: '' + str}, function(){
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '错误', "设置失败");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
});
|
|
|
app.controller('SaleChangeCtrl', function($scope, $filter, PurcChange, ngTableParams, toaster, BaseService, PurcChangeHis){
|
|
|
$scope.active = 'todo';
|