1
pzy
2024-08-13 4f4a5a073bed3688ddead42557829fc8610db86b
WebTM/views/ÏúÊÛ¹ÜÀí/ÏúÊÛºÏͬ/Add_Edit_Xs_ContractBillList.html
@@ -613,6 +613,7 @@
                        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));
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -649,6 +650,7 @@
                        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));
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -686,6 +688,7 @@
                        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));
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -1026,6 +1029,8 @@
                                    //    return layer.msg("请选择一条数据");
                                    //}
                                    OptionData = checkStatus.data[0];
                                    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++) {
@@ -1049,7 +1054,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);
                                    }
@@ -1063,7 +1068,11 @@
                                end: function () {
                                    //通过供应商id获取税率
                                    var HSupID = $("#HCusID").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_Customer/xg",
                                            //url: "http://localhost:12761/Gy_Supplier/xg",
@@ -1080,6 +1089,14 @@
                                                var HMoney = HQty * HPrice;                     //金额=数量*单价
                                                var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                                                var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                                                //数字精度
                                                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));
                                                obj.update({ //更新表格数据
                                                    "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                                    , "物料代码": OptionData.物料代码
@@ -1096,7 +1113,7 @@
                                                })
                                            }
                                        });
                                    } else {
                                    } else if (typeof (OptionData.HItemID) != "undefined") {
                                        obj.update({ //更新表格数据
                                            "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                            , "物料代码": OptionData.物料代码
@@ -1209,6 +1226,8 @@
                                //    return layer.msg("请选择一条数据");
                                //}
                                OptionData = checkStatus.data[0];
                                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++) {
@@ -1232,7 +1251,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);
                                }
@@ -1246,7 +1265,11 @@
                            end: function () {
                                //通过供应商id获取税率
                                var HSupID = $("#HCusID").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_Customer/xg",
                                        //url: "http://localhost:12761/Gy_Supplier/xg",
@@ -1263,6 +1286,14 @@
                                            var HMoney = HQty * HPrice;                     //金额=数量*单价
                                            var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                                            var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                                            //数字精度
                                            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));
                                            obj.update({ //更新表格数据
                                                "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                                , "物料代码": OptionData.物料代码
@@ -1279,7 +1310,7 @@
                                            })
                                        }
                                    });
                                } else {
                                } else if (typeof (OptionData.HItemID) != "undefined"){
                                    obj.update({ //更新表格数据
                                        "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                        , "物料代码": OptionData.物料代码
@@ -1539,6 +1570,30 @@
            }
            //#endregion
            //#region é€šè¿‡å®¢æˆ·id获取税率
            function getHTaxRateByHSupID() {
                var HTaxRate;
                //通过供应商id获取税率
                var HSupID = $("#HCusID").val();
                if (HSupID != 0) {
                    $.ajax({
                        url: GetWEBURL() + "/Gy_Customer/xg",
                        type: "GET",
                        async: false,
                        data: {
                            "HInterID": HSupID
                        },
                        success: function (d) {
                            HTaxRate = parseInt(d.data[0].增值税率);
                        }
                    });
                } else {
                    HTaxRate = 0;
                }
                return HTaxRate;
            }
            //#endregion
            //#region ä¿å­˜åŽæµè§ˆæ–¹æ³•
            function ReRoadBillMain() {
                location.replace('Add_Edit_Xs_POInStockBillList.html?OperationType=4&linterid=' + linterid + '&HSouceBillType=');