资金计划表 付款和收款增加公式校验

dev_1.0.0
‘wangjiuyun 2024-11-13 16:42:38 +08:00
parent 182a9991cf
commit cf9c367577
4 changed files with 68 additions and 17 deletions

View File

@ -92,7 +92,10 @@ $(function () {
$("#collaboratorUrl").val($("#collaboratorUrl_span").text());
// checkIfFillIn();
if(!checkprojectPlan()){
$("#saveDraft").attr('disabled', false);
return;
}
var dataIncome = collectData("am-modal-prompt-input-income");
if (dataIncome.length <= 0) {
window.confirm('请填写收入明细表');
@ -211,7 +214,10 @@ $(function () {
$("#saveApprove").click(function () {
$("#saveApprove").attr('disabled', true);
$("#collaboratorUrl").val($("#collaboratorUrl_span").text());
if(!checkprojectPlan()){
$("#saveApprove").attr('disabled', false);
return
}
checkIfFillIn();
if (check === 1) {
$("#saveApprove").attr('disabled', false);
@ -274,17 +280,17 @@ $(function () {
dataManage = prepareAjaxDataVerify(dataManage, COST_PROJECT_MANAGE_DETAIL, $("#id").val());
var totalTotal = dataManage.details.reduce((total, now) => {
return now.total + total
return now.total + total
}, 0)
var limitTotal = dataManage.details.reduce((total, now) => {
if (now.type == 2 && (now.name == '5' || now.name == '4'))
return + total
return +total
else return total
}, 0)
var projectGrossProfitA = $('[name="projectGrossProfitA"]').val()
console.log(limitTotal , projectGrossProfitA.replace(/,/g, ''),totalTotal,limitTotal)
console.log(limitTotal, projectGrossProfitA.replace(/,/g, ''), totalTotal, limitTotal)
if (limitTotal > ((parseFloat(projectGrossProfitA.replace(/,/g, ''))-(totalTotal-limitTotal)) * 0.1)) {
if (limitTotal > ((parseFloat(projectGrossProfitA.replace(/,/g, '')) - (totalTotal - limitTotal)) * 0.1)) {
$("#saveApprove").attr('disabled', false);
layuiAlert(`差旅费+业务费总金额不超过【毛利A(${projectGrossProfitA})-(项目管理费用-差旅费-业务费)】*10%`);
return
@ -388,8 +394,6 @@ function checkIfFillIn() {
var calculationCollectionBudget = $("#calculationCollectionBudget").val();
if (name.length <= 0) {
window.confirm('项目名称不能为空');
check = 1;
@ -519,17 +523,17 @@ function checkIfFillIn() {
check = 1;
return;
}
if(!isSecondBudget){
if (!isSecondBudget) {
window.confirm('是否二次合作不能为空');
check = 1;
return;
}
if(!signTypeBudget){
if (!signTypeBudget) {
window.confirm('是否汇智中标不能为空');
check = 1;
return;
}
if(!calculationCollectionBudget){
if (!calculationCollectionBudget) {
window.confirm('计收计划不能为空');
check = 1;
return;
@ -543,7 +547,7 @@ function checkName() {
var name = $("#nameBudget").val();
var id = $("#id").val();
$.ajax({
url: base+"/project/checkName",
url: base + "/project/checkName",
data: {name: name, id: id},
type: "post",
dataType: "json",
@ -1020,3 +1024,32 @@ function updateBudgetPlanDetailDataUnsubmit(data, returnData) {
updateCashFlow();
}
// 校验资金计划表
function checkprojectPlan() {
// 付款总计
let planPayTotal = f2($('.input-total-title-total-cost-budget-plan').val())
// 保证金付款总计
let planPayEarnest = f2($('.input-total-title-earnest-money-cost-budget-plan').val())
// 项目管理付款总计
let planPayProject = f2($('.input-total-title-project-manage-cost-budget-plan').val())
// 采购成本明细总计
let costTatol = f2($('.input-changeable-total-total-tax-include-cost').val())
if (planPayTotal != (planPayEarnest + planPayProject + costTatol)) {
layuiAlert('资金计划表的付款合计需=保证金付款+项目管理费用表总计+采购成本明细表总计')
return false;
}
// 收款总计
let saleTatol = f2($('.input-total-title-total-income-budget-plan').val())
// 保证金收款
let saleEarnest=f2($('.input-total-title-earnest-money-income-budget-plan').val())
// 收入明细表总计
let incomeTotal=f2($('.input-changeable-total-total-tax-include-income').val())
if (saleTatol != (saleEarnest + incomeTotal)) {
layuiAlert('资金计划表的收款合计需= 保证金收款+收入明细表总计')
return false;
}
return true
}

View File

@ -48,6 +48,8 @@ $(function () {
bindNum();
updateTotal("input-changeable-receive-income-plan", "input-changeable-total-receive-income-plan");
});
bindIncomePlanTotal();
});
@ -56,7 +58,23 @@ $(function () {
*/
function updateIncomePlanData(data,returnData) {
layuiAlert("保存成功");
$('.input-changeable-sale-income-budget-plan').val(0)
$('.input-changeable-sale-income-budget-plan').each( (index,ele) =>{
let time=$(ele).parent().parent().find('.input-changeable-month-budget-plan').val()
let total=0
data.details.forEach((ele)=>{
if(time==ele.receiveTime.slice(0, 7))
total+=ele.receiveAmount
})
$(ele).val(total)
var eventChange= new Event('change',{bubbles:true});
ele.dispatchEvent(eventChange);
updateTotal('input-changeable-sale-income-budget-plan','input-total-title-sale-income-budget-plan')
})
$('#my-prompt-income-plan-detail').modal('close');
}

View File

@ -6,7 +6,7 @@ BUDGET_PLAN_DETAIL2={
"month":[true,"月份"],
"deviceCost":[false,"设备付款","number"],
"projectCost":[false,"工程付款","number"],
"serviceCost ":[false,"服务付款","number"],
"serviceCost":[false,"服务付款","number"],
"otherCost":[false,"其他付款","number"],
"projectManageCost":[false,"经营性开支","number"],
"earnestMoneyCost":[false,"保证金付款","number"],
@ -24,7 +24,7 @@ BUDGET_PLAN_DETAIL={
"month":[true,"月份"],
"deviceCost":[true,"设备付款","number"],
"projectCost":[false,"工程付款","number"],
"serviceCost ":[false,"服务付款","number"],
"serviceCost":[false,"服务付款","number"],
"otherCost":[false,"其他付款","number"],
"projectManageCost":[true,"经营性开支","number"],
"earnestMoneyCost":[true,"保证金付款","number"],
@ -395,7 +395,7 @@ function appendTrBudgetPlan() {
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-project-manage-cost-budget-plan" ></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-cost-budget-plan" ></td>\n' +
' <td style="display: block;"><input type="text" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-cost-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-income-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-income-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-fund-balance-budget-plan" readonly></td>\n' +
@ -440,7 +440,7 @@ function appendTrBudgetPlan2() {
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-project-manage-cost-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-cost-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-cost-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-income-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-income-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-fund-balance-budget-plan" readonly></td>\n' +

View File

@ -1771,7 +1771,7 @@
oninput="if(value.length>16)value=value.slice(0,16)"
maxlength="16"
class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan"
value="${Utils.format(projectBudgetPlanDetail.saleIncome)}">
value="${Utils.format(projectBudgetPlanDetail.saleIncome)}" readonly>
</td>
<td style="display: block;"><input type="text"
oninput="if(value.length>16)value=value.slice(0,16)"