diff --git a/src/main/resources/static/assets/js/project_budget_cost.js b/src/main/resources/static/assets/js/project_budget_cost.js index 25ca5b2..fc8248a 100644 --- a/src/main/resources/static/assets/js/project_budget_cost.js +++ b/src/main/resources/static/assets/js/project_budget_cost.js @@ -72,20 +72,20 @@ function updateCostData(details) { details.forEach(function (t, number, ts) { if(t["type"] == "1"){ //设备类 - deviceTaxInclude += parseFloat(t["totalTaxInclude"]); - deviceTaxExclude += parseFloat(t["totalTaxExclude"]); + deviceTaxInclude += f2(t["totalTaxInclude"]); + deviceTaxExclude += f2(t["totalTaxExclude"]); }else if(t["type"] == "2"){ //施工类 - buildTaxInclude += parseFloat(t["totalTaxInclude"]); - buildTaxExclude += parseFloat(t["totalTaxExclude"]); + buildTaxInclude += f2(t["totalTaxInclude"]); + buildTaxExclude += f2(t["totalTaxExclude"]); }else if(t["type"] == "3"){ //服务类 - serviceTaxInclude += parseFloat(t["totalTaxInclude"]); - serviceTaxExclude += parseFloat(t["totalTaxExclude"]); + serviceTaxInclude += f2(t["totalTaxInclude"]); + serviceTaxExclude += f2(t["totalTaxExclude"]); }else if(t["type"] == "4"){ //其他类 - otherTaxInclude += parseFloat(t["totalTaxInclude"]); - otherTaxExclude += parseFloat(t["totalTaxExclude"]); + otherTaxInclude += f2(t["totalTaxInclude"]); + otherTaxExclude += f2(t["totalTaxExclude"]); } }); $("input[name='costPurchaseDeviceTaxInclude']").val(deviceTaxInclude); @@ -108,24 +108,24 @@ function updateCostData(details) { function bindOtherOtherChangeable() { $("input[name='costOtherOtherTaxInclude']").change(function () { - var costPurchaseDeviceTaxInclude = parseFloat($("input[name='costPurchaseDeviceTaxInclude']").val()); - var costPurchaseBuildTaxInclude = parseFloat($("input[name='costPurchaseBuildTaxInclude']").val()); - var costPurchaseServiceTaxInclude = parseFloat($("input[name='costPurchaseServiceTaxInclude']").val()); - var costPurchaseOtherTaxInclude = parseFloat($("input[name='costPurchaseOtherTaxInclude']").val()); + var costPurchaseDeviceTaxInclude = f2($("input[name='costPurchaseDeviceTaxInclude']").val()); + var costPurchaseBuildTaxInclude = f2($("input[name='costPurchaseBuildTaxInclude']").val()); + var costPurchaseServiceTaxInclude = f2($("input[name='costPurchaseServiceTaxInclude']").val()); + var costPurchaseOtherTaxInclude = f2($("input[name='costPurchaseOtherTaxInclude']").val()); - var costOtherOther = parseFloat($(this).val()); + var costOtherOther = f2($(this).val()); $("input[name='costTotalTaxInclude']").val(costPurchaseDeviceTaxInclude+costPurchaseBuildTaxInclude+costPurchaseServiceTaxInclude+costPurchaseOtherTaxInclude+costOtherOther); }); $("input[name='costOtherOtherTaxExclude']").change(function () { - var costPurchaseDeviceTaxExclude = parseFloat($("input[name='costPurchaseDeviceTaxExclude']").val()); - var costPurchaseBuildTaxExclude = parseFloat($("input[name='costPurchaseBuildTaxExclude']").val()); - var costPurchaseServiceTaxExclude = parseFloat($("input[name='costPurchaseServiceTaxExclude']").val()); - var costPurchaseOtherTaxExclude = parseFloat($("input[name='costPurchaseOtherTaxExclude']").val()); + var costPurchaseDeviceTaxExclude = f2($("input[name='costPurchaseDeviceTaxExclude']").val()); + var costPurchaseBuildTaxExclude = f2($("input[name='costPurchaseBuildTaxExclude']").val()); + var costPurchaseServiceTaxExclude = f2($("input[name='costPurchaseServiceTaxExclude']").val()); + var costPurchaseOtherTaxExclude = f2($("input[name='costPurchaseOtherTaxExclude']").val()); - var costProjectManageTaxExclude = parseFloat($("input[name='costProjectManageTaxExclude']").val()); - var costOtherOther = parseFloat($(this).val()); + var costProjectManageTaxExclude = f2($("input[name='costProjectManageTaxExclude']").val()); + var costOtherOther = f2($(this).val()); $("input[name='costTotalTaxExclude']").val(costPurchaseDeviceTaxExclude+costPurchaseBuildTaxExclude+costPurchaseServiceTaxExclude+costPurchaseOtherTaxExclude+costProjectManageTaxExclude+costOtherOther); }); diff --git a/src/main/resources/static/assets/js/project_budget_cost_project_manage.js b/src/main/resources/static/assets/js/project_budget_cost_project_manage.js index 42f5e18..efa2c7c 100644 --- a/src/main/resources/static/assets/js/project_budget_cost_project_manage.js +++ b/src/main/resources/static/assets/js/project_budget_cost_project_manage.js @@ -53,19 +53,17 @@ function appendTrCostProjectManage() { function bindChangeableInputProjectManage() { //数量改变 $(".input-changeable-amount-project-manage").change(function () { - var amount = parseFloat($(this).val()); + var amount = parseInt($(this).val()); //找到对应的单价 - var price = parseFloat($(this).parent().parent().find(".input-changeable-price-project-manage").val()); - console.log(amount,price); + 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); }); //单价改变 $(".input-changeable-price-project-manage").change(function () { - var price = parseFloat($(this).val()); + var price = f2($(this).val()); //找到对应的数量 - var amount = parseFloat($(this).parent().parent().find(".input-changeable-amount-project-manage").val()); - console.log(amount,price); + 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); }); @@ -76,17 +74,17 @@ function bindChangeableInputProjectManage() { function updateCostProjectManageData(details) { var total = 0; details.forEach(function (t, number, ts) { - total += parseFloat(t["total"]); + total += f2(t["total"]); }); $("input[name='costProjectManageTaxExclude']").val(total); - var costPurchaseDeviceTaxExclude = parseFloat($("input[name='costPurchaseDeviceTaxExclude']").val()); - var costPurchaseBuildTaxExclude = parseFloat($("input[name='costPurchaseBuildTaxExclude']").val()); - var costPurchaseServiceTaxExclude = parseFloat($("input[name='costPurchaseServiceTaxExclude']").val()); - var costPurchaseOtherTaxExclude = parseFloat($("input[name='costPurchaseOtherTaxExclude']").val()); + var costPurchaseDeviceTaxExclude = f2($("input[name='costPurchaseDeviceTaxExclude']").val()); + var costPurchaseBuildTaxExclude = f2($("input[name='costPurchaseBuildTaxExclude']").val()); + var costPurchaseServiceTaxExclude = f2($("input[name='costPurchaseServiceTaxExclude']").val()); + var costPurchaseOtherTaxExclude = f2($("input[name='costPurchaseOtherTaxExclude']").val()); - var costOtherOtherTaxExclude = parseFloat($("input[name='costOtherOtherTaxExclude']").val()); + var costOtherOtherTaxExclude = f2($("input[name='costOtherOtherTaxExclude']").val()); $("input[name='costTotalTaxExclude']").val(costPurchaseDeviceTaxExclude+costPurchaseBuildTaxExclude+costPurchaseServiceTaxExclude+costPurchaseOtherTaxExclude+total+costOtherOtherTaxExclude); } \ No newline at end of file