yusijie
2023-12-01 56b15c48939c9be8ed4fb1315d0cdbde963d3ea6
WebTM/views/ÏúÊÛ¹ÜÀí/ÏúÊÛ¶©µ¥/Add_Edit_Xs_SeOrderBillList.html
@@ -192,7 +192,7 @@
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">客户余额</label>
                                            <label class="layui-form-label">客户余额<i class="layui-icon layui-icon-tips" id="tips-HCusBalance"></i></label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="HCusBalance" id="HCusBalance" autocomplete="off" readonly>
                                            </div>
@@ -204,9 +204,15 @@
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">可用额度</label>
                                            <label class="layui-form-label">可用额度<i class="layui-icon layui-icon-tips" id="tips-HAvailableBalance"></i></label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="HAvailableBalance" id="HAvailableBalance" autocomplete="off" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">需求金额<i class="layui-icon layui-icon-tips" id="tips-HBillMoney"></i></label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="HBillMoney" id="HBillMoney" autocomplete="off" readonly>
                                            </div>
                                        </div>
                                    </div>
@@ -655,6 +661,8 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
                    case "HPrice":                                                       //单价
                        //数据格式校验
@@ -695,6 +703,8 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
                    case "HTaxRate":                                                       //数量
                        //数据格式校验
@@ -735,6 +745,8 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
                    case "HTaxPrice":                                                       //数量
                        //数据格式校验
@@ -775,11 +787,38 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
                    default:
                }
            });
            //#endregion
            //#endregion
            //#region æ–‡æœ¬æ¡†ç›‘听
            $(document).ready(function () {
                //#region å®¢æˆ·ä½™é¢æç¤ºä¿¡æ¯
                $("#tips-HCusBalance").on('click', function (data) {
                    var tips_Message = "客户余额 = æœŸåˆ+本期收款(已审核)-本期退款(已审核)-本期出库(已审核)+本期退货(已审核)";
                    layer.alert(tips_Message, { icon: 0, btn: ['退出'], time: 100000, offset: 't' });
                });
                //#endregion
                //#region å¯ç”¨ä½™é¢æç¤ºä¿¡æ¯
                $("#tips-HAvailableBalance").on('click', function (data) {
                    var tips_Message = "可用额度 = å®¢æˆ·ä½™é¢ + ä¿¡ç”¨é¢åº¦ - ï¼ˆæœ¬æœŸé”€å”®è®¢å•总金额 * 0.5)";
                    layer.alert(tips_Message, { icon: 0, btn: ['退出'], time: 100000, offset: 't' });
                });
                //#endregion
                //#region éœ€æ±‚金额
                $("#tips-HBillMoney").on('click', function (data) {
                    var tips_Message = "需求金额 = ä»·ç¨Žåˆè®¡ * 0.5";
                    layer.alert(tips_Message, { icon: 0, btn: ['退出'], time: 100000, offset: 't' });
                });
                //#endregion
            });
            //#endregion
            //#endregion
@@ -889,24 +928,25 @@
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , totalRow: true
                    , limit: 500
                    , height: 500
                    , loading: false
                    , cols: [[ //子表
                        { type: 'checkbox', totalRowText: '合计行', style: 'background-color:#efefef4d;' }
                        , { type: 'numbers', title: '序号', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { type: 'numbers', title: '序号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '物料代码', title: '物料代码', width: 150, edit: 'text', event: "HMaterID" }//f7
                        , { field: '物料名称', title: '物料名称', width: 150, style: 'background-color:#efefef4d;' }
                        , { field: '规格型号', title: '规格型号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '计量单位', title: '计量单位', width: 100, style: 'background-color:#efefef4d;' }//f7
                        , { field: 'HQty', title: '数量', width: 100, edit: 'text' }
                        , { field: 'HQty', title: '数量', width: 100, totalRow: true, edit: 'text' }
                        , { field: 'HPrice', title: '单价', width: 100, edit: 'text' }
                        , { field: 'HTaxRate', title: '税率', width: 100, edit: 'text' }
                        , { 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: 'HMoney', title: '金额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotal', title: '价税合计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HDate', title: '交货日期', event: "HDate", width: 120 }
                        , { field: 'HRemark', title: '备注', width: 100, edit: 'text' }
@@ -946,6 +986,9 @@
                option.data = rowdata;
                table.render(option);
                //设置表头所需金额
                set_HBillMoney();
            }
            //#endregion
@@ -1069,6 +1112,9 @@
                            option.cols[0][20].edit = null;
                            table.render(option);
                            //设置表头所需金额
                            set_HBillMoney();
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
@@ -1573,6 +1619,8 @@
                table.cache["mainTable"].push(NewRow);
                option.data = table.cache["mainTable"];
                table.render(option);
                //设置表头所需金额
                set_HBillMoney();
                //rows++;
                layer.msg('增加一行按钮!')
            }
@@ -1594,6 +1642,8 @@
                    }
                    option.data = tables;
                    table.render(option);
                    //设置表头所需金额
                    set_HBillMoney();
                } else {
                    layer.msg('请选择一行数据编辑!');
                }
@@ -1618,6 +1668,8 @@
                    option.data[option.data.length - 1].HWeight = "0";
                    table.render(option);//将数据渲染到表格上
                    //设置表头所需金额
                    set_HBillMoney();
                }
            }
            //#endregion
@@ -1642,6 +1694,8 @@
                            option.data[i - 1] = data[0];
                            option.data[i] = tables[0];
                            table.render(option);
                            //设置表头所需金额
                            set_HBillMoney();
                            break;
                        }
                    }
@@ -1673,6 +1727,8 @@
                            option.data[i + 1] = data[0];
                            option.data[i] = tables[0];
                            table.render(option);
                            //设置表头所需金额
                            set_HBillMoney();
                            break;
                        }
                    }
@@ -1698,6 +1754,8 @@
                            oldData.splice(obj.tr.data('index'), 1);
                            option.data = oldData;
                            table.render(option);
                            //设置表头所需金额
                            set_HBillMoney();
                            layer.close(index);
                        }
                    });
@@ -1788,6 +1846,8 @@
                                    }
                                    table.render(option);
                                    //设置表头所需金额
                                    set_HBillMoney();
                                    layer.close(index);//关闭弹窗
                                }
@@ -1986,6 +2046,24 @@
            //#region æ‰“印
            function get_PrintReport() {
                //#region åˆ¤æ–­æºå•状态
                var HSourceBillData = "";
                var HSourceBillData = getSourceBillStatus_SeOrderBill();            //获取源单数据
                if (HSourceBillData != "none") {
                    if (HSourceBillData.length == 0) {
                        layer.alert("打印失败!未查询到单据信息!", { icon: 5 });
                        return;
                    } else if (HSourceBillData[0]["状态"] != "已审核") {
                        layer.alert("打印失败!单据状态未为'已审核'状态!", { icon: 5 });
                        return;
                    }
                } else {
                    return;
                }
                //#endregion
                var InterID = $("#HInterID").val();
                $.ajax({
                    type: "GET",
@@ -2012,6 +2090,39 @@
                });
            }
            //#endregion
            //#region è®¾ç½®è¡¨å¤´æ‰€éœ€é‡‘额
            function set_HBillMoney() {
                var HBillMoney = 0;
                for (var i = 0; i < option.data.length; i++) {
                    HBillMoney += option.data[i]["HlineTotal"] * 1;
                }
                $("#HBillMoney").val(HBillMoney * 0.5);
            }
            //#endregion
            //#region èŽ·å–æºå•-销售订单单据状态
            function getSourceBillStatus_SeOrderBill() {
                var HSourceBillData = "none";
                var sWhere = " and hmainid = " + $("#HInterID").val();
                $.ajax({
                    url: GetWEBURL() + '/Xs_SeOrderBill/list',
                    async: false,
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.count == 1) {
                            HSourceBillData = data1.data;
                        } else {
                            layer.alert(data1.code + "单据状态判断失败!", { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                return HSourceBillData;
            }
            //#endregion
            //#endregion