资金计划表的数据校验

master
xxssyyyyssxx 2021-11-08 13:09:30 +08:00
parent 94d0ad9c13
commit b2d64d3380
1 changed files with 56 additions and 0 deletions
src/main/resources/static/assets/js

View File

@ -7,6 +7,15 @@ $(function () {
$('#my-prompt-budget-plan-detail').modal({
relatedTarget: this,
onConfirm: function(e) {
//校验数据正确性
var message = verifyBudgetPlan();
if (message) {
alert(message);
return;
}
//不能使用e.data因为无法获取动态添加的
var data = collectData("am-modal-prompt-input-budget-plan-detail");
data = prepareAjaxData(data, BUDGET_PLAN_DETAIL_ARR, $("#id").val());
@ -27,6 +36,53 @@ $(function () {
//绑定公司管理费用的输入框
bindCompanyManageChangeable();
});
/**
* 校验资金计划表
* 校验失败返回相应的报错信息否则返回""
*/
function verifyBudgetPlan(){
var costPurchaseDeviceTaxExclude = $("input[name='costPurchaseDeviceTaxExclude']").val();
var costPurchaseBuildTaxExclude = $("input[name='costPurchaseBuildTaxExclude']").val();
var costPurchaseServiceTaxExclude = $("input[name='costPurchaseServiceTaxExclude']").val();
var costPurchaseOtherTaxExclude = $("input[name='costPurchaseOtherTaxExclude']").val();
var costProjectManageTaxExclude = $("input[name='costProjectManageTaxExclude']").val();
var incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']").val();
var input_total_device_cost_budget_plan = $(".input-total-device-cost-budget-plan").val();
var input_total_engineer_cost_budget_plan = $(".input-total-engineer-cost-budget-plan").val();
var input_total_project_manage_budget_plan = $(".input-total-project-manage-cost-budget-plan").val();
var input_total_sale_income_budget_plan = $(".input-total-sale-income-budget-plan").val();
var input_total_earnest_money_cost_budget_plan = $(".input-total-earnest-money-cost-budget-plan").val();
var input_total_earnest_money_income_budget_plan = $(".input-total-earnest-money-income-budget-plan").val();
//从采购成本明细中取“设备”大类下的总计---设备支出
if(costPurchaseDeviceTaxExclude != input_total_device_cost_budget_plan){
return "采购成本明细中取“设备”大类下的总计["+costPurchaseDeviceTaxExclude+"]与设备支出["+input_total_device_cost_budget_plan+"]不等";
}
//从采购成本明细中取“服务+施工+其他”大类的总计---工程支出
var t = f2(f2(costPurchaseBuildTaxExclude)+f2(costPurchaseServiceTaxExclude)+f2(costPurchaseOtherTaxExclude));
if(t != f2(input_total_engineer_cost_budget_plan)){
return "采购成本明细中取“服务+施工+其他”大类的总计["+t+"]与工程支出["+input_total_engineer_cost_budget_plan+"]不等";
}
//从项目管理成本取总计金额--经营性开支
if(costProjectManageTaxExclude != input_total_project_manage_budget_plan){
return "项目管理成本取总计金额["+costProjectManageTaxExclude+"]与经营性开支["+input_total_project_manage_budget_plan+"]不等";
}
//从“销售收入明细”中取合计--销售收款
if(incomeTotalTaxExclude != input_total_sale_income_budget_plan){
return "销售收入明细金额["+incomeTotalTaxExclude+"]与销售收款["+input_total_sale_income_budget_plan+"]不等";
}
//保证金支出和收入一致
if(input_total_earnest_money_cost_budget_plan != input_total_earnest_money_income_budget_plan){
return "保证金支出["+input_total_earnest_money_cost_budget_plan+"]与保证金收款["+input_total_earnest_money_income_budget_plan+"]不等";
}
return "";
}
/**
* 资金计划增加一行
*/