修改预算资金计划表
parent
e0c3986f6d
commit
97a7875bad
|
@ -355,20 +355,19 @@ function updateEachUnderwrittenPlan() {
|
||||||
//找到每个月的垫资计划输入框
|
//找到每个月的垫资计划输入框
|
||||||
$(".input-changeable-underwritten-plan-budget-plan").each(function (t) {
|
$(".input-changeable-underwritten-plan-budget-plan").each(function (t) {
|
||||||
//找到当前月的收入和支出
|
//找到当前月的收入和支出
|
||||||
var income = f2($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
|
var income = $(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());
|
var cost = $(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val();
|
||||||
//我的上月余额
|
//我的上月余额
|
||||||
var prevFundBalance = f2($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
|
var prevFundBalance = $(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val();
|
||||||
if(!prevFundBalance){
|
if(!prevFundBalance){
|
||||||
//第一个月的话,上月余额就为0
|
//第一个月的话,上月余额就为0
|
||||||
prevFundBalance = 0;
|
prevFundBalance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var underwrittenPlan = calUnderwrittenPlan(income, cost, prevFundBalance);
|
var underwrittenPlan = calUnderwrittenPlan(income, cost, prevFundBalance);
|
||||||
|
|
||||||
total += underwrittenPlan;
|
total += underwrittenPlan;
|
||||||
|
|
||||||
$(this).val(f2(underwrittenPlan));
|
$(this).val(underwrittenPlan);
|
||||||
});
|
});
|
||||||
|
|
||||||
//总垫资计划=所有月累加
|
//总垫资计划=所有月累加
|
||||||
|
@ -390,15 +389,15 @@ function calUnderwrittenPlan(income, cost, prevFundBalance) {
|
||||||
//数据还不全的时候
|
//数据还不全的时候
|
||||||
underwrittenPlan = NaN;
|
underwrittenPlan = NaN;
|
||||||
}else {
|
}else {
|
||||||
|
;
|
||||||
if (income - cost >= 0) {
|
if (f2(income) - f2(cost) >= 0) {
|
||||||
underwrittenPlan = 0;
|
underwrittenPlan = 0;
|
||||||
} else {
|
} else {
|
||||||
if (prevFundBalance < 0) {
|
if (f2(prevFundBalance) < 0) {
|
||||||
underwrittenPlan = cost - income;
|
underwrittenPlan = f2(f2(cost) - f2(income));
|
||||||
} else {
|
} else {
|
||||||
if (prevFundBalance <= cost - income) {
|
if (f2(prevFundBalance) <= f2(cost) - f2(income)) {
|
||||||
underwrittenPlan = cost - income - prevFundBalance;
|
underwrittenPlan = f2(f2(cost) - f2(income) - f2(prevFundBalance));
|
||||||
} else {
|
} else {
|
||||||
underwrittenPlan = 0;
|
underwrittenPlan = 0;
|
||||||
}
|
}
|
||||||
|
@ -417,10 +416,10 @@ function updateEachRepaymentPlan() {
|
||||||
//找到每个月的回款计划输入框
|
//找到每个月的回款计划输入框
|
||||||
$(".input-changeable-repayment-plan-budget-plan").each(function (t) {
|
$(".input-changeable-repayment-plan-budget-plan").each(function (t) {
|
||||||
//找到当前月的收入和支出
|
//找到当前月的收入和支出
|
||||||
var income = f2($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
|
var income = $(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());
|
var cost = $(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val();
|
||||||
//我的上月余额
|
//我的上月余额
|
||||||
var prevFundBalance = f2($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
|
var prevFundBalance = $(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val();
|
||||||
if(!prevFundBalance){
|
if(!prevFundBalance){
|
||||||
//第一个月的话,上月余额就为0
|
//第一个月的话,上月余额就为0
|
||||||
prevFundBalance = 0;
|
prevFundBalance = 0;
|
||||||
|
@ -431,7 +430,7 @@ function updateEachRepaymentPlan() {
|
||||||
|
|
||||||
total += repaymentPlan;
|
total += repaymentPlan;
|
||||||
|
|
||||||
$(this).val(f2(repaymentPlan));
|
$(this).val(repaymentPlan);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -452,16 +451,16 @@ function calRepaymentPlan(income, cost, prevFundBalance) {
|
||||||
//数据还不全的时候
|
//数据还不全的时候
|
||||||
repaymentPlan = NaN;
|
repaymentPlan = NaN;
|
||||||
}else {
|
}else {
|
||||||
if(income - cost <= 0){
|
if (f2(income) - f2(cost) <= 0) {
|
||||||
repaymentPlan = 0;
|
repaymentPlan = 0;
|
||||||
} else {
|
} else {
|
||||||
if(prevFundBalance >= 0){
|
if (f2(prevFundBalance) >= 0) {
|
||||||
repaymentPlan = 0;
|
repaymentPlan = 0;
|
||||||
} else {
|
} else {
|
||||||
if(income - cost <= -prevFundBalance){
|
if (f2(-prevFundBalance) >= f2(income) - f2(cost)) {
|
||||||
repaymentPlan = income - cost;
|
repaymentPlan = f2(f2(income) - f2(cost));
|
||||||
} else {
|
} else {
|
||||||
repaymentPlan = -prevFundBalance;
|
repaymentPlan = f2(-prevFundBalance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue