2021-11-04 05:17:03 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 一个资金计划的字段
|
|
|
|
|
|
*/
|
2021-11-05 09:52:48 +00:00
|
|
|
|
BUDGET_PLAN_DETAIL_ARR=["month","deviceCost","engineerCost","projectManageCost","earnestMoneyCost","totalCost","saleIncome","earnestMoneyIncome","totalIncome","fundBalance","capitalInterest","underwrittenPlan","repaymentPlan"];
|
2021-11-04 05:17:03 +00:00
|
|
|
|
$(function () {
|
|
|
|
|
|
$(".budget-plan-detail").click(function () {
|
2021-11-04 08:05:36 +00:00
|
|
|
|
$('#my-prompt-budget-plan-detail').modal({
|
2021-11-04 05:17:03 +00:00
|
|
|
|
relatedTarget: this,
|
|
|
|
|
|
onConfirm: function(e) {
|
|
|
|
|
|
//不能使用e.data,因为无法获取动态添加的
|
2021-11-04 08:05:36 +00:00
|
|
|
|
var data = collectData("am-modal-prompt-input-budget-plan-detail");
|
2021-11-04 05:17:03 +00:00
|
|
|
|
data = prepareAjaxData(data, BUDGET_PLAN_DETAIL_ARR, $("#id").val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
saveDetail("/fourcal/project/budgetEditSaveBudgetPlanDetail", data, updateBudgetPlanDetailData);
|
2021-11-04 05:17:03 +00:00
|
|
|
|
},
|
|
|
|
|
|
onCancel: function(e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
2021-11-04 08:05:36 +00:00
|
|
|
|
$("#budgetPlanDetailAddBtn").click(function () {
|
2021-11-04 05:17:03 +00:00
|
|
|
|
appendTrBudgetPlan();
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 资金计划增加一行
|
|
|
|
|
|
*/
|
|
|
|
|
|
function appendTrBudgetPlan() {
|
|
|
|
|
|
var template = '<tr>\n' +
|
2021-11-05 04:19:01 +00:00
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-month-budget-plan"></td>\n' +
|
2021-11-04 08:05:36 +00:00
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-device-cost-budget-plan"></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-engineer-cost-budget-plan"></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-project-manage-cost-budget-plan"></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-cost-budget-plan"></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-cost-budget-plan" readonly></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan"></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-income-budget-plan"></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-income-budget-plan" readonly></td>\n' +
|
2021-11-04 09:47:56 +00:00
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-fund-balance-budget-plan" readonly></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-capital-interest-budget-plan" readonly></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-underwritten-plan-budget-plan" readonly></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-repayment-plan-budget-plan" readonly></td>\n' +
|
2021-11-04 08:19:46 +00:00
|
|
|
|
' <td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete-budget-plan"><span class="am-icon-minus"></span></button></td>\n' +
|
2021-11-04 05:17:03 +00:00
|
|
|
|
' </tr>';
|
2021-11-04 08:05:36 +00:00
|
|
|
|
$("#budgetPlanDetailTable").append(template);
|
2021-11-04 05:17:03 +00:00
|
|
|
|
//重新绑定删除事件和input修改事件
|
2021-11-04 08:19:46 +00:00
|
|
|
|
bindBudgetPlanDeleteBtn();
|
2021-11-04 08:05:36 +00:00
|
|
|
|
bindChangeableInputBudgetPlanDetail();
|
2021-11-04 05:17:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-04 08:19:46 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 绑定删除删除按钮,不仅删除还需要重新计算统计的数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
function bindBudgetPlanDeleteBtn() {
|
|
|
|
|
|
$(".am-modal-line-delete-budget-plan").click(function () {
|
|
|
|
|
|
//删除自己对应的tr
|
|
|
|
|
|
$(this).parent().parent().remove();
|
|
|
|
|
|
//还需要更新每一列的合计数据
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-device-cost-budget-plan","input-total-device-cost-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-engineer-cost-budget-plan","input-total-engineer-cost-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-project-manage-cost-budget-plan","input-total-project-manage-cost-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-earnest-money-cost-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-sale-income-budget-plan","input-total-sale-income-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-earnest-money-income-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan");
|
2021-11-04 09:17:40 +00:00
|
|
|
|
/*updateBudgetPlanTotal("input-changeable-fund-balance-budget-plan","input-total-fund-balance-budget-plan");*/
|
2021-11-04 08:19:46 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-capital-interest-budget-plan","input-total-capital-interest-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-underwritten-plan-budget-plan","input-total-underwritten-plan-budget-plan");
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-repayment-plan-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//更新余额
|
2021-11-04 09:56:04 +00:00
|
|
|
|
updateEachFundBalance();
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//更新垫资计划
|
|
|
|
|
|
updateEachUnderwrittenPlan();
|
|
|
|
|
|
//更新回款计划
|
|
|
|
|
|
updateEachRepaymentPlan();
|
|
|
|
|
|
//更新资金利息
|
|
|
|
|
|
updateEachCapitalInterest();
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//更新垫资峰值月
|
|
|
|
|
|
updateUnderwrittenInfo();
|
2021-11-04 08:55:01 +00:00
|
|
|
|
|
2021-11-04 08:19:46 +00:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-04 08:05:36 +00:00
|
|
|
|
function bindChangeableInputBudgetPlanDetail() {
|
|
|
|
|
|
//设备支出改变
|
|
|
|
|
|
$(".input-changeable-device-cost-budget-plan").change(function () {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var deviceCost = f2($(this).val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
//找到对应的工程支出、经营性支出、保证金支出
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var engineerCost = f2($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
|
|
|
|
|
|
var projectManageCost = f2($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
|
|
|
|
|
|
var earnestMoneyCost = f2($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新本月所有项支出
|
2021-11-04 08:05:36 +00:00
|
|
|
|
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月设备支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-device-cost-budget-plan","input-total-device-cost-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//更新余额
|
2021-11-04 09:56:04 +00:00
|
|
|
|
updateEachFundBalance();
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//更新垫资计划
|
|
|
|
|
|
updateEachUnderwrittenPlan();
|
|
|
|
|
|
//更新回款计划
|
|
|
|
|
|
updateEachRepaymentPlan();
|
|
|
|
|
|
//更新资金利息
|
|
|
|
|
|
updateEachCapitalInterest();
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//更新垫资峰值月
|
|
|
|
|
|
updateUnderwrittenInfo();
|
2021-11-04 08:05:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
//工程支出改变
|
|
|
|
|
|
$(".input-changeable-engineer-cost-budget-plan").change(function () {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var engineerCost = f2($(this).val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
//找到对应的设备支出、经营性支出、保证金支出
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var deviceCost = f2($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
|
|
|
|
|
|
var projectManageCost = f2($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
|
|
|
|
|
|
var earnestMoneyCost = f2($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新本月所有项支出
|
2021-11-04 08:05:36 +00:00
|
|
|
|
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月工程支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-engineer-cost-budget-plan","input-total-engineer-cost-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//更新余额
|
2021-11-04 09:56:04 +00:00
|
|
|
|
updateEachFundBalance();
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//更新垫资计划
|
|
|
|
|
|
updateEachUnderwrittenPlan();
|
|
|
|
|
|
//更新回款计划
|
|
|
|
|
|
updateEachRepaymentPlan();
|
|
|
|
|
|
//更新资金利息
|
|
|
|
|
|
updateEachCapitalInterest();
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//更新垫资峰值月
|
|
|
|
|
|
updateUnderwrittenInfo();
|
2021-11-04 08:05:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
//经营性支出改变
|
|
|
|
|
|
$(".input-changeable-project-manage-cost-budget-plan").change(function () {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var projectManageCost = f2($(this).val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
//找到对应的设备支出、工程支出、保证金支出
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var deviceCost = f2($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
|
|
|
|
|
|
var engineerCost = f2($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
|
|
|
|
|
|
var earnestMoneyCost = f2($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新本月所有项支出
|
2021-11-04 08:05:36 +00:00
|
|
|
|
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月经营性支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-project-manage-cost-budget-plan","input-total-project-manage-cost-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//更新余额
|
2021-11-04 09:56:04 +00:00
|
|
|
|
updateEachFundBalance();
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//更新垫资计划
|
|
|
|
|
|
updateEachUnderwrittenPlan();
|
|
|
|
|
|
//更新回款计划
|
|
|
|
|
|
updateEachRepaymentPlan();
|
|
|
|
|
|
//更新资金利息
|
|
|
|
|
|
updateEachCapitalInterest();
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//更新垫资峰值月
|
|
|
|
|
|
updateUnderwrittenInfo();
|
2021-11-04 08:05:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
//保证金改变
|
|
|
|
|
|
$(".input-changeable-earnest-money-cost-budget-plan").change(function () {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var earnestMoneyCost = f2($(this).val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
//找到对应的设备支出、经营性支出、保证金支出
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var deviceCost = f2($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
|
|
|
|
|
|
var engineerCost = f2($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
|
|
|
|
|
|
var projectManageCost = f2($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新本月所有项支出
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(f2(deviceCost+engineerCost+projectManageCost+earnestMoneyCost));
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月保证金支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-earnest-money-cost-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月支出总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//更新余额
|
2021-11-04 09:56:04 +00:00
|
|
|
|
updateEachFundBalance();
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//更新垫资计划
|
|
|
|
|
|
updateEachUnderwrittenPlan();
|
|
|
|
|
|
//更新回款计划
|
|
|
|
|
|
updateEachRepaymentPlan();
|
|
|
|
|
|
//更新资金利息
|
|
|
|
|
|
updateEachCapitalInterest();
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//更新垫资峰值月
|
|
|
|
|
|
updateUnderwrittenInfo();
|
2021-11-04 08:05:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//销售收款改变
|
|
|
|
|
|
$(".input-changeable-sale-income-budget-plan").change(function () {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var saleIncome = f2($(this).val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
//找到保证金收款
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var earnestMoneyIncome = f2($(this).parent().parent().find(".input-changeable-earnest-money-income-budget-plan").val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新本月所有项收入
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(f2(saleIncome+earnestMoneyIncome));
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月销售收款总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-sale-income-budget-plan","input-total-sale-income-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月收入总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan");
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//更新余额
|
2021-11-04 09:56:04 +00:00
|
|
|
|
updateEachFundBalance();
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//更新垫资计划
|
|
|
|
|
|
updateEachUnderwrittenPlan();
|
|
|
|
|
|
//更新回款计划
|
|
|
|
|
|
updateEachRepaymentPlan();
|
|
|
|
|
|
//更新资金利息
|
|
|
|
|
|
updateEachCapitalInterest();
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//更新垫资峰值月
|
|
|
|
|
|
updateUnderwrittenInfo();
|
2021-11-04 08:05:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
//保证金收款改变
|
|
|
|
|
|
$(".input-changeable-earnest-money-income-budget-plan").change(function () {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var earnestMoneyIncome = f2($(this).val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
//找到保证金收款
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var saleIncome = f2($(this).parent().parent().find(".input-changeable-sale-income-budget-plan").val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新本月所有项收入
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(f2(saleIncome+earnestMoneyIncome));
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月保证金收款总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-earnest-money-income-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
//更新所有月收入总额
|
2021-11-04 08:05:36 +00:00
|
|
|
|
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan");
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//更新余额
|
2021-11-04 09:56:04 +00:00
|
|
|
|
updateEachFundBalance();
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//更新垫资计划
|
|
|
|
|
|
updateEachUnderwrittenPlan();
|
|
|
|
|
|
//更新回款计划
|
|
|
|
|
|
updateEachRepaymentPlan();
|
|
|
|
|
|
//更新资金利息
|
|
|
|
|
|
updateEachCapitalInterest();
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//更新垫资峰值月
|
|
|
|
|
|
updateUnderwrittenInfo();
|
2021-11-04 08:05:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-04 08:55:01 +00:00
|
|
|
|
/*//资金余额改变
|
2021-11-04 08:05:36 +00:00
|
|
|
|
$(".input-changeable-fund-balance-budget-plan").change(function () {
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-fund-balance-budget-plan","input-total-fund-balance-budget-plan");
|
2021-11-04 08:55:01 +00:00
|
|
|
|
});*/
|
2021-11-04 08:05:36 +00:00
|
|
|
|
//资金利息改变
|
|
|
|
|
|
$(".input-changeable-capital-interest-budget-plan").change(function () {
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-capital-interest-budget-plan","input-total-capital-interest-budget-plan");
|
|
|
|
|
|
});
|
|
|
|
|
|
//垫资计划改变
|
|
|
|
|
|
$(".input-changeable-underwritten-plan-budget-plan").change(function () {
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-underwritten-plan-budget-plan","input-total-underwritten-plan-budget-plan");
|
|
|
|
|
|
});
|
|
|
|
|
|
//还款计划改变
|
|
|
|
|
|
$(".input-changeable-repayment-plan-budget-plan").change(function () {
|
|
|
|
|
|
updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-repayment-plan-budget-plan");
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新每列的总计
|
|
|
|
|
|
*/
|
|
|
|
|
|
function updateBudgetPlanTotal(className, totalClassName) {
|
|
|
|
|
|
var total = 0;
|
|
|
|
|
|
//找到本列所有的
|
|
|
|
|
|
$("."+className).each(function (t) {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
total += f2($(this).val());
|
2021-11-04 08:05:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$("."+totalClassName).val(f2(total));
|
2021-11-04 05:17:03 +00:00
|
|
|
|
}
|
2021-11-04 08:05:36 +00:00
|
|
|
|
|
2021-11-04 09:17:40 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新每一行【即每个月】的资金余额
|
|
|
|
|
|
* 每个月的余额=本月收入-支出+上月余额
|
|
|
|
|
|
*/
|
2021-11-04 09:56:04 +00:00
|
|
|
|
function updateEachFundBalance() {
|
2021-11-04 09:17:40 +00:00
|
|
|
|
var fundBalance = 0;
|
|
|
|
|
|
//找到每个月的资金余额输入框
|
|
|
|
|
|
$(".input-changeable-fund-balance-budget-plan").each(function (t) {
|
|
|
|
|
|
//找到当前月的收入和支出
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var income = f2($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
|
|
|
|
|
|
var cost = f2($(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val());
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//我的上月余额
|
2021-11-05 09:52:48 +00:00
|
|
|
|
var prevFundBalance = f2($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
|
2021-11-04 09:17:40 +00:00
|
|
|
|
if(!prevFundBalance){
|
|
|
|
|
|
//第一个月的话,上月余额就为0
|
|
|
|
|
|
prevFundBalance = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
fundBalance = income - cost + prevFundBalance;
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(this).val(f2(fundBalance));
|
2021-11-04 09:17:40 +00:00
|
|
|
|
});
|
2021-11-04 08:55:01 +00:00
|
|
|
|
|
2021-11-04 09:17:40 +00:00
|
|
|
|
//总余额=最后一个月的余额
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(".input-total-fund-balance-budget-plan").val(f2(fundBalance));
|
2021-11-04 09:17:40 +00:00
|
|
|
|
}
|
2021-11-04 08:55:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
2021-11-04 10:45:11 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新每一行【即每个月】的垫资计划
|
|
|
|
|
|
*/
|
|
|
|
|
|
function updateEachUnderwrittenPlan() {
|
|
|
|
|
|
var total = 0;
|
|
|
|
|
|
//找到每个月的垫资计划输入框
|
|
|
|
|
|
$(".input-changeable-underwritten-plan-budget-plan").each(function (t) {
|
|
|
|
|
|
//找到当前月的收入和支出
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var income = f2($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
|
|
|
|
|
|
var cost = f2($(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val());
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//我的上月余额
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var prevFundBalance = f2($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
|
2021-11-04 10:45:11 +00:00
|
|
|
|
if(!prevFundBalance){
|
|
|
|
|
|
//第一个月的话,上月余额就为0
|
|
|
|
|
|
prevFundBalance = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-05 01:17:59 +00:00
|
|
|
|
var underwrittenPlan = calUnderwrittenPlan(income, cost, prevFundBalance);
|
2021-11-04 10:45:11 +00:00
|
|
|
|
|
|
|
|
|
|
total += underwrittenPlan;
|
|
|
|
|
|
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(this).val(f2(underwrittenPlan));
|
2021-11-04 10:45:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//总垫资计划=所有月累加
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(".input-total-underwritten-plan-budget-plan").val(f2(total));
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//下放小表的垫资峰值金额
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(".input-underwritten-plan-statistic-amount-budget-plan").val(f2(total));
|
2021-11-04 10:45:11 +00:00
|
|
|
|
}
|
2021-11-05 01:17:59 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 计算垫资计划
|
|
|
|
|
|
* @param income 收入
|
|
|
|
|
|
* @param cost 支出
|
|
|
|
|
|
* @param prevFundBalance 上月余额
|
|
|
|
|
|
*/
|
|
|
|
|
|
function calUnderwrittenPlan(income, cost, prevFundBalance) {
|
|
|
|
|
|
var underwrittenPlan = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if(!income || !cost){
|
|
|
|
|
|
//数据还不全的时候
|
|
|
|
|
|
underwrittenPlan = NaN;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
|
|
if (income - cost >= 0) {
|
|
|
|
|
|
underwrittenPlan = 0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (prevFundBalance < 0) {
|
|
|
|
|
|
underwrittenPlan = cost - income;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (prevFundBalance <= cost - income) {
|
|
|
|
|
|
underwrittenPlan = cost - income - prevFundBalance;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
underwrittenPlan = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return underwrittenPlan;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-04 10:45:11 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新每一行【即每个月】的还款计划
|
|
|
|
|
|
*/
|
|
|
|
|
|
function updateEachRepaymentPlan() {
|
|
|
|
|
|
var total = 0;
|
|
|
|
|
|
//找到每个月的回款计划输入框
|
|
|
|
|
|
$(".input-changeable-repayment-plan-budget-plan").each(function (t) {
|
|
|
|
|
|
//找到当前月的收入和支出
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var income = f2($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
|
|
|
|
|
|
var cost = f2($(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val());
|
2021-11-04 10:45:11 +00:00
|
|
|
|
//我的上月余额
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var prevFundBalance = f2($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
|
2021-11-04 10:45:11 +00:00
|
|
|
|
if(!prevFundBalance){
|
|
|
|
|
|
//第一个月的话,上月余额就为0
|
|
|
|
|
|
prevFundBalance = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-05 01:17:59 +00:00
|
|
|
|
var repaymentPlan = calRepaymentPlan(income, cost, prevFundBalance);
|
2021-11-04 10:45:11 +00:00
|
|
|
|
|
|
|
|
|
|
total += repaymentPlan;
|
|
|
|
|
|
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(this).val(f2(repaymentPlan));
|
2021-11-04 10:45:11 +00:00
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//总回款计划=所有月累加
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(".input-total-repayment-plan-budget-plan").val(f2(total));
|
2021-11-04 10:45:11 +00:00
|
|
|
|
}
|
2021-11-05 01:17:59 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 计算回款计划
|
|
|
|
|
|
* @param income 收入
|
|
|
|
|
|
* @param cost 支出
|
|
|
|
|
|
* @param prevFundBalance 上月余额
|
|
|
|
|
|
*/
|
|
|
|
|
|
function calRepaymentPlan(income, cost, prevFundBalance) {
|
|
|
|
|
|
var repaymentPlan = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if(!income || !cost){
|
|
|
|
|
|
//数据还不全的时候
|
|
|
|
|
|
repaymentPlan = NaN;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
if(income - cost <= 0){
|
|
|
|
|
|
repaymentPlan = 0;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
if(prevFundBalance >= 0){
|
|
|
|
|
|
repaymentPlan = 0;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
if(income - cost <= -prevFundBalance){
|
|
|
|
|
|
repaymentPlan = income - cost;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
repaymentPlan = -prevFundBalance;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return repaymentPlan;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-04 10:45:11 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新每一行【即每个月】的资金利息
|
|
|
|
|
|
*/
|
|
|
|
|
|
function updateEachCapitalInterest() {
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var underwrittenPlanTaxRate = f2($(".input-underwritten-plan-statistic-tax-rate-budget-plan").val());
|
2021-11-04 10:45:11 +00:00
|
|
|
|
var total = 0;
|
|
|
|
|
|
//找到每个月的资金利息输入框
|
|
|
|
|
|
$(".input-changeable-capital-interest-budget-plan").each(function (t) {
|
|
|
|
|
|
//找到当前月的垫资计划
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var underwrittenPlan = f2($(this).parent().parent().find(".input-changeable-underwritten-plan-budget-plan").val());
|
2021-11-05 04:19:01 +00:00
|
|
|
|
var capitalInterest = underwrittenPlan*underwrittenPlanTaxRate/100/12;
|
2021-11-04 10:45:11 +00:00
|
|
|
|
total += capitalInterest;
|
|
|
|
|
|
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(this).val(f2(capitalInterest));
|
2021-11-04 10:45:11 +00:00
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//总资金利息=所有月累加
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(".input-total-capital-interest-budget-plan").val(f2(total));
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//下方小表的资金利息
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$(".input-underwritten-plan-statistic-capital-interest-budget-plan").val(f2(total));
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//主页面上的财务费用
|
2021-11-05 09:52:48 +00:00
|
|
|
|
$("input[name='costExpropriationTaxExclude']").val(f2(total));
|
2021-11-05 04:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新资金相关信息
|
|
|
|
|
|
*
|
|
|
|
|
|
垫资峰值时间 垫资最大的那一个月
|
|
|
|
|
|
垫资峰值金额 垫资累计 @see updateEachUnderwrittenPlan
|
|
|
|
|
|
资金利息 垫资每月利息累加 @see updateEachCapitalInterest
|
|
|
|
|
|
*/
|
|
|
|
|
|
function updateUnderwrittenInfo() {
|
|
|
|
|
|
var max = 0;
|
|
|
|
|
|
var month = '';
|
|
|
|
|
|
//找到每个月的垫资计划输入框
|
|
|
|
|
|
$(".input-changeable-underwritten-plan-budget-plan").each(function (t) {
|
|
|
|
|
|
//找到当前月垫资计划
|
2021-11-05 09:15:31 +00:00
|
|
|
|
var underwrittenPlan = f2($(this).val());
|
2021-11-05 04:19:01 +00:00
|
|
|
|
//当月比最大的还大,就取当月的
|
|
|
|
|
|
if(underwrittenPlan > max){
|
|
|
|
|
|
month = $(this).parent().parent().find(".input-changeable-month-budget-plan").val();
|
|
|
|
|
|
max = underwrittenPlan;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//垫资峰值时间为每个月最大的那个月
|
|
|
|
|
|
$(".input-underwritten-plan-statistic-max-month-budget-plan").val(month);
|
2021-11-04 10:45:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-04 05:17:03 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新页面收入的数据
|
|
|
|
|
|
*/
|
2021-11-04 08:05:36 +00:00
|
|
|
|
function updateBudgetPlanDetailData(details) {
|
2021-11-04 05:17:03 +00:00
|
|
|
|
}
|