duhe
7 天以前 922f6d5e03eb30a0b2f4d31a1b734cd61567b436
染厂领料单:子表数值计算时存在小数自动加00000001的情况处理
1个文件已修改
58 ■■■■ 已修改文件
WebTM/views/领料发货/领料出库/Kf_MateOutBillLEdit.html 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/ÁìÁÏ·¢»õ/ÁìÁϳö¿â/Kf_MateOutBillLEdit.html
@@ -825,11 +825,11 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = option.data[i].HRate * HWeight;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            option.data[i].HQty = option.data[i].HRate * HWaterQty * 0.001;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            option.data[i].HQty = option.data[i].HRate * HWeight * 0.001;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        }
                    }
                    table.render(option);
@@ -846,11 +846,11 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = option.data[i].HRate * HWeight;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            option.data[i].HQty = option.data[i].HRate * HWaterQty * 0.001;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            option.data[i].HQty = option.data[i].HRate * HWeight * 0.001;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        }
                    }
                    table.render(option);
@@ -1053,11 +1053,11 @@
                        var HQty = 0;
                        var HMaterRuleType = obj.data.HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            HQty = HRate * HWeight;
                            HQty = dealDoubleToFixed(HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = HRate * HWaterQty * 0.001;
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = HRate * HWeight * 0.001;
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        }
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -1073,11 +1073,11 @@
                        var HQty = 0;
                        var HMaterRuleType = value;
                        if (HMaterRuleType == "染料") {
                            HQty = HRate * HWeight;
                            HQty = dealDoubleToFixed(HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = HRate * HWaterQty * 0.001;
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = HRate * HWeight * 0.001;
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        }
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -1652,11 +1652,11 @@
                                        var HWeight = $("#HWeight").val();
                                        var HWaterQty = $("#HWaterQty").val();
                                        if (option.data[rowIndex + i].HMaterRuleType == "染料") {
                                            option.data[rowIndex + i].HQty = option.data[rowIndex + i].HRate * HWeight;
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight);
                                        } else if (option.data[rowIndex + i].HMaterRuleType == "助剂") {
                                            option.data[rowIndex + i].HQty = option.data[rowIndex + i].HRate * HWaterQty * 0.001;
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWaterQty * 0.001);
                                        } else if (option.data[rowIndex + i].HMaterRuleType == "助剂(按布算)") {
                                            option.data[rowIndex + i].HQty = option.data[rowIndex + i].HRate * HWeight * 0.001;
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight * 0.001);
                                        }
                                    }
                                    table.render(option);
@@ -2204,7 +2204,33 @@
           //双击返回计量单位
         function GetGyUnit(data) {
             OptionData = data
         }
        }
        //#region å¤„理小数显示位数(data:需要处理的数据;num:数据的类型(如1:数量;2:金额;3:单价))
        function dealDoubleToFixed(data) {
            //用于设置小数位数
            var dotLength = 6;
            //判断是否存在小数点及其索引位置
            data = data + "";
            var index = data.indexOf(".");
            //处理数据并返回
            if (index < 0) {
                return data * 1;
            } else {
                //获取小数位数
                var length = data.length - index - 1;
                if (length <= dotLength) {
                    return data * 1;
                } else {
                    data = data * 1;
                    return data.toFixed(dotLength) * 1;
                }
            }
        }
                //#endregion
    </script>
</body>
</html>