function calIncomeAndCost() { $("input[name='incomeDeviceTaxInclude']").change(function () { calIncomeInclude(); calIncomeCost(); }); $("input[name='incomeEngineerTaxInclude']").change(function () { calIncomeInclude(); calIncomeCost(); }); $("input[name='incomeServiceTaxInclude']").change(function () { calIncomeInclude(); calIncomeCost(); }); $("input[name='incomeDeviceTaxExclude']").change(function () { calIncomeExclude(); calIncomeCost(); }); $("input[name='incomeEngineerTaxExclude']").change(function () { calIncomeExclude(); calIncomeCost(); }); $("input[name='incomeServiceTaxExclude']").change(function () { calIncomeExclude(); calIncomeCost(); }); $("input[name='costPurchaseDeviceTaxInclude']").change(function () { calCostInclude(); calIncomeCost(); }); $("input[name='costPurchaseBuildTaxInclude']").change(function () { calCostInclude(); calIncomeCost(); }); $("input[name='costPurchaseServiceTaxInclude']").change(function () { calCostInclude(); calIncomeCost(); }); $("input[name='costPurchaseOtherTaxInclude']").change(function () { calCostInclude(); calIncomeCost(); }); /*$("input[name='costProjectManageTaxInclude']").change(function () { calCostInclude(); calIncomeCost(); });*/ $("input[name='costOtherOtherTaxInclude']").change(function () { calCostInclude(); calIncomeCost(); }); $("input[name='costPurchaseDeviceTaxExclude']").change(function () { calCostExclude(); calIncomeCost(); }); $("input[name='costPurchaseBuildTaxExclude']").change(function () { calCostExclude(); calIncomeCost(); }); $("input[name='costPurchaseServiceTaxExclude']").change(function () { calCostExclude(); calIncomeCost(); }); $("input[name='costPurchaseOtherTaxExclude']").change(function () { calCostExclude(); calIncomeCost(); }); $("input[name='costProjectManageTaxExclude']").change(function () { calCostExclude(); //不含税的=含税的 //含税的总额更新 $("input[name='costProjectManageTaxInclude']").val($("input[name='costProjectManageTaxExclude']").val()); calCostInclude(); calIncomeCost(); }); $("input[name='costOtherOtherTaxExclude']").change(function () { calCostExclude(); calIncomeCost(); }); $("input[name='costExpropriationTaxExclude']").change(function () { calIncomeCost(); }); $("input[name='costCompanyManageTaxExclude']").change(function () { calIncomeCost(); }); } /** * 统计收入(含税),有一项没填就置空 */ function calIncomeInclude() { var incomeDeviceTaxInclude = inputVal("incomeDeviceTaxInclude"); var incomeEngineerTaxInclude = inputVal("incomeEngineerTaxInclude"); var incomeServiceTaxInclude = inputVal("incomeServiceTaxInclude"); var $incomeTotalTaxInclude = $("input[name='incomeTotalTaxInclude']"); if(incomeDeviceTaxInclude && incomeEngineerTaxInclude && incomeServiceTaxInclude){ $incomeTotalTaxInclude.val(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude)); }else { $incomeTotalTaxInclude.val(""); } } /** * 统计收入(不含税),有一项没填就置空 */ function calIncomeExclude() { var incomeDeviceTaxExclude = inputVal("incomeDeviceTaxExclude"); var incomeEngineerTaxExclude = inputVal("incomeEngineerTaxExclude"); var incomeServiceTaxExclude = inputVal("incomeServiceTaxExclude"); var $incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']"); if(incomeDeviceTaxExclude && incomeEngineerTaxExclude && incomeServiceTaxExclude){ $incomeTotalTaxExclude.val(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude)); }else { $incomeTotalTaxExclude.val(""); } } /** * 计算毛利、毛利率、贡献、贡献率 */ function calIncomeCost() { var incomeTotalTaxExclude = inputVal("incomeTotalTaxExclude"); var costTotalTaxExclude = inputVal("costTotalTaxExclude"); var costExpropriationTaxExclude = inputVal("costExpropriationTaxExclude"); var costCompanyManageTaxExclude = inputVal("costCompanyManageTaxExclude"); var $projectGrossProfit = $("input[name='projectGrossProfit']"); var $projectGrossProfitRate = $("input[name='projectGrossProfitRate']"); var $projectContributionProfit = $("input[name='projectContributionProfit']"); var $projectContributionProfitRate = $("input[name='projectContributionProfitRate']"); if (incomeTotalTaxExclude && costTotalTaxExclude && costExpropriationTaxExclude) { $projectGrossProfit.val(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude)); $projectGrossProfitRate.val(f2($projectGrossProfit.val()) * 100 / f2(incomeTotalTaxExclude)); } else { $projectGrossProfit.val(""); $projectGrossProfitRate.val(""); } if ($projectGrossProfit.val() && costCompanyManageTaxExclude) { $projectContributionProfit.val(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude)); $projectContributionProfitRate.val(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude)) } else { $projectContributionProfit.val(""); $projectContributionProfitRate.val(""); } }