1
pzy
2024-08-13 4f4a5a073bed3688ddead42557829fc8610db86b
WebTM/views/²É¹º¹ÜÀí/Ó¦¸¶µ¥/Cg_PayableBill.html
@@ -1239,15 +1239,17 @@
                        var HPrice = obj.data.HPrice * 1;               //单价
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxRate = obj.data.HTaxRate * 0.01;           //税率 
                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                        var HTaxMoney = Number((HMoney * HTaxRate));         //税额=金额*税率
                        var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                        var HExRate = $("#HExRate").val();                      //汇率
                        var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4));      //本位币价税合计=(税额+金额)*汇率
                        var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate));      //本位币价税合计=(税额+金额)*汇率
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                        HlineTotalBB = Number(HlineTotalBB.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
@@ -1292,6 +1294,8 @@
                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                        HTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HRelTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HlineTotalBB = Number(HlineTotalBB.toFixed(HMoneyDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
@@ -1339,6 +1343,8 @@
                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                        HTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HRelTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HlineTotalBB = Number(HlineTotalBB.toFixed(HMoneyDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HTaxRate: HTaxRate * 100
@@ -1373,18 +1379,18 @@
                        var HQty = obj.data.HQty * 1;                   //数量
                        var HPrice = obj.data.HPrice * 1;
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                        var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4));        //含税单价=单价*(1+税率)
                        var HTaxMoney = Number((HMoney * HTaxRate));         //税额=金额*税率
                        var HTaxPrice = Number((HPrice * (1 + HTaxRate)));        //含税单价=单价*(1+税率)
                        var HDiscountRate = obj.data.HDiscountRate * 1;     //折扣率
                        var HRelTaxPrice = Number((HTaxPrice * HDiscountRate).toFixed(4));   //实际含税单价=含税单价*折扣率
                        var HRelTaxPrice = Number((HTaxPrice * HDiscountRate));   //实际含税单价=含税单价*折扣率
                        //数字精度
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                        HTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HRelTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HTaxRate: HTaxRate * 100
@@ -1429,9 +1435,11 @@
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                        HTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HRelTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
                        HRelTaxPrice = Number(HRelTaxPrice.toFixed(HPriceDec));
                        HlineTotalBB = Number(HlineTotalBB.toFixed(HMoneyDec));
                        //同步更新表格和缓存对应的值
                        obj.update({                    //更新表格数据                æ–¹æ³•是该对象提供的一个方法,用于更新其内部状态或与之关联的数据源
                            HQty: HQty                               //更新HQty字段,HQty
@@ -1975,7 +1983,7 @@
                    if (event.key == "F7") {
                        //物料
                        if (obj.event == "HMaterID") {
                                var HOrgID = $("#HOrgID").val();
                            var HOrgID = $("#HOrgID").val();  //获取id="HOrgID"的元素中获取其值,并将该值存储在变量HOrgID中
                            layer.open({
                                type: 2
                                , skin: "layui-layer-rim" //加上边框
@@ -1997,60 +2005,74 @@
                                    OptionData = checkStatus.data[0];
                                    layer.close(index);//关闭弹窗
                                }
                               , 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 HExRate = $("#HExRate").val();                      //汇率
                                               //数据校验合格,重算记录
                                               var HQty = obj.data.HQty * 1;                           //数量
                                               var HPrice = obj.data.HPrice * 1;               //单价
                                               var HMoney = HQty * HPrice;                     //金额=数量*单价
                                               var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                                               var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                                               var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4));        //含税单价=单价*(1+税率)
                                               var HDiscountRate = obj.data.HDiscountRate * 1;   //折扣率
                                               var HRelTaxPrice = Number((HTaxPrice * HDiscountRate).toFixed(4));   //实际含税单价=含税单价*折扣率
                                               var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).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
                                                   , HlineTotal: HlineTotal             //更新HlineTotal字段,HlineTotal
                                                   , HTaxPrice, HTaxPrice                   //更新HTaxPrice字段,HTaxPrice
                                                   , HRelTaxPrice: HRelTaxPrice            //更新HRelTaxPrice字段,其值来自变量HRelTaxPrice
                                                   , HlineTotalBB: HlineTotalBB              //更新HlineTotalBB字段,其值来自变量HlineTotalBB
                                               })
                                           }
                                       });
                                   } 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 HExRate = $("#HExRate").val();                      //汇率
                                                //数据校验合格,重算记录
                                                var HQty = obj.data.HQty * 1;                           //数量
                                                var HPrice = obj.data.HPrice * 1;               //单价
                                                var HMoney = HQty * HPrice;                     //金额=数量*单价
                                                var HTaxMoney = Number((HMoney * HTaxRate));         //税额=金额*税率
                                                var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                                                var HTaxPrice = Number((HPrice * (1 + HTaxRate)));        //含税单价=单价*(1+税率)
                                                var HDiscountRate = obj.data.HDiscountRate * 1;   //折扣率
                                                var HRelTaxPrice = Number((HTaxPrice * HDiscountRate));   //实际含税单价=含税单价*折扣率
                                                var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate));     //本位币价税合计=(税额+金额)*汇率
                                                //数字精度
                                                HQty = Number(HQty.toFixed(HQtyDec));
                                                HPrice = Number(HPrice.toFixed(HPriceDec));
                                                HMoney = Number(HMoney.toFixed(HMoneyDec));
                                                HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                                                HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                                                HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
                                                HRelTaxPrice = Number(HRelTaxPrice.toFixed(HPriceDec));
                                                HlineTotalBB = Number(HlineTotalBB.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
                                                    , HlineTotal: HlineTotal             //更新HlineTotal字段,HlineTotal
                                                    , HTaxPrice, HTaxPrice                   //更新HTaxPrice字段,HTaxPrice
                                                    , HRelTaxPrice: HRelTaxPrice            //更新HRelTaxPrice字段,其值来自变量HRelTaxPrice
                                                    , HlineTotalBB: HlineTotalBB              //更新HlineTotalBB字段,其值来自变量HlineTotalBB
                                                })
                                            }
                                        });
                                    } else if (typeof (OptionData.HItemID) != "undefined") {
                                        obj.update({ //更新表格数据
                                            "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                            , "物料代码": OptionData.物料代码
                                            , "物料名称": OptionData.物料名称
                                            , "规格型号": OptionData.规格型号
                                            , "HUnitID": OptionData.HUnitID
                                            , "计量单位": OptionData.计量单位名称
                                        })
                                    }
                                }
                            })
                        }
                        //计量单位
@@ -2122,7 +2144,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",
@@ -2137,12 +2163,22 @@
                                        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));         //税额=金额*税率
                                        var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                                        var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4));        //含税单价=单价*(1+税率)
                                        var HTaxPrice = Number((HPrice * (1 + HTaxRate)));        //含税单价=单价*(1+税率)
                                        var HDiscountRate = obj.data.HDiscountRate * 1;   //折扣率
                                        var HRelTaxPrice = Number((HTaxPrice * HDiscountRate).toFixed(4));   //实际含税单价=含税单价*折扣率
                                        var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4));     //本位币价税合计=(税额+金额)*汇率
                                        var HRelTaxPrice = Number((HTaxPrice * HDiscountRate));   //实际含税单价=含税单价*折扣率
                                        var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate));     //本位币价税合计=(税额+金额)*汇率
                                        //数字精度
                                        HQty = Number(HQty.toFixed(HQtyDec));
                                        HPrice = Number(HPrice.toFixed(HPriceDec));
                                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
                                        HRelTaxPrice = Number(HRelTaxPrice.toFixed(HPriceDec));
                                        HlineTotalBB = Number(HlineTotalBB.toFixed(HMoneyDec));
                                        obj.update({ //更新表格数据
                                            "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                            , "物料代码": OptionData.物料代码
@@ -2162,7 +2198,7 @@
                                        })
                                    }
                                });
                            } else {
                            } else if (typeof (OptionData.HItemID) != "undefined"){
                                obj.update({ //更新表格数据
                                    "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                    , "物料代码": OptionData.物料代码