资金计划详表计算保留2位小数
parent
41ae92208f
commit
d8da86d5bf
|
@ -57,7 +57,7 @@ function bindChangeableInputProjectManage() {
|
||||||
//找到对应的单价
|
//找到对应的单价
|
||||||
var price = f2($(this).parent().parent().find(".input-changeable-price-project-manage").val());
|
var price = f2($(this).parent().parent().find(".input-changeable-price-project-manage").val());
|
||||||
|
|
||||||
$(this).parent().parent().find(".input-changeable-total-project-manage").val(amount*price);
|
$(this).parent().parent().find(".input-changeable-total-project-manage").val(f2(amount*price));
|
||||||
});
|
});
|
||||||
//单价改变
|
//单价改变
|
||||||
$(".input-changeable-price-project-manage").change(function () {
|
$(".input-changeable-price-project-manage").change(function () {
|
||||||
|
@ -65,7 +65,7 @@ function bindChangeableInputProjectManage() {
|
||||||
//找到对应的数量
|
//找到对应的数量
|
||||||
var amount = parseInt($(this).parent().parent().find(".input-changeable-amount-project-manage").val());
|
var amount = parseInt($(this).parent().parent().find(".input-changeable-amount-project-manage").val());
|
||||||
|
|
||||||
$(this).parent().parent().find(".input-changeable-total-project-manage").val(amount*price);
|
$(this).parent().parent().find(".input-changeable-total-project-manage").val(f2(amount*price));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* 一个资金计划的字段
|
* 一个资金计划的字段
|
||||||
*/
|
*/
|
||||||
BUDGET_PLAN_DETAIL_ARR=["month","deviceCost","engineerCost","project_manageCost","earnestMoneyCost","totalCost","saleIncome","earnestMoneyIncome","totalIncome","fundBalance","capitalInterest","underwrittenPlan","repaymentPlan"];
|
BUDGET_PLAN_DETAIL_ARR=["month","deviceCost","engineerCost","projectManageCost","earnestMoneyCost","totalCost","saleIncome","earnestMoneyIncome","totalIncome","fundBalance","capitalInterest","underwrittenPlan","repaymentPlan"];
|
||||||
$(function () {
|
$(function () {
|
||||||
$(".budget-plan-detail").click(function () {
|
$(".budget-plan-detail").click(function () {
|
||||||
$('#my-prompt-budget-plan-detail').modal({
|
$('#my-prompt-budget-plan-detail').modal({
|
||||||
|
@ -166,7 +166,7 @@ function bindChangeableInputBudgetPlanDetail() {
|
||||||
var projectManageCost = f2($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
|
var projectManageCost = f2($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
|
||||||
|
|
||||||
//更新本月所有项支出
|
//更新本月所有项支出
|
||||||
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
|
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(f2(deviceCost+engineerCost+projectManageCost+earnestMoneyCost));
|
||||||
//更新所有月保证金支出总额
|
//更新所有月保证金支出总额
|
||||||
updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-earnest-money-cost-budget-plan");
|
updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-earnest-money-cost-budget-plan");
|
||||||
//更新所有月支出总额
|
//更新所有月支出总额
|
||||||
|
@ -190,7 +190,7 @@ function bindChangeableInputBudgetPlanDetail() {
|
||||||
var earnestMoneyIncome = f2($(this).parent().parent().find(".input-changeable-earnest-money-income-budget-plan").val());
|
var earnestMoneyIncome = f2($(this).parent().parent().find(".input-changeable-earnest-money-income-budget-plan").val());
|
||||||
|
|
||||||
//更新本月所有项收入
|
//更新本月所有项收入
|
||||||
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(saleIncome+earnestMoneyIncome);
|
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(f2(saleIncome+earnestMoneyIncome));
|
||||||
//更新所有月销售收款总额
|
//更新所有月销售收款总额
|
||||||
updateBudgetPlanTotal("input-changeable-sale-income-budget-plan","input-total-sale-income-budget-plan");
|
updateBudgetPlanTotal("input-changeable-sale-income-budget-plan","input-total-sale-income-budget-plan");
|
||||||
//更新所有月收入总额
|
//更新所有月收入总额
|
||||||
|
@ -213,7 +213,7 @@ function bindChangeableInputBudgetPlanDetail() {
|
||||||
var saleIncome = f2($(this).parent().parent().find(".input-changeable-sale-income-budget-plan").val());
|
var saleIncome = f2($(this).parent().parent().find(".input-changeable-sale-income-budget-plan").val());
|
||||||
|
|
||||||
//更新本月所有项收入
|
//更新本月所有项收入
|
||||||
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(saleIncome+earnestMoneyIncome);
|
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(f2(saleIncome+earnestMoneyIncome));
|
||||||
//更新所有月保证金收款总额
|
//更新所有月保证金收款总额
|
||||||
updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-earnest-money-income-budget-plan");
|
updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-earnest-money-income-budget-plan");
|
||||||
//更新所有月收入总额
|
//更新所有月收入总额
|
||||||
|
@ -259,7 +259,7 @@ function updateBudgetPlanTotal(className, totalClassName) {
|
||||||
total += f2($(this).val());
|
total += f2($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
$("."+totalClassName).val(total);
|
$("."+totalClassName).val(f2(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,17 +274,17 @@ function updateEachFundBalance() {
|
||||||
var income = f2($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
|
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 cost = f2($(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val());
|
||||||
//我的上月余额
|
//我的上月余额
|
||||||
var prevFundBalance = parseFloat($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
|
var prevFundBalance = f2($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
|
||||||
if(!prevFundBalance){
|
if(!prevFundBalance){
|
||||||
//第一个月的话,上月余额就为0
|
//第一个月的话,上月余额就为0
|
||||||
prevFundBalance = 0;
|
prevFundBalance = 0;
|
||||||
}
|
}
|
||||||
fundBalance = income - cost + prevFundBalance;
|
fundBalance = income - cost + prevFundBalance;
|
||||||
$(this).val(fundBalance);
|
$(this).val(f2(fundBalance));
|
||||||
});
|
});
|
||||||
|
|
||||||
//总余额=最后一个月的余额
|
//总余额=最后一个月的余额
|
||||||
$(".input-total-fund-balance-budget-plan").val(fundBalance);
|
$(".input-total-fund-balance-budget-plan").val(f2(fundBalance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,13 +309,13 @@ function updateEachUnderwrittenPlan() {
|
||||||
|
|
||||||
total += underwrittenPlan;
|
total += underwrittenPlan;
|
||||||
|
|
||||||
$(this).val(underwrittenPlan);
|
$(this).val(f2(underwrittenPlan));
|
||||||
});
|
});
|
||||||
|
|
||||||
//总垫资计划=所有月累加
|
//总垫资计划=所有月累加
|
||||||
$(".input-total-underwritten-plan-budget-plan").val(total);
|
$(".input-total-underwritten-plan-budget-plan").val(f2(total));
|
||||||
//下放小表的垫资峰值金额
|
//下放小表的垫资峰值金额
|
||||||
$(".input-underwritten-plan-statistic-amount-budget-plan").val(total);
|
$(".input-underwritten-plan-statistic-amount-budget-plan").val(f2(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -372,12 +372,12 @@ function updateEachRepaymentPlan() {
|
||||||
|
|
||||||
total += repaymentPlan;
|
total += repaymentPlan;
|
||||||
|
|
||||||
$(this).val(repaymentPlan);
|
$(this).val(f2(repaymentPlan));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//总回款计划=所有月累加
|
//总回款计划=所有月累加
|
||||||
$(".input-total-repayment-plan-budget-plan").val(total);
|
$(".input-total-repayment-plan-budget-plan").val(f2(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -424,16 +424,16 @@ function updateEachCapitalInterest() {
|
||||||
var capitalInterest = underwrittenPlan*underwrittenPlanTaxRate/100/12;
|
var capitalInterest = underwrittenPlan*underwrittenPlanTaxRate/100/12;
|
||||||
total += capitalInterest;
|
total += capitalInterest;
|
||||||
|
|
||||||
$(this).val(capitalInterest);
|
$(this).val(f2(capitalInterest));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//总资金利息=所有月累加
|
//总资金利息=所有月累加
|
||||||
$(".input-total-capital-interest-budget-plan").val(total);
|
$(".input-total-capital-interest-budget-plan").val(f2(total));
|
||||||
//下方小表的资金利息
|
//下方小表的资金利息
|
||||||
$(".input-underwritten-plan-statistic-capital-interest-budget-plan").val(total);
|
$(".input-underwritten-plan-statistic-capital-interest-budget-plan").val(f2(total));
|
||||||
//主页面上的财务费用
|
//主页面上的财务费用
|
||||||
$("input[name='costExpropriationTaxExclude']").val(total);
|
$("input[name='costExpropriationTaxExclude']").val(f2(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
/**
|
/**
|
||||||
* parse float保留两位小数,四舍五入
|
* parse float保留两位小数,四舍五入
|
||||||
|
* 空格或者非数字认为是0
|
||||||
* @param x
|
* @param x
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
function f2(x) {
|
function f2(x) {
|
||||||
if(!x){
|
if(!x){
|
||||||
return NaN;
|
return 0;
|
||||||
}
|
}
|
||||||
var f = parseFloat(x);
|
var f = parseFloat(x);
|
||||||
if (isNaN(f)) {
|
if (isNaN(f)) {
|
||||||
return x;
|
return 0;
|
||||||
}
|
}
|
||||||
return Math.round(x*100)/100;
|
return Math.round(x*100)/100;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue