|
|
@@ -1,6 +1,6 @@
|
|
|
-define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives', 'service/Purc', 'service/Make', 'service/Fa', 'service/Account', 'service/Alert', 'service/CheckTel', 'ui.router', 'ui.bootstrap', 'file-upload', 'ngSanitize', 'service/BaseInfo', 'service/Cart', 'service/ApprovalFlow', 'service/DeputyOrder', 'service/Product', 'service/Token', 'service/ProductUsers', 'service/File', 'service/PublicInquiry', 'service/Customer', 'service/PurcChange', 'angularTreeview'], function () {
|
|
|
+define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives', 'service/Purc', 'service/Make', 'service/Fa', 'service/Account', 'service/Alert', 'service/CheckTel', 'ui.router', 'ui.bootstrap', 'file-upload', 'ngSanitize', 'service/BaseInfo', 'service/Cart', 'service/ApprovalFlow', 'service/DeputyOrder', 'service/Product', 'service/Token', 'service/ProductUsers', 'service/File', 'service/PublicInquiry', 'service/Customer', 'service/PurcChange', 'angularTreeview', 'wui.date'], function () {
|
|
|
'use strict';
|
|
|
- var app = angular.module('myApp', ['toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'common.directives', 'PurcServices', 'MakeServices', 'FaServices', 'AccountServices', 'AlertServices', 'ui.bootstrap', 'angularFileUpload', 'ngSanitize', 'CheckTelModule', 'ProductServices', 'CartServices', 'ApprvoalFlowService', 'DeputyOrderService', 'ProductInfoServices', 'TokenService', 'ProductUserService', 'ui.tour', 'FileService', 'publicInquiryService', 'CustomerService', 'changeService', 'angularTreeview']);
|
|
|
+ var app = angular.module('myApp', ['toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'common.directives', 'PurcServices', 'MakeServices', 'FaServices', 'AccountServices', 'AlertServices', 'ui.bootstrap', 'angularFileUpload', 'ngSanitize', 'CheckTelModule', 'ProductServices', 'CartServices', 'ApprvoalFlowService', 'DeputyOrderService', 'ProductInfoServices', 'TokenService', 'ProductUserService', 'ui.tour', 'FileService', 'publicInquiryService', 'CustomerService', 'changeService', 'angularTreeview', 'wui.date']);
|
|
|
app.init = function () {
|
|
|
angular.bootstrap(document, ['myApp']);
|
|
|
};
|
|
|
@@ -680,6 +680,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
},
|
|
|
templateUrl: "static/tpl/index/fa/apCheck.html",
|
|
|
controller: 'PurchaseApCheckCtrl'
|
|
|
+ }).state('fa.apCheck_not', {
|
|
|
+ url: "/apChecknot/:id",
|
|
|
+ templateUrl: "static/tpl/index/fa/apChecknot.html",
|
|
|
+ controller: 'PurchaseApCheckNotCtrl'
|
|
|
}).state('fa.apCheck_detail', {
|
|
|
url: "/apCheck/:id",
|
|
|
templateUrl: "static/tpl/index/fa/apCheck_detail.html",
|
|
|
@@ -2152,6 +2156,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
resolve: {
|
|
|
customer: function () {
|
|
|
return customer;
|
|
|
+ },
|
|
|
+ type: function () {
|
|
|
+ return 'purchase'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -2189,6 +2196,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
resolve: {
|
|
|
customer: function () {
|
|
|
return customer;
|
|
|
+ },
|
|
|
+ type: function () {
|
|
|
+ return 'purchase'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -2436,6 +2446,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
resolve: {
|
|
|
customer: function () {
|
|
|
return $scope.customerInfo;
|
|
|
+ },
|
|
|
+ type: function () {
|
|
|
+ return 'purchase'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -2462,18 +2475,32 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
- app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService',
|
|
|
- function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService) {
|
|
|
+ app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService', 'type',
|
|
|
+ function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService, type) {
|
|
|
AuthenticationService.getAuthentication().success(function (data) {
|
|
|
$scope.thisUser = data;
|
|
|
});
|
|
|
|
|
|
+ var urlData, urlSaveData, uuData;
|
|
|
+ var params = {};
|
|
|
+ if (type === 'sale') {
|
|
|
+ params = {id : customer.id};
|
|
|
+ urlSaveData = 'addSaleUserToVendor';
|
|
|
+ urlData = 'findSaleUsers';
|
|
|
+ uuData = customer.id;
|
|
|
+ } else {
|
|
|
+ params = {uu : customer.myEnterprise.uu};
|
|
|
+ urlSaveData = 'addUserToVendor';
|
|
|
+ urlData = 'findUsers';
|
|
|
+ uuData = customer.myEnterprise.uu;
|
|
|
+ }
|
|
|
+
|
|
|
$scope.checkboxes = {
|
|
|
checked: false
|
|
|
};
|
|
|
$scope.loading = true;
|
|
|
$scope.distribute = [];
|
|
|
- AccountUser.findUsers({uu: customer.myEnterprise.uu}, null, function (data) {
|
|
|
+ AccountUser[urlData](params, null, function (data) {
|
|
|
$scope.userinfos = data;
|
|
|
var distribute = [];
|
|
|
angular.forEach($scope.userinfos, function (user, index) {
|
|
|
@@ -2522,13 +2549,13 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.close = function (save) {
|
|
|
var chooseResult = [];
|
|
|
if (save) {
|
|
|
- if (customer.myEnterprise.uu) {
|
|
|
+ if (uuData) {
|
|
|
angular.forEach($scope.userinfos, function (item, i) {
|
|
|
chooseResult.push(item);
|
|
|
});
|
|
|
if (chooseResult.length > 0) {
|
|
|
$scope.loading = true;
|
|
|
- AccountUser.addUserToVendor({uu: customer.myEnterprise.uu}, chooseResult, function (data) {
|
|
|
+ AccountUser[urlSaveData](params, chooseResult, function (data) {
|
|
|
$scope.loading = false;
|
|
|
toaster.pop('success', '提示', '保存成功');
|
|
|
$modalInstance.close(false);
|
|
|
@@ -2551,7 +2578,21 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}]);
|
|
|
|
|
|
// 转移权限
|
|
|
- app.controller('TransferUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService', function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService) {
|
|
|
+ app.controller('TransferUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService', 'type', function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService, type) {
|
|
|
+ var urlData, urlSaveData, uuData;
|
|
|
+ var params = {};
|
|
|
+ if (type === 'sale') {
|
|
|
+ params = {id : customer.id};
|
|
|
+ urlSaveData = 'transferSaleUserToVendor';
|
|
|
+ urlData = 'findSaleUsers';
|
|
|
+ uuData = customer.vendorEnterprise.uu;
|
|
|
+ } else {
|
|
|
+ params = {uu : customer.myEnterprise.uu};
|
|
|
+ urlSaveData = 'transferUserToVendor';
|
|
|
+ urlData = 'findUsers';
|
|
|
+ uuData = customer.myEnterprise.uu;
|
|
|
+ }
|
|
|
+
|
|
|
AuthenticationService.getAuthentication().success(function (data) {
|
|
|
$scope.loading = false;
|
|
|
$scope.thisUser = data;
|
|
|
@@ -2561,7 +2602,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
};
|
|
|
$scope.loading = true;
|
|
|
$scope.transfer = [];
|
|
|
- AccountUser.findUsers({uu: customer.myEnterprise.uu}, {}, function (data) {
|
|
|
+ AccountUser[urlData](params, {}, function (data) {
|
|
|
$scope.userinfos = data;
|
|
|
var transfer = [];
|
|
|
angular.forEach($scope.userinfos, function (user, index) {
|
|
|
@@ -2638,7 +2679,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.close = function (save) {
|
|
|
var chooseResult = [];
|
|
|
if (save) {
|
|
|
- if (customer.myEnterprise.uu) {
|
|
|
+ if (uuData) {
|
|
|
// 当前用户是管理员时
|
|
|
if ($scope.thisUser.sys) {
|
|
|
angular.forEach($scope.userinfos, function (item, i) {
|
|
|
@@ -2646,7 +2687,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
if (chooseResult.length > 0) {
|
|
|
$scope.loading = true;
|
|
|
- AccountUser.transferUserToVendor({uu: customer.myEnterprise.uu}, chooseResult, function (data) {
|
|
|
+ AccountUser[urlSaveData](params, chooseResult, function (data) {
|
|
|
$scope.loading = false;
|
|
|
toaster.pop('success', '提示', '保存成功');
|
|
|
$modalInstance.close(false);
|
|
|
@@ -2659,6 +2700,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '保存失败', "您未勾选任何记录");
|
|
|
}
|
|
|
} else {
|
|
|
+ if(type === 'sale') {
|
|
|
+ toaster.pop('info', '提示', "您没有权限转移对象");
|
|
|
+ return
|
|
|
+ }
|
|
|
// 非管理员转移自己的权限时
|
|
|
angular.forEach($scope.userinfos, function (item, i) {
|
|
|
if (item.transfer && item.userUU !== $scope.thisUser.userUU) {
|
|
|
@@ -2669,7 +2714,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '保存失败', "您未选择权限转移对象");
|
|
|
} else {
|
|
|
$scope.loading = true;
|
|
|
- AccountUser.transferMyDistribute({custUU: customer.myEnterprise.uu, userUU: $scope.target.userUU}, {} ,function (data) {
|
|
|
+ AccountUser.transferMyDistribute({custUU: uuData, userUU: $scope.target.userUU}, {} ,function (data) {
|
|
|
$scope.loading = false;
|
|
|
toaster.pop('success', '提示', '保存成功');
|
|
|
$modalInstance.close(false);
|
|
|
@@ -9399,7 +9444,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
var total = 0;
|
|
|
if (check.items) {
|
|
|
angular.forEach(check.items, function (value) {
|
|
|
- total += value.qty;
|
|
|
+ total += value.checkQty;
|
|
|
});
|
|
|
}
|
|
|
return total;
|
|
|
@@ -9424,7 +9469,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
BaseService.scrollBackToTop();
|
|
|
var loadData = function () {
|
|
|
FaArCheck.get({id: $stateParams.id}, function (data) {
|
|
|
- $scope.order = data;
|
|
|
+ $scope.order = data.data;
|
|
|
$scope.loading = false;
|
|
|
});
|
|
|
};
|
|
|
@@ -9464,7 +9509,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
|
|
|
|
|
|
//应收对账单列表
|
|
|
- app.controller('PurchaseApCheckCtrl', ['$scope', 'FaApCheck', 'BaseService', 'ngTableParams', 'toaster', 'ReportService', 'Symbol', 'CurrentRole', function ($scope, FaApCheck, BaseService, ngTableParams, toaster, ReportService, Symbol, CurrentRole) {
|
|
|
+ app.controller('PurchaseApCheckCtrl', ['$scope', 'FaApCheck', 'BaseService', 'ngTableParams', 'toaster', 'ReportService', 'Symbol', 'CurrentRole', 'DecimalNumber', '$filter', '$state', function ($scope, FaApCheck, BaseService, ngTableParams, toaster, ReportService, Symbol, CurrentRole, DecimalNumber, $filter, $state) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
// 获取当前用户是否为普通用户
|
|
|
CurrentRole.isUser({}, {}, function (data) {
|
|
|
@@ -9473,7 +9518,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.dateZoneText = '不限';
|
|
|
$scope.condition = {dateZone: 1};
|
|
|
$scope.currency = Symbol.currency;//将币别转化为对应的符号
|
|
|
- $scope.active = 'todo';
|
|
|
+ $scope.active = 'all';
|
|
|
|
|
|
/* 时间筛选初始化*/
|
|
|
var fromDate = new Date();
|
|
|
@@ -9504,6 +9549,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.tableParams.reload();
|
|
|
else
|
|
|
$scope.tableParams.page(1);
|
|
|
+ $scope.showNotCheck = false
|
|
|
}
|
|
|
};
|
|
|
$scope.changeDateZone = function (zone) {
|
|
|
@@ -9529,21 +9575,38 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.loading = true;
|
|
|
var pageParams = params.url();
|
|
|
pageParams.searchFilter = { // 筛选条件
|
|
|
- keyword: $scope.keyword,
|
|
|
fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
endDate: getDateTime($scope.condition.dateTo)
|
|
|
};
|
|
|
- FaApCheck[getState($scope.active)](BaseService.parseParams(pageParams), function (page) {
|
|
|
- $scope.loading = false;
|
|
|
- if (page) {
|
|
|
- params.total(page.totalElement);
|
|
|
- $scope.data = $defer.resolve(page.content);
|
|
|
- $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的条件
|
|
|
- }
|
|
|
- }, function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '数据加载失败', response.data);
|
|
|
- });
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ if ($scope.active === 'all') {
|
|
|
+ pageParams.keyword = $scope.keyword
|
|
|
+ FaApCheck.customer(BaseService.parseParams(pageParams), function (page) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (page) {
|
|
|
+ params.total(page.totalElement);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ }
|
|
|
+ $scope.ALLList = page.content
|
|
|
+ $scope.totalCount = page.totalElement;
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ FaApCheck[getState($scope.active)](BaseService.parseParams(pageParams), function (page) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (page) {
|
|
|
+ params.total(page.totalElement);
|
|
|
+ $scope.data = $defer.resolve(page.content);
|
|
|
+
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的条件
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -9611,7 +9674,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
};
|
|
|
|
|
|
// 搜索框回车
|
|
|
- $scope.onSearch = function () {
|
|
|
+ $scope.onSearch = function (keyword) {
|
|
|
+ $scope.keyword = keyword;
|
|
|
$scope.tableParams.page(1);
|
|
|
$scope.tableParams.reload();
|
|
|
};
|
|
|
@@ -9632,8 +9696,403 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '数据加载失败', response.data);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ $scope.data = [];// 列表数据
|
|
|
+
|
|
|
+ $scope.condition = {
|
|
|
+ $fromOpened: false
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.openDatePicker = function ($event, item, openParam) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 客户联想词
|
|
|
+ $scope.getSimilarCustomers = function (value) {
|
|
|
+ if (value) {
|
|
|
+ return Vendor.getSimilarCustomers({keyword: value}).$promise.then(function (data) {
|
|
|
+ return data.map(function (item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.onAssociateCustomerClick = function (vendor) {
|
|
|
+ if (vendor.apcheck == 0) {
|
|
|
+ toaster.pop('info', '提示', '该客户暂未启用平台对账功能');
|
|
|
+ $scope.suuorname = '';
|
|
|
+ } else {
|
|
|
+ $scope.suuorname = vendor.custName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //查找客户
|
|
|
+ $scope.searchCust = function (suuorname) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/tpl/index/fa/apcheck_customer.html',
|
|
|
+ controller: 'SearchCustInfoCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ suuorname: function () {
|
|
|
+ return suuorname;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function (customer) {
|
|
|
+ $scope.suuorname = customer.myEnterprise.enName;
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.showNotCheck = false
|
|
|
+ $scope.goToMNs = function(item) {
|
|
|
+ $scope.chooseItem = item;
|
|
|
+ $scope.showNotCheck = true
|
|
|
+ $scope.suuorname = item.myEnterprise.enName
|
|
|
+ this.searchOrder()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击筛选根据条件选择数据
|
|
|
+ // 默认本月
|
|
|
+ $scope.sdateTo = new Date();
|
|
|
+ $scope.sdateFrom = new Date($scope.sdateTo.getFullYear(), $scope.sdateTo.getMonth(), 1);
|
|
|
+ $scope.thisMouth = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
|
|
|
+ $scope.condition.uuorname = '';
|
|
|
+ // $scope.condition.dateFrom = '';
|
|
|
+ // $scope.condition.dateTo = '';
|
|
|
+ $scope.condition.venduuorname = '';
|
|
|
+ $scope.condition.factory = '';
|
|
|
+ $scope.condition.prodtitle = '';
|
|
|
+ $scope.condition.prodspec = '';
|
|
|
+
|
|
|
+ $scope.searchOrder = function (check) {
|
|
|
+ $scope.data = [];
|
|
|
+ $scope.checkboxes.checked = false;
|
|
|
+ $scope.totalMoney = 0;
|
|
|
+ $scope.condition.uuorname = $scope.suuorname;
|
|
|
+ $scope.condition.factory = $scope.factory
|
|
|
+ $scope.condition.prodtitle = $scope.prodtitle;
|
|
|
+ $scope.condition.prodspec = $scope.prodspec;
|
|
|
+ // $scope.condition.dateFrom = ($scope.sdateFrom || 0);
|
|
|
+ $scope.thisdatato = ($scope.sdateTo || 0);
|
|
|
+ if ($scope.thisdatato != 0) {
|
|
|
+ $scope.condition.dateTo = (new Date($scope.thisdatato.valueOf()) || 0);
|
|
|
+ } else {
|
|
|
+ $scope.condition.dateTo = ($scope.sdateTo || 0);
|
|
|
+ }
|
|
|
+ $scope.condition.venduuorname = $scope.vuuorname;
|
|
|
+ if ($scope.condition.dateTo != null || $scope.keywordXls != null) {
|
|
|
+
|
|
|
+ // $scope.fromDate = $scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null;
|
|
|
+ // $scope.endDate = $scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null;
|
|
|
+ $scope.searchKeyWord = {
|
|
|
+ receiveName: $scope.receiveName,
|
|
|
+ factory: $scope.factory,
|
|
|
+ prodTitle: $scope.prodTitle,
|
|
|
+ prodSpec: $scope.prodSpec,
|
|
|
+ taxRate: $scope.taxRate,
|
|
|
+ suuorname: $scope.suuorname
|
|
|
+ }
|
|
|
+ $scope.exportKeywords = encodeURIComponent($scope.searchKeyWord);
|
|
|
+ // $scope.fromDateXls = angular.copy($scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null);//保存当前取值的起始日期
|
|
|
+ // $scope.endDateXls = angular.copy($scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null);//保存当前取值的截止日期
|
|
|
+ // if (!$scope.suuorname) {
|
|
|
+ // toaster.pop('warning', '提示', '请先选择客户');
|
|
|
+ // document.getElementById('suuorname').focus();//光标默认在客户
|
|
|
+ // } else {
|
|
|
+ $scope.loading = true;
|
|
|
+ FaApCheck.getAllByKeywords({
|
|
|
+ // fromDate: $scope.fromDate,
|
|
|
+ // endDate: $scope.endDate,
|
|
|
+ receiveName: $scope.receiveName,
|
|
|
+ factory: $scope.factory,
|
|
|
+ prodTitle: $scope.prodTitle,
|
|
|
+ prodSpec: $scope.prodSpec,
|
|
|
+ taxRate: $scope.taxRate,
|
|
|
+ checkDate: $scope.thisMouth,
|
|
|
+ suuorname: $scope.suuorname
|
|
|
+ }, function (data) {
|
|
|
+ if (data.length > 0) {
|
|
|
+ angular.forEach(data, function (item) {
|
|
|
+ item.$selected = true;
|
|
|
+ });
|
|
|
+ $scope.data = data;
|
|
|
+ $scope.checkboxes.checked = true;
|
|
|
+ $scope.getTotalMoney();
|
|
|
+ } else {
|
|
|
+ toaster.pop('info', '提示', '当前没有需要对账记录');
|
|
|
+ }
|
|
|
+ $scope.loading = false;
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.exportApcheckList = function() {
|
|
|
+ var url = 'sale/apCheck/xls?fromDate=' + $scope.fromDate + '&endDate=' + $scope.endDate;
|
|
|
+ if (angular.isDefined($scope.receiveName)) {
|
|
|
+ url = url + '&receiveName=' + $scope.receiveName;
|
|
|
+ }
|
|
|
+ if (angular.isDefined($scope.factory)) {
|
|
|
+ url = url + '&factory=' + $scope.factory;
|
|
|
+ }
|
|
|
+ if (angular.isDefined($scope.prodTitle)) {
|
|
|
+ url = url + '&prodTitle=' + $scope.prodTitle;
|
|
|
+ }
|
|
|
+ if (angular.isDefined($scope.prodSpec)) {
|
|
|
+ url = url + '&prodSpec=' + $scope.prodSpec;
|
|
|
+ }
|
|
|
+ if (angular.isDefined($scope.suuorname)) {
|
|
|
+ url = url + '&suuorname=' + $scope.suuorname;
|
|
|
+ }
|
|
|
+ if (angular.isDefined($scope.taxRate)) {
|
|
|
+ url = url + '&receiveName=' + $scope.taxRate;
|
|
|
+ }
|
|
|
+ window.location.href = url;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 点击勾选框,选中要转应收对账单的订单
|
|
|
+ * */
|
|
|
+ $scope.totalMoney = 0;
|
|
|
+ $scope.checkboxes = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+
|
|
|
+ // 点击勾选全部的复选框
|
|
|
+ $scope.checkAll = function () {
|
|
|
+ $scope.totalMoney = 0;
|
|
|
+ $scope.filteredData = $filter('filter')($scope.data, $scope.condition.prodtitle || $scope.condition.uuorname || $scope.condition.venduuorname || $scope.condition.prodspec || $scope.condition.factory);
|
|
|
+ // var dateFrom = $scope.condition.dateFrom;
|
|
|
+ // var dateTo = $scope.condition.dateTo;
|
|
|
+ angular.forEach($scope.filteredData, function (item) {
|
|
|
+ // if ((item.pidate >= dateFrom || dateFrom == '') && (item.pidate < dateTo || dateTo == '')) {
|
|
|
+ item.$selected = $scope.checkboxes.checked;
|
|
|
+ // }
|
|
|
+ });
|
|
|
+ $scope.getTotalMoney();
|
|
|
+ };
|
|
|
+
|
|
|
+ //获取已选单据总金额
|
|
|
+ $scope.getTotalMoney = function () {
|
|
|
+ $scope.totalMoney = 0;
|
|
|
+ angular.forEach($scope.data, function (check) {
|
|
|
+ if (check.$selected) {
|
|
|
+ var price = DecimalNumber.accMul((check.thischeckqty || 0), (check.orderprice || 0));
|
|
|
+ $scope.totalMoney += Math.round(price * 100) / 100;
|
|
|
+ } else {
|
|
|
+ $scope.totalMoney += 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击其中一个明细的复选框
|
|
|
+ $scope.checkOne = function (check) {
|
|
|
+ var result = true;
|
|
|
+ angular.forEach($scope.data, function (item) {
|
|
|
+ if (item.$selected != true) {
|
|
|
+ result = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.checkboxes.checked = result;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.haveSelected = false;
|
|
|
+
|
|
|
+ //生成应收对账单
|
|
|
+ $scope.createApCheck = function () {
|
|
|
+ //保存应收对账单主记录字段
|
|
|
+ $scope.apCheck = {
|
|
|
+ custUu: '',
|
|
|
+ custName: '',
|
|
|
+ enUu: '',
|
|
|
+ apDate: '',
|
|
|
+ beginDate: '',
|
|
|
+ endDate: '',
|
|
|
+ checkStatus: '未对账',
|
|
|
+ checkAmount: 0,
|
|
|
+ currency: '',
|
|
|
+ rate: '',
|
|
|
+ items: [],
|
|
|
+ taxrate: ''
|
|
|
+ };
|
|
|
+ //保存来源单据相关信息
|
|
|
+ var sourceInfos = [];
|
|
|
+
|
|
|
+
|
|
|
+ //所允许的本次对账最大最小数量
|
|
|
+ $scope.data.maxThisCheckQty = 0;
|
|
|
+ $scope.data.minThisCheckQty = 0;
|
|
|
+
|
|
|
+ $scope.sameCust = true;
|
|
|
+ $scope.validQty = true;
|
|
|
+ $scope.loading = true;
|
|
|
+
|
|
|
+ angular.forEach($scope.data, function (check) {
|
|
|
+ //保存应收对账单明细行数据
|
|
|
+ $scope.item = {
|
|
|
+ inoutno: '',
|
|
|
+ inoutnodetno: '',
|
|
|
+ orderCode: '',
|
|
|
+ orderClass: '',
|
|
|
+ orderDetno: '',
|
|
|
+ price: '',
|
|
|
+ checkQty: '',
|
|
|
+ amount: '',
|
|
|
+ sourceId: '',
|
|
|
+ sourceTable: '',
|
|
|
+ oldYCheckQty: '',
|
|
|
+ status: 0,
|
|
|
+ receiveCode: '',
|
|
|
+ receiveName: '',
|
|
|
+ prodCode: '',
|
|
|
+ prodTitle: '',
|
|
|
+ prodUnit: '',
|
|
|
+ prodSpec: '',
|
|
|
+ taxrate: '',
|
|
|
+ sendcode: '',
|
|
|
+ whname: '',
|
|
|
+ custUserUU: ''
|
|
|
+ };
|
|
|
+
|
|
|
+ //应收对账单明细行来源表信息
|
|
|
+ $scope.sourceInfo = {
|
|
|
+ sourceId: '',
|
|
|
+ sourceTable: '',
|
|
|
+ newYCheckQty: ''
|
|
|
+ };
|
|
|
+
|
|
|
+ //此次对账后新的已转数
|
|
|
+ $scope.newYCheckQty = 0;
|
|
|
+ if (check.$selected == true) {
|
|
|
+ $scope.apCheck.custName = check.custname;
|
|
|
+ $scope.apCheck.enUu = check.enuu;
|
|
|
+ $scope.apCheck.checkAmount += (check.thischeckqty || 0) * (check.orderprice || 0);
|
|
|
+ $scope.apCheck.apDate = check.pidate;
|
|
|
+ $scope.apCheck.rate = check.rate;
|
|
|
+
|
|
|
+ //必须是同一家客户才能生成对账单,否则提示错误
|
|
|
+ if ($scope.apCheck.custUu == '') {
|
|
|
+ $scope.apCheck.custUu = check.custuu;
|
|
|
+ } else if ($scope.apCheck.custUu !== check.custuu) {
|
|
|
+ $scope.sameCust = false;
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '请选择同一家客户');
|
|
|
+ }
|
|
|
+
|
|
|
+ //必须是相同币别才能生成对账单,否则提示错误
|
|
|
+ if ($scope.apCheck.currency == '') {
|
|
|
+ $scope.apCheck.currency = check.currency;
|
|
|
+ } else if ($scope.apCheck.currency !== check.currency) {
|
|
|
+ $scope.sameCust = false;
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '请选择同一种币别');
|
|
|
+ }
|
|
|
+
|
|
|
+ //必须是相同税率才能生成对账单,否则提示错误
|
|
|
+ if (!angular.isNumber($scope.apCheck.taxrate)) {
|
|
|
+ $scope.apCheck.taxrate = check.taxrate;
|
|
|
+ } else if ($scope.apCheck.taxrate != check.taxrate) {
|
|
|
+ $scope.sameCust = false;
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '请选择相同的税率');
|
|
|
+ }
|
|
|
+
|
|
|
+ //本次对账数量必须小于总对账数量
|
|
|
+ if (check.qty > 0) {
|
|
|
+ $scope.data.maxThisCheckQty = check.qty;
|
|
|
+ $scope.data.minThisCheckQty = 0;
|
|
|
+ if (check.qty - (check.ycheckqty || 0) < check.thischeckqty || check.thischeckqty < 0 || check.thischeckqty == 0) {
|
|
|
+ $scope.validQty = false;
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '本次对账数量,填写有误!');
|
|
|
+ }
|
|
|
+ } else if (check.qty < 0) {
|
|
|
+ $scope.data.maxThisCheckQty = 0;
|
|
|
+ $scope.data.minThisCheckQty = check.qty;
|
|
|
+ if (((-check.qty) - (-check.ycheckqty) < (-check.thischeckqty)) || check.thischeckqty > 0 || check.thischeckqty == 0) {
|
|
|
+ $scope.validQty = false;
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '本次对账数量,填写有误!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取筛选时间的开始时间为对账的开始时间
|
|
|
+ $scope.apCheck.beginDate = $scope.fromDate;
|
|
|
+
|
|
|
+ //获取筛选的截止时间为对账的截止时间
|
|
|
+ $scope.apCheck.endDate = $scope.endDate;
|
|
|
+
|
|
|
+ //应收对账单明细行数据
|
|
|
+ $scope.item.orderCode = check.ordercode;
|
|
|
+ $scope.item.orderClass = check.piclass;
|
|
|
+ $scope.item.orderDetno = check.orderdetno;
|
|
|
+ $scope.item.price = check.orderprice;
|
|
|
+ $scope.item.checkQty = check.thischeckqty;
|
|
|
+ $scope.item.amount = (check.thischeckqty || 0) * (check.orderprice || 0);
|
|
|
+ $scope.item.sourceId = check.sourceid;
|
|
|
+ $scope.item.sourceTable = check.sourcetable;
|
|
|
+ $scope.item.oldYCheckQty = check.ycheckqty;
|
|
|
+ $scope.item.prodCode = check.prodcode;
|
|
|
+ $scope.item.prodTitle = check.prodtitle;
|
|
|
+ $scope.item.prodSpec = check.prodspec;
|
|
|
+ $scope.item.prodUnit = check.produnit;
|
|
|
+ $scope.item.inoutno = check.inoutno;
|
|
|
+ $scope.item.inoutnodetno = check.detno;
|
|
|
+ $scope.item.taxrate = check.taxrate;
|
|
|
+ $scope.item.receiveCode = check.receivecode;
|
|
|
+ $scope.item.receiveName = check.receivename;
|
|
|
+ $scope.item.sendcode = check.sendcode;
|
|
|
+ $scope.item.whname = check.whname;
|
|
|
+ $scope.item.custUserUU = check.custuseruu;
|
|
|
+
|
|
|
+ //来源表相关信息
|
|
|
+ $scope.sourceInfo.sourceid = check.sourceid;
|
|
|
+ $scope.sourceInfo.sourcetable = check.sourcetable;
|
|
|
+ $scope.sourceInfo.newYCheckQty = ((check.ycheckqty || 0) + check.thischeckqty);
|
|
|
+
|
|
|
+ sourceInfos.push($scope.sourceInfo);
|
|
|
+ $scope.apCheck.items.push($scope.item);
|
|
|
+ $scope.haveSelected = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //保存生成的应收对账单
|
|
|
+ $scope.saveApCheck = function () {
|
|
|
+ if ($scope.apCheck.items.length == 0) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '请先选择需要对账的数据');
|
|
|
+ } else {
|
|
|
+ FaApCheck.saveApCheck({}, $scope.apCheck, function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('success', '成功', '生成应收对账成功');
|
|
|
+ $state.go('fa.apCheck_detail', {id: data.id}, {reload: true});
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '生成对账单失败', response.data);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ //如果是同一家客户,生成对账单的同时,关闭模态框
|
|
|
+ if ($scope.sameCust && $scope.validQty) {
|
|
|
+ $scope.saveApCheck();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}]);
|
|
|
|
|
|
+
|
|
|
//应收对账单详情
|
|
|
app.controller('PurchaseApCheckDetailCtrl', ['$scope', 'toaster', 'FaApCheck', '$stateParams', 'BaseService', 'CurrentRole', function ($scope, toaster, FaApCheck, $stateParams, BaseService, CurrentRole) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
@@ -14175,6 +14634,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
resolve: {
|
|
|
customer: function () {
|
|
|
return customer;
|
|
|
+ },
|
|
|
+ type: function () {
|
|
|
+ return 'purchase'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -14278,7 +14740,125 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.purcByEn = function (businessCode) {
|
|
|
$rootScope.businessCode = businessCode;
|
|
|
window.location.hash = "#/purc/addOrder";
|
|
|
- }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 分配用户
|
|
|
+ $scope.addUserInfo = function (customer) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/tpl/index/account/add_userInfo.html',
|
|
|
+ controller: 'AddUserInfoCtrl',
|
|
|
+ resolve: {
|
|
|
+ customer: function () {
|
|
|
+ return customer;
|
|
|
+ },
|
|
|
+ type: function () {
|
|
|
+ return 'sale'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function (changed, checked) {
|
|
|
+ if (changed) {
|
|
|
+ if (checked)
|
|
|
+ $scope.newUser.roles = checked;
|
|
|
+ else
|
|
|
+ loadUsers();
|
|
|
+ }
|
|
|
+ $scope.customerParams.reload();
|
|
|
+ });
|
|
|
+ // if (!$scope.enabled) {
|
|
|
+ // toaster.pop('error', '您没有为当前客户分配用户的权限!');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // 获取当前用户在当前企业是否被转移权限
|
|
|
+ // AccountUser.getEnTransfer({custUU: customer.myEnterprise.uu}, function (data) {
|
|
|
+ // customer.enTransfer = data.result;
|
|
|
+ // //是管理员,或者被转移了权限时
|
|
|
+ // if ($scope.enabled || customer.enTransfer) {
|
|
|
+ // var modalInstance = $modal.open({
|
|
|
+ // animation: true,
|
|
|
+ // templateUrl: 'static/tpl/index/account/add_userInfo.html',
|
|
|
+ // controller: 'AddUserInfoCtrl',
|
|
|
+ // resolve: {
|
|
|
+ // customer: function () {
|
|
|
+ // return customer;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // modalInstance.result.then(function (changed, checked) {
|
|
|
+ // if (changed) {
|
|
|
+ // if (checked)
|
|
|
+ // $scope.newUser.roles = checked;
|
|
|
+ // else
|
|
|
+ // loadUsers();
|
|
|
+ // }
|
|
|
+ // $scope.customerParams.reload();
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // toaster.pop('error', '您没有为当前客户分配用户的权限!');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 转移权限
|
|
|
+ $scope.transferUserInfo = function (customer) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/tpl/index/account/transfer_userInfo.html',
|
|
|
+ controller: 'TransferUserInfoCtrl',
|
|
|
+ resolve: {
|
|
|
+ customer: function () {
|
|
|
+ return customer;
|
|
|
+ },
|
|
|
+ type: function () {
|
|
|
+ return 'sale'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function (changed, checked) {
|
|
|
+ if (changed) {
|
|
|
+ if (checked)
|
|
|
+ $scope.newUser.roles = checked;
|
|
|
+ else
|
|
|
+ loadUsers();
|
|
|
+ }
|
|
|
+ $scope.customerParams.reload();
|
|
|
+ });
|
|
|
+
|
|
|
+ // customer.enDistribute = null;
|
|
|
+ // if (!$scope.enabled) {
|
|
|
+ // toaster.pop('error', '您没有转移当前客户权限的权限!');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // 获取当前用户在当前企业是否被转移权限
|
|
|
+ // AccountUser.getDistribute ({custUU: customer.myEnterprise.uu}, function(data) {
|
|
|
+ // customer.enDistribute = data.result;
|
|
|
+ // //是管理员,或者被分配时
|
|
|
+ // if ($scope.enabled || customer.enDistribute) {
|
|
|
+ // var modalInstance = $modal.open({
|
|
|
+ // animation: true,
|
|
|
+ // templateUrl: 'static/tpl/index/account/transfer_userInfo.html',
|
|
|
+ // controller: 'TransferUserInfoCtrl',
|
|
|
+ // resolve: {
|
|
|
+ // customer: function () {
|
|
|
+ // return customer;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // modalInstance.result.then(function (changed, checked) {
|
|
|
+ // if (changed) {
|
|
|
+ // if (checked)
|
|
|
+ // $scope.newUser.roles = checked;
|
|
|
+ // else
|
|
|
+ // loadUsers();
|
|
|
+ // }
|
|
|
+ // $scope.customerParams.reload();
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // toaster.pop('error', '您没有转移当前客户权限的权限!');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ };
|
|
|
|
|
|
}]);
|
|
|
|
|
|
@@ -15167,7 +15747,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.loading = true;
|
|
|
var pageParams = params.url();
|
|
|
pageParams.keyword = $scope.keyword;
|
|
|
- VendorService.customer.get(BaseService.parseParams(pageParams), function (page) {
|
|
|
+ FaApCheck.customer(BaseService.parseParams(pageParams), function (page) {
|
|
|
$scope.loading = false;
|
|
|
if (page) {
|
|
|
params.total(page.totalElement);
|