方法提取

master
xxssyyyyssxx 2021-11-17 17:28:55 +08:00
parent 653b8bc20a
commit 4829a2f820
4 changed files with 83 additions and 67 deletions

View File

@ -157,7 +157,7 @@ function bindChangeableInput() {
* 低于阀值就返回提示信息否则返回"" * 低于阀值就返回提示信息否则返回""
*/ */
function verifyProjectContributionProfitRate() { function verifyProjectContributionProfitRate() {
var projectContributionProfitRate = f2($("input[name='projectContributionProfitRate']").val()); var projectContributionProfitRate = f2(inputVal("projectContributionProfitRate"));
var projectContributionProfitRateThreshold = f2($("#projectContributionProfitRateThreshold").val()); var projectContributionProfitRateThreshold = f2($("#projectContributionProfitRateThreshold").val());
if(projectContributionProfitRate<projectContributionProfitRateThreshold){ if(projectContributionProfitRate<projectContributionProfitRateThreshold){
return "项目贡献利润率["+projectContributionProfitRate+"]低于阀值["+projectContributionProfitRateThreshold+"],请调整后重新提交"; return "项目贡献利润率["+projectContributionProfitRate+"]低于阀值["+projectContributionProfitRateThreshold+"],请调整后重新提交";
@ -175,13 +175,13 @@ function verifyProjectContributionProfitRate() {
*/ */
function updateProjectContributionProfitRate() { function updateProjectContributionProfitRate() {
//收入总计不含税 //收入总计不含税
var incomeTotalTaxExclude = f2($("input[name='incomeTotalTaxExclude']").val()); var incomeTotalTaxExclude = f2(inputVal("incomeTotalTaxExclude"));
//成本总计不含税 //成本总计不含税
var costTotalTaxExclude = f2($("input[name='costTotalTaxExclude']").val()); var costTotalTaxExclude = f2(inputVal("costTotalTaxExclude"));
//资金使用成本不含税 //资金使用成本不含税
var costExpropriationTaxExclude = f2($("input[name='costExpropriationTaxExclude']").val()); var costExpropriationTaxExclude = f2(inputVal("costExpropriationTaxExclude"));
//公司管理费用 //公司管理费用
var costCompanyManageTaxExclude = f2($("input[name='costCompanyManageTaxExclude']").val()); var costCompanyManageTaxExclude = f2(inputVal("costCompanyManageTaxExclude"));
var projectGrossProfit = f2(incomeTotalTaxExclude-costTotalTaxExclude-costExpropriationTaxExclude); var projectGrossProfit = f2(incomeTotalTaxExclude-costTotalTaxExclude-costExpropriationTaxExclude);
var projectGrossProfitRate = rate(projectGrossProfit, incomeTotalTaxExclude); var projectGrossProfitRate = rate(projectGrossProfit, incomeTotalTaxExclude);

View File

@ -43,18 +43,18 @@ $(function () {
*/ */
function verifyBudgetPlan(){ function verifyBudgetPlan(){
var costPurchaseDeviceTaxExclude = $("input[name='costPurchaseDeviceTaxExclude']").val(); var costPurchaseDeviceTaxExclude = inputVal("costPurchaseDeviceTaxExclude");
var costPurchaseBuildTaxExclude = $("input[name='costPurchaseBuildTaxExclude']").val(); var costPurchaseBuildTaxExclude = inputVal("costPurchaseBuildTaxExclude");
var costPurchaseServiceTaxExclude = $("input[name='costPurchaseServiceTaxExclude']").val(); var costPurchaseServiceTaxExclude = inputVal("costPurchaseServiceTaxExclude");
var costPurchaseOtherTaxExclude = $("input[name='costPurchaseOtherTaxExclude']").val(); var costPurchaseOtherTaxExclude = inputVal("costPurchaseOtherTaxExclude");
var costProjectManageTaxExclude = $("input[name='costProjectManageTaxExclude']").val(); var costProjectManageTaxExclude = inputVal("costProjectManageTaxExclude");
var incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']").val(); var incomeTotalTaxExclude = inputVal("incomeTotalTaxExclude");
var input_total_device_cost_budget_plan = $(".input-total-device-cost-budget-plan").val(); var input_total_device_cost_budget_plan = classVal("input-total-device-cost-budget-plan");
var input_total_engineer_cost_budget_plan = $(".input-total-engineer-cost-budget-plan").val(); var input_total_engineer_cost_budget_plan = classVal("input-total-engineer-cost-budget-plan");
var input_total_project_manage_budget_plan = $(".input-total-project-manage-cost-budget-plan").val(); var input_total_project_manage_budget_plan = classVal("input-total-project-manage-cost-budget-plan");
var input_total_sale_income_budget_plan = $(".input-total-sale-income-budget-plan").val(); var input_total_sale_income_budget_plan = classVal("input-total-sale-income-budget-plan");
var input_total_earnest_money_cost_budget_plan = $(".input-total-earnest-money-cost-budget-plan").val(); var input_total_earnest_money_cost_budget_plan = classVal("input-total-earnest-money-cost-budget-plan");
var input_total_earnest_money_income_budget_plan = $(".input-total-earnest-money-income-budget-plan").val(); var input_total_earnest_money_income_budget_plan = classVal("input-total-earnest-money-income-budget-plan");
//从采购成本明细中取“设备”大类下的总计---设备支出 //从采购成本明细中取“设备”大类下的总计---设备支出
@ -596,17 +596,17 @@ function bindCompanyManageChangeable() {
*/ */
function updateCashFlow() { function updateCashFlow() {
var saleIncome = $(".input-total-sale-income-budget-plan").val(); var saleIncome = classVal("input-total-sale-income-budget-plan");
var earnestMoneyIncome = $(".input-total-earnest-money-income-budget-plan").val(); var earnestMoneyIncome = classVal("input-total-earnest-money-income-budget-plan");
var deviceCost = $(".input-total-device-cost-budget-plan").val(); var deviceCost = classVal("input-total-device-cost-budget-plan");
var engineerCost = $(".input-total-engineer-cost-budget-plan").val(); var engineerCost = classVal("input-total-engineer-cost-budget-plan");
var projectManageCost = $(".input-total-project-manage-cost-budget-plan").val(); var projectManageCost = classVal("input-total-project-manage-cost-budget-plan");
var earnestMoneyCost = $(".input-total-earnest-money-cost-budget-plan").val(); var earnestMoneyCost = classVal("input-total-earnest-money-cost-budget-plan");
var capitalInterest = $(".input-total-capital-interest-budget-plan").val(); var capitalInterest = classVal("input-total-capital-interest-budget-plan");
var underwrittenPlan = $(".input-total-underwritten-plan-budget-plan").val(); var underwrittenPlan = classVal("input-total-underwritten-plan-budget-plan");
var repaymentPlan = $(".input-total-repayment-plan-budget-plan").val(); var repaymentPlan = classVal("input-total-repayment-plan-budget-plan");
var d = f2(f2(deviceCost)+f2(engineerCost)); var d = f2(f2(deviceCost)+f2(engineerCost));
var f = f2(f2(projectManageCost)+f2(earnestMoneyCost)+f2(capitalInterest)); var f = f2(f2(projectManageCost)+f2(earnestMoneyCost)+f2(capitalInterest));

View File

@ -45,18 +45,34 @@ function postAjax(url, data, callback) {
}); });
} }
/**
* 获取给定名字的input框的值
* @param name
* @returns {*|jQuery}
*/
function inputVal(name) {
return $("input[name='"+name+"']").val();
}
/**
* 获取给定class名字的input框的值
* @param className
* @returns {*|jQuery}
*/
function classVal(className) {
return $("."+className).val();
}
/** /**
* 统计成本(含税)有一项没填就置空 * 统计成本(含税)有一项没填就置空
*/ */
function calCostInclude() { function calCostInclude() {
var costPurchaseDeviceTaxInclude = $("input[name='costPurchaseDeviceTaxInclude']").val(); var costPurchaseDeviceTaxInclude = inputVal("costPurchaseDeviceTaxInclude");
var costPurchaseBuildTaxInclude = $("input[name='costPurchaseBuildTaxInclude']").val(); var costPurchaseBuildTaxInclude = inputVal("costPurchaseBuildTaxInclude");
var costPurchaseServiceTaxInclude = $("input[name='costPurchaseServiceTaxInclude']").val(); var costPurchaseServiceTaxInclude = inputVal("costPurchaseServiceTaxInclude");
var costPurchaseOtherTaxInclude = $("input[name='costPurchaseOtherTaxInclude']").val(); var costPurchaseOtherTaxInclude = inputVal("costPurchaseOtherTaxInclude");
var costProjectManageTaxInclude = $("input[name='costProjectManageTaxInclude']").val(); var costProjectManageTaxInclude = inputVal("costProjectManageTaxInclude");
var costOtherOtherTaxInclude = $("input[name='costOtherOtherTaxInclude']").val(); var costOtherOtherTaxInclude = inputVal("costOtherOtherTaxInclude");
var $costTotalTaxInclude = $("input[name='costTotalTaxInclude']"); var $costTotalTaxInclude = $("input[name='costTotalTaxInclude']");
@ -75,12 +91,12 @@ function calCostInclude() {
* 统计成本(不含税)有一项没填就置空 * 统计成本(不含税)有一项没填就置空
*/ */
function calCostExclude() { function calCostExclude() {
var costPurchaseDeviceTaxExclude = $("input[name='costPurchaseDeviceTaxExclude']").val(); var costPurchaseDeviceTaxExclude = inputVal("costPurchaseDeviceTaxExclude");
var costPurchaseBuildTaxExclude = $("input[name='costPurchaseBuildTaxExclude']").val(); var costPurchaseBuildTaxExclude = inputVal("costPurchaseBuildTaxExclude");
var costPurchaseServiceTaxExclude = $("input[name='costPurchaseServiceTaxExclude']").val(); var costPurchaseServiceTaxExclude = inputVal("costPurchaseServiceTaxExclude");
var costPurchaseOtherTaxExclude = $("input[name='costPurchaseOtherTaxExclude']").val(); var costPurchaseOtherTaxExclude = inputVal("costPurchaseOtherTaxExclude");
var costProjectManageTaxExclude = $("input[name='costProjectManageTaxExclude']").val(); var costProjectManageTaxExclude = inputVal("costProjectManageTaxExclude");
var costOtherOtherTaxExclude = $("input[name='costOtherOtherTaxExclude']").val(); var costOtherOtherTaxExclude = inputVal("costOtherOtherTaxExclude");
var $costTotalTaxExclude = $("input[name='costTotalTaxExclude']"); var $costTotalTaxExclude = $("input[name='costTotalTaxExclude']");

View File

@ -96,32 +96,32 @@ function calIncomeAndCost() {
* 统计收入(含税)有一项没填就置空 * 统计收入(含税)有一项没填就置空
*/ */
function calIncomeInclude() { function calIncomeInclude() {
var incomeDeviceTaxInclude = $("input[name='incomeDeviceTaxInclude']").val(); var incomeDeviceTaxInclude = inputVal("incomeDeviceTaxInclude");
var incomeEngineerTaxInclude = $("input[name='incomeEngineerTaxInclude']").val(); var incomeEngineerTaxInclude = inputVal("incomeEngineerTaxInclude");
var incomeServiceTaxInclude = $("input[name='incomeServiceTaxInclude']").val(); var incomeServiceTaxInclude = inputVal("incomeServiceTaxInclude");
var incomeTotalTaxInclude = $("input[name='incomeTotalTaxInclude']"); var $incomeTotalTaxInclude = $("input[name='incomeTotalTaxInclude']");
if(incomeDeviceTaxInclude && incomeEngineerTaxInclude && incomeServiceTaxInclude){ if(incomeDeviceTaxInclude && incomeEngineerTaxInclude && incomeServiceTaxInclude){
incomeTotalTaxInclude.val(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude)); $incomeTotalTaxInclude.val(f2(incomeDeviceTaxInclude)+f2(incomeEngineerTaxInclude)+f2(incomeServiceTaxInclude));
}else { }else {
incomeTotalTaxInclude.val(""); $incomeTotalTaxInclude.val("");
} }
} }
/** /**
* 统计收入(不含税)有一项没填就置空 * 统计收入(不含税)有一项没填就置空
*/ */
function calIncomeExclude() { function calIncomeExclude() {
var incomeDeviceTaxExclude = $("input[name='incomeDeviceTaxExclude']").val(); var incomeDeviceTaxExclude = inputVal("incomeDeviceTaxExclude");
var incomeEngineerTaxExclude = $("input[name='incomeEngineerTaxExclude']").val(); var incomeEngineerTaxExclude = inputVal("incomeEngineerTaxExclude");
var incomeServiceTaxExclude = $("input[name='incomeServiceTaxExclude']").val(); var incomeServiceTaxExclude = inputVal("incomeServiceTaxExclude");
var incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']"); var $incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']");
if(incomeDeviceTaxExclude && incomeEngineerTaxExclude && incomeServiceTaxExclude){ if(incomeDeviceTaxExclude && incomeEngineerTaxExclude && incomeServiceTaxExclude){
incomeTotalTaxExclude.val(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude)); $incomeTotalTaxExclude.val(f2(incomeDeviceTaxExclude)+f2(incomeEngineerTaxExclude)+f2(incomeServiceTaxExclude));
}else { }else {
incomeTotalTaxExclude.val(""); $incomeTotalTaxExclude.val("");
} }
} }
@ -129,29 +129,29 @@ function calIncomeExclude() {
* 计算毛利毛利率贡献贡献率 * 计算毛利毛利率贡献贡献率
*/ */
function calIncomeCost() { function calIncomeCost() {
var incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']").val(); var incomeTotalTaxExclude = inputVal("incomeTotalTaxExclude");
var costTotalTaxExclude = $("input[name='costTotalTaxExclude']").val(); var costTotalTaxExclude = inputVal("costTotalTaxExclude");
var costExpropriationTaxExclude = $("input[name='costExpropriationTaxExclude']").val(); var costExpropriationTaxExclude = inputVal("costExpropriationTaxExclude");
var costCompanyManageTaxExclude = $("input[name='costCompanyManageTaxExclude']").val(); var costCompanyManageTaxExclude = inputVal("costCompanyManageTaxExclude");
var projectGrossProfit = $("input[name='projectGrossProfit']"); var $projectGrossProfit = $("input[name='projectGrossProfit']");
var projectGrossProfitRate = $("input[name='projectGrossProfitRate']"); var $projectGrossProfitRate = $("input[name='projectGrossProfitRate']");
var projectContributionProfit = $("input[name='projectContributionProfit']"); var $projectContributionProfit = $("input[name='projectContributionProfit']");
var projectContributionProfitRate = $("input[name='projectContributionProfitRate']"); var $projectContributionProfitRate = $("input[name='projectContributionProfitRate']");
if (incomeTotalTaxExclude && costTotalTaxExclude && costExpropriationTaxExclude) { if (incomeTotalTaxExclude && costTotalTaxExclude && costExpropriationTaxExclude) {
projectGrossProfit.val(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude)); $projectGrossProfit.val(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude));
projectGrossProfitRate.val(f2(projectGrossProfit.val()) * 100 / f2(incomeTotalTaxExclude)); $projectGrossProfitRate.val(f2($projectGrossProfit.val()) * 100 / f2(incomeTotalTaxExclude));
} else { } else {
projectGrossProfit.val(""); $projectGrossProfit.val("");
projectGrossProfitRate.val(""); $projectGrossProfitRate.val("");
} }
if (projectGrossProfit.val() && costCompanyManageTaxExclude) { if ($projectGrossProfit.val() && costCompanyManageTaxExclude) {
projectContributionProfit.val(f2(projectGrossProfit.val()) - f2(costCompanyManageTaxExclude)); $projectContributionProfit.val(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude));
projectContributionProfitRate.val(f2(projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude)) $projectContributionProfitRate.val(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude))
} else { } else {
projectContributionProfit.val(""); $projectContributionProfit.val("");
projectContributionProfitRate.val(""); $projectContributionProfitRate.val("");
} }
} }