2024-10-28 12:03:47 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 一个采购成本详情的字段
|
|
|
|
|
|
*/
|
|
|
|
|
|
//COST_DETAIL_ARR=["type","category","name","unit","amount","price","taxRate","totalTaxInclude","totalTaxExclude"];
|
2024-10-29 09:07:51 +00:00
|
|
|
|
pay_DETAIL2 = {
|
|
|
|
|
|
"num": [false, "序号", "string"],
|
|
|
|
|
|
"payPoint": [false, "付款节点", "string"],
|
|
|
|
|
|
"payTime": [false, "付款时间", "string"],
|
|
|
|
|
|
"payProject": [false, "采购成本项目", "number"],
|
|
|
|
|
|
"payAmount": [false, "付款金额", "number"],
|
|
|
|
|
|
"supplier": [false, "供应商", "string"],
|
2024-10-28 12:03:47 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2024-10-29 09:07:51 +00:00
|
|
|
|
pay_DETAIL = {
|
|
|
|
|
|
"num": [false, "序号", "string"],
|
|
|
|
|
|
"payPoint": [false, "付款节点", "string"],
|
|
|
|
|
|
"payTime": [false, "付款时间", "string"],
|
|
|
|
|
|
"payProject": [false, "采购成本项目", "number"],
|
|
|
|
|
|
"payAmount": [false, "付款金额", "number"],
|
|
|
|
|
|
"supplier": [false, "供应商", "string"],
|
2024-10-28 12:03:47 +00:00
|
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
|
|
|
[
|
|
|
|
|
|
{"id":"1","name":"xxx1"},{"id":"2","name":"xxx2"}
|
|
|
|
|
|
]
|
|
|
|
|
|
*/
|
2024-10-29 09:07:51 +00:00
|
|
|
|
SELECT_TYPE_CATEGORY_DATA = [];
|
2024-10-28 12:03:47 +00:00
|
|
|
|
/*{
|
|
|
|
|
|
"1":[
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"1",
|
|
|
|
|
|
"name":"华智产品"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"2",
|
|
|
|
|
|
"name":"紫光其他产品"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"3",
|
|
|
|
|
|
"name":"外购产品"
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"2":[
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"4",
|
|
|
|
|
|
"name":"外购工程"
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"3":[
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"5",
|
|
|
|
|
|
"name":"华智服务"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"6",
|
|
|
|
|
|
"name":"紫光其他服务"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"7",
|
|
|
|
|
|
"name":"外购服务"
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"4":[
|
|
|
|
|
|
{
|
|
|
|
|
|
"id":"8",
|
|
|
|
|
|
"name":"其他"
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
};*/
|
2024-10-29 09:07:51 +00:00
|
|
|
|
SELECT_TYPE_CATEGORY_MAP_DATA = {};
|
2024-10-28 12:03:47 +00:00
|
|
|
|
/*{
|
|
|
|
|
|
"1":"1",
|
|
|
|
|
|
"2":"1",
|
|
|
|
|
|
"3":"1",
|
|
|
|
|
|
"4":"2",
|
|
|
|
|
|
"5":"3",
|
|
|
|
|
|
"6":"3",
|
|
|
|
|
|
"7":"3",
|
|
|
|
|
|
"8":"4"
|
|
|
|
|
|
};
|
|
|
|
|
|
*/
|
2024-10-29 09:07:51 +00:00
|
|
|
|
SELECT_CATEGORY_TYPE_MAP_DATA = {};
|
2024-10-28 12:03:47 +00:00
|
|
|
|
|
|
|
|
|
|
/*$(function () {
|
|
|
|
|
|
$("#cost-detail").click(function () {
|
|
|
|
|
|
$('#my-prompt-cost-detail').modal({
|
|
|
|
|
|
relatedTarget: this,
|
|
|
|
|
|
closeOnConfirm:false,
|
|
|
|
|
|
onConfirm: function(e) {
|
|
|
|
|
|
//不能使用e.data,因为无法获取动态添加的
|
|
|
|
|
|
var data = collectData("am-modal-prompt-input-cost");
|
|
|
|
|
|
//data = prepareAjaxData(data, COST_DETAIL_ARR, $("#id").val(),false);
|
|
|
|
|
|
data = prepareAjaxDataVerify(data, COST_DETAIL, $("#id").val());
|
|
|
|
|
|
if(data){
|
|
|
|
|
|
postAjax(base+"/project/budgetEditSaveCostDetail", data, updateCostData);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onCancel: function(e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#costAddBtn").click(function () {
|
|
|
|
|
|
appendTrCost();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化大类和类别的数据
|
|
|
|
|
|
getAjax(base+"/procurement/type/map", null, initTypeCategory);
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//保存采购成本明细表
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
$("#payTableSave").click(function () {
|
|
|
|
|
|
//不能使用e.data,因为无法获取动态添加的
|
|
|
|
|
|
var data = collectData("am-modal-prompt-input-pay");
|
|
|
|
|
|
//data = prepareAjaxData(data, COST_DETAIL_ARR, $("#id").val(),false);
|
|
|
|
|
|
data = prepareAjaxDataVerify(data, pay_DETAIL2, $("#id").val());
|
2024-10-30 08:31:46 +00:00
|
|
|
|
var flag = verifyBudgetPay()
|
|
|
|
|
|
if (!flag) return
|
2024-10-29 09:07:51 +00:00
|
|
|
|
if (data) {
|
|
|
|
|
|
postAjax(base + "/project/budgetEditSaveBudgetPayPlan", data, updateCostData);
|
2024-10-28 12:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#payAddBtn").click(function () {
|
|
|
|
|
|
appendTrPay();
|
|
|
|
|
|
$("#payAddBtn").blur();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//绑定删除按钮
|
|
|
|
|
|
bindDeleteBtnPay();
|
2024-10-30 08:31:46 +00:00
|
|
|
|
//绑定总计值
|
|
|
|
|
|
bindPayTotal();
|
2024-10-28 12:03:47 +00:00
|
|
|
|
//初始化大类和类别的数据
|
2024-10-29 09:07:51 +00:00
|
|
|
|
getAjax(base + "/procurement/type/map", null, initTypeCategory);
|
2024-10-28 12:03:47 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 采购成本增加一行
|
|
|
|
|
|
*/
|
|
|
|
|
|
function appendTrPay() {
|
|
|
|
|
|
//console.log(SELECT_TYPE_CATEGORY_DATA);
|
|
|
|
|
|
var options = '<option value="xxxx" disabled selected>--请选择--</option>\r\n';
|
|
|
|
|
|
SELECT_TYPE_CATEGORY_DATA.forEach(function (e) {
|
2024-10-29 09:07:51 +00:00
|
|
|
|
options += '<option value="' + e.id + '">' + e.name + '</option>\r\n';
|
2024-10-28 12:03:47 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var template = '<tr>' +
|
|
|
|
|
|
'<td width="60px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-pay input-budget-num" readonly></td>' +
|
2024-10-29 09:07:51 +00:00
|
|
|
|
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-pay am-modal-prompt-input-pay-point" ></td>' +
|
|
|
|
|
|
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-pay input-changeable-pay-time" autocomplete="off" data-am-datepicker></td>' +
|
|
|
|
|
|
'<td width="100px">' +
|
2024-10-28 12:03:47 +00:00
|
|
|
|
'<select style="float: left;" class="am-modal-prompt-input am-modal-prompt-input-pay am-modal-prompt-input-pay-project">\n' +
|
2024-10-29 09:07:51 +00:00
|
|
|
|
'<option value="xxxx" disabled selected>--请选择--</option>' +
|
|
|
|
|
|
'<option value="1">设备成本</option>' +
|
|
|
|
|
|
'<option value="2">工程成本</option>' +
|
|
|
|
|
|
'<option value="3">服务成本</option>' +
|
|
|
|
|
|
'<option value="4">其他成本</option>' +
|
|
|
|
|
|
'</select>' +
|
|
|
|
|
|
'</td>' +
|
2024-10-30 08:31:46 +00:00
|
|
|
|
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-pay am-modal-prompt-input-pay-amount input-changeable-pay-amount" ></td>' +
|
2024-10-28 12:03:47 +00:00
|
|
|
|
'<td width="100px"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-pay am-modal-prompt-input-pay-supplier" ></td>' +
|
2024-10-29 09:07:51 +00:00
|
|
|
|
'<td width="60px"><button type="button" style="margin-top: 10px" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>' +
|
2024-10-28 12:03:47 +00:00
|
|
|
|
|
|
|
|
|
|
'</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
$("#payTotal").before(template);
|
|
|
|
|
|
//重新绑定删除事件和input修改事件
|
|
|
|
|
|
bindDeleteBtnPay();
|
|
|
|
|
|
//绑定序号
|
|
|
|
|
|
bindNum();
|
|
|
|
|
|
//绑定时间
|
|
|
|
|
|
bindTime();
|
|
|
|
|
|
//绑定总计值
|
|
|
|
|
|
bindPayTotal();
|
|
|
|
|
|
//绑定数字输入框保留两位小数
|
|
|
|
|
|
bindNumberInput();
|
|
|
|
|
|
|
|
|
|
|
|
if ($('#costTable').find('tbody') && $('#costTable').find('tbody')[0]) {
|
|
|
|
|
|
$('#costTable').find('tbody')[0].scrollTop = $('#costTable').find('tbody')[0].scrollHeight
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 绑定时间选择器
|
|
|
|
|
|
*/
|
|
|
|
|
|
function bindTime() {
|
|
|
|
|
|
$('[data-am-datepicker]').datepicker();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 绑定每一行的删除事件,删除当前的一行tr,修改总计值
|
|
|
|
|
|
*/
|
|
|
|
|
|
function bindDeleteBtnPay() {
|
|
|
|
|
|
$(".am-modal-line-delete").click(function () {
|
|
|
|
|
|
//删除自己对应的tr
|
|
|
|
|
|
$(this).parent().parent().remove();
|
|
|
|
|
|
bindNum();
|
|
|
|
|
|
updateTotal("input-changeable-pay-amount", "input-changeable-pay-amount-total");
|
2024-10-29 09:07:51 +00:00
|
|
|
|
});
|
2024-10-28 12:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 绑定每个可改变的输入框,修改后改变对应输入框的值
|
|
|
|
|
|
*/
|
|
|
|
|
|
function bindPayTotal() {
|
|
|
|
|
|
//数量改变
|
|
|
|
|
|
$(".input-changeable-pay-amount").change(function () {
|
|
|
|
|
|
updateTotal("input-changeable-pay-amount", "input-changeable-pay-amount-total");
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新页面收入的数据【累加】
|
|
|
|
|
|
*/
|
|
|
|
|
|
function updateCostData(data, returnData) {
|
|
|
|
|
|
var details = data.details;
|
|
|
|
|
|
var deviceTaxInclude = 0;
|
|
|
|
|
|
var deviceTaxExclude = 0;
|
|
|
|
|
|
var deviceTax = 0;
|
|
|
|
|
|
var buildTaxInclude = 0;
|
|
|
|
|
|
var buildTaxExclude = 0;
|
|
|
|
|
|
var buildTax = 0;
|
|
|
|
|
|
var serviceTaxInclude = 0;
|
|
|
|
|
|
var serviceTaxExclude = 0;
|
|
|
|
|
|
var serviceTax = 0;
|
|
|
|
|
|
var otherTaxInclude = 0;
|
|
|
|
|
|
var otherTaxExclude = 0;
|
|
|
|
|
|
var otherTax = 0;
|
|
|
|
|
|
var costTaxRates = "";
|
|
|
|
|
|
var set = new Set();
|
|
|
|
|
|
details.forEach(function (t, number, ts) {
|
2024-10-29 09:07:51 +00:00
|
|
|
|
if (t["type"] == "1") {
|
2024-10-28 12:03:47 +00:00
|
|
|
|
//设备类
|
|
|
|
|
|
deviceTaxInclude += f2(t["totalTaxInclude"]);
|
|
|
|
|
|
deviceTaxExclude += f2(t["totalTaxExclude"]);
|
|
|
|
|
|
deviceTax += f2(t["totalTax"]);
|
2024-10-29 09:07:51 +00:00
|
|
|
|
} else if (t["type"] == "2") {
|
2024-10-28 12:03:47 +00:00
|
|
|
|
//施工类
|
|
|
|
|
|
buildTaxInclude += f2(t["totalTaxInclude"]);
|
|
|
|
|
|
buildTaxExclude += f2(t["totalTaxExclude"]);
|
|
|
|
|
|
buildTax += f2(t["totalTax"]);
|
2024-10-29 09:07:51 +00:00
|
|
|
|
} else if (t["type"] == "3") {
|
2024-10-28 12:03:47 +00:00
|
|
|
|
//服务类
|
|
|
|
|
|
serviceTaxInclude += f2(t["totalTaxInclude"]);
|
|
|
|
|
|
serviceTaxExclude += f2(t["totalTaxExclude"]);
|
|
|
|
|
|
serviceTax += f2(t["totalTax"]);
|
2024-10-29 09:07:51 +00:00
|
|
|
|
} else if (t["type"] == "4") {
|
2024-10-28 12:03:47 +00:00
|
|
|
|
//其他类
|
|
|
|
|
|
otherTaxInclude += f2(t["totalTaxInclude"]);
|
|
|
|
|
|
otherTaxExclude += f2(t["totalTaxExclude"]);
|
|
|
|
|
|
otherTax += f2(t["totalTax"]);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!set.has(t["taxRate"])) {
|
|
|
|
|
|
costTaxRates += f2Fixed(t["taxRate"]) + "%,";
|
|
|
|
|
|
set.add(t["taxRate"]);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
$("input[name='costPurchaseDeviceTaxInclude']").val(f2Fixed(deviceTaxInclude));
|
|
|
|
|
|
$("input[name='costPurchaseDeviceTaxExclude']").val(f2Fixed(deviceTaxExclude));
|
|
|
|
|
|
$("input[name='costPurchaseDeviceTax']").val(f2Fixed(deviceTax));
|
|
|
|
|
|
$("input[name='costPurchaseBuildTaxInclude']").val(f2Fixed(buildTaxInclude));
|
|
|
|
|
|
$("input[name='costPurchaseBuildTaxExclude']").val(f2Fixed(buildTaxExclude));
|
|
|
|
|
|
$("input[name='costPurchaseBuildTax']").val(f2Fixed(buildTax));
|
|
|
|
|
|
$("input[name='costPurchaseServiceTaxInclude']").val(f2Fixed(serviceTaxInclude));
|
|
|
|
|
|
$("input[name='costPurchaseServiceTaxExclude']").val(f2Fixed(serviceTaxExclude));
|
|
|
|
|
|
$("input[name='costPurchaseServiceTax']").val(f2Fixed(serviceTax));
|
|
|
|
|
|
$("input[name='costPurchaseOtherTaxInclude']").val(f2Fixed(otherTaxInclude));
|
|
|
|
|
|
$("input[name='costPurchaseOtherTaxExclude']").val(f2Fixed(otherTaxExclude));
|
|
|
|
|
|
$("input[name='costPurchaseOtherTax']").val(f2Fixed(otherTax));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//资金计划表中的
|
|
|
|
|
|
$(".input-total-title-device-cost-budget-plan").val(f2Fixed(deviceTaxInclude));
|
2024-10-29 09:07:51 +00:00
|
|
|
|
$(".input-total-title-engineer-cost-budget-plan").val(f2Fixed(f2(serviceTaxInclude) + f2(buildTaxInclude) + f2(otherTaxInclude)));
|
|
|
|
|
|
$(".input-total-title-total-cost-budget-plan").val(f2Fixed(f2(deviceTaxInclude) + f2(buildTaxInclude) + f2(serviceTaxInclude) + f2(otherTaxInclude)
|
|
|
|
|
|
+ f2($(".input-total-title-project-manage-cost-budget-plan").val())
|
|
|
|
|
|
+ f2($(".input-total-title-earnest-money-cost-budget-plan").val())));
|
2024-10-28 12:03:47 +00:00
|
|
|
|
|
|
|
|
|
|
/* var costOtherOtherTaxInclude = f2($("input[name='costOtherOtherTaxInclude']").val());
|
|
|
|
|
|
var costOtherOtherTaxExclude = f2($("input[name='costOtherOtherTaxExclude']").val());
|
|
|
|
|
|
|
|
|
|
|
|
var costProjectManageTaxInclude = f2($("input[name='costProjectManageTaxInclude']").val());
|
|
|
|
|
|
var costProjectManageTaxExclude = f2($("input[name='costProjectManageTaxExclude']").val());
|
|
|
|
|
|
|
|
|
|
|
|
$("input[name='costTotalTaxInclude']").val(f2(deviceTaxInclude+buildTaxInclude+serviceTaxInclude+otherTaxInclude+costOtherOtherTaxInclude+costProjectManageTaxInclude));
|
|
|
|
|
|
$("input[name='costTotalTaxExclude']").val(f2(deviceTaxExclude+buildTaxExclude+serviceTaxExclude+otherTaxExclude+costOtherOtherTaxExclude+costProjectManageTaxExclude));*/
|
|
|
|
|
|
|
|
|
|
|
|
calCostExclude();
|
|
|
|
|
|
calCostInclude();
|
|
|
|
|
|
calCostTotalTax();
|
|
|
|
|
|
updateProjectContributionProfitRate();
|
|
|
|
|
|
if (costTaxRates.length > 0) {
|
|
|
|
|
|
$(".costTaxRates").text(costTaxRates.substr(0, costTaxRates.length - 1));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
layuiAlert("保存成功");
|
|
|
|
|
|
$('#my-prompt-cost-detail').modal('close');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 大类类别联动效果
|
|
|
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 初始化数据
|
|
|
|
|
|
* SELECT_TYPE_CATEGORY_MAP_DATA
|
|
|
|
|
|
* SELECT_CATEGORY_TYPE_MAP_DATA
|
|
|
|
|
|
* SELECT_TYPE_CATEGORY_DATA
|
|
|
|
|
|
*/
|
|
|
|
|
|
function initTypeCategory(params, data) {
|
|
|
|
|
|
var d = data.data;
|
|
|
|
|
|
var map = d.map;
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(map).forEach(function (t, number) {
|
|
|
|
|
|
var temp = [];
|
|
|
|
|
|
map[t].forEach(function (g) {
|
|
|
|
|
|
temp.push({
|
2024-10-29 09:07:51 +00:00
|
|
|
|
name: g.name,
|
|
|
|
|
|
id: g.id + ""
|
2024-10-28 12:03:47 +00:00
|
|
|
|
});
|
|
|
|
|
|
});
|
2024-10-29 09:07:51 +00:00
|
|
|
|
SELECT_TYPE_CATEGORY_MAP_DATA[t] = temp;
|
2024-10-28 12:03:47 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var procurementTypes = d.procurementTypes;
|
|
|
|
|
|
procurementTypes.forEach(function (e) {
|
|
|
|
|
|
SELECT_TYPE_CATEGORY_DATA.push({
|
2024-10-29 09:07:51 +00:00
|
|
|
|
id: e.id + "",
|
|
|
|
|
|
name: e.name
|
2024-10-28 12:03:47 +00:00
|
|
|
|
});
|
2024-10-29 09:07:51 +00:00
|
|
|
|
SELECT_CATEGORY_TYPE_MAP_DATA[e.id] = e.type;
|
2024-10-28 12:03:47 +00:00
|
|
|
|
});
|
|
|
|
|
|
//--请选择--的映射
|
|
|
|
|
|
//SELECT_CATEGORY_TYPE_MAP_DATA["xxxx"]="xxxx";
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(SELECT_TYPE_CATEGORY_MAP_DATA);
|
|
|
|
|
|
// console.log(SELECT_TYPE_CATEGORY_DATA);
|
|
|
|
|
|
// console.log(SELECT_CATEGORY_TYPE_MAP_DATA);
|
|
|
|
|
|
}
|
2024-10-29 09:07:51 +00:00
|
|
|
|
|
|
|
|
|
|
//校验付款明细表
|
2024-10-30 08:31:46 +00:00
|
|
|
|
function verifyBudgetPay(isApprove) {
|
|
|
|
|
|
// 时间必填校验
|
2024-10-29 09:07:51 +00:00
|
|
|
|
var timeValue = $(".input-changeable-pay-time");
|
2024-10-30 08:31:46 +00:00
|
|
|
|
var flag = true
|
2024-10-29 09:07:51 +00:00
|
|
|
|
var timeFlag = true
|
|
|
|
|
|
timeValue.each((index, element) => {
|
|
|
|
|
|
if ($(element).val().length != 10)
|
|
|
|
|
|
timeFlag = false
|
|
|
|
|
|
})
|
|
|
|
|
|
if (timeFlag == false) {
|
2024-10-30 08:31:46 +00:00
|
|
|
|
flag = false
|
2024-10-29 09:07:51 +00:00
|
|
|
|
layuiAlert('付款计划表中付款时间为必填')
|
|
|
|
|
|
}
|
2024-10-30 08:31:46 +00:00
|
|
|
|
// 采购成本与付款金额校验
|
|
|
|
|
|
if (isApprove) {
|
|
|
|
|
|
var payData = prepareAjaxDataVerify(collectData("am-modal-prompt-input-pay"), pay_DETAIL2, $("#id").val())
|
|
|
|
|
|
var costData = prepareAjaxDataVerify(collectData("am-modal-prompt-input-cost"), COST_DETAIL2, $("#id").val())
|
|
|
|
|
|
|
|
|
|
|
|
var payTotal_equipment = calculateTotal(payData, 1,'payProject','payAmount');
|
|
|
|
|
|
var payTotal_project = calculateTotal(payData, 2,'payProject','payAmount');
|
|
|
|
|
|
var payTotal_server = calculateTotal(payData, 3,'payProject','payAmount');
|
|
|
|
|
|
var payTotal_other = calculateTotal(payData, 4,'payProject','payAmount');
|
|
|
|
|
|
|
2024-10-31 10:47:01 +00:00
|
|
|
|
var costTotal_equipment = calculateTotal(costData, 1,'type','totalTaxInclude');
|
|
|
|
|
|
var costTotal_project = calculateTotal(costData, 2,'type','totalTaxInclude');
|
|
|
|
|
|
var costTotal_server = calculateTotal(costData, 3,'type','totalTaxInclude');
|
|
|
|
|
|
var costTotal_other = calculateTotal(costData, 4,'type','totalTaxInclude');
|
2024-10-30 08:31:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
2024-10-31 09:39:13 +00:00
|
|
|
|
console.log(payTotal_equipment,payTotal_project,payTotal_server,payTotal_other,costTotal_equipment,costTotal_project,costTotal_server,costTotal_other)
|
|
|
|
|
|
if (f2Fixed(payTotal_equipment) != f2Fixed(costTotal_equipment)) {
|
2024-10-30 08:31:46 +00:00
|
|
|
|
flag = false
|
|
|
|
|
|
layuiAlert('[付款计划表中"设备"成本总金]额需要与[采购成本明细表中"设备"成本总金额]一致')
|
2024-10-31 09:39:13 +00:00
|
|
|
|
} else if (f2Fixed(payTotal_project) != f2Fixed(costTotal_project)) {
|
2024-10-30 08:31:46 +00:00
|
|
|
|
flag = false
|
|
|
|
|
|
layuiAlert('[付款计划表中"工程"成本总金]额需要与[采购成本明细表中"工程"成本总金额]一致')
|
2024-10-31 09:39:13 +00:00
|
|
|
|
} else if (f2Fixed(payTotal_server) != f2Fixed(costTotal_server)) {
|
2024-10-30 08:31:46 +00:00
|
|
|
|
flag = false
|
|
|
|
|
|
layuiAlert('[付款计划表中"服务"成本总金]额需要与[采购成本明细表中"服务"成本总金额]一致')
|
2024-10-31 09:39:13 +00:00
|
|
|
|
} else if (f2Fixed(payTotal_other) != f2Fixed(costTotal_other)) {
|
2024-10-30 08:31:46 +00:00
|
|
|
|
flag = false
|
|
|
|
|
|
layuiAlert('[付款计划表中"其他"成本总金]额需要与[采购成本明细表中"其他"成本总金额]一致')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-29 09:07:51 +00:00
|
|
|
|
return flag
|
|
|
|
|
|
}
|
2024-10-30 08:31:46 +00:00
|
|
|
|
|
|
|
|
|
|
function calculateTotal(payData, type,key,value) {
|
|
|
|
|
|
return payData.details.reduce((total, now) => {
|
2024-10-31 09:39:13 +00:00
|
|
|
|
return now[key] == type ? parseFloat(now[value]) + total : total;
|
2024-10-30 08:31:46 +00:00
|
|
|
|
}, 0);
|
|
|
|
|
|
}
|