wtt
2024-08-13 44178ad4def665fe10f64dbdd557b970ea0a7e77
WebTM/views/²É¹º¹ÜÀí/ÍËÁÏ֪ͨµ¥/Add_Edit_Cg_POInStockBackBillList.html
@@ -781,12 +781,16 @@
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxRate = obj.data.HTaxRate * 0.01;           //税率 
                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                        //数字精度
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: Number(HQty.toFixed(HQtyDec))
                            , HPrice: Number(HPrice.toFixed(HPriceDec))
                            , HMoney: Number(HMoney.toFixed(HMoneyDec))
                            HQty: HQty
                            , HPrice: HPrice
                            , HMoney:HMoney
                            , HTaxMoney: HTaxMoney
                        });
                        table.render(option)
@@ -810,12 +814,16 @@
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxRate = obj.data.HTaxRate * 0.01;           //税率 
                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                        //数字精度
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: Number(HQty.toFixed(HQtyDec))
                            , HPrice: Number(HPrice.toFixed(HPriceDec))
                            , HMoney: Number(HMoney.toFixed(HMoneyDec))
                            HQty: HQty
                            , HPrice: HPrice
                            , HMoney: HMoney
                            , HTaxMoney: HTaxMoney
                        });
                        table.render(option)
@@ -840,13 +848,17 @@
                        var HPrice = obj.data.HPrice * 1;
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                        //数字精度
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HTaxRate: HTaxRate * 100
                            , HQty: Number(HQty.toFixed(HQtyDec))
                            , HPrice: Number(HPrice.toFixed(HPriceDec))
                            , HMoney: Number(HMoney.toFixed(HMoneyDec))
                            , HQty: HQty
                            , HPrice: HPrice
                            , HMoney: HMoney
                            , HTaxMoney: HTaxMoney
                        });
                        break;
@@ -1345,26 +1357,25 @@
                    if (event.key == "F7") {
                        //物料
                        if (obj.event == "HMaterID") {
                            var HOrgID = $("#HOrgID").val();
                            layer.open({
                                type: 2
                            var HOrgID = $("#HOrgID").val();  //获取id="HOrgID"的元素中获取其值,并将该值存储在变量HOrgID中
                            layer.open({  //打开层
                                type: 2         // //表示弹出层的内容是一个 iframe       ç±»åž‹ä¸º2
                                , skin: "layui-layer-rim" //加上边框
                                , title: "物料列表"  //标题
                                , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                                , shift: 2 //弹出动画
                                , area: ["90%", "90%"] //窗体大小
                                , maxmin: true //设置最大最小按钮是否显示
                                , content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                , content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']   //页面加载
                                , btn: ["确定", "取消"]  //属性定义了弹出层上的按钮数“确定”和“取消
                                , btn1: function (index, laero) { //当点击“确定”按钮时会被调用
                                    //按钮一  çš„回调
                                    var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                    //if (checkStatus.data.length != 1) {
                                    //    return layer.msg("请选择一条数据");
                                    //}
                                    OptionData = checkStatus.data[0];
                                    OptionData = checkStatus.data[0];  //把选中数据的第一条赋值给OptionData变量
                                    var TaxRate = getHTaxRateByHSupID();
                                    //选中多行时
                                    if (checkStatus.data.length > 1) {
                                        var rowIndex = $(obj.tr).attr("data-index") * 1;
                                        for (var i = 0; i < checkStatus.data.length; i++) {
@@ -1391,62 +1402,71 @@
                                            option.data[rowIndex + i].规格型号 = resultData.HMaterModel;
                                            option.data[rowIndex + i].HUnitID = resultData.HUnitID;
                                            option.data[rowIndex + i].计量单位 = resultData.HUnitName;
                                            option.data[rowIndex + i].HTaxRate = TaxRate;
                                        }
                                        table.render(option);
                                    }
                                    layer.closeAll();
                                    layer.closeAll();  //关闭所有通过layer
                                    //layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                                , btn2: function (index, layero) {
                                , btn2: function (index, layero) {   //当点击“取消”按钮时会被调用
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                 end: function () {
                                     //通过供应商id获取税率
                                     var HSupID = $("#HSupID").val();
                                     if (HSupID != 0) {
                                         $.ajax({
                                             url: GetWEBURL() + "/Gy_Supplier/xg",
                                             //url: "http://localhost:12761/Gy_Supplier/xg",
                                             type: "GET",
                                             data: {
                                                 "HInterID": HSupID
                                             },
                                             success: function (d) {
                                                 var HTaxRate = parseInt(d.data[0].增值税率) * 0.01;
                                                 //数据校验合格,重算记录
                                                 var HQty = obj.data.HQty * 1;                           //数量
                                                 var HPrice = obj.data.HPrice * 1;               //单价
                                                 var HMoney = HQty * HPrice;                     //金额=数量*单价
                                                 var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                                                 obj.update({ //更新表格数据
                                                     "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                                     , "物料代码": OptionData.物料代码
                                                     , "物料名称": OptionData.物料名称
                                                     , "规格型号": OptionData.规格型号
                                                     , "HUnitID": OptionData.HUnitID
                                                     , "计量单位": OptionData.计量单位名称
                                                     , "HTaxRate": HTaxRate * 100
                                                     , HQty: HQty                               //更新HQty字段,HQty
                                                     , HPrice: HPrice                         //更新HPrice字段,HPrice
                                                     , HMoney: HMoney                      //更新HMoney字段,HMoney
                                                     , HTaxMoney: HTaxMoney                  //更新HTaxMoney字段,HTaxMoney
                                                 })
                                             }
                                         });
                                     } else {
                                         obj.update({ //更新表格数据
                                             "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                             , "物料代码": OptionData.物料代码
                                             , "物料名称": OptionData.物料名称
                                             , "规格型号": OptionData.规格型号
                                             , "HUnitID": OptionData.HUnitID
                                             , "计量单位": OptionData.计量单位名称
                                         })
                                     }
                                end: function () {
                                    //通过供应商id获取税率
                                    var HSupID = $("#HSupID").val();
                                    if (HSupID != 0 && typeof (OptionData.HItemID) != "undefined") {
                                        var Dec = getDecByMaterID(obj.data.HMaterID) //获取精度
                                        var HQtyDec = (Dec["HQtyDec"] == null || Dec["HQtyDec"] == 0) ? 4 : Dec["HQtyDec"];  //数量精度
                                        var HPriceDec = (Dec["HPriceDec"] == null || Dec["HPriceDec"] == 0) ? 4 : Dec["HPriceDec"];  //单价精度
                                        var HMoneyDec = (Dec["HMoneyDec"] == null || Dec["HMoneyDec"] == 0) ? 2 : Dec["HMoneyDec"];  //金额精度
                                        $.ajax({
                                            url: GetWEBURL() + "/Gy_Supplier/xg",
                                            //url: "http://localhost:12761/Gy_Supplier/xg",
                                            type: "GET",
                                            data: {
                                                "HInterID": HSupID
                                            },
                                            success: function (d) {
                                                var HTaxRate = parseInt(d.data[0].增值税率) * 0.01;
                                                //数据校验合格,重算记录
                                                var HQty = obj.data.HQty * 1;                           //数量
                                                var HPrice = obj.data.HPrice * 1;               //单价
                                                var HMoney = HQty * HPrice;                     //金额=数量*单价
                                                var HTaxMoney = Number((HMoney * HTaxRate));         //税额=金额*税率
                                                //数字精度
                                                HQty = Number(HQty.toFixed(HQtyDec));
                                                HPrice = Number(HPrice.toFixed(HPriceDec));
                                                HMoney = Number(HMoney.toFixed(HMoneyDec));
                                                HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                                                obj.update({ //更新表格数据
                                                    "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                                    , "物料代码": OptionData.物料代码
                                                    , "物料名称": OptionData.物料名称
                                                    , "规格型号": OptionData.规格型号
                                                    , "HUnitID": OptionData.HUnitID
                                                    , "计量单位": OptionData.计量单位名称
                                                    , "HTaxRate": HTaxRate * 100
                                                    , HQty: HQty                               //更新HQty字段,HQty
                                                    , HPrice: HPrice                         //更新HPrice字段,HPrice
                                                    , HMoney: HMoney                      //更新HMoney字段,HMoney
                                                    , HTaxMoney: HTaxMoney                  //更新HTaxMoney字段,HTaxMoney
                                                })
                                            }
                                        });
                                    } else if (typeof (OptionData.HItemID) != "undefined") {
                                        obj.update({ //更新表格数据
                                            "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                            , "物料代码": OptionData.物料代码
                                            , "物料名称": OptionData.物料名称
                                            , "规格型号": OptionData.规格型号
                                            , "HUnitID": OptionData.HUnitID
                                            , "计量单位": OptionData.计量单位名称
                                        })
                                    }
                                }
                            });
                        }
@@ -1614,6 +1634,7 @@
                            var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                            OptionData = checkStatus.data[0];  //把选中数据的第一条赋值给OptionData变量
                            var TaxRate = getHTaxRateByHSupID();
                            //选中多行时
                            if (checkStatus.data.length > 1) {
                                var rowIndex = $(obj.tr).attr("data-index") * 1;
@@ -1641,7 +1662,7 @@
                                    option.data[rowIndex + i].规格型号 = resultData.HMaterModel;
                                    option.data[rowIndex + i].HUnitID = resultData.HUnitID;
                                    option.data[rowIndex + i].计量单位 = resultData.HUnitName;
                                    option.data[rowIndex + i].HTaxRate = TaxRate;
                                }
                                table.render(option);
@@ -1656,7 +1677,11 @@
                        end: function () {
                            //通过供应商id获取税率
                            var HSupID = $("#HSupID").val();
                            if (HSupID != 0) {
                            if (HSupID != 0 && typeof (OptionData.HItemID) != "undefined") {
                                var Dec = getDecByMaterID(obj.data.HMaterID) //获取精度
                                var HQtyDec = (Dec["HQtyDec"] == null || Dec["HQtyDec"] == 0) ? 4 : Dec["HQtyDec"];  //数量精度
                                var HPriceDec = (Dec["HPriceDec"] == null || Dec["HPriceDec"] == 0) ? 4 : Dec["HPriceDec"];  //单价精度
                                var HMoneyDec = (Dec["HMoneyDec"] == null || Dec["HMoneyDec"] == 0) ? 2 : Dec["HMoneyDec"];  //金额精度
                                $.ajax({
                                    url: GetWEBURL() + "/Gy_Supplier/xg",
                                    //url: "http://localhost:12761/Gy_Supplier/xg",
@@ -1670,7 +1695,12 @@
                                        var HQty = obj.data.HQty * 1;                           //数量
                                        var HPrice = obj.data.HPrice * 1;               //单价
                                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                                        var HTaxMoney = Number((HMoney * HTaxRate));         //税额=金额*税率
                                        //数字精度
                                        HQty = Number(HQty.toFixed(HQtyDec));
                                        HPrice = Number(HPrice.toFixed(HPriceDec));
                                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                                        obj.update({ //更新表格数据
                                            "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                            , "物料代码": OptionData.物料代码
@@ -1686,7 +1716,7 @@
                                        })
                                    }
                                });
                            } else {
                            } else if (typeof (OptionData.HItemID) != "undefined"){
                                obj.update({ //更新表格数据
                                    "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                    , "物料代码": OptionData.物料代码
@@ -1881,6 +1911,31 @@
                })
            }
            //#endregion
            //#region é€šè¿‡ä¾›åº”商id获取税率
            function getHTaxRateByHSupID() {
                var HTaxRate;
                //通过供应商id获取税率
                var HSupID = $("#HSupID").val();
                if (HSupID != 0) {
                    $.ajax({
                        url: GetWEBURL() + "/Gy_Supplier/xg",
                        type: "GET",
                        async: false,
                        data: {
                            "HInterID": HSupID
                        },
                        success: function (d) {
                            HTaxRate = parseInt(d.data[0].增值税率);
                        }
                    });
                } else {
                    HTaxRate = 0;
                }
                return HTaxRate;
            }
            //#endregion
         //#region æ ¹æ®ä¸»å†…码与子内码获取源单采购订单数据
            function getPushSource_POOrderBillInit(HSourceInterID, HSourceEntryID) {
                var res = "none";