|
|
@@ -7714,7 +7714,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}]);
|
|
|
|
|
|
//未对账单据列表
|
|
|
- app.controller('PurchaseApCheckListCtrl',['$scope', 'FaApCheck', 'toaster', '$state','$filter', '$modal', function($scope, FaApCheck, toaster, $state, $filter, $modal){
|
|
|
+ app.controller('PurchaseApCheckListCtrl',['$scope', 'FaApCheck', 'toaster', '$state','$filter', '$modal', 'Vendor', function($scope, FaApCheck, toaster, $state, $filter, $modal, Vendor){
|
|
|
$scope.data = [];// 列表数据
|
|
|
|
|
|
$scope.condition = {
|
|
|
@@ -7727,20 +7727,41 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
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/custInfo.html',
|
|
|
+ templateUrl: 'static/tpl/index/fa/apcheck_customer.html',
|
|
|
controller: 'SearchCustInfoCtrl',
|
|
|
+ size: 'lg',
|
|
|
resolve: {
|
|
|
suuorname: function() {
|
|
|
return suuorname;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- modalInstance.result.then(function(suuorname){
|
|
|
- $scope.suuorname = suuorname;
|
|
|
+ modalInstance.result.then(function(customer){
|
|
|
+ $scope.suuorname = customer.myEnterprise.enName;
|
|
|
});
|
|
|
|
|
|
}
|
|
|
@@ -8041,334 +8062,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
- //货款调账
|
|
|
- app.controller('PurchaseAdjustListCtrl',['$scope', 'FaApCheck', 'toaster', '$state','$filter', '$modal', 'ApbillAdjustment', function($scope, FaApCheck, toaster, $state, $filter, $modal, ApbillAdjustment){
|
|
|
- $scope.data = [];// 列表数据
|
|
|
-
|
|
|
- $scope.condition = {
|
|
|
- $fromOpened: false
|
|
|
- }
|
|
|
-
|
|
|
- $scope.openDatePicker = function($event, item, openParam) {
|
|
|
- $event.preventDefault();
|
|
|
- $event.stopPropagation();
|
|
|
- item[openParam] = !item[openParam];
|
|
|
- }
|
|
|
-
|
|
|
- //查找客户
|
|
|
- $scope.searchCust = function(suuorname) {
|
|
|
- var modalInstance = $modal.open({
|
|
|
- animation: true,
|
|
|
- templateUrl: 'static/tpl/index/fa/custInfo.html',
|
|
|
- controller: 'SearchCustInfoCtrl',
|
|
|
- resolve: {
|
|
|
- suuorname: function() {
|
|
|
- return suuorname;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- modalInstance.result.then(function(suuorname){
|
|
|
- $scope.suuorname = suuorname;
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // 点击筛选根据条件选择数据
|
|
|
- $scope.suuorname = '';
|
|
|
- // 默认本月
|
|
|
- $scope.sdateTo = new Date();
|
|
|
- $scope.sdateFrom = new Date($scope.sdateTo.getFullYear(), $scope.sdateTo.getMonth(), 1);
|
|
|
- $scope.vuuorname = '';
|
|
|
- $scope.factory = '';
|
|
|
- $scope.prodTitle = '';
|
|
|
- $scope.prodSpec = '';
|
|
|
- $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() + 3600 * 12 * 1000) || 0);
|
|
|
- } else {
|
|
|
- $scope.condition.dateTo = ($scope.sdateTo || 0);
|
|
|
- }
|
|
|
- $scope.condition.venduuorname = $scope.vuuorname;
|
|
|
- if($scope.condition.dateFrom != null || $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.keywordXls = angular.copy(($scope.condition.uuorname == null ? "" : $scope.condition.uuorname)
|
|
|
- + "|"+ ($scope.condition.venduuorname == null ? "" : $scope.condition.venduuorname)
|
|
|
- + "|"+ ($scope.condition.factory == null ? "" : $scope.condition.factory)
|
|
|
- + "|"+ ($scope.condition.prodTitle == null ? "" : $scope.condition.prodTitle)
|
|
|
- + "|"+ ($scope.condition.prodSpec == null ? "" : $scope.condition.prodSpec));//保存当前取值的关键词
|
|
|
- $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;
|
|
|
- ApbillAdjustment.adjustList({fromDate: $scope.fromDate, endDate: $scope.endDate, keyword:$scope.keywordXls}, 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.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 uuorname = $scope.suuorname;
|
|
|
- var venduuorname = $scope.venduuorname;
|
|
|
- var dateFrom = $scope.condition.dateFrom;
|
|
|
- var dateTo = $scope.condition.dateTo;
|
|
|
- var prodTitle = $scope.condition.prodTitle;
|
|
|
- var prodSpec = $scope.condition.prodSpec;
|
|
|
- var factory = $scope.condition.factory;
|
|
|
- angular.forEach($scope.filteredData, function(item) {
|
|
|
- if((item.orderdate >= dateFrom || dateFrom == '') && (item.orderdate < dateTo || dateTo == '')){
|
|
|
- item.$selected = $scope.checkboxes.checked;
|
|
|
- }
|
|
|
- });
|
|
|
- $scope.getTotalMoney();
|
|
|
- };
|
|
|
-
|
|
|
- //获取已选单据总金额
|
|
|
- var total = true;
|
|
|
- $scope.getTotalMoney = function(){
|
|
|
- $scope.totalMoney = 0;
|
|
|
- angular.forEach($scope.data, function(check) {
|
|
|
- if(check.$selected){
|
|
|
- $scope.totalMoney += (check.thischeckqty || 0)*(check.orderprice || 0);
|
|
|
- }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: []
|
|
|
- };
|
|
|
- //保存来源单据相关信息
|
|
|
- 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:'',
|
|
|
- prodSpec:'',
|
|
|
- taxrate: '',
|
|
|
- sendcode: '',
|
|
|
- whname: '',
|
|
|
- };
|
|
|
-
|
|
|
- //应收对账单明细行来源表信息
|
|
|
- $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.date;
|
|
|
- $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(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','本次对账数量,填写有误!');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //获取最小时间作为对账区间的起始时间
|
|
|
- if($scope.apCheck.beginDate == ''){
|
|
|
- $scope.apCheck.beginDate = check.date;
|
|
|
- }else{
|
|
|
- $scope.apCheck.beginDate = $scope.apCheck.beginDate>check.piDate? check.orderdate : $scope.apCheck.beginDate;
|
|
|
- }
|
|
|
-
|
|
|
- //获取最大时间作为对账区间的截止时间
|
|
|
- if($scope.apCheck.endDate == ''){
|
|
|
- $scope.apCheck.endDate = check.date;
|
|
|
- }else{
|
|
|
- $scope.apCheck.endDate = $scope.apCheck.endDate<check.piDate? check.orderdate : $scope.apCheck.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.id;
|
|
|
- $scope.item.sourceTable = 'purc$apbilladjustment';
|
|
|
- $scope.item.orderClass = '货款调账';
|
|
|
- $scope.item.oldYCheckQty = check.ycheckqty;
|
|
|
- $scope.item.prodCode = check.prodcode;
|
|
|
- $scope.item.prodTitle = check.prodtitle;
|
|
|
- $scope.item.prodSpec = check.prodspec;
|
|
|
- $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.sourceInfo.sourceId = check.id;
|
|
|
- $scope.sourceInfo.sourceTable = 'purc$apbilladjustment';
|
|
|
- $scope.sourceInfo.newYCheckQty = ((check.ycheckqty || 0) + check.thischeckqty);
|
|
|
-
|
|
|
- sourceInfos.push($scope.sourceInfo);
|
|
|
- $scope.apCheck.items.push($scope.item);
|
|
|
- $scope.haveSelected = true;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //保存生成的应收对账单
|
|
|
- $scope.saveApCheck = function(){
|
|
|
- FaApCheck.saveApCheck({}, $scope.apCheck, function(data){
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('success', '成功', '生成应收对账成功');
|
|
|
- $state.go('fa.apCheck_detail', {id: data.id}, {reload:true});
|
|
|
- }, function(response){
|
|
|
- toaster.pop('error', '生成对账单失败', response.data);
|
|
|
- })
|
|
|
- };
|
|
|
-
|
|
|
- //如果是同一家客户,生成对账单的同时,关闭模态框
|
|
|
- if($scope.sameCust && $scope.validQty) {
|
|
|
- $scope.saveApCheck();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }]);
|
|
|
|
|
|
// 企业信息设置
|
|
|
app.controller('EnterpriseCtrl', ['$scope', 'AccountEnterprise', 'toaster', '$state', '$modal', 'BaseService', 'ShipAddress', '$http', 'DeputyOrder', function($scope, AccountEnterprise, toaster, $state, $modal, BaseService, ShipAddress, $http, DeputyOrder){
|
|
|
@@ -12772,7 +12465,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
/**
|
|
|
* 财务对账时,企业进行筛选操作
|
|
|
*/
|
|
|
- app.controller('SearchCustInfoCtrl', ['$scope', '$modalInstance', 'suuorname', 'FaApCheck', function($scope, $modalInstance, suuorname, FaApCheck) {
|
|
|
+ app.controller('SearchCustInfoCtrl', ['$scope', '$modalInstance', 'suuorname', 'FaApCheck', 'VendorService', 'ngTableParams', 'BaseService', function($scope, $modalInstance, suuorname, FaApCheck, VendorService, ngTableParams, BaseService) {
|
|
|
var getData = function(){
|
|
|
$scope.loading = true;
|
|
|
FaApCheck.getAllCustomers(function(data) {
|
|
|
@@ -12783,8 +12476,38 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
|
|
|
getData();
|
|
|
|
|
|
- $scope.select = function(suuorname) {
|
|
|
- $modalInstance.close(suuorname);
|
|
|
+ $scope.customerParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 20
|
|
|
+ }, {
|
|
|
+ total : 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData : function($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ VendorService.customer.get(BaseService.parseParams(pageParams), function(page){
|
|
|
+ $scope.loading = false;
|
|
|
+ if(page) {
|
|
|
+ params.total(page.totalElement);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ }
|
|
|
+ $scope.totalCount = page.totalElement;
|
|
|
+ }, function(response){
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function(keyword) {
|
|
|
+ $scope.customerParams.page(1);
|
|
|
+ $scope.customerParams.reload();
|
|
|
+ $scope.tip = keyword;
|
|
|
+ };
|
|
|
+ $scope.select = function(customer) {
|
|
|
+ $modalInstance.close(customer);
|
|
|
}
|
|
|
|
|
|
$scope.close = function() {
|