From 7df042662e1929abdd667cfd7b037f4e10e8c2ad Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 14 三月 2024 11:27:56 +0800
Subject: [PATCH] 其他应付单 增加子表保存,目录放到采购管理,其他入库单编辑模块 并完善 其他出库单 列表功能;( 常规 功能, 新增,修改,删除,审核,作废,关闭,自定义过滤,源单类型列表(源单 手工录入), 合计行,保存控制,审核控制,删除控制,关联数回填 等等 ) (注: 基础资料选择, 均用 基础资料列表 的方式)

---
 WebTM/views/采购管理/采购订单/Cg_POOrderBillEdit.html |  591 ++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 463 insertions(+), 128 deletions(-)

diff --git "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\350\256\242\345\215\225/Cg_POOrderBillEdit.html" "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\350\256\242\345\215\225/Cg_POOrderBillEdit.html"
index 8a34bde..d8925b5 100644
--- "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\350\256\242\345\215\225/Cg_POOrderBillEdit.html"
+++ "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\350\256\242\345\215\225/Cg_POOrderBillEdit.html"
@@ -15,6 +15,7 @@
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
     <script src="../../../layuiadmin/PubCustom.js"></script>
     <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
+    <script src="../../../layuiadmin/PageTitle.js"></script>
     <style type="text/css">
         .layui-form-item .layui-inline {
             margin-right: 0;
@@ -80,41 +81,7 @@
                                             </div>
                                         </div>
                                     </div>
-                                    <div class="layui-row">
-                                        <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">閲囪喘閮ㄩ棬</label>
-                                            <div class="layui-input-inline">
-                                                <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="0" style="float:left;width:150px;">
-                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HDeptList" style="width:40px;">
-                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
-                                                </button>
-                                            </div>
-                                        </div>
-                                        <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">浜よ揣鍦扮偣</label>
-                                            <div class="layui-input-inline">
-                                                <input class="layui-input" name="HAddress" id="HAddress" autocomplete="off">
-                                            </div>
-                                        </div>
-                                        <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">姹囩巼</label>
-                                            <div class="layui-input-inline">
-                                                <input class="layui-input" name="HExRate" id="HExRate" autocomplete="off" value="0">
-                                            </div>
-                                        </div>
-                                    </div>
-                                    <div class="layui-row">
-                                        <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">閲囪喘鍛�</label>
-                                            <div class="layui-input-inline">
-                                                <input type="text" name="HEmpName" id="HEmpName" " class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="0" style="float:left;width:150px;">
-                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;">
-                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
-                                                </button>
-                                            </div>
-                                        </div>
+                                    <div class="layui-row">                                        
                                         <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">甯佸埆</label>
                                             <div class="layui-input-inline">
@@ -126,11 +93,45 @@
                                             </div>
                                         </div>
                                         <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">姹囩巼</label>
+                                            <div class="layui-input-inline">
+                                                <input class="layui-input" name="HExRate" id="HExRate" autocomplete="off" value="0">
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">浜よ揣鍦扮偣</label>
+                                            <div class="layui-input-inline">
+                                                <input class="layui-input" name="HAddress" id="HAddress" autocomplete="off">
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">閲囪喘鍛�</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" name="HEmpName" id="HEmpName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">閲囪喘閮ㄩ棬</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HDeptList" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">渚涘簲鍟�</label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HCusName" id="HCusName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HCusID" id="HCusID" class="layui-input" value="0" style="float:left;width:150px;">
-                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HCusList" style="width:40px;">
+                                                <input type="text" name="HSupName" id="HSupName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="hidden" name="HSupID" id="HSupID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HSupList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                 </button>
                                             </div>
@@ -150,9 +151,9 @@
                                         <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">閲囪喘鏂瑰紡</label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HSellSName" id="HSellSName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HSellSID" id="HSellSID" class="layui-input" value="0" style="float:left;width:150px;">
-                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HSellSList" style="width:40px;">
+                                                <input type="text" name="HPSStyleName" id="HPSStyleName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="hidden" name="HPSStyleID" id="HPSStyleID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HPSStyleList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                 </button>
                                             </div>
@@ -311,6 +312,7 @@
                 , admin = layui.admin
                 , layer = layui.layer
                 , table = layui.table
+                , laydate = layui.laydate
                 , form = layui.form
                 , element = layui.element;
             var sWhere = "";
@@ -328,6 +330,13 @@
             //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             get_LoginIs();
 
+            //#region 銆愬姩鎬佽幏鍙栨ā鍧楀悕绉般��
+            var HModuleType = "1102";
+            //閫氳繃鍗曟嵁绫诲瀷锛屼粠鏁版嵁搴撳姩鎬佽幏鍙栧崟鎹ā鍧楀懡鍚�,寮曠敤js鏂囦欢 PageTitle.js
+            var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
+            $("h1").html('<b>' + HPageTitle + '</b>');
+            //#endregion
+
             //鑾峰彇椤甸潰璺宠浆鍙傛暟
             var params = get_UrlVars();
             var OperationType = params[params[0]]; //浠庡弬鏁颁腑鑾峰彇 鏁版嵁绫诲瀷  1娣诲姞 淇濆瓨  2澶嶅埗  3 缂栬緫
@@ -338,6 +347,7 @@
             //鍒ゆ柇鏄惁鏂板
             if (linterid == null || linterid == 0) {
                 //鑾峰彇鏈�澶у崟鎹彿 new
+                $("#HMaker").val(sessionStorage["HUserName"]);
                 $("#HInterID").val("0");
                 $("#HBillNo").val("");
                 $.ajax({
@@ -360,7 +370,7 @@
 
             var rowdata = [{
                 "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "鏁伴噺": "", "HRemark": ""
-                , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0"
+                , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0","HDate":"2022-12-05"
             }];
 
             // 鍒濆鍖栫晫
@@ -373,7 +383,7 @@
                 //鏂板琛岃〃鏍兼暟鎹�
                 var NewRow = {
                     "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "鏁伴噺": "", "HRemark": ""
-                    , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0"
+                    , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0", "HDate": "2022-12-05"
                 };
                 switch (obj.event) {
                     case 'btn-AddLine':
@@ -416,17 +426,17 @@
                 Pub_Close(1);
             })
 
-            //閫夋嫨涓氬姟鍛樻寜閽�
+            //閫夋嫨閲囪喘鍛樻寜閽�
             form.on('submit(HEmpList)', function () {
                 get_checkEmp();
             });
             //閫夋嫨瀹㈡埛鎸夐挳
-            form.on('submit(HCusList)', function () {
-                get_checkCus();
+            form.on('submit(HSupList)', function () {
+                get_checkSup();
             });
             //閫夋嫨閿�鍞柟寮忔寜閽�
-            form.on('submit(HSellSList)', function () {
-                get_checkSellS();
+            form.on('submit(HPSStyleList)', function () {
+                get_checkPSStyle();
             });
             //閫夋嫨缁撶畻鎸夐挳
             form.on('submit(HSSList)', function () {
@@ -457,12 +467,237 @@
             table.on('tool(mainTable)', function (obj) {
                 set_GridDelete(obj);   //琛屽唴鍒犻櫎
                 set_GridCellCheck(obj); //琛屽唴蹇嵎閿瓫閫�
+
+                var data = obj.data;
+                if (obj.event == 'HDate') {
+                    var field = $(this).data('field');
+                    laydate.render({
+                        elem: this.firstChild
+                        , show: true //鐩存帴鏄剧ず
+                        , closeStop: this
+                        , done: function (nowDate) {
+                            //鏃堕棿閫夋嫨瀹屾垚锛岃鏁版嵁鏇存柊
+                            data[field] = nowDate;
+                            obj.update(data);
+                            //鍒锋柊澶嶉�夋
+                            //checkRefresh();
+                        }
+                    });
+                }
             });
 
             //#endregion
 
 
-            //#region 鏈〉闈㈡墍鏈夎璋冪敤鐨勬柟娉�
+            //#region 鐩戝惉鍗曞厓鏍肩紪杈�  鍗曞厓鏍肩紪杈戝悗 鍙樻洿
+            table.on('edit(mainTable)', function (obj) {
+                //鏁板�兼牸寮忔牎楠屽伐鍏�
+                var ref = /^\d+(\.\d+)?$/;          //闈炶礋鏁版鍒欒〃杈惧紡
+                var temp = "";
+
+                // 鍗曞厓鏍肩紪杈戜箣鍓嶇殑鍊�
+                var oldText = $(this).prev().text();
+                var value = obj.value //寰楀埌淇敼鍚庣殑鍊�
+                    , data = obj.data //寰楀埌鎵�鍦ㄨ鎵�鏈夐敭鍊�
+                    , field = obj.field; //寰楀埌瀛楁
+                //#endregion
+
+                switch (field) {
+                    case "HQty":                                         //鏁伴噺
+                        //鏁版嵁鏍煎紡鏍¢獙
+                        temp = value + "";
+                        if (!ref.test(temp) || temp == 0) {
+                            //鎭㈠鏁版嵁鍒扮紪杈戝墠
+                            obj.update({
+                                HQty: oldText
+                            });
+                            table.render(option);
+
+                            layer.msg("鏁伴噺璇疯緭鍏ュぇ浜�0鐨勬暟瀛�!");
+                            return;
+                        }
+
+
+                        //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                        var HQty = value * 1;                           //鏁伴噺
+                        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 HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+                        var HExRate = $("#HExRate").val();                      //姹囩巼
+                        var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4));      //鏈綅甯佷环绋庡悎璁�=(绋庨+閲戦)*姹囩巼
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HQty: HQty
+                            , HPrice: HPrice
+                            , HMoney: HMoney
+                            , HTaxMoney: HTaxMoney
+                            , HlineTotal: HlineTotal
+                            , HlineTotalBB: HlineTotalBB
+                        });
+                        break;
+                    case "HPrice":                                         //鍗曚环
+                        //鏁版嵁鏍煎紡鏍¢獙
+                        temp = value + "";
+                        if (!ref.test(temp) || temp == 0) {
+                            //鎭㈠鏁版嵁鍒扮紪杈戝墠
+                            obj.update({
+                                HPrice: oldText
+                            });
+
+                            layer.msg("鍗曚环璇疯緭鍏ュぇ浜�0鐨勬暟瀛�!");
+                            return;
+                        }
+
+                        //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                        var HQty = obj.data.HQty * 1;                   //鏁伴噺
+                        var HPrice = value * 1;
+                        var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
+                        var HTaxRate = obj.data.HTaxRate * 0.01;           //绋庣巼 
+                        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 HExRate = $("#HExRate").val();                      //姹囩巼
+                        var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4));     //鏈綅甯佷环绋庡悎璁�=(绋庨+閲戦)*姹囩巼
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HQty: HQty
+                            , HPrice: HPrice
+                            , HMoney: HMoney
+                            , HTaxMoney: HTaxMoney
+                            , HlineTotal: HlineTotal
+                            , HTaxPrice, HTaxPrice
+                            , HRelTaxPrice: HRelTaxPrice
+                            , HlineTotalBB: HlineTotalBB
+                        });
+                        break;
+                    case "HTaxRate":                                                       //鏁伴噺
+                        //鏁版嵁鏍煎紡鏍¢獙
+                        temp = value + "";
+                        if (!ref.test(temp)) {
+                            //鎭㈠鏁版嵁鍒扮紪杈戝墠
+                            obj.update({
+                                HTaxRate: oldText
+                            });
+
+                            layer.msg("绋庣巼璇疯緭鍏ヤ笉灏忎簬0鐨勬暟瀛�!");
+                            return;
+                        }
+
+
+                        //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                        var HTaxRate = obj.data.HTaxRate * 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));         //绋庨=閲戦*绋庣巼
+                        var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4));        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                        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 HExRate = $("#HExRate").val();                       //姹囩巼
+                        var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4));       //鏈綅甯佷环绋庡悎璁�=(绋庨+閲戦)*姹囩巼
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HTaxRate: HTaxRate * 100
+                            , HQty: HQty
+                            , HPrice: HPrice
+                            , HMoney: HMoney
+                            , HTaxMoney: HTaxMoney
+                            , HTaxPrice: HTaxPrice
+                            , HlineTotal: HlineTotal
+                            , HTaxPrice, HTaxPrice
+                            , HRelTaxPrice: HRelTaxPrice
+                            , HlineTotalBB: HlineTotalBB
+                        });
+                        break;
+                    case "HDiscountRate":                                                       //鏁伴噺
+                        //鏁版嵁鏍煎紡鏍¢獙
+                        temp = value + "";
+                        if (!ref.test(temp)) {
+                            //鎭㈠鏁版嵁鍒扮紪杈戝墠
+                            obj.update({
+                                HDiscountRate: oldText
+                            });
+
+                            layer.msg("鎶樻墸鐜囪杈撳叆涓嶅皬浜�0鐨勬暟瀛�!");
+                            return;
+                        }
+
+
+                        //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                        var HTaxRate = obj.data.HTaxRate * 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));         //绋庨=閲戦*绋庣巼
+                        var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4));        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                        var HDiscountRate = obj.data.HDiscountRate * 1;     //鎶樻墸鐜�
+                        var HRelTaxPrice = Number((HTaxPrice * HDiscountRate).toFixed(4));   //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�
+
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HTaxRate: HTaxRate * 100
+                            , HQty: HQty
+                            , HPrice: HPrice
+                            , HMoney: HMoney
+                            , HTaxMoney: HTaxMoney
+                            , HTaxPrice: HTaxPrice
+                            , HDiscountRate: HDiscountRate
+                            , HRelTaxPrice: HRelTaxPrice
+                        });
+                        break;
+                        table.render(option);
+                    default:
+                }
+            });
+            //#endregion
+            //#endregion
+            //#endregion
+
+            //#region 鏂囨湰妗嗙洃鍚�
+            $(document).ready(function () {
+                //#region 姹囩巼澶辩劍浜嬩欢
+                var oldHExRate = "";                          //淇敼鍓嶇殑鍊�
+                var newHExRate = "";                          //淇敼鍚庣殑鍊�
+                $("#HExRate").on('focus', function (data) {
+                    oldHExRate = $("#HExRate").val() * 1;   //姹囩巼鏂囨湰妗嗚幏鍙栫劍鐐规椂鑾峰彇淇敼鍓嶇殑鍊�
+                }).on('blur', function (data) {
+                    newHExRate = $("#HExRate").val();       //姹囩巼鏂囨湰妗嗗け鐒︽椂鑾峰彇淇敼鍚庣殑鍊�
+
+                    //鍒ゆ柇杈撳叆鐨勬眹鐜囨槸鍚﹀悎娉�
+                    var ref = /^\d+(\.\d+)?$/;          //闈炶礋鏁版鍒欒〃杈惧紡
+                    if (!ref.test(newHExRate)) {
+                        layer.msg("姹囩巼璇疯緭鍏ヤ笉灏忎簬0鐨勬暟瀛�!");
+                        $("#HExRate").val(oldHExRate);
+                        return false;
+                    }
+
+                    //杈撳叆鐨勬眹鐜囧悎娉曪紝閲嶇畻
+                    var HExRate = newHExRate * 1;                       //姹囩巼
+                    $("#HExRate").val(HExRate);
+
+                    for (var i = 0; i < option.data.length; i++) {
+                        var HMoney = option.data[i].HMoney;
+                        var HTaxMoney = option.data[i].HTaxMoney;
+                        option.data[i].HlineTotalBB = (option.data[i].HMoney + option.data[i].HTaxMoney) * HExRate;
+                    }
+                    table.render(option);
+
+                });
+                //#endregion
+            });
+            //#endregion
+
+            //#region 鏈〉闈㈡墍鏈夎璋冪敤鐨勬柟娉�           
 
             //#region 鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             function get_LoginIs() {
@@ -492,28 +727,30 @@
                 option = {
                     elem: '#mainTable'
                     , toolbar: '#toolbarDemo'
+                    , totalRow: true
                     , limit: 500
                     , height: 500
                     , loading: false
                     , cols: [[ //瀛愯〃
-                        { type: 'checkbox', totalRowText: '鍚堣琛�' }
-                        , { type: 'numbers', title: '搴忓彿', width: 100, totalRow: true }
+                        { type: 'checkbox', fixed: 'left', totalRowText: '鍚堣琛�' }
+                        , { type: 'numbers', title: '搴忓彿', width: 100}
                         , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                         , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, edit: 'text', event: "HMaterID" }//f7
                         , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, }
                         , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, }
                         , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true }
                         , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, edit: 'text', event: "HUnitID" }//f7
-                        , { field: 'HQty', title: '鏁伴噺', width: 100, edit: 'text' }
-                        , { field: 'HPrice', title: '涓嶅惈绋庡崟浠�', width: 100, edit: 'text' }
-                        , { field: 'HTaxPrice', title: '鍚◣鍗曚环', width: 100, edit: 'text' }
-                        , { field: 'HMoney', title: '閲戦', width: 100, edit: 'text' }
-                        , { field: 'HDiscountRate', title: '鎶樻墸鐜�', width: 100, edit: 'text' }
+                        , { field: 'HQty', title: '鏁伴噺', width: 100, edit: 'text', totalRow: true}
+                        , { field: 'HPrice', title: '鍗曚环', width: 100, edit: 'text'}
+                        , { field: 'HTaxPrice', title: '鍚◣鍗曚环', width: 100, edit: 'text'}
+                        , { field: 'HMoney', title: '閲戦', width: 100, totalRow: true }
+                        , { field: 'HDiscountRate', title: '鎶樻墸鐜�', width: 100, edit: 'text'}
                         , { field: 'HRelTaxPrice', title: '瀹為檯鍚◣鍗曚环', width: 110, }
                         , { field: 'HTaxRate', title: '绋庣巼', width: 100, edit: 'text' }
                         , { field: 'HTaxMoney', title: '绋庨', width: 100, }
-                        , { field: 'HlineTotal', title: '浠风◣鍚堣', width: 100, }
+                        , { field: 'HlineTotal', title: '浠风◣鍚堣', width: 100, edit: 'text' }
                         , { field: 'HlineTotalBB', title: '鏈綅甯佷环绋庡悎璁�', width: 120, }
+                        , { field: 'HDate', title: '鍒拌揣鏃ユ湡', width: 120, event: 'HDate'}
                         , { field: 'HRemark', title: '澶囨敞', width: 100, edit: 'text' }
                         , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
                     ]]
@@ -528,7 +765,7 @@
                 //鏌ヨ妫�楠屾柟妗堝崟鏄惁瀛樺湪
                 var ajaxLoad = layer.load();
                 $.ajax({
-                    url: GetWEBURL() + "/Xs_SeOrderBill/cx",
+                    url: GetWEBURL() + "/Cg_POOrderBill/cx",
                     type: "GET",
                     data: {
                         "HInterID": linterid
@@ -542,11 +779,11 @@
                                 , "HDate": formatDate(data.鏃ユ湡)
                                 , "HSSDate": formatDate(data.缁撶畻鏃ユ湡)
                                 //, "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
-                                , "HAddress": data.浜よ揣鍦板潃
+                                , "HAddress": data.浜よ揣鍦扮偣
                                 , "HDeptName": data.閮ㄩ棬
                                 , "HDeptID": data.HDeptID
-                                , "HCusID": data.HCusID
-                                , "HCusName": data.瀹㈡埛
+                                , "HSupID": data.HSupID
+                                , "HSupName": data.渚涘簲鍟�
                                 , "HEmpID": data.HEmpID
                                 , "HEmpName": data.涓氬姟鍛�
                                 , "HCurID": data.HCurID
@@ -554,8 +791,8 @@
                                 , "HExRate": data.姹囩巼
                                 , "HManagerName": data.涓荤
                                 , "HManagerID": data.HManagerID
-                                , "HSellSID": data.HSellSID
-                                , "HSellSName": data.閿�鍞柟寮�
+                                , "HPSStyleID": data.HPSStyleID
+                                , "HPSStyleName": data.閲囪喘鏂瑰紡
                                 , "HSSID": data.HSSID
                                 , "HSSName": data.缁撶畻鏂瑰紡
                                 , "HLinkMan": data.鑱旂郴浜�
@@ -583,6 +820,7 @@
                                         , "HPrice": data.鍗曚环, "HMoney": data.閲戦, "HTaxRate": data.绋庣巼
                                         , "HTaxMoney": data.閲戦 * data.绋庣巼, "HlineTotal": data.閲戦 + data.绋庨, "HlineTotalBB": (data.閲戦 + data.绋庨) * data.姹囩巼
                                         , "HTaxPrice": data.鍚◣鍗曚环, "HDiscountRate": data.鎶樻墸鐜�, "HRelTaxPrice": data.瀹為檯鍚◣鍗曚环
+                                        , "HDate": Format(new Date(data.浜よ揣鏃ユ湡), "yyyy-MM-dd")
                                     }
                                 )
                             }
@@ -606,7 +844,31 @@
             //#region 淇濆瓨鏂规硶
             function set_SaveBill(data) {
 
-                //var sMainStr = JSON.stringify(data.field) + ";" + sessionStorage["HUserName"];
+                if ($("#HCurID").val() == 0) {
+                    layer.msg("璇烽�夋嫨甯佸埆锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return;
+                }
+                if ($("#HExRate").val() == 0) {
+                    layer.msg("璇疯緭鍏ユ眹鐜囷紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return;
+                }
+                if ($("#HEmpID").val() == 0) {
+                    layer.msg("璇烽�夋嫨閲囪喘鍛橈紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return;
+                }
+                if ($("#HDeptID").val() == 0) {
+                    layer.msg("璇烽�夋嫨閲囪喘閮ㄩ棬锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return;
+                }
+                if ($("#HSupID").val() == 0) {
+                    layer.msg("璇烽�夋嫨渚涘簲鍟嗭紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return;
+                }
+                if ($("#HPSStyleID").val() == 0) {
+                    layer.msg("璇烽�夋嫨閲囪喘鏂瑰紡锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return;
+                }
+
                 var num = [];
                 for (var i = 0; i < table.cache["mainTable"].length; i++) {
                     if (table.cache["mainTable"][i] != "") {
@@ -623,7 +885,7 @@
 
                 $.ajax({
                     type: "POST",
-                    url: GetWEBURL() + "Xs_SeOrder/SeOrderBillEdit", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    url: GetWEBURL() + "Cg_POOrderBill/POOrderBillEdit", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
                     async: true,
                     data: { "sMainSub": sMainSub },
                     dataType: "json",
@@ -649,7 +911,7 @@
             //#endregion
 
             //琛屽唴蹇嵎閿瓫閫�
-            function set_GridCellCheck(obj) {
+            function set_GridCellCheck(obj) {               
                 $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
                     if (event.key == "F7") {
                         //鐗╂枡
@@ -669,20 +931,48 @@
                                     var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
                                     var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
 
-                                    if (checkStatus.data.length != 1) {
-                                        return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
-                                    }
+                                    //if (checkStatus.data.length != 1) {
+                                    //    return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
+                                    //}
 
-                                    //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
-                                    obj.update({
-                                        "HMaterID": checkStatus.data[0].HItemID
-                                        , "鐗╂枡浠g爜": checkStatus.data[0].HNumber
-                                        , "鐗╂枡鍚嶇О": checkStatus.data[0].HName
-                                        , "瑙勬牸鍨嬪彿": checkStatus.data[0].HModel
-                                    })
-                                    layer.close(index);//鍏抽棴寮圭獥
+
+                                    var rowIndex = $(obj.tr).attr("data-index") * 1;
+                                    for (var i = 0; i < checkStatus.data.length; i++) {
+                                        if (rowIndex + i >= option.data.length) {
+                                            var NewRow = {
+                                                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "鏁伴噺": "", "HRemark": ""
+                                                , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0", "HDate": "2022-12-05"
+                                            };
+                                             
+                                            table.cache["mainTable"].push(NewRow);
+                                            option.data = table.cache["mainTable"];
+
+                                            table.render(option);
+                                        }
+
+
+
+                                        var HMaterID = checkStatus.data[i].HItemID;
+                                        var resultData = getMaterialByMaterID(HMaterID);
+                                        option.data[rowIndex + i].HMaterID = resultData.HMaterID;
+                                        option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.HMaterNumber;
+                                        option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.HMaterName;
+                                        option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.HMaterModel;
+                                        option.data[rowIndex + i].HUnitID = resultData.HUnitID;
+                                        option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.HUnitName;
+
+                                    }
+                                    table.render(option);
+                                    layer.closeAll();
+                                    //layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                                 }
-                            })
+                                , btn2: function (index, layero) {
+                                    //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                                    //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                                },
+                                end: function () {
+                                    }
+                                });
                         }
                         //璁¢噺鍗曚綅
                         if (obj.event == "HUnitID") {
@@ -701,7 +991,7 @@
                                     var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
                                     var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
 
-                                    if (checkStatus.data.length != 1) {
+                                    if (checkStatus.data.length != 0) {
                                         return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
                                     }
                                     //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
@@ -713,6 +1003,7 @@
                                 }
                             })
                         }
+                        
                         obj.event = "";
                         return false;
                     }
@@ -745,30 +1036,30 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '閲囪喘鍛樺垪琛�'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_EmployeeList.html', 'yes']
-                    , btn: ['纭畾', '鍙栨秷']
-                    , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
-                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
-                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
-                        if (checkStatus.data.length === 0) {
-                            return layer.msg('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HEmpName").val(checkStatus.data[0].HName);
-                        $("#HEmpID").val(checkStatus.data[0].HItemID);
-                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) { }
+                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_EmployeeList.html?Type=HEmp', 'yes']
+                    //, btn: ['纭畾', '鍙栨秷']
+                    //, btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                    //    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                    //    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                    //    if (checkStatus.data.length === 0) {
+                    //        return layer.msg('璇烽�夋嫨鏁版嵁');
+                    //    }
+                    //    $("#HEmpName").val(checkStatus.data[0].HName);
+                    //    $("#HEmpID").val(checkStatus.data[0].HItemID);
+                    //    layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    //}
+                    //, btn2: function (index, layero) { }
                 })
             }
 
-            function get_checkCus() {
+            function get_checkSup() {
                 layer.open({
                     type: 2//寮圭獥绫诲瀷
                     , skin: 'layui-layer-rim' //鍔犱笂杈规
                     , area: ['90%', '90%']//澶у皬
                     , title: '渚涘簲鍟嗗垪琛�'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_SupplierList.html', 'yes']
+                    , content: ['../../鍩虹璧勬枡/閲囪喘鍩虹璧勬枡/Gy_Supplier.html', 'yes']
                     , btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                         var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -776,8 +1067,8 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        $("#HCusName").val(checkStatus.data[0].HName);
-                        $("#HCusID").val(checkStatus.data[0].HItemID);
+                        $("#HSupName").val(checkStatus.data[0].渚涘簲鍟嗗悕绉�);
+                        $("#HSupID").val(checkStatus.data[0].HItemID);
                         layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) { }
@@ -801,6 +1092,7 @@
                         }
                         $("#HCurName").val(checkStatus.data[0].璐у竵鍚嶇О);
                         $("#HCurID").val(checkStatus.data[0].HItemID);
+                        $("#HExRate").val(checkStatus.data[0].姹囩巼)
                         layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) { }
@@ -815,18 +1107,18 @@
                     , title: '閲囪喘閮ㄩ棬鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
                     , content: ['../../Baseset/鍩虹璧勬枡/Gy_DepartmentList.html', 'yes']
-                    , btn: ['纭畾', '鍙栨秷']
-                    , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
-                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
-                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
-                        if (checkStatus.data.length === 0) {
-                            return layer.msg('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HDeptName").val(checkStatus.data[0].HName);
-                        $("#HDeptID").val(checkStatus.data[0].HItemID);
-                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) { }
+                    //, btn: ['纭畾', '鍙栨秷']
+                    //, btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                    //    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                    //    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                    //    if (checkStatus.data.length === 0) {
+                    //        return layer.msg('璇烽�夋嫨鏁版嵁');
+                    //    }
+                    //    $("#HDeptName").val(checkStatus.data[0].HName);
+                    //    $("#HDeptID").val(checkStatus.data[0].HItemID);
+                    //    layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    //}
+                    //, btn2: function (index, layero) { }
                 })
             }
 
@@ -837,32 +1129,30 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '涓荤鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_EmployeeList.html', 'yes']
-                    , btn: ['纭畾', '鍙栨秷']
-                    , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
-                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
-                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
-                        if (checkStatus.data.length === 0) {
-                            return layer.msg('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HManagerName").val(checkStatus.data[0].HName);
-                        $("#HManagerID").val(checkStatus.data[0].HItemID);
-                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) { }
+                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_EmployeeList.html?Type=HManager', 'yes']
+                    //, btn: ['纭畾', '鍙栨秷']
+                    //, btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                    //    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                    //    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                    //    if (checkStatus.data.length === 0) {
+                    //        return layer.msg('璇烽�夋嫨鏁版嵁');
+                    //    }
+                    //    $("#HManagerName").val(checkStatus.data[0].HName);
+                    //    $("#HManagerID").val(checkStatus.data[0].HItemID);
+                    //    layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    //}
+                    //, btn2: function (index, layero) { }
                 })
             }
 
-            //Gy_PoStockStyle
-
-            function get_checkSellS() {
+            function get_checkPSStyle() {
                 layer.open({
                     type: 2//寮圭獥绫诲瀷
                     , skin: 'layui-layer-rim' //鍔犱笂杈规
                     , area: ['90%', '90%']//澶у皬
                     , title: '閲囪喘鏂瑰紡鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_SellStyle.html', 'yes']
+                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_PoStockStyle.html', 'yes']
                     , btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                         var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -870,8 +1160,8 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        $("#HSellSName").val(checkStatus.data[0].HName);
-                        $("#HSellSID").val(checkStatus.data[0].HItemID);
+                        $("#HPSStyleName").val(checkStatus.data[0].HName);
+                        $("#HPSStyleID").val(checkStatus.data[0].HItemID);
                         layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) { }
@@ -901,6 +1191,31 @@
                 })
             }
 
+            //#region 鏍规嵁鐗╂枡ID鑾峰彇鐗╂枡璇︾粏淇℃伅
+            function getMaterialByMaterID(HMaterID) {
+                var resultData = {};
+                $.ajax({
+                    url: GetWEBURL() + "Cg_POOrderBill/getMaterialByMaterID",
+                    async: false,
+                    type: "GET",
+                    data: {
+                        "HMaterID": HMaterID
+                    },
+                    success: function (result) {
+                        if (result.code == 1) {
+                            var data = result.data;
+                            resultData = data[0];
+                        } else {
+                            layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                        }
+                    }, error: function () {
+                        layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                    }
+                });
+                return resultData;
+            }
+            //#endregion
+
             //#region 淇濆瓨鍚庢祻瑙堟柟娉�
             function ReRoadBillMain() {
                 location.replace('Add_Edit_Cg_POInStockBillList.html?OperationType=4&linterid=' + linterid + '&HSouceBillType=');
@@ -913,7 +1228,27 @@
 
 
             //浠ヤ笂鏄痩ayui妯″潡
+
         });
+       // 鍩虹璧勬枡杩斿洖鏁版嵁
+       function GetHEmpValue(obj)  //杩斿洖閲囪喘鍛�
+       {
+           $("#HEmpName").val(obj[0].HName);
+           $("#HEmpID").val(obj[0].HItemID);
+       }
+
+       function GetHDeptNameValue(obj)  //杩斿洖閲囪喘閮ㄩ棬
+       {
+           $("#HDeptName").val(obj[0].HName);
+           $("#HDeptID").val(obj[0].HItemID);
+        } 
+
+        function GetHManagerValue(obj)  //杩斿洖涓荤
+        {
+            $("#HManagerName").val(obj[0].HName);
+            $("#HManagerID").val(obj[0].HItemID);
+        }
+
     </script>
 </body>
-</html>
\ No newline at end of file
+</html>     
\ No newline at end of file

--
Gitblit v1.9.1