fourcal/src/main/resources/static/assets/js/project_estimate.js

150 lines
5.2 KiB
JavaScript
Raw Normal View History

2021-11-02 04:20:20 +00:00
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 () {
2021-11-02 04:20:20 +00:00
calCostInclude();
calIncomeCost();
});*/
2021-11-02 04:20:20 +00:00
$("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();
2021-11-02 04:20:20 +00:00
calIncomeCost();
});
$("input[name='costOtherOtherTaxExclude']").change(function () {
calCostExclude();
calIncomeCost();
});
$("input[name='costExpropriationTaxExclude']").change(function () {
calIncomeCost();
});
$("input[name='costCompanyManageTaxExclude']").change(function () {
calIncomeCost();
});
}
/**
* 统计收入(含税)有一项没填就置空
*/
function calIncomeInclude() {
2021-11-17 09:28:55 +00:00
var incomeDeviceTaxInclude = inputVal("incomeDeviceTaxInclude");
var incomeEngineerTaxInclude = inputVal("incomeEngineerTaxInclude");
var incomeServiceTaxInclude = inputVal("incomeServiceTaxInclude");
2021-11-02 04:20:20 +00:00
2021-11-17 09:28:55 +00:00
var $incomeTotalTaxInclude = $("input[name='incomeTotalTaxInclude']");
2021-11-02 04:20:20 +00:00
2021-12-01 03:24:34 +00:00
$incomeTotalTaxInclude.val(f2(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude)));
2021-11-02 04:20:20 +00:00
}
/**
* 统计收入(不含税)有一项没填就置空
*/
function calIncomeExclude() {
2021-11-17 09:28:55 +00:00
var incomeDeviceTaxExclude = inputVal("incomeDeviceTaxExclude");
var incomeEngineerTaxExclude = inputVal("incomeEngineerTaxExclude");
var incomeServiceTaxExclude = inputVal("incomeServiceTaxExclude");
2021-11-02 04:20:20 +00:00
2021-11-17 09:28:55 +00:00
var $incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']");
2021-11-02 04:20:20 +00:00
2021-12-01 03:24:34 +00:00
$incomeTotalTaxExclude.val(f2(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude)));
2021-11-02 04:20:20 +00:00
}
/**
* 计算毛利毛利率贡献贡献率
*/
function calIncomeCost() {
2021-11-17 09:28:55 +00:00
var incomeTotalTaxExclude = inputVal("incomeTotalTaxExclude");
var costTotalTaxExclude = inputVal("costTotalTaxExclude");
var costExpropriationTaxExclude = inputVal("costExpropriationTaxExclude");
var costCompanyManageTaxExclude = inputVal("costCompanyManageTaxExclude");
2021-11-02 04:20:20 +00:00
2021-11-17 09:28:55 +00:00
var $projectGrossProfit = $("input[name='projectGrossProfit']");
var $projectGrossProfitRate = $("input[name='projectGrossProfitRate']");
var $projectContributionProfit = $("input[name='projectContributionProfit']");
var $projectContributionProfitRate = $("input[name='projectContributionProfitRate']");
2021-11-02 04:20:20 +00:00
2021-11-22 02:32:36 +00:00
var incomeTotalTaxExcludeValue = f2(incomeTotalTaxExclude);
if (incomeTotalTaxExcludeValue != 0) {
2021-12-01 03:24:34 +00:00
$projectGrossProfit.val(f2(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude)));
2021-11-22 02:36:35 +00:00
$projectGrossProfitRate.val(f2(f2($projectGrossProfit.val()) * 100 / incomeTotalTaxExcludeValue));
2021-11-02 04:20:20 +00:00
} else {
2021-11-17 09:28:55 +00:00
$projectGrossProfit.val("");
$projectGrossProfitRate.val("");
2021-11-02 04:20:20 +00:00
}
2021-11-22 02:32:36 +00:00
if ($projectGrossProfit.val()) {
2021-12-01 03:24:34 +00:00
$projectContributionProfit.val(f2(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude)));
2021-11-22 02:36:35 +00:00
$projectContributionProfitRate.val(f2(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude)))
2021-11-02 04:20:20 +00:00
} else {
2021-11-17 09:28:55 +00:00
$projectContributionProfit.val("");
$projectContributionProfitRate.val("");
2021-11-02 04:20:20 +00:00
}
}