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