单价限制5位小数,结算表不校验小于0
parent
57fe59478e
commit
efd4519ed5
|
@ -451,7 +451,7 @@ function bindChangeableInput() {
|
|||
});
|
||||
//单价改变
|
||||
$(".input-changeable-price").change(function () {
|
||||
var price = f2($(this).val());
|
||||
var price = f5($(this).val());
|
||||
//找到对应的数量和税率
|
||||
var amount = parseInt($(this).parent().parent().find(".input-changeable-amount").val());
|
||||
var taxRate = f2($(this).parent().parent().find(".input-changeable-tax-rate").val());
|
||||
|
@ -459,7 +459,7 @@ function bindChangeableInput() {
|
|||
|
||||
$(this).parent().parent().find(".input-changeable-total-tax-include").val(f2Fixed(amount * price));
|
||||
$(this).parent().parent().find(".input-changeable-total-tax-exclude").val(f2Fixed(amount * price / (1 + taxRate / 100)));
|
||||
$(this).val(f2Fixed(price));
|
||||
$(this).val(f5Price(price));
|
||||
console.log("单价:" + $(this).val());
|
||||
});
|
||||
//税率改变
|
||||
|
|
|
@ -188,7 +188,7 @@ function appendTrCost() {
|
|||
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost"></td>'+
|
||||
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost""></td>'+
|
||||
'<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount"></td>'+
|
||||
'<td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="16" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price"></td>'+
|
||||
'<td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price"></td>'+
|
||||
'<td><input type="text" min="0.00" max="99.99" step="0.01" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate"></td>'+
|
||||
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include" readonly></td>'+
|
||||
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude" readonly></td>'+
|
||||
|
|
|
@ -119,7 +119,7 @@ function appendTrCostProjectManage() {
|
|||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage"></td>\n' +
|
||||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage"></td>\n' +
|
||||
' <td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-amount-project-manage"></td>\n' +
|
||||
' <td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="16" class="number am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-price-project-manage"></td>\n' +
|
||||
' <td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-price-project-manage"></td>\n' +
|
||||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-total-project-manage" readonly></td>\n' +
|
||||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage"></td>\n' +
|
||||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage"></td>\n' +
|
||||
|
|
|
@ -137,7 +137,7 @@ function appendTrIncome() {
|
|||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income"></td>\n' +
|
||||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income"></td>\n' +
|
||||
' <td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-amount"></td>\n' +
|
||||
' <td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="16" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-price"></td>\n' +
|
||||
' <td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-income input-changeable-price"></td>\n' +
|
||||
' <td><input type="text" min="0.00" max="99.99" step="0.01" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate"></td>\n' +
|
||||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include" readonly></td>\n' +
|
||||
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude" readonly></td>\n' +
|
||||
|
|
|
@ -42,6 +42,34 @@ function f2Fixed(f) {
|
|||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配单价
|
||||
*/
|
||||
function f5Price(f) {
|
||||
//return Number(f).toFixed(2);
|
||||
//格式化413,423,423.24
|
||||
f = Number(f).toLocaleString('en-US',{minimumFractionDigits: 2, maximumFractionDigits: 5, useGrouping: true});
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配单价
|
||||
*/
|
||||
function f5(x) {
|
||||
if(!x){
|
||||
return 0;
|
||||
}
|
||||
if(typeof x === 'string'){
|
||||
//这一步因为数字格式化为了包含分隔符,获取的时候就去掉这个分隔符
|
||||
x = x.replaceAll(",","");
|
||||
}
|
||||
var f = parseFloat(x);
|
||||
if (isNaN(f)) {
|
||||
return 0;
|
||||
}
|
||||
return Math.round(f*100000)/100000;
|
||||
}
|
||||
|
||||
function digitalSelf(name, action) {
|
||||
var self = inputVal(name);
|
||||
|
||||
|
@ -76,6 +104,10 @@ function bindNumberInput() {
|
|||
//所有的number类的输入框
|
||||
var $numberClassInputs = $("input.number");
|
||||
inputKeepDigital($numberClassInputs);
|
||||
|
||||
//所有的price类的输入框,根据单价要求单独设置
|
||||
var $priceClassInputs = $("input.price");
|
||||
inputKeepDigitalPrice($priceClassInputs);
|
||||
}
|
||||
|
||||
function inputKeepDigital($inputs) {
|
||||
|
@ -93,6 +125,15 @@ function keepDigital($input) {
|
|||
$input.val(keepDigitalVal($input.val()));
|
||||
}
|
||||
|
||||
function inputKeepDigitalPrice($inputs) {
|
||||
console.log("1");
|
||||
|
||||
//失去焦点时再校验一遍
|
||||
$inputs.blur(function() {
|
||||
$(this).val(keepDigitalValPrice($(this).val()));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 只保留数字
|
||||
*/
|
||||
|
@ -109,6 +150,22 @@ function keepDigitalVal(value) {
|
|||
return f2Fixed(f2(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 只保留数字
|
||||
*/
|
||||
function keepDigitalValPrice(value) {
|
||||
value = value.replace(/[^\-\d.]/g, ""); //清除“-”、“数字”和“.”以外的字符
|
||||
value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
|
||||
value = value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
|
||||
value = value.replace(/^(\-)?(\d+)\.(\d\d\d\d\d).*$/, '$1$2.$3'); //只能输入两个小数
|
||||
if (value.indexOf(".") < 0 && value != "") {
|
||||
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
|
||||
value = parseFloat(value);
|
||||
}
|
||||
|
||||
return f5Price(f5(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保留整数
|
||||
*/
|
||||
|
|
|
@ -17,13 +17,6 @@ var incomeDeviceValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月收入设备类数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -36,13 +29,6 @@ var incomeEngineerValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月收入工程类数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -55,13 +41,6 @@ var incomeServiceValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月收入服务类数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -87,13 +66,6 @@ var costPurchaseDeviceValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月采购成本设备类数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -106,13 +78,6 @@ var costPurchaseBuildValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月采购成本施工类数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -125,13 +90,6 @@ var costPurchaseServiceValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月采购成本服务类数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -144,13 +102,6 @@ var costPurchaseOtherValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月采购成本其他类数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -164,13 +115,6 @@ var costProjectManageValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月项目管理成本数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(salary) > parseFloat(month)) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
|
@ -190,13 +134,6 @@ var costOtherValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月其他成本数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -224,13 +161,6 @@ var costExpropriationValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月财务费用数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(settle) > parseFloat(budget)) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
|
@ -250,13 +180,6 @@ var costCompanyManageValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月公司管理费用数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -269,13 +192,6 @@ var costIncomeTaxValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月所得税费用数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -288,13 +204,6 @@ var saleIncomeCashValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月本月销售商品、提供劳务收到的现金数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -307,13 +216,6 @@ var taxReturnValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月收到的税费返还数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -326,13 +228,6 @@ var earnestMoneyIncomeValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月收到其他与经营活动有关的现金数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -345,13 +240,6 @@ var purchaseCostValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月购买商品、接受劳务支付的现金数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -364,13 +252,6 @@ var taxCostValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月支付的各项税费数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -383,13 +264,6 @@ var earnestMoneyCostValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月支付其他与经营活动有关的现金数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -402,13 +276,6 @@ var cashInflowFromInvestingActivitiesValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月投资活动现金流入数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -421,13 +288,6 @@ var cashOutflowFromInvestingActivitiesValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月投资活动现金流出数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -440,13 +300,6 @@ var financingCapitalInflowValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月融资资金流入数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -459,13 +312,6 @@ var financingCapitalOutflowValid = function() {
|
|||
});
|
||||
return false;
|
||||
}
|
||||
if (parseFloat(month) < 0) {
|
||||
layui.use('layer', function(){
|
||||
var layer = layui.layer;
|
||||
layer.alert("本月还款资金流出数据不能小于0");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@
|
|||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="${incomeDetail.name!}"></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="${incomeDetail.unit!}"></td>
|
||||
<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-amount" value="${incomeDetail.amount!0}" oninput="if(value.length>8)value=value.slice(0,8)" <#--onkeyup="integerNumber(this)"-->></td>
|
||||
<td><input type="text" maxlength="16" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-price" value="${Utils.format(incomeDetail.price,'0')}" oninput="if(value.length>16)value=value.slice(0,16)"></td>
|
||||
<td><input type="text" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-income input-changeable-price" value="${Utils.format(incomeDetail.price,'0')}" oninput="if(value.length>19)value=value.slice(0,19)"></td>
|
||||
<td><input type="text" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate" value="${Utils.format(incomeDetail.taxRate,'0')}" oninput="if(value.length>5)value=value.slice(0,5)"></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include" value="${Utils.format(incomeDetail.totalTaxInclude,'0')}" readonly></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude" value="${Utils.format(incomeDetail.totalTaxExclude,'0')}" readonly></td>
|
||||
|
@ -459,7 +459,7 @@
|
|||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="${costDetail.name!}"></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="${costDetail.unit!}"></td>
|
||||
<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount" value="${costDetail.amount!0}" oninput="if(value.length>8)value=value.slice(0,8)" <#--onkeyup="integerNumber(this)"-->></td>
|
||||
<td><input type="text" maxlength="16" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price" value="${Utils.format(costDetail.price,'0')}" oninput="if(value.length>16)value=value.slice(0,16)"></td>
|
||||
<td><input type="text" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price" value="${Utils.format(costDetail.price,'0')}" oninput="if(value.length>19)value=value.slice(0,19)"></td>
|
||||
<td><input type="text" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate" value="${Utils.format(costDetail.taxRate,'0')}" oninput="if(value.length>5)value=value.slice(0,5)"></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include" value="${Utils.format(costDetail.totalTaxInclude,'0')}" readonly></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude" value="${Utils.format(costDetail.totalTaxExclude,'0')}" readonly></td>
|
||||
|
@ -527,7 +527,7 @@
|
|||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.detail!}"></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.unit!}"></td>
|
||||
<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-amount-project-manage" value="${costProjectManageDetail.amount!0}" <#--onkeyup="integerNumber(this)"--> oninput="if(value.length>8)value=value.slice(0,8)"></td>
|
||||
<td><input type="text" maxlength="16" class="number am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-price-project-manage" value="${Utils.format(costProjectManageDetail.price,'0')}" oninput="if(value.length>16)value=value.slice(0,16)"></td>
|
||||
<td><input type="text" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-price-project-manage" value="${Utils.format(costProjectManageDetail.price,'0')}" oninput="if(value.length>19)value=value.slice(0,19)"></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-total-project-manage" value="${Utils.format(costProjectManageDetail.total,'0')}" readonly></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.predictMethod!}"></td>
|
||||
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.predictWhy!}"></td>
|
||||
|
|
Loading…
Reference in New Issue