From 8a36bbee40f5e1069b15a98b1e64ac9719ee8a46 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 23 四月 2024 17:17:13 +0800
Subject: [PATCH] 1.销售出库单 增加 反写源单 销售订单和发货通知单   超出 关联数量  关闭源单 2.应收单 增加  反写源单 销售出库单 和 销售订单  超出关联数量  关闭源单 3.动态获取源单增加参数 Num 0蓝单   1红单  2全部 4.销售流程的测试并完善功能; 销售订单-》发货通知单-》销售出库单-》应收单 (注意: 源单类型的下拉框 需要 根据数据库 表动态加载, 关联数量 要准确 , 审核 且 未关闭 未行关闭的行 才能下推 ,关联数量超额后,要 反写 关闭 源单 )

---
 WebTM/views/采购管理/退料通知单/Add_Edit_Cg_POInStockBackBillList.html |  896 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 760 insertions(+), 136 deletions(-)

diff --git "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\200\200\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBackBillList.html" "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\200\200\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBackBillList.html"
index 1be3ef4..7c73c46 100644
--- "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\200\200\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBackBillList.html"
+++ "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\200\200\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBackBillList.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-top: 5px;
@@ -47,7 +48,8 @@
                 <form class="layui-form" lay-filter="component-form-group" action="">
                     <div class="layui-card-header">
                         <div class="layui-btn-group">
-                            <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_SaveBill">淇濆瓨</button>
+                            <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">淇濆瓨</button>
+                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_CheckBill">瀹℃牳</button>
                             <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">閫�鍑�</button>
                         </div>
                     </div>
@@ -67,7 +69,7 @@
                                             <div class="layui-input-inline">
                                                 <input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
                                                 <input type="hidden" name="HInterID" id="HInterID" value="0">
-                                                <input type="hidden" name="HSTOCKORGID" id="HSTOCKORGID" lay-verify="HSTOCKORGID">
+                                                <input type="hidden" name="hstockorgid" id="hstockorgid" lay-verify="hstockorgid" value="0">
                                             </div>
                                         </div>
                                         <div class="layui-col-xs4 layui-inline">
@@ -154,13 +156,19 @@
                                         <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">婧愬崟绫诲瀷</label>
                                             <div class="layui-input-inline">
-                                                <input class="layui-input" name="HSourceBillType" id="HSourceBillType" value="0">
+                                                <select name="HSourceBillType" id="HSourceBillType" lay-verify="HSourceBillType">
+                                                    <!--鍔ㄦ�佹覆鏌撴簮鍗曠被鍨�-->
+                                                </select>
                                             </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="Box2" id="Box2" autocomplete="off">
+                                                <input type="text" name="" id="" class="layui-input" value="" style="float:left;width:150px;">
+
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
                                             </div>
                                         </div>
 
@@ -173,7 +181,7 @@
                                             </div>
                                         </div>
                                         <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">杈呭姪瀛楁</label>
+                                            <label class="layui-form-label">鍐呴儴鍗曟嵁鍙�</label>
                                             <div class="layui-input-inline">
                                                 <input class="layui-input" name="HInnerBillNo" id="HInnerBillNo" autocomplete="off">
                                             </div>
@@ -184,6 +192,16 @@
                                             <label class="layui-form-label">澶囨敞</label>
                                             <div class="layui-input-block">
                                                 <input class="layui-input" name="HRemark" id="HRemark" autocomplete="off">
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label" style="width: 85px;">缁勭粐</label>
+                                            <div class="layui-input-block" style="margin-left: 120px; width: 185px;">
+                                                <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
+                                                    <!--鍔ㄦ�佹覆鏌撶粍缁�-->
+                                                </select>
                                             </div>
                                         </div>
                                     </div>
@@ -316,56 +334,104 @@
 
             //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             get_LoginIs();
+           //鑾峰彇缁勭粐
+            Organ() ;
 
-            //鑾峰彇椤甸潰璺宠浆鍙傛暟
+            //#region 銆愬姩鎬佽幏鍙栨ā鍧楀悕绉般��
+            var HModuleType = "1105";
+            //閫氳繃鍗曟嵁绫诲瀷锛屼粠鏁版嵁搴撳姩鎬佽幏鍙栧崟鎹ā鍧楀懡鍚�,寮曠敤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 缂栬緫
-            var linterid = params[params[1]]; //浠庡弬鏁颁腑鑾峰彇 鍗曟嵁鍐呯爜
-
             if (typeof (params[params[0]]) == "undefined") {
                 OperationType = 1;//鎿嶄綔绫诲瀷
             } else {
-                OperationType = params[params[0]];//鎿嶄綔绫诲瀷
-                linterid = params[params[1]];//婧愬崟id
+                var OperationType = params[params[0]];//鎿嶄綔绫诲瀷
+                var linterid = params[params[1]];//婧愬崟id
+                var HSouceBillType = params[params[2]];//婧愬崟绫诲瀷
             }
-
-
-            $("#HUSEORGID").val(sessionStorage["OrganizationID"]);
-
-            //鍒ゆ柇鏄惁鏂板
-            if (linterid == null || linterid == 0) {
-                //鑾峰彇鏈�澶у崟鎹彿 new
-                $("#HMaker").val(sessionStorage["HUserName"]);
+      //#region 鑾峰彇鏈�澶у崟鎹彿
+            function get_MAXNum() {
                 $("#HInterID").val("0");
                 $("#HBillNo").val("");
                 $.ajax({
-                    url: GetWEBURL() + "/Web/GetMAXNum",
+                    url: GetWEBURL() + "/WEBSController/GetMaxBillNoAndID_Json",
                     type: "GET",
                     data: { "HBillType": '1105' },
                     success: function (d) {
-                        //console.log(d.data);
                         $("#HBillNo").val(d.data[0].HBillNo);
-                        $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                         $("#HInterID").val(d.data[0].HInterID);
-                        $("#HSSDate").val(Format(new Date(), "yyyy-MM-dd")); //缁撶畻鏂瑰紡
                     }
                 });
-            } else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
+            }
+            //#endregion
+
+        // 鍒濆鍖栫晫
+        set_InitGrid();
+
+        //#region 鍒ゆ柇鎿嶄綔绫诲瀷骞跺垵濮嬪寲鐣岄潰
+            if (OperationType == 1) {                                                   //鏃犳簮鍗曟柊澧�
+               /* $("#HItemID").val(0);*/
+
+                //鐢熸垚鍗曟嵁鍙峰拰鍐呯爜
+                get_MAXNum();
+                //鍒濆鍖栨棩鏈熴�佸垱寤轰汉銆佸垱寤烘椂闂�
+                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HReceiveDate").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HMaker").val(sessionStorage["HUserName"]);
+                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));
+            }
+            else if (OperationType == 3) {                                              //缂栬緫
+                //淇敼鏃朵富琛↖D
                 $("#HInterID").val(linterid);
+
+                //缂栬緫鐘舵�佹椂锛屾牴鎹唴鐮侊紝鑾峰彇淇℃伅骞跺啓鍏ョ晫闈�
                 RoadBillMain(linterid);
+            }
+            else if (OperationType == 4) {                     //涓嬫帹
+                setInit_PushBill();
+            }
+            else {
+                layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
             }
             //#endregion
             //#endregion
 
+         //鑾峰彇缁勭粐
+            function Organ() {
+                //鑾峰彇鐧诲綍椤电粍缁囧垪
+                $.ajax({
+                    type: "get",
+                    url: GetWEBURL() + "/Web/GetOrganizations",
+                    success: function (result) {
+                        var Organization = "";
+                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            var data = result.data;
+                            for (var i = 0; i < data.length; i++) {
+                                Organization += '<option  style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
+                            }
+                            $("#HOrgID").append(Organization);
+                            $("#HOrgID").val(sessionStorage["OrganizationID"])
+                            form.render('select');
+                        }
+                        layer.closeAll("loading");
+                    }
+                })
+            }
+
             var rowdata = [{
-                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HAuxPropID": 0, "杈呭姪灞炴��": "", "HWHID": 0, "鏀舵枡浠撳簱": "",
-                "HSPID": 0, "閫�鏂欎粨浣�": "", "HSecUnitID": 0, "杈呭姪鍗曚綅": "", "HQty": "0"
-                , "HPrice": "0", "HMoney": "0", "HTaxRate": "0", "HTaxMoney": "0", "HBatChNo": "", "HRemark": ""
+                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HAuxPropID": 0, "HWHID": 0, "閫�鏂欎粨搴�": "",
+                "HSPID": 0, "浠撲綅鍚嶇О": "", "HSecUnitID": 0, "杈呭姪鍗曚綅": "", "HQty": "0"
+                , "HPrice": "0", "HMoney": "0", "HTaxRate": "0", "HTaxMoney": "0", "HBatChNo": "", "HRemark": "",
+                "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0
             }];
 
 
-            // 鍒濆鍖栫晫
-            set_InitGrid();
+            //鑾峰彇婧愬崟绫诲瀷
+            HSourceBillType();
 
             //澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
@@ -373,9 +439,10 @@
                     , data = checkStatus.data;
                 //鏂板琛岃〃鏍兼暟鎹�
                 var NewRow = {
-                    "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HAuxPropID": 0, "杈呭姪灞炴��": "", "HWHID": 0, "鏀舵枡浠撳簱": "",
-                    "HSPID": 0, "閫�鏂欎粨浣�": "", "HSecUnitID": 0, "杈呭姪鍗曚綅": "", "HQty": "0"
-                    , "HPrice": "0", "HMoney": "0", "HTaxRate": "0", "HTaxMoney": "0", "HBatChNo": "", "HRemark": ""
+                    "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HAuxPropID": 0,  "HWHID": 0, "閫�鏂欎粨搴�": "",
+                    "HSPID": 0, "浠撲綅鍚嶇О": "", "HSecUnitID": data.HSecUnitID, "杈呭姪鍗曚綅": data.杈呭姪鍗曚綅, "HQty": "0"
+                    , "HPrice": "0", "HMoney": "0", "HTaxRate": "0", "HTaxMoney": "0", "HBatChNo": "", "HRemark": "",
+                    "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0
                 };
                 switch (obj.event) {
                     case 'btn-AddLine':
@@ -419,6 +486,11 @@
                 Pub_Close(1); 
             })
 
+        //#region 瀹℃牳鎸夐挳
+            form.on('submit(set_CheckBill)', function (data) {
+                set_CheckBill(0);
+            });
+
             //閫夋嫨涓氬姟鍛樻寜閽�
             form.on('submit(HEmpList)', function () {
                 get_checkEmp();
@@ -447,10 +519,6 @@
             });
 
 
-            //淇濆瓨鎸夐挳
-            form.on('submit(set_SaveBill)', function (data) {
-                set_SaveBill(data);
-            });
 
             //琛屽唴浜嬩欢
             table.on('tool(mainTable)', function (obj) {
@@ -504,6 +572,9 @@
             }
             //#endregion
 
+
+
+
             function set_InitGrid() {
                 option = {
                     elem: '#mainTable'
@@ -511,37 +582,42 @@
                     , limit: 500
                     , height: 500
                     , loading: false
+                    , totalRow: true
                     , cols: [[ //瀛愯〃
                         { type: 'checkbox', totalRowText: '鍚堣琛�' }
                         , { type: 'numbers', title: '搴忓彿', width: 100, totalRow: true }
+                        , { type: 'HSourceBillNo', title: '婧愬崟鍙�', width: 100, hide: true }//婧愬崟鍙�
+                        , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100, hide: true }//婧愬崟绫诲瀷
+                        , { type: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 100, hide: true }//婧愬崟涓诲唴鐮�
+                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 100, hide: true }//婧愬崟瀛愬唴鐮�
                         , { 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: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, style: 'background-color:#efefef4d;'}
+                        , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, style: 'background-color:#efefef4d;'}
                         , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true }
                         , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, edit: 'text', event: "HUnitID" }//f7
-                        , { field: 'HAuxPropID', title: 'HAuxPropID', width: 100, hide: true }
-                        , { field: '杈呭姪灞炴��', title: '杈呭姪灞炴��', width: 150, edit: 'text', event: "HAuxPropID" }//f7
-                        , { field: 'HWHID ', title: 'HWHID ', width: 100, hide: true }
-                        , { field: '鏀舵枡浠撳簱', title: '鏀舵枡浠撳簱', width: 100, edit: 'text', event: "HWHID" }//f7
+                        , { field: 'HWHID', title: 'HWHID', width: 100, hide: true }
+                        , { field: '閫�鏂欎粨搴�', title: '閫�鏂欎粨搴�', width: 100, edit: 'text', event: "HWHID" }//f7
                         , { field: 'HSPID', title: 'HSPID', width: 100, hide: true }
                         , { field: '浠撲綅鍚嶇О', title: '浠撲綅鍚嶇О', width: 100, edit: 'text', event: "HSPID" }//f7
                         , { field: 'HSecUnitID', title: 'HSecUnitID', width: 100, hide: true }
                         , { field: '杈呭姪鍗曚綅', title: '杈呭姪鍗曚綅', width: 100, edit: 'text', event: "HSecUnitID" }//f7
-                        , { field: 'HQty', title: '鏁伴噺', width: 100, edit: 'text' }
+                        , { field: 'HQty', title: '鏁伴噺', width: 100, edit: 'text', totalRow: true}
                         , { field: 'HPrice', title: '鍗曚环', width: 100, edit: 'text' }
-                        , { field: 'HMoney', title: '閲戦', width: 100, edit: 'text' }
+                        , { field: 'HMoney', title: '閲戦', width: 100, edit: 'text', totalRow: true }
                         , { field: 'HTaxRate', title: '绋庣巼', width: 100, edit: 'text' }
-                        , { field: 'HTaxMoney', title: '绋庨', width: 100, }
+                        , { field: 'HTaxMoney', title: '绋庨', width: 100, style: 'background-color:#efefef4d;'}
                         , { field: 'HBatchNo', title: '鎵瑰彿', width: 150, edit: 'text' }
                         , { field: 'HRemark', title: '澶囨敞', width: 100, edit: 'text' }
                         , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
                     ]]
                 }
 
-                option.data = rowdata;
+                option.data = [];
                 table.render(option);
             }
+            //#endregion
+            //#endregion
 
 
             //#region 鍔犺浇琛ㄥご
@@ -561,13 +637,13 @@
                             form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
                                 "HBillNo": data.鍗曟嵁鍙�
                                 , "HDate": formatDate(data.鏃ユ湡)
-                             /*   , "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�*/
+                                , "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
                                 , "HEmpID": data.HEmpID
                                 , "HEmpName": data.涓氬姟鍛�
                                 , "HSupID": data.HSupID
                                 , "HSupName": data.渚涘簲鍟�
-                                , "HWHID": data.HWHID
-                                , "HWHName": data.鏀舵枡浠撳簱
+                                , "HWHID": data.涓昏〃浠撳簱ID
+                                , "HWHName": data.涓昏〃浠撳簱
                                 , "HCurID": data.HCurID
                                 , "HCurName": data.甯佸埆
                                 , "HExRate": data.姹囩巼
@@ -577,7 +653,6 @@
                                 , "HManagerID": data.HManagerID
                                 , "HSourceBillType": data.婧愬崟绫诲瀷
                                 , "HAddress": data.浜よ揣鍦扮偣
-                                , "HInnerBillNo": data.杈呭姪瀛楁
                                 , "HExRate": data.姹囩巼
                                 , "Box2": ""
                                 , "HRemark": data.琛ㄥご澶囨敞
@@ -597,9 +672,13 @@
                             for (var i = 0; i < subdata.length; i++) {
                                 rowdata.push(
                                     {
-                                        "HMaterID": subdata[i].HMaterID, "鐗╂枡浠g爜": subdata[i].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": subdata[i].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": subdata[i].瑙勬牸鍨嬪彿, "HUnitID": subdata[i].HUnitID, "璁¢噺鍗曚綅": subdata[i].璁¢噺鍗曚綅, "HAuxPropID": subdata[i].HAuxPropID, "杈呭姪灞炴��": subdata[i].杈呭姪灞炴��, "HWHID": subdata[i].HWHID, "鏀舵枡浠撳簱": subdata[i].鏀舵枡浠撳簱,
+                                        "HMaterID": subdata[i].HMaterID, "鐗╂枡浠g爜": subdata[i].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": subdata[i].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": subdata[i].瑙勬牸鍨嬪彿, "HUnitID": subdata[i].HUnitID, "璁¢噺鍗曚綅": subdata[i].璁¢噺鍗曚綅, "HWHID": subdata[i].HWHID, "閫�鏂欎粨搴�": subdata[i].閫�鏂欎粨搴�,
                                         "HSPID": subdata[i].HSPID, "浠撲綅鍚嶇О": subdata[i].浠撲綅鍚嶇О, "HSecUnitID": subdata[i].HSecUnitID, "杈呭姪鍗曚綅": subdata[i].杈呭姪鍗曚綅, "HQty": subdata[i].鏁伴噺, "HRemark": subdata[i].琛ㄤ綋澶囨敞,
-                                        "HPrice": subdata[i].鍗曚环, "HMoney": subdata[i].閲戦, "HTaxRate": subdata[i].绋庣巼, "HTaxMoney": subdata[i].绋庨, "HBatchNo": subdata[i].鎵瑰彿
+                                        "HPrice": subdata[i].鍗曚环, "HMoney": subdata[i].閲戦, "HTaxRate": subdata[i].绋庣巼, "HTaxMoney": subdata[i].绋庨, "HBatchNo": subdata[i].鎵瑰彿,
+                                        "HSourceBillNo": data.婧愬崟鍗曞彿,    //婧愬崟鍙�
+                                        "HSourceBillType": data.婧愬崟绫诲瀷,   //婧愬崟绫诲瀷
+                                        "HSourceInterID": data.婧愬崟涓诲唴鐮�,   //婧愬崟涓诲唴鐮�
+                                        "HSourceEntryID": data.婧愬崟瀛愬唴鐮�     //婧愬崟瀛愬唴鐮�
                                     }
                                 )
                             }
@@ -619,6 +698,28 @@
                     }
                 });
             }
+
+        //鍒ゆ柇鏄惁鏂板
+            if (linterid == null || linterid == 0) {
+                //鑾峰彇鏈�澶у崟鎹彿 new
+                $("#HInterID").val("0");
+                $("#HBillNo").val("");
+                $.ajax({
+                    url: GetWEBURL() + "/Web/GetMAXNum",
+                    type: "GET",
+                    data: { "HBillType": '1105' },
+                    success: function (d) {
+                        //console.log(d.data);
+                        $("#HBillNo").val(d.data[0].HBillNo);
+                        $("#HDate").val(shijian);
+                        $("#HInterID").val();
+                    }
+                });
+            }
+            else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
+                RoadBillMain(linterid);
+                //RoadBillSub(linterid);
+            }
             //#endregion
 
             //閫�鍑�
@@ -632,6 +733,271 @@
                     Pub_Close(1);
                 }
             });
+
+
+         //#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));         //绋庨=閲戦*绋庣巼
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HQty: HQty
+                            , HPrice: HPrice
+                            , HMoney: HMoney
+                            , HTaxMoney: HTaxMoney
+                        });
+                        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));         //绋庨=閲戦*绋庣巼
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HQty: HQty
+                            , HPrice: HPrice
+                            , HMoney: HMoney
+                            , HTaxMoney: HTaxMoney
+                        });
+                        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));         //绋庨=閲戦*绋庣巼
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HTaxRate: HTaxRate * 100
+                            , HQty: HQty
+                            , HPrice: HPrice
+                            , HMoney: HMoney
+                            , HTaxMoney: HTaxMoney
+                        });
+                        break;
+                        table.render(option);
+                    default:
+                }
+            });
+            //#endregion
+            //#endregion
+
+        //#region 淇濆瓨鎸夐挳
+            form.on('submit(Saver)', function (data) {
+                //#region 鍒ゆ柇婧愬崟鐘舵��
+                if (OperationType == 1 || OperationType == 4) {
+                    
+                    if ($("#HSourceBillType").val() == "1102") {
+                        for (var i = 0; i < option.data.length; i++) {
+                            var HSourceBillData = "";
+                            var HSourceBillData = getPushSource_POOrderBillInit(option.data[i].HSourceInterID, option.data[i].HSourceEntryID);            //鑾峰彇婧愬崟鏁版嵁
+                            if (HSourceBillData != "none") {
+                                if (HSourceBillData == null) {
+                                    layer.alert("淇濆瓨澶辫触!绗�" + (i + 1) + "琛岋細鏈煡璇㈠埌婧愬崟鍗曟嵁!", { icon: 5 });
+                                    return;
+                                } else if (HSourceBillData.鐘舵�� != "宸插鏍�") {
+                                    var err = "淇濆瓨澶辫触!鍘熷洜锛氱" + (i + 1) + "琛�-婧愬崟鍗曟嵁鐘舵�佷负鈥�" + HSourceBillData.鐘舵�� + "鈥濓紝涓嶅厑璁镐繚瀛橈紒";
+                                    layer.alert(err, { icon: 5 });
+                                    return;
+                                } else if (HSourceBillData.琛岀姸鎬� == "宸插叧闂�") {
+                                    layer.alert("淇濆瓨澶辫触!绗�" + (i + 1) + "琛岋細璇ヨ璁板綍琛岀姸鎬佷负'宸插叧闂�'鐘舵��!", { icon: 5 });
+                                    return;
+                                }
+                            } else {
+                                return;
+                            }
+                        }
+                    }
+                    else {
+                        return layer.msg('褰撳墠涓嶆敮鎸佽婧愬崟锛侊紒');
+                    }
+                }
+                //#endregion
+
+                //if (AllowLoadData(data)) {
+                    set_SaveBill(data);
+                //}
+            });
+            //#endregion
+
+        
+            //#region 鑾峰彇鍙傛暟_浼犻�掔殑JSON鏍煎紡鍙傛暟
+            function getUrlVars_JSON() {
+                var datajson;
+                var str = window.location.search; //鑾峰彇閾炬帴涓紶閫掔殑鍙傛暟
+                var arr = str.substring(str.lastIndexOf("=")+1);
+                datajson = $.parseJSON(decodeURI(arr));
+                return datajson;
+            }
+            //#endregion
+
+
+          //#region 涓嬫帹椤甸潰鍒濆鍖�
+            function setInit_PushBill() {
+                 //鐢熸垚鍗曟嵁鍙峰拰鍐呯爜
+                get_MAXNum();
+
+                //鍒濆鍖栨棩鏈熴�佸埗鍗曚汉銆佸埗鍗曟棩鏈�
+                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HReceiveDate").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HMaker").val(sessionStorage["HUserName"]);
+                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));
+
+                //璁剧疆婧愬崟绫诲瀷
+                $("#BillType").val(HSouceBillType);
+
+                //绂佺敤缁勭粐閫夐」
+                $("#HOrgID").attr("disabled", true);
+
+               //鑾峰彇
+                 var data = getUrlVars_JSON().data;
+                    var dataArray = [];
+                    for (var i = 0; i < data.length; i++) {
+                        var temp = getPushSource_POOrderBillInit(data[i].hmainid, data[i].hsubid);
+                        if (temp != "none") {
+                            dataArray.push(temp);
+                        } else {
+                            return;
+                    }
+                }
+
+
+                    form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
+                        "HMainSourceInterID": "0"
+                        , "HMainSourceEntryID": "0"
+                        , "HMainSourceBillNo": ""
+                        , "HMainSourceBillType": $("#BillType").val()
+
+                        , "HDeptID": dataArray[0].HDeptID
+                        , "HDeptName": dataArray[0].閮ㄩ棬
+                        , "HManagerID": dataArray[0].HManagerID
+                        , "HManagerName": dataArray[0].涓荤
+                        , "HWHID": dataArray[0].HWHID
+                        , "HWHName": dataArray[0].浠撳簱
+                        , "HEmpID": dataArray[0].HEmpID
+                        , "HEmpName": dataArray[0].涓氬姟鍛�
+                        , "HSupID": dataArray[0].HSupID
+                        , "HSupName": dataArray[0].渚涘簲鍟�
+                        , "HCurID": dataArray[0].HCurID
+                        , "HCurName": dataArray[0].甯佸埆
+                        , "HExRate": dataArray[0].姹囩巼
+                        , "HAddress": data.浜よ揣鍦扮偣
+                        , "HRemark": data.琛ㄥご澶囨敞
+                        , "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
+                    });
+
+                    //瀛愯〃  璧嬪��
+                    var rowdata = [];
+                    for (var i = 0; i < dataArray.length; i++) {
+                        rowdata.push(
+                            {
+                                "HMaterID": dataArray[i].HMaterID
+                                , "鐗╂枡浠g爜": dataArray[i].鐗╂枡浠g爜
+                                , "鐗╂枡鍚嶇О": dataArray[i].鐗╂枡鍚嶇О
+                                , "瑙勬牸鍨嬪彿": dataArray[i].瑙勬牸鍨嬪彿
+                                , "HUnitID": dataArray[i].HUnitID
+                                , "璁¢噺鍗曚綅": dataArray[i].璁¢噺鍗曚綅
+                                , "HWHID": dataArray[i].HWHID
+                                , "閫�鏂欎粨搴�": dataArray[i].閫�鏂欎粨搴�
+                                , "HSPID": dataArray[i].HSPID    
+                                , "浠撲綅鍚嶇О": dataArray[i].浠撲綅鍚嶇О
+                                , "HSecUnitID": dataArray[i].HSecUnitID
+                                , "杈呭姪鍗曚綅": dataArray[i].杈呭姪鍗曚綅
+                                , "HQty": dealDoubleToFixed(dataArray[i].鏁伴噺, 1)
+                                , "HPrice": dealDoubleToFixed(dataArray[i].鍗曚环, 3)
+                                , "HTaxPrice": dealDoubleToFixed(dataArray[i].鍚◣鍗曚环, 3)
+                                , 'HDiscountRate': dataArray[i].鎶樻墸鐜�                                                    //
+                                , 'HRelTaxPrice': "0"
+                                , "HTaxRate": dataArray[i].绋庣巼
+                                , 'HTaxMoney': dataArray[i].绋庨                                                     //
+                                , "HMoney": dealDoubleToFixed(dataArray[i].閲戦, 2)
+                                , "HRemark": dataArray[i].琛ㄤ綋澶囨敞
+
+                                , "HSourceInterID": dataArray[i].hmainid
+                                , "HSourceEntryID": dataArray[i].hsubid
+                                , "HSourceBillNo": dataArray[i].鍗曟嵁鍙�
+                                , "HSourceBillType": dataArray[i].HBillType
+                                , "HRelationQty": "0"
+                                , "HRelationMoney": "0"
+
+                                , 'HPOOrderInterID': "0"
+                                , 'HPOOrderEntryID': "0"
+                                , 'HPOOrderBillNo': ""
+
+                                , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].鍚◣鍗曚环, 3)
+                                , "HSeOrderInterID": dataArray[i].hmainid
+                                , "HSeOrderEntryID": dataArray[i].hsubid
+                                , "HSeOrderBillNo": dataArray[i].鍗曟嵁鍙�
+                            }
+                        );
+                    }
+                    option.data = rowdata;
+                    table.render(option);
+                }
+        
+            //#endregion
 
             //#region 淇濆瓨鏂规硶
             function set_SaveBill(data) {
@@ -713,19 +1079,19 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '涓氬姟鍛樺垪琛�'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , 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) { }
+                    , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/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].鑱屽憳鍚嶇О);
+                        $("#HEmpID").val(checkStatus.data[0].HItemID);
+                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
                 })
             }
             function get_checkSup() {
@@ -735,7 +1101,7 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '渚涘簲鍟嗗垪琛�'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../鍩虹璧勬枡/閲囪喘鍩虹璧勬枡/Gy_Supplier.html', 'yes']
+                    , content: ['../../鍩虹璧勬枡/閲囪喘鍩虹璧勬枡/Gy_Supplier.html?Type=HSup', 'yes']
                     , btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                         var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -757,19 +1123,19 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '浠撳簱鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_WarehouseList.html?Type=HWHID', '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('璇烽�夋嫨鏁版嵁');
-                    //    }
-                    //    $("#HWHName").val(checkStatus.data[0].HName);
-                    //    $("#HWHID").val(checkStatus.data[0].HItemID);
-                    //    layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    //}
-                    //, btn2: function (index, layero) { }
+                    , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Warehouse.html?Type=HWH', '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('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HWHName").val(checkStatus.data[0].浠撳簱鍚嶇О);
+                        $("#HWHID").val(checkStatus.data[0].HItemID);
+                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
                 })
             }
             function get_checkCur() {
@@ -803,19 +1169,19 @@
                     , area: ['90%', '90%']//澶у皬
                     , 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) { }
+                    , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/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].閮ㄩ棬鍚嶇О);
+                        $("#HDeptID").val(checkStatus.data[0].HItemID);
+                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
                 })
             }
 
@@ -826,21 +1192,48 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '涓荤鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , 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) { }
+                    , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/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].鑱屽憳鍚嶇О);
+                        $("#HManagerID").val(checkStatus.data[0].HItemID);
+                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
                 })
             }
+
+           //#region 鍙嶅鏍�/瀹℃牳鏁版嵁
+            function set_CheckBill(num) {
+                var InterID = $("#HInterID").val();
+                //閫昏緫瀹℃牳鏂规硶
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Cg_POInStockBackBill/AuditCg_POInStockBackBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                // 寰楀埌frame绱㈠紩
+                                var index = layer.getFrameIndex(window.name);
+                                //鍏抽棴褰撳墠frame
+                                layer.close(index);
+                            });
+
+                        } else {
+                            layer.alert(result.code + result.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+            //#endregion
 
 
             //琛屽唴蹇嵎閿瓫閫�
@@ -849,6 +1242,7 @@
                     if (event.key == "F7") {
                         //鐗╂枡
                         if (obj.event == "HMaterID") {
+                            var HOrgID = $("#HOrgID").val();
                             layer.open({
                                 type: 2
                                 , skin: "layui-layer-rim" //鍔犱笂杈规
@@ -857,7 +1251,7 @@
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../Baseset/鍩虹璧勬枡/Gy_MaterialList.html', 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
@@ -872,8 +1266,8 @@
                                     for (var i = 0; i < checkStatus.data.length; i++) {
                                         if (rowIndex + i >= option.data.length) {
                                             var NewRow = {
-                                                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HAuxPropID": 0, "杈呭姪灞炴��": "", "HWHID": 0, "鏀舵枡浠撳簱": "",
-                                                "HSPID": 0, "閫�鏂欎粨浣�": "", "HSecUnitID": 0, "杈呭姪鍗曚綅": "", "HQty": "0"
+                                                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HWHID": 0, "閫�鏂欎粨搴�": "",
+                                                "HSPID": 0, "浠撲綅鍚嶇О": "", "HSecUnitID": 0, "杈呭姪鍗曚綅": "", "HQty": "0"
                                                 , "HPrice": "0", "HMoney": "0", "HTaxRate": "0", "HTaxMoney": "0", "HBatChNo": "", "HRemark": ""
                                             };
 
@@ -894,16 +1288,7 @@
                                         option.data[rowIndex + i].HUnitID = resultData.HUnitID;
                                         option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.HUnitName;
 
-                                        ////鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
-                                        //obj.update({
-                                        //    "HMaterID": checkStatus.data[0].HItemID
-                                        //    , "鐗╂枡浠g爜": checkStatus.data[0].HNumber
-                                        //    , "鐗╂枡鍚嶇О": checkStatus.data[0].HName
-                                        //    , "瑙勬牸鍨嬪彿": checkStatus.data[0].HModel
-                                        //    , "HUnitID": checkStatus.data[0].HUnitID
-                                        //    , "璁¢噺鍗曚綅": checkStatus.data[0].HUnitName
-                                        //})
-                                        //layer.close(index);//鍏抽棴寮圭獥
+                                       
                                     }
                                     table.render(option);
                                     layer.closeAll();
@@ -913,7 +1298,15 @@
                                     //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
                                     //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
                                 },
-                                end: function () {
+                                 end: function () {
+                                  obj.update({
+                                      "HMaterID" :OptionData.HMaterID
+                                        ,"鐗╂枡浠g爜" : OptionData.鐗╂枡浠g爜
+                                       , "鐗╂枡鍚嶇О" :OptionData.鐗╂枡鍚嶇О
+                                        ,"瑙勬牸鍨嬪彿" : OptionData.瑙勬牸鍨嬪彿
+                                        ,"HUnitID" :OptionData.HUnitID
+                                        ,"璁¢噺鍗曚綅" : OptionData.璁¢噺鍗曚綅鍚嶇О
+                                })
                                 }
                             });
                         }
@@ -927,7 +1320,7 @@
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../Baseset/鍩虹璧勬枡/Gy_UnitList.html', 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Unit.html', 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
@@ -939,11 +1332,17 @@
                                     }
                                     //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
                                     obj.update({
-                                        "璁¢噺鍗曚綅": checkStatus.data[0].HName
+                                        "璁¢噺鍗曚綅": checkStatus.data[0].璁¢噺鍗曚綅鍚嶇О
                                         , "HUnitID": checkStatus.data[0].HItemID
                                     })
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
+                              , end: function () {
+                                obj.update({
+                                    "HUnitID": OptionData.HItemID
+                                    , "璁¢噺鍗曚綅": OptionData.璁¢噺鍗曚綅鍚嶇О
+                                })
+                            }
                             })
                         }
                         //閫�鏂欎粨搴�
@@ -951,12 +1350,12 @@
                             layer.open({
                                 type: 2
                                 , skin: "layui-layer-rim" //鍔犱笂杈规
-                                , title: "鏀舵枡浠撳簱鍒楄〃"  //鏍囬
+                                , title: "閫�鏂欎粨搴撳垪琛�"  //鏍囬
                                 , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../Baseset/鍩虹璧勬枡/Gy_WarehouseList.html', 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Warehouse.html', 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
@@ -968,11 +1367,17 @@
                                     }
                                     //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
                                     obj.update({
-                                        "鏀舵枡浠撳簱": checkStatus.data[0].HName
+                                        "閫�鏂欎粨搴�": checkStatus.data[0].浠撳簱鍚嶇О
                                         , "HWHID": checkStatus.data[0].HItemID
                                     })
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
+                              , end: function () {
+                                obj.update({
+                                    "HWHID": OptionData.HItemID
+                                    , "閫�鏂欎粨搴�": OptionData.浠撳簱鍚嶇О
+                                })
+                            }
                             })
                         }
                         //閫�鏂欎粨浣�
@@ -985,7 +1390,7 @@
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../Baseset/鍩虹璧勬枡/Gy_StockPlaceList.html', 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_StockPlace_List.html', 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
@@ -997,11 +1402,17 @@
                                     }
                                     //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
                                     obj.update({
-                                        "閫�鏂欎粨浣�": checkStatus.data[0].HName
-                                        , "HSPID": checkStatus.data[0].HItemID
+                                        "浠撲綅鍚嶇О": checkStatus.data[0].浠撲綅鍚嶇О
+                                        , "HSPID": checkStatus.data[0].HMainID
                                     })
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
+                             , end: function () {
+                                obj.update({
+                                    "HSPID": OptionData.HMainID
+                                    , "浠撲綅鍚嶇О": OptionData.浠撲綅鍚嶇О
+                                })
+                            }
                             })
                         }
                         //杈呭姪鍗曚綅
@@ -1014,7 +1425,7 @@
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../Baseset/鍩虹璧勬枡/Gy_UnitList.html', 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Unit.html', 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
@@ -1026,11 +1437,17 @@
                                     }
                                     //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
                                     obj.update({
-                                        "杈呭姪鍗曚綅": checkStatus.data[0].HName
+                                        "杈呭姪鍗曚綅": checkStatus.data[0].璁¢噺鍗曚綅鍚嶇О
                                         , "HSecUnitID": checkStatus.data[0].HItemID
                                     })
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
+                            , end: function () {
+                                obj.update({
+                                    "HSecUnitID": OptionData.HItemID
+                                    , "杈呭姪鍗曚綅": OptionData.璁¢噺鍗曚綅鍚嶇О
+                                })
+                            }
                             })
                         }
                         obj.event = "";
@@ -1058,7 +1475,110 @@
                 }
             }
 
+           //鍔ㄦ�佸脊鍑洪〉闈�
+            function getSupType() {
+                var type = $("#HSourceBillType").val();
+                var data = [];
+                //鑾峰彇缂栫爜瀵瑰簲鍗曟嵁鍚嶇О
+                $.ajax({
+                    type: "get",
+                    async: false,
+                    data: { "HBillType": type },
+                    url: GetWEBURL() + "/Web/GetHSourceBillName",
+                    success: function (result) {
+                        data = result.data;
+                    }
+                })
+                switch (type) {
+                    case '1102':
+                        return { url: "../../閲囪喘绠$悊/閲囪喘璁㈠崟/Cg_POOrderBillList.html", name: data[0]["HName"] };
+                        break;
+                }
 
+            }
+
+            //琛ㄥご淇℃伅閫夋嫨鍗曟嵁寮圭獥
+            form.on('submit(XDHList)', function () {
+                var HOrgID = $("#HOrgID").val();
+                var url = "";
+                if ($("#HSourceBillType").val() == "1102") {
+                    url = "../../閲囪喘绠$悊/閲囪喘璁㈠崟/Cg_POOrderBillList.html?openType=2&HOrgID=" + HOrgID;
+                } else {
+                    return layer.msg('褰撳墠涓嶆敮鎸佽婧愬崟閫夋嫨锛侊紒');
+                }
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2
+                    , skin: "layui-layer-rim" //鍔犱笂杈规
+                    , title: '' + getSupType().name + '鍒楄〃'  //鏍囬
+                    , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                    , shift: 2 //寮瑰嚭鍔ㄧ敾
+                    , area: ["90%", "90%"] //绐椾綋澶у皬
+                    , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                    , content: [url, "yes"]
+                    , btn: ["纭畾", "鍙栨秷"]
+                    , btn1: function (index, laero) {
+                        //鎸夐挳涓�  鐨勫洖璋�
+                        var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
+
+                        if (checkStatus.data.length == 0) {
+                            return layer.msg("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�!");
+                        }
+                        //layer.alert("浣犲凡閫夋嫨" + checkStatus.data.length + "鏉℃暟鎹�");
+                        //鑾峰彇閫�鏂欓�氱煡鍗曚唬鐮�
+                        var ProcessNumber = [];
+                        for (var i = 0; i < checkStatus.data.length; i++) {
+                            ProcessNumber.push(checkStatus.data[i]);
+                        }
+
+                        //鑾峰彇褰撳墠浣嶇疆鎵�鍦ㄨ鏁�
+                        var NowNum = 0;
+                        NowNum = option.data.length;
+
+                        if ($("#HSourceBillType").val() == "1102") {
+                            var j = 0;
+                            for (var i = 0; i < ProcessNumber.length; i++) {
+                                option.data.push({
+                                    "HMaterID": checkStatus.data[j].HMaterID, "鐗╂枡浠g爜": checkStatus.data[j].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": checkStatus.data[j].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": checkStatus.data[j].瑙勬牸鍨嬪彿,
+                                    "HUnitID": checkStatus.data[j].HUnitID, "璁¢噺鍗曚綅": checkStatus.data[j].璁¢噺鍗曚綅,
+                                    "HQty": checkStatus.data[j].鏁伴噺-checkStatus.data[j].鍏宠仈鏁伴噺, "HPrice": checkStatus.data[j].鍗曚环,
+                                    "HMoney": checkStatus.data[j].閲戦, "HTaxPrice": checkStatus.data[j].鍚◣鍗曚环, "HTaxRate": checkStatus.data[j].绋庣巼, "HTaxMoney": checkStatus.data[j].绋庨,"HWHID": checkStatus.data[j].HWHID,
+                                    "閫�鏂欎粨搴�": checkStatus.data[j].閫�鏂欎粨搴�,"HSPID": checkStatus.data[j].HSPID,"浠撲綅鍚嶇О": checkStatus.data[j].浠撲綅鍚嶇О,"HSecUnitID": checkStatus.data[j].HSecUnitID,"杈呭姪鍗曚綅": checkStatus.data[j].杈呭姪鍗曚綅,
+                                    "HSourceBillNo": checkStatus.data[j].鍗曟嵁鍙�, "HSourceBillType": checkStatus.data[j].HBillType, "HSourceInterID": checkStatus.data[j].hmainid, "HSourceEntryID": checkStatus.data[j].hsubid
+                                })
+                                j++;
+                            }
+                            table.render(option);
+                            layer.close(index);//鍏抽棴寮圭獥
+                        }
+                    }
+
+                });
+            });
+
+             //鍒ゆ柇鎵�閫夌潃涓庤〃鏍兼槸鍚︽湁閲嶅鏁版嵁
+            function checkDuplicateData(data) {
+                const duplicates = [];
+
+                for (let i = 0; i < data.length; i++) {
+                    const currentItem = data[i];
+                    let isDuplicate = false;
+
+                    for (let j = i + 1; j < data.length; j++) {
+                        const compareItem = data[j];
+                        //涓诲瓙id
+                        if (currentItem.HSourceInterID === compareItem.HSourceInterID && currentItem.HSourceEntryID === compareItem.HSourceEntryID) {
+                            isDuplicate = true;
+                            duplicates.push({ row1: i + 1, row2: j + 1 }); // 璁板綍閲嶅鏁版嵁鎵�鍦ㄨ鏁�
+                        }
+                    }
+                    if (isDuplicate && !duplicates.some(item => item.row1 === i + 1)) {
+                        duplicates.push({ row1: i + 1, row2: -1 }); // 璁板綍閲嶅鏁版嵁鎵�鍦ㄨ鏁帮紝-1 琛ㄧず鏈壘鍒颁笌褰撳墠琛岄噸澶嶇殑琛�
+                    }
+                }
+                return duplicates;
+            }
 
             //#region 鏍规嵁鐗╂枡ID鑾峰彇鐗╂枡璇︾粏淇℃伅
             function getMaterialByMaterID(HMaterID) {
@@ -1092,7 +1612,55 @@
                 $('#set_SaveBill').addClass("layui-btn-disabled").attr("disabled", true);//淇濆瓨鍚庡姞杞芥暟鎹椂淇濆瓨鎸夐挳绂佺敤
             }
             //#endregion
-
+          //#region 鑾峰彇婧愬崟绫诲瀷
+            function HSourceBillType() {
+                var HName = '閫�鏂欓�氱煡鍗�';
+                //鑾峰彇鐧诲綍椤电粍缁囧垪
+                $.ajax({
+                    type: "get",
+                    async: false,
+                    data: { "HName": HName, "Num": 2 },       //0钃濆崟 1绾㈠崟 2涓嶅垎绾㈣摑鍗�
+                    url: GetWEBURL() + "/Web/GetHSourceBillType",
+                    success: function (result) {
+                        var HSourceBillTypes = "";
+                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            var data = result.data;
+                            for (var i = 0; i < data.length; i++) {
+                                HSourceBillTypes += '<option  style="color:blue;" value="' + data[i].HSourceBillType + '">' + data[i].HSourceBillTypeName + '</option>';
+                            }
+                            $("#HSourceBillType").append(HSourceBillTypes);
+                            form.render('select');
+                        }
+                    }
+                })
+            }
+            //#endregion
+         //#region 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栨簮鍗曢噰璐鍗曟暟鎹�
+            function getPushSource_POOrderBillInit(HSourceInterID, HSourceEntryID) {
+                var res = "none";
+                $.ajax({
+                    url: GetWEBURL() + "/Cg_POOrderBill/loadCg_POOrderBill_Push",
+                    async: false,
+                    type: "GET",
+                    data: {
+                        "HInterID": HSourceInterID
+                        , "HSubID": HSourceEntryID
+                    },
+                    success: function (result) {
+                        if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            res = result.data[0];
+                        } else {
+                            res = result.data;
+                            //layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                        }
+                    }, error: function () {
+                        res = "none";
+                        layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                    }
+                });
+                return res;
+            }
+            //#endregion
             //#endregion
 
 
@@ -1101,33 +1669,89 @@
         // 鍩虹璧勬枡杩斿洖鏁版嵁
         function GetHEmpValue(obj)  //杩斿洖涓氬姟鍛�
         {
-            $("#HEmpName").val(obj[0].HName);
+            $("#HEmpName").val(obj[0].鑱屽憳鍚嶇О);
             $("#HEmpID").val(obj[0].HItemID);
         }
 
-        function GetHSupValue(obj)  //杩斿洖渚涘簲鍟�
+        function GetHSupNameValue(obj)  //杩斿洖渚涘簲鍟�
         {
-            $("#HSupName").val(obj[0].HName);
+            $("#HSupName").val(obj[0].渚涘簲鍟嗗悕绉�);
             $("#HSupID").val(obj[0].HItemID);
         }
 
         function GetHWHValue(obj)  //杩斿洖浠撳簱
         {
-            $("#HWHName").val(obj[0].HName);
+            $("#HWHName").val(obj[0].浠撳簱鍚嶇О);
             $("#HWHID").val(obj[0].HItemID);
         }
 
         function GetHDeptNameValue(obj)  //杩斿洖閮ㄩ棬
         {
-            $("#HDeptName").val(obj[0].HName);
+            $("#HDeptName").val(obj[0].閮ㄩ棬鍚嶇О);
             $("#HDeptID").val(obj[0].HItemID);
         }
 
         function GetHManagerValue(obj)  //杩斿洖涓荤
         {
-            $("#HManagerName").val(obj[0].HName);
+            $("#HManagerName").val(obj[0].鑱屽憳鍚嶇О);
             $("#HManagerID").val(obj[0].HItemID);
         }
+
+         //鍙屽嚮杩斿洖鐗╂枡
+         function GetGyMaterial(data) {
+             OptionData = data
+         }
+           //鍙屽嚮杩斿洖璁¢噺鍗曚綅
+         function GetGyUnit(data) {
+             OptionData = data
+         }
+
+           //鍙屽嚮杩斿洖閫�鏂欎粨搴�
+         function GetGyWarehouse(data) {
+             OptionData = data
+         } 
+
+
+        //鍙屽嚮杩斿洖閫�鏂欎粨浣�
+         function GetGyStockPlace(data) {
+             OptionData = data
+         } 
+
+         //#region 澶勭悊灏忔暟鏄剧ず浣嶆暟锛坉ata锛氶渶瑕佸鐞嗙殑鏁版嵁锛沶um锛氭暟鎹殑绫诲瀷(濡�1:鏁伴噺锛�2:閲戦锛�3:鍗曚环)锛�
+        function dealDoubleToFixed(data, num) {
+            //鐢ㄤ簬璁剧疆灏忔暟浣嶆暟
+            var dotLength = 0;
+
+            if (num == 1) {                                    //褰撴暟鎹负鏁伴噺鏃讹紝鏈�澶氫繚鐣�6浣嶅皬鏁�
+                //璁剧疆鏈�澶氫繚鐣�6浣嶅皬鏁�
+                dotLength = 6;
+            } else if (num == 2) {                             //褰撴暟鎹负閲戦鏃讹紝鏈�澶氫繚鐣�2浣嶅皬鏁�
+                //璁剧疆鏈�澶氫繚鐣�2浣嶅皬鏁�
+                dotLength = 2;
+            } else if (num == 3) {                             //褰撴暟鎹负鍗曚环鏃讹紝鏈�澶氫繚鐣�4浣嶅皬鏁�
+                //璁剧疆鏈�澶氫繚鐣�4浣嶅皬鏁�
+                dotLength = 4;
+            }
+
+            //鍒ゆ柇鏄惁瀛樺湪灏忔暟鐐瑰強鍏剁储寮曚綅缃�
+            data = data + "";
+            var index = data.indexOf(".");
+
+            //澶勭悊鏁版嵁骞惰繑鍥�
+            if (index < 0) {
+                return data * 1;
+            } else {
+                //鑾峰彇灏忔暟浣嶆暟
+                var length = data.length - index - 1;
+                if (length <= dotLength) {
+                    return data * 1;
+                } else {
+                    data = data * 1;
+                    return data.toFixed(dotLength);
+                }
+            }
+        }
+            //#endregion
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1