资金计划计算保留两位小数

master
xxssyyyyssxx 2021-11-05 17:15:31 +08:00
parent 8be9937813
commit 41ae92208f
1 changed files with 32 additions and 38 deletions

View File

@ -84,12 +84,11 @@ function bindBudgetPlanDeleteBtn() {
function bindChangeableInputBudgetPlanDetail() {
//设备支出改变
$(".input-changeable-device-cost-budget-plan").change(function () {
var deviceCost = parseFloat($(this).val());
var deviceCost = f2($(this).val());
//找到对应的工程支出、经营性支出、保证金支出
var engineerCost = parseFloat($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
var projectManageCost = parseFloat($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
var earnestMoneyCost = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
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());
//更新本月所有项支出
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
@ -110,12 +109,11 @@ function bindChangeableInputBudgetPlanDetail() {
});
//工程支出改变
$(".input-changeable-engineer-cost-budget-plan").change(function () {
var engineerCost = parseFloat($(this).val());
var engineerCost = f2($(this).val());
//找到对应的设备支出、经营性支出、保证金支出
var deviceCost = parseFloat($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
var projectManageCost = parseFloat($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
var earnestMoneyCost = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
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());
//更新本月所有项支出
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
@ -136,12 +134,11 @@ function bindChangeableInputBudgetPlanDetail() {
});
//经营性支出改变
$(".input-changeable-project-manage-cost-budget-plan").change(function () {
var projectManageCost = parseFloat($(this).val());
var projectManageCost = f2($(this).val());
//找到对应的设备支出、工程支出、保证金支出
var deviceCost = parseFloat($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
var engineerCost = parseFloat($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
var earnestMoneyCost = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
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());
//更新本月所有项支出
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
@ -162,12 +159,11 @@ function bindChangeableInputBudgetPlanDetail() {
});
//保证金改变
$(".input-changeable-earnest-money-cost-budget-plan").change(function () {
var earnestMoneyCost = parseFloat($(this).val());
var earnestMoneyCost = f2($(this).val());
//找到对应的设备支出、经营性支出、保证金支出
var deviceCost = parseFloat($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
var engineerCost = parseFloat($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
var projectManageCost = parseFloat($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
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());
//更新本月所有项支出
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
@ -189,10 +185,9 @@ function bindChangeableInputBudgetPlanDetail() {
//销售收款改变
$(".input-changeable-sale-income-budget-plan").change(function () {
var saleIncome = parseFloat($(this).val());
var saleIncome = f2($(this).val());
//找到保证金收款
var earnestMoneyIncome = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-income-budget-plan").val());
console.log(saleIncome, earnestMoneyIncome);
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);
@ -213,10 +208,9 @@ function bindChangeableInputBudgetPlanDetail() {
});
//保证金收款改变
$(".input-changeable-earnest-money-income-budget-plan").change(function () {
var earnestMoneyIncome = parseFloat($(this).val());
var earnestMoneyIncome = f2($(this).val());
//找到保证金收款
var saleIncome = parseFloat($(this).parent().parent().find(".input-changeable-sale-income-budget-plan").val());
console.log(saleIncome, earnestMoneyIncome);
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);
@ -262,7 +256,7 @@ function updateBudgetPlanTotal(className, totalClassName) {
var total = 0;
//找到本列所有的
$("."+className).each(function (t) {
total += parseFloat($(this).val());
total += f2($(this).val());
});
$("."+totalClassName).val(total);
@ -277,8 +271,8 @@ function updateEachFundBalance() {
//找到每个月的资金余额输入框
$(".input-changeable-fund-balance-budget-plan").each(function (t) {
//找到当前月的收入和支出
var income = parseFloat($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
var cost = parseFloat($(this).parent().parent().find(".input-changeable-total-cost-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 prevFundBalance = parseFloat($(this).parent().parent().prev("tr").find(".input-changeable-fund-balance-budget-plan").val());
if(!prevFundBalance){
@ -302,10 +296,10 @@ function updateEachUnderwrittenPlan() {
//找到每个月的垫资计划输入框
$(".input-changeable-underwritten-plan-budget-plan").each(function (t) {
//找到当前月的收入和支出
var income = parseFloat($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
var cost = parseFloat($(this).parent().parent().find(".input-changeable-total-cost-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 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){
//第一个月的话上月余额就为0
prevFundBalance = 0;
@ -364,10 +358,10 @@ function updateEachRepaymentPlan() {
//找到每个月的回款计划输入框
$(".input-changeable-repayment-plan-budget-plan").each(function (t) {
//找到当前月的收入和支出
var income = parseFloat($(this).parent().parent().find(".input-changeable-total-income-budget-plan").val());
var cost = parseFloat($(this).parent().parent().find(".input-changeable-total-cost-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 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){
//第一个月的话上月余额就为0
prevFundBalance = 0;
@ -421,12 +415,12 @@ function calRepaymentPlan(income, cost, prevFundBalance) {
* 更新每一行即每个月的资金利息
*/
function updateEachCapitalInterest() {
var underwrittenPlanTaxRate = parseFloat($(".input-underwritten-plan-statistic-tax-rate-budget-plan").val());
var underwrittenPlanTaxRate = f2($(".input-underwritten-plan-statistic-tax-rate-budget-plan").val());
var total = 0;
//找到每个月的资金利息输入框
$(".input-changeable-capital-interest-budget-plan").each(function (t) {
//找到当前月的垫资计划
var underwrittenPlan = parseFloat($(this).parent().parent().find(".input-changeable-underwritten-plan-budget-plan").val());
var underwrittenPlan = f2($(this).parent().parent().find(".input-changeable-underwritten-plan-budget-plan").val());
var capitalInterest = underwrittenPlan*underwrittenPlanTaxRate/100/12;
total += capitalInterest;
@ -455,7 +449,7 @@ function updateUnderwrittenInfo() {
//找到每个月的垫资计划输入框
$(".input-changeable-underwritten-plan-budget-plan").each(function (t) {
//找到当前月垫资计划
var underwrittenPlan = parseFloat($(this).val());
var underwrittenPlan = f2($(this).val());
//当月比最大的还大,就取当月的
if(underwrittenPlan > max){
month = $(this).parent().parent().find(".input-changeable-month-budget-plan").val();