1
cwjbxqmz
2023-11-14 66a7d3c6b9aefe3c5142ada65670f172cffeee0a
WebTM/views/ÏúÊÛ¹ÜÀí/ÏúÊÛ¶©µ¥/Add_Edit_Xs_SeOrderBillList.html
@@ -200,7 +200,7 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label">客户余额</label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="" id="" autocomplete="off" readonly>
                                                <input class="layui-input" name="HCusBalance" id="HCusBalance" autocomplete="off" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -407,6 +407,10 @@
            //#region åˆå§‹åŒ–组织
            Organ();
            //#endregion
            //#region é¡µé¢åˆå§‹åŒ–后,根据客户获取客户余额
            getCustomerBalance( $("#HCusID").val() );
            //#endregion
            //#region åˆ—设置:子表1
@@ -694,6 +698,46 @@
                        });
                        table.render(option);
                        break;
                    case "HTaxPrice":                                                       //数量
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp)) {
                            //恢复数据到编辑前
                            obj.update({
                                HTaxPrice: oldText
                            });
                            table.render(option);
                            layer.msg("含税单据请输入不小于0的数字!");
                            return;
                        }
                        //数据校验合格,重算记录
                        var HQty = obj.data.HQty * 1;                   //数量
                        var HTaxRate = obj.data.HTaxRate * 0.01;        //税率
                        var HTaxPrice = value * 1;                          //含税单价=单价*(1+税率)
                        var HPrice = HTaxPrice / (1 + HTaxRate);        //单价=含税单据/(1+税率)
                        /*var HDiscountRate = obj.data.HDiscountRate * 1; //折扣率*/
                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //实际含税单价=含税单价*折扣率*/
                        //折扣额 = å«ç¨Žå•ä»· * (1 - æŠ˜æ‰£çއ) * æ•°é‡
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxMoney = HMoney * HTaxRate;              //税额=金额*税率
                        var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HTaxRate: HTaxRate * 100
                            , HTaxPrice: HTaxPrice
                            , HMoney: HMoney
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        break;
                    default:
                }
            });
@@ -822,7 +866,7 @@
                        , { field: 'HQty', title: '数量', width: 100, edit: 'text' }
                        , { field: 'HPrice', title: '单价', width: 100, edit: 'text' }
                        , { field: 'HTaxRate', title: '税率', width: 100, edit: 'text' }
                        , { field: 'HTaxPrice', title: '含税单价', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HTaxPrice', title: '含税单价', width: 100, edit: 'text' }
                        , { field: 'HMoney', title: '金额', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotal', title: '价税合计', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HDate', title: '交货日期', event: "HDate", width: 120 }
@@ -1040,6 +1084,9 @@
                            return layer.msg('请选择数据');
                        }
                        getCustomerByCusID(checkStatus.data[0].HItemID);
                        //根据客户获取客户余额
                        getCustomerBalance(checkStatus.data[0].HItemID);
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
@@ -1684,7 +1731,7 @@
                                        var HlineTotal = HMoney + HTaxMoney;                        //价税合计=金额+税额
                                        option.data[rowIndex + i].HMaterID = resultData.HMaterID;
                                        option.data[rowIndex + i].HMaterID = resultData.HItemID;
                                        option.data[rowIndex + i].物料代码 = resultData.物料代码;
                                        option.data[rowIndex + i].物料名称 = resultData.物料名称;
                                        option.data[rowIndex + i].规格型号 = resultData.规格型号;
@@ -1893,7 +1940,10 @@
        {
            //$("#HCusName").val(obj[0].HName);
            //$("#HCusID").val(obj[0].HItemID);
            //根据客户获取相关信息
            getCustomerByCusID(obj[0].HItemID);
            //根据客户获取客户余额
            getCustomerBalance(obj[0].HItemID);
        }
        function GetHManagerValue(obj)  //返回主管
@@ -1908,7 +1958,7 @@
            $("#HDeptID").val(obj[0].HItemID);
        }
        //#region æ ¹æ®å®¢æˆ·èŽ·å–å¸åˆ«ã€æ±‡çŽ‡ã€ç»“ç®—æ–¹å¼
        //#region æ ¹æ®å®¢æˆ·èŽ·å–å¸åˆ«ã€æ±‡çŽ‡ã€ç»“ç®—æ–¹å¼ã€å®¢æˆ·ä¿¡ç”¨é¢åº¦ã€è”ç³»äººã€è”ç³»ç”µè¯
        function getCustomerByCusID(HCusID) {
            $.ajax({
                url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
@@ -1929,6 +1979,8 @@
                        $("#HSSID").val(data.HSSID);
                        $("#HSSName").val(data.HSSName);
                        $("#HCreditRating_Now").val(data.HCreditRating_Now);
                        $("#HLinkMan").val(data.HLinkMan);
                        $("#HLinkPhone").val(data.HLinkPhone);
                        subHTaxRate = data.HTaxRate;
@@ -1941,6 +1993,31 @@
            });
        }
        //#endregion
        //#region æ ¹æ®å®¢æˆ·èŽ·å–å®¢æˆ·ä½™é¢
        function getCustomerBalance(HCusID) {
            $.ajax({
                url: GetWEBURL() + "/Xs_CusRatingChangeBill/getCustomerBalance",
                async: false,
                type: "GET",
                data: {
                    "HCusID": HCusID
                },
                success: function (result) {
                    if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        var data = result.data[0];
                        $("#HCusBalance").val(data.HCusBalance == null ? 0 : data.HCusBalance);
                        $("#HCreditRating_Now").val(data.HCreditRating_Now == null ? 0 : data.HCreditRating_Now);
                    } else {
                        layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    }
                }, error: function () {
                    layer.alert("发生错误!", { icon: 5 });
                }
            });
        }
        //#endregion
    </script>
</body>
</html>