diff --git a/src/main/resources/static/assets/js/project_common.js b/src/main/resources/static/assets/js/project_common.js index e6bb101..5af16c7 100644 --- a/src/main/resources/static/assets/js/project_common.js +++ b/src/main/resources/static/assets/js/project_common.js @@ -131,15 +131,9 @@ function calCostInclude() { var $costTotalTaxInclude = $("input[name='costTotalTaxInclude']"); - if(costPurchaseDeviceTaxInclude && costPurchaseBuildTaxInclude - && costPurchaseServiceTaxInclude && costPurchaseOtherTaxInclude - && costProjectManageTaxInclude && costOtherOtherTaxInclude){ - $costTotalTaxInclude.val(f2(costPurchaseDeviceTaxInclude) +f2(costPurchaseBuildTaxInclude) - +f2(costPurchaseServiceTaxInclude)+f2(costPurchaseOtherTaxInclude) - +f2(costProjectManageTaxInclude)+f2(costOtherOtherTaxInclude)); - }else { - $costTotalTaxInclude.val(""); - } + $costTotalTaxInclude.val(f2(costPurchaseDeviceTaxInclude) +f2(costPurchaseBuildTaxInclude) + +f2(costPurchaseServiceTaxInclude)+f2(costPurchaseOtherTaxInclude) + +f2(costProjectManageTaxInclude)+f2(costOtherOtherTaxInclude)); } /** * 统计成本(不含税),有一项没填就置空 @@ -155,13 +149,7 @@ function calCostExclude() { var $costTotalTaxExclude = $("input[name='costTotalTaxExclude']"); - if(costPurchaseDeviceTaxExclude && costPurchaseBuildTaxExclude - && costPurchaseServiceTaxExclude && costPurchaseOtherTaxExclude - && costProjectManageTaxExclude && costOtherOtherTaxExclude){ - $costTotalTaxExclude.val(f2(costPurchaseDeviceTaxExclude)+f2(costPurchaseBuildTaxExclude) - +f2(costPurchaseServiceTaxExclude)+f2(costPurchaseOtherTaxExclude) - +f2(costProjectManageTaxExclude)+f2(costOtherOtherTaxExclude)); - }else { - $costTotalTaxExclude.val(""); - } + $costTotalTaxExclude.val(f2(costPurchaseDeviceTaxExclude)+f2(costPurchaseBuildTaxExclude) + +f2(costPurchaseServiceTaxExclude)+f2(costPurchaseOtherTaxExclude) + +f2(costProjectManageTaxExclude)+f2(costOtherOtherTaxExclude)); } \ No newline at end of file diff --git a/src/main/resources/static/assets/js/project_estimate.js b/src/main/resources/static/assets/js/project_estimate.js index cbcbf93..ed0a1b1 100644 --- a/src/main/resources/static/assets/js/project_estimate.js +++ b/src/main/resources/static/assets/js/project_estimate.js @@ -102,11 +102,7 @@ function calIncomeInclude() { var $incomeTotalTaxInclude = $("input[name='incomeTotalTaxInclude']"); - if(incomeDeviceTaxInclude && incomeEngineerTaxInclude && incomeServiceTaxInclude){ - $incomeTotalTaxInclude.val(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude)); - }else { - $incomeTotalTaxInclude.val(""); - } + $incomeTotalTaxInclude.val(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude)); } /** * 统计收入(不含税),有一项没填就置空 @@ -118,11 +114,7 @@ function calIncomeExclude() { var $incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']"); - if(incomeDeviceTaxExclude && incomeEngineerTaxExclude && incomeServiceTaxExclude){ - $incomeTotalTaxExclude.val(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude)); - }else { - $incomeTotalTaxExclude.val(""); - } + $incomeTotalTaxExclude.val(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude)); } /** @@ -139,17 +131,18 @@ function calIncomeCost() { var $projectContributionProfit = $("input[name='projectContributionProfit']"); var $projectContributionProfitRate = $("input[name='projectContributionProfitRate']"); - if (incomeTotalTaxExclude && costTotalTaxExclude && costExpropriationTaxExclude) { + var incomeTotalTaxExcludeValue = f2(incomeTotalTaxExclude); + if (incomeTotalTaxExcludeValue != 0) { $projectGrossProfit.val(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude)); - $projectGrossProfitRate.val(f2($projectGrossProfit.val()) * 100 / f2(incomeTotalTaxExclude)); + $projectGrossProfitRate.val(f2(f2($projectGrossProfit.val()) * 100 / incomeTotalTaxExcludeValue)); } else { $projectGrossProfit.val(""); $projectGrossProfitRate.val(""); } - if ($projectGrossProfit.val() && costCompanyManageTaxExclude) { + if ($projectGrossProfit.val()) { $projectContributionProfit.val(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude)); - $projectContributionProfitRate.val(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude)) + $projectContributionProfitRate.val(f2(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude))) } else { $projectContributionProfit.val(""); $projectContributionProfitRate.val(""); diff --git a/src/main/resources/templates/admin/project_estimate_edit.ftl b/src/main/resources/templates/admin/project_estimate_edit.ftl index a3d575a..4a38aac 100644 --- a/src/main/resources/templates/admin/project_estimate_edit.ftl +++ b/src/main/resources/templates/admin/project_estimate_edit.ftl @@ -330,6 +330,7 @@ +