解决被除数为0的情况补充
parent
7d5f1c41f5
commit
fe6fb6ebaa
|
@ -58,7 +58,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static String format(Number number){
|
public static String format(Number number){
|
||||||
return format(number, "#,##0.00");
|
return format(number, "0.00");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +72,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static String format2(Number number){
|
public static String format2(Number number){
|
||||||
return format(number, "#,##0.00###");
|
return format(number, "0.00");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ function f2(x) {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function f2Fixed(f) {
|
function f2Fixed(f) {
|
||||||
if(!x){
|
if(!f){
|
||||||
return f2Fixed(0);
|
return "0.00";
|
||||||
}
|
}
|
||||||
//return Number(f).toFixed(2);
|
//return Number(f).toFixed(2);
|
||||||
//格式化413,423,423.24
|
//格式化413,423,423.24
|
||||||
|
|
|
@ -452,15 +452,15 @@ function calIncomeCost() {
|
||||||
$projectGrossProfit.val(f2Fixed(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude)));
|
$projectGrossProfit.val(f2Fixed(f2(incomeTotalTaxExclude) - f2(costTotalTaxExclude) - f2(costExpropriationTaxExclude)));
|
||||||
$projectGrossProfitRate.val(f2Fixed(f2($projectGrossProfit.val()) * 100 / incomeTotalTaxExcludeValue));
|
$projectGrossProfitRate.val(f2Fixed(f2($projectGrossProfit.val()) * 100 / incomeTotalTaxExcludeValue));
|
||||||
} else {
|
} else {
|
||||||
$projectGrossProfit.val("");
|
$projectGrossProfit.val("0.00");
|
||||||
$projectGrossProfitRate.val("");
|
$projectGrossProfitRate.val("0.00");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($projectGrossProfit.val()) {
|
if ($projectGrossProfit.val()) {
|
||||||
$projectContributionProfit.val(f2Fixed(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude)));
|
$projectContributionProfit.val(f2Fixed(f2($projectGrossProfit.val()) - f2(costCompanyManageTaxExclude)));
|
||||||
$projectContributionProfitRate.val(f2Fixed(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude)))
|
$projectContributionProfitRate.val(f2Fixed(f2($projectContributionProfit.val()) * 100 / f2(incomeTotalTaxExclude)))
|
||||||
} else {
|
} else {
|
||||||
$projectContributionProfit.val("");
|
$projectContributionProfit.val("0.00");
|
||||||
$projectContributionProfitRate.val("");
|
$projectContributionProfitRate.val("0.00");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue