方法提取

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() {
var projectContributionProfitRate = f2($("input[name='projectContributionProfitRate']").val());
var projectContributionProfitRate = f2(inputVal("projectContributionProfitRate"));
var projectContributionProfitRateThreshold = f2($("#projectContributionProfitRateThreshold").val());
if(projectContributionProfitRate<projectContributionProfitRateThreshold){
return "项目贡献利润率["+projectContributionProfitRate+"]低于阀值["+projectContributionProfitRateThreshold+"],请调整后重新提交";
@ -175,13 +175,13 @@ function verifyProjectContributionProfitRate() {
*/
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 projectGrossProfitRate = rate(projectGrossProfit, incomeTotalTaxExclude);

View File

@ -43,18 +43,18 @@ $(function () {
*/
function verifyBudgetPlan(){
var costPurchaseDeviceTaxExclude = $("input[name='costPurchaseDeviceTaxExclude']").val();
var costPurchaseBuildTaxExclude = $("input[name='costPurchaseBuildTaxExclude']").val();
var costPurchaseServiceTaxExclude = $("input[name='costPurchaseServiceTaxExclude']").val();
var costPurchaseOtherTaxExclude = $("input[name='costPurchaseOtherTaxExclude']").val();
var costProjectManageTaxExclude = $("input[name='costProjectManageTaxExclude']").val();
var incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']").val();
var input_total_device_cost_budget_plan = $(".input-total-device-cost-budget-plan").val();
var input_total_engineer_cost_budget_plan = $(".input-total-engineer-cost-budget-plan").val();
var input_total_project_manage_budget_plan = $(".input-total-project-manage-cost-budget-plan").val();
var input_total_sale_income_budget_plan = $(".input-total-sale-income-budget-plan").val();
var input_total_earnest_money_cost_budget_plan = $(".input-total-earnest-money-cost-budget-plan").val();
var input_total_earnest_money_income_budget_plan = $(".input-total-earnest-money-income-budget-plan").val();
var costPurchaseDeviceTaxExclude = inputVal("costPurchaseDeviceTaxExclude");
var costPurchaseBuildTaxExclude = inputVal("costPurchaseBuildTaxExclude");
var costPurchaseServiceTaxExclude = inputVal("costPurchaseServiceTaxExclude");
var costPurchaseOtherTaxExclude = inputVal("costPurchaseOtherTaxExclude");
var costProjectManageTaxExclude = inputVal("costProjectManageTaxExclude");
var incomeTotalTaxExclude = inputVal("incomeTotalTaxExclude");
var input_total_device_cost_budget_plan = classVal("input-total-device-cost-budget-plan");
var input_total_engineer_cost_budget_plan = classVal("input-total-engineer-cost-budget-plan");
var input_total_project_manage_budget_plan = classVal("input-total-project-manage-cost-budget-plan");
var input_total_sale_income_budget_plan = classVal("input-total-sale-income-budget-plan");
var input_total_earnest_money_cost_budget_plan = classVal("input-total-earnest-money-cost-budget-plan");
var input_total_earnest_money_income_budget_plan = classVal("input-total-earnest-money-income-budget-plan");
//从采购成本明细中取“设备”大类下的总计---设备支出
@ -596,17 +596,17 @@ function bindCompanyManageChangeable() {
*/
function updateCashFlow() {
var saleIncome = $(".input-total-sale-income-budget-plan").val();
var earnestMoneyIncome = $(".input-total-earnest-money-income-budget-plan").val();
var deviceCost = $(".input-total-device-cost-budget-plan").val();
var engineerCost = $(".input-total-engineer-cost-budget-plan").val();
var saleIncome = classVal("input-total-sale-income-budget-plan");
var earnestMoneyIncome = classVal("input-total-earnest-money-income-budget-plan");
var deviceCost = classVal("input-total-device-cost-budget-plan");
var engineerCost = classVal("input-total-engineer-cost-budget-plan");
var projectManageCost = $(".input-total-project-manage-cost-budget-plan").val();
var earnestMoneyCost = $(".input-total-earnest-money-cost-budget-plan").val();
var capitalInterest = $(".input-total-capital-interest-budget-plan").val();
var projectManageCost = classVal("input-total-project-manage-cost-budget-plan");
var earnestMoneyCost = classVal("input-total-earnest-money-cost-budget-plan");
var capitalInterest = classVal("input-total-capital-interest-budget-plan");
var underwrittenPlan = $(".input-total-underwritten-plan-budget-plan").val();
var repaymentPlan = $(".input-total-repayment-plan-budget-plan").val();
var underwrittenPlan = classVal("input-total-underwritten-plan-budget-plan");
var repaymentPlan = classVal("input-total-repayment-plan-budget-plan");
var d = f2(f2(deviceCost)+f2(engineerCost));
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() {
var costPurchaseDeviceTaxInclude = $("input[name='costPurchaseDeviceTaxInclude']").val();
var costPurchaseBuildTaxInclude = $("input[name='costPurchaseBuildTaxInclude']").val();
var costPurchaseServiceTaxInclude = $("input[name='costPurchaseServiceTaxInclude']").val();
var costPurchaseOtherTaxInclude = $("input[name='costPurchaseOtherTaxInclude']").val();
var costProjectManageTaxInclude = $("input[name='costProjectManageTaxInclude']").val();
var costOtherOtherTaxInclude = $("input[name='costOtherOtherTaxInclude']").val();
var costPurchaseDeviceTaxInclude = inputVal("costPurchaseDeviceTaxInclude");
var costPurchaseBuildTaxInclude = inputVal("costPurchaseBuildTaxInclude");
var costPurchaseServiceTaxInclude = inputVal("costPurchaseServiceTaxInclude");
var costPurchaseOtherTaxInclude = inputVal("costPurchaseOtherTaxInclude");
var costProjectManageTaxInclude = inputVal("costProjectManageTaxInclude");
var costOtherOtherTaxInclude = inputVal("costOtherOtherTaxInclude");
var $costTotalTaxInclude = $("input[name='costTotalTaxInclude']");
@ -75,12 +91,12 @@ function calCostInclude() {
* 统计成本(不含税)有一项没填就置空
*/
function calCostExclude() {
var costPurchaseDeviceTaxExclude = $("input[name='costPurchaseDeviceTaxExclude']").val();
var costPurchaseBuildTaxExclude = $("input[name='costPurchaseBuildTaxExclude']").val();
var costPurchaseServiceTaxExclude = $("input[name='costPurchaseServiceTaxExclude']").val();
var costPurchaseOtherTaxExclude = $("input[name='costPurchaseOtherTaxExclude']").val();
var costProjectManageTaxExclude = $("input[name='costProjectManageTaxExclude']").val();
var costOtherOtherTaxExclude = $("input[name='costOtherOtherTaxExclude']").val();
var costPurchaseDeviceTaxExclude = inputVal("costPurchaseDeviceTaxExclude");
var costPurchaseBuildTaxExclude = inputVal("costPurchaseBuildTaxExclude");
var costPurchaseServiceTaxExclude = inputVal("costPurchaseServiceTaxExclude");
var costPurchaseOtherTaxExclude = inputVal("costPurchaseOtherTaxExclude");
var costProjectManageTaxExclude = inputVal("costProjectManageTaxExclude");
var costOtherOtherTaxExclude = inputVal("costOtherOtherTaxExclude");
var $costTotalTaxExclude = $("input[name='costTotalTaxExclude']");

View File

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