From d3ac42d57af442df363041350c16d42e28cfbe9b Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 29 七月 2024 11:11:09 +0800
Subject: [PATCH] 付款单增加源单功能

---
 WebTM/views/采购管理/付款单/YF_PayMentBill.html |  389 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 329 insertions(+), 60 deletions(-)

diff --git "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\344\273\230\346\254\276\345\215\225/YF_PayMentBill.html" "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\344\273\230\346\254\276\345\215\225/YF_PayMentBill.html"
index badff8d..f6139a7 100644
--- "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\344\273\230\346\254\276\345\215\225/YF_PayMentBill.html"
+++ "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\344\273\230\346\254\276\345\215\225/YF_PayMentBill.html"
@@ -206,10 +206,10 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">浠樻浜嬬敱</label>
                                             <div class="layui-input-inline">
-                                                <input class="layui-input" name="HReason" value="" id="HReason" autocomplete="off" >
+                                                <input class="layui-input" name="HReason" value="" id="HReason" autocomplete="off">
                                             </div>
                                         </div>
-                                       
+
                                     </div>
                                     <div class="layui-row">
                                         <div class="layui-inline">
@@ -307,11 +307,16 @@
                             </div>
                         </div>
                     </div>
+                   
+                        <table  id="mainTable" lay-filter="mainTable" ></table>
+                    
                 </form>
             </div>
         </div>
     </div>
-
+    <script type="text/html" id="barDemo">
+        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
+    </script>
     <script>
 
         layui.config({
@@ -336,6 +341,9 @@
 
             //#endregion
 
+            //瀛愯〃娓叉煋鍙傛暟
+            var option = {};
+            var tableShow = false;
             //#region 杩涘叆椤甸潰鍗冲姞杞�
             //#region 鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             if (sessionStorage.login != "login") {
@@ -366,9 +374,13 @@
 
                 //涓氬姟鍛樸�侀儴闂ㄥ垵濮嬪寲
                 getCzyglByUser();
+                //鍒濆鍖栧瓙琛�
+                set_InitGrid();
             }
             else if (OperationType == 3) {   //缂栬緫
                 $('#print-btn').prop('disabled', false).removeClass('layui-btn-disabled');
+                //鍒濆鍖栧瓙琛�
+                set_InitGrid()
                 //鍔犺浇缂栬緫椤甸潰
                 RoadBillMain(linterid);
             }
@@ -379,6 +391,12 @@
             //#endregion
 
             //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
+
+            //#region 琛屽唴浜嬩欢
+            table.on('tool(mainTable)', function (obj) {
+                set_GridDelete(obj);   //琛屽唴鍒犻櫎
+            });
+            //#endregion
 
             //#region 寮圭獥閫夋嫨瑙﹀彂浜嬩欢
             //#region 閫夋嫨閮ㄩ棬鎸夐挳
@@ -533,7 +551,7 @@
             //#region 淇濆瓨鎻愪氦
             form.on('submit(btnSave)', function (data) {//鎻愪氦
                 //if (AllowLoadData(data)) {
-                    set_AddNew(data);
+                set_AddNew(data);
                 //}
             });
             //#endregion
@@ -646,6 +664,71 @@
             }
             //#endregion
 
+
+            //#region 瀛愯〃鍒濆鍖�
+            function set_InitGrid() {
+                option = {
+                    elem: '#mainTable'
+                    , toolbar: '#toolbarDemo'
+                    , totalRow: true
+                    , limit: 500
+                    , height: 500
+                    , loading: false
+                    , cols: [[ //瀛愯〃
+                        { type: 'checkbox', totalRowText: '鍚堣琛�' }
+                        , { type: 'numbers', title: '搴忓彿', width: 100 }
+                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, style: 'background-color:#efefef4d;'}
+                        , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, style: 'background-color:#efefef4d;' }
+                        , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, style: 'background-color:#efefef4d;' }
+                        , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, style: 'background-color:#efefef4d;'}
+                        , { field: 'HQty', title: '鏁伴噺', width: 100, totalRow: true }
+                        , { field: 'HPrice', title: '鍗曚环', width: 100, style: 'background-color:#efefef4d;' }
+                        , { field: 'HMoney', title: '缁撶畻閲戦', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HReceiveBillInterID', title: '鎺ユ敹婧愬崟鍐呯爜', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HReceiveBillEntryID', title: '鎺ユ敹婧愬崟瀛愬唴鐮�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HReceiveBillNo', title: '鎺ユ敹婧愬崟鍙�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSourceDate', title: '婧愬崟鏃ユ湡', width: 100, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSourceMoney', title: '婧愬崟閲戦', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSourceMoneyBB', title: '婧愬崟閲戦鏈綅甯�', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HInovceExRate', title: '褰撴湡姹囩巼', width: 100, style: 'background-color:#efefef4d;'}
+                        //, { field: 'HReadyCheckMoney', title: '宸叉牳閿�閲戦', width: 100 }
+                        //, { field: 'HUnCheckMoney', title: '鏈牳閿�閲戦', width: 100 }
+                        //, { field: 'HCheckMoney', title: '鏈鏍搁攢閲戦', width: 100}
+                        //, { field: 'HCheckMoneyBB', title: '鏈鏍搁攢閲戦', width: 100}
+                        , { field: 'HSourceRemark', title: '婧愬崟澶囨敞', width: 100 }
+
+                        , { field: 'HSourceInterID', title: '婧愬崟鍐呯爜', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSourceBillNo', title: '婧愬崟鍙�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+
+                        //, { field: 'HRelationQty', title: '鍏宠仈鏁伴噺', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' }
+                        //, { field: 'HRelationMoney', title: '鍏宠仈閲戦', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' }
+
+                        , { field: 'HPOOrderInterID', title: '閲囪喘璁㈠崟鍐呯爜', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HPOOrderEntryID', title: '閲囪喘璁㈠崟瀛愬唴鐮�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HPOOrderBillNo', title: '閲囪喘璁㈠崟鍙�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+
+                        , { field: 'HSeOrderInterID', title: '閿�鍞鍗曞唴鐮�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSeOrderEntryID', title: '閿�鍞鍗曞瓙鍐呯爜', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HSeOrderBillNo', title: '閿�鍞鍗曞彿', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        //, { field: 'HPOContractInterID', title: '閲囪喘鍚堝悓鍐呯爜', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        //, { field: 'HPOContractEntryID', title: '閲囪喘鍚堝悓瀛愬唴鐮�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        //, { field: 'HPOContractBillNo', title: '閲囪喘鍚堝悓鍙�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+
+                        //, { field: 'HSeContractInterID', title: '閿�鍞悎鍚屽唴鐮�', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        //, { field: 'HSeContractEntryID', title: '閿�鍞悎鍚屽瓙鍐呯爜', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        //, { field: 'HSeContractBillNo', title: '閿�鍞悎鍚屽彿', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
+                    ]]
+                }
+                
+            }
+            //#endregion
+
+
             //#region 鏃堕棿缁勪欢鍒濆鍖�
             function set_InitDate() {
                 var dateList = ["#HAccDate"];
@@ -683,6 +766,27 @@
                 });
             }
             //#endregion
+
+            //#region 琛屽唴鍒犻櫎
+            function set_GridDelete(obj) {
+                var data = obj.data;
+                var rowIndex = $(obj.tr).attr("data-index");
+                if (obj.event === 'del') {
+                    layer.confirm('鐪熺殑鍒犻櫎琛屽悧锛�', function (index) {
+                        console.log("绱㈠紩涓�:" + rowIndex);
+                        if (rowIndex === '0') {
+                            layer.msg('棣栬鏃犳硶鍒犻櫎锛侊紒锛�');
+                        } else {
+                            obj.del();
+                            option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓�
+                            table.reload(option);
+                            layer.close(index);
+                        }
+                    });
+                }
+            }
+            //#endregion
+
             //#region 寮圭獥椤甸潰鏂规硶
             //#region 閫夋嫨閮ㄩ棬
             function get_checkDept() {
@@ -695,21 +799,21 @@
                     , 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) { }
+                        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) { }
                 })
             }
             //#endregion
 
-           function get_checkEmp() {
+            function get_checkEmp() {
                 layer.open({
                     type: 2//寮圭獥绫诲瀷
                     , skin: 'layui-layer-rim' //鍔犱笂杈规
@@ -816,7 +920,7 @@
                                 //table.reload(layTableId, {
                                 //    data: ajaxReturnData
                                 //});
-                            },error: function (err) {
+                            }, error: function (err) {
                                 layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                             }
                         });
@@ -835,44 +939,114 @@
                     type: 2//寮圭獥绫诲瀷
                     , skin: 'layui-layer-rim' //鍔犱笂杈规
                     , area: ['90%', '90%']//澶у皬
-                    , title: '婧愬崟-搴斾粯鍗�' +  + '鍒楄〃'//鏍囬
+                    , title: '婧愬崟-搴斾粯鍗�' + '鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
                     , content: [url, '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 != 1) {
-                            return layer.msg('璇烽�夋嫨涓�琛屾暟鎹�');
+                        if (checkStatus.data.length === 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        checkStatus = checkStatus.data;
-                        console.log(checkStatus);
-                        form.val("formData", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
-                            "HMainSourceInterID": checkStatus[0].hmainid
-                            , "HMainSourceEntryID": checkStatus[0].hsubid
-                            , "HMainSourceBillNo": checkStatus[0].鍗曟嵁鍙�
-                            , "HMainSourceBillType": '1114'
+                        setPayableBill(checkStatus);
 
-                            , "HDeptID": checkStatus[0].HDeptID
-                            , "HDeptName": checkStatus[0].閮ㄩ棬
-                            , "HEmpID": checkStatus[0].HEmpID
-                            , "HEmpName": checkStatus[0].涓氬姟鍛�
-                            , "HCurID": checkStatus[0].HCurID
-                            , "HCurName": checkStatus[0].甯佸埆
-                            , "HExRate": checkStatus[0].绋庣巼
-                            , "HSSID": checkStatus[0].HSSID
-                            , "HSupID": checkStatus[0].HSupID
-                            , "HSupName": checkStatus[0].渚涘簲鍟�
-                            , "HSSName": checkStatus[0].缁撶畻鏂瑰紡
-                            /*, "HSSNum": checkStatus[0].缁撶畻鍙�*/
-                            , "HAccSupID": checkStatus[0].HSupID
-                            , "HAccSupName": checkStatus[0].渚涘簲鍟�
-                            , "HSumMoney": checkStatus[0].閲戦
-                        });
                         layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) { }
                 })
+            }
+            //#endregion
+
+
+            //#region 閫夋嫨婧愬崟-浠樻鍗�
+            function setPayableBill(checkStatus) {
+                var dataArray = [];
+
+                for (var i = 0; i < checkStatus.data.length; i++) {
+                    var temp = checkStatus.data[i];
+                    if (temp != "none") {
+                        if (temp.鍗曟嵁鐘舵�� != "宸插鏍�") {
+                            layer.msg("涓嬫帹澶辫触!鍗曟嵁鍙枫��" + temp.鍗曟嵁鍙� + "銆戝崟鎹姸鎬佷笉涓哄凡瀹℃牳鐘舵��!");
+                            return;
+                        }
+                        //if (temp.琛岀姸鎬� == "宸插叧闂�") {
+                        //    layer.msg("涓嬫帹澶辫触!鍗曟嵁鍙枫��" + temp.鍗曟嵁鍙� + "銆戜笅閫変腑鐨勮褰曚腑瀛樺湪宸插叧闂姸鎬佺殑璁板綍!");
+                        //    return;
+                        //}
+                        dataArray.push(temp);
+                    } else {
+                        return;
+                    }
+                }
+
+                form.val("formData", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
+                    "HMainSourceInterID": 0
+                    , "HMainSourceEntryID": 0
+                    , "HMainSourceBillNo": ''
+                    , "HMainSourceBillType": '1114'
+
+                    , "HDeptID": dataArray[0].HDeptID
+                    , "HDeptName": dataArray[0].閮ㄩ棬
+                    , "HEmpID": dataArray[0].HEmpID
+                    , "HEmpName": dataArray[0].涓氬姟鍛�
+                    , "HCurID": dataArray[0].HCurID
+                    , "HCurName": dataArray[0].甯佸埆
+                    , "HExRate": dataArray[0].绋庣巼
+                    , "HSSID": dataArray[0].HSSID
+                    , "HSupID": dataArray[0].HSupID
+                    , "HSupName": dataArray[0].渚涘簲鍟�
+                    , "HSSName": dataArray[0].缁撶畻鏂瑰紡
+                    /*, "HSSNum": checkStatus[0].缁撶畻鍙�*/
+                    , "HAccSupID": dataArray[0].HSupID
+                    , "HAccSupName": dataArray[0].渚涘簲鍟�
+                    , "HSumMoney": dataArray[0].閲戦
+                });
+
+                //瀛愯〃  璧嬪��
+                var rowdata = [];
+                for (var i = 0; i < dataArray.length; i++) {
+                    rowdata.push(
+                        {
+                            "HMaterID": dataArray[i].HMaterID == null ? 0 : dataArray[i].HMaterID
+                            , "鐗╂枡浠g爜": dataArray[i].鐗╂枡浠g爜
+                            , "鐗╂枡鍚嶇О": dataArray[i].鐗╂枡鍚嶇О
+                            , "瑙勬牸鍨嬪彿": dataArray[i].瑙勬牸鍨嬪彿
+                            , "HUnitID": dataArray[i].HUnitID == null ? 0 : dataArray[i].HUnitID
+                            , "璁¢噺鍗曚綅": dataArray[i].璁¢噺鍗曚綅
+                            , "HQty": dealDoubleToFixed(dataArray[i].鏁伴噺, 1)
+                            , "HPrice": dealDoubleToFixed(dataArray[i].鍗曚环, 3)                                                   //
+                            , "HMoney": dealDoubleToFixed(dataArray[i].閲戦, 2)
+                            , "HReceiveBillInterID": dataArray[i].hmainid
+                            , "HReceiveBillEntryID": dataArray[i].hsubid
+                            , "HReceiveBillNo": dataArray[i].鍗曟嵁鍙�
+                            , "HSourceDate": Format(dataArray[i].鏃ユ湡, "yyyy-MM-dd")
+                            , "HSourceMoney": dealDoubleToFixed(dataArray[i].閲戦, 2)
+                            , "HSourceMoneyBB": dealDoubleToFixed(dataArray[i].閲戦 * dataArray[0].姹囩巼, 2)
+                            , "HInovceExRate": dataArray[i].姹囩巼
+
+                            , "HSourceRemark": dataArray[i].琛ㄤ綋澶囨敞
+
+                            , "HSourceInterID": dataArray[i].hmainid
+                            , "HSourceEntryID": dataArray[i].hsubid
+                            , "HSourceBillNo": dataArray[i].鍗曟嵁鍙�
+                            , "HSourceBillType": dataArray[i].鍗曟嵁绫诲瀷
+                            , "HRelationQty": "0"
+                            , "HRelationMoney": "0"
+
+                            , 'HPOOrderInterID': dataArray[i].HPOOrderInterID
+                            , 'HPOOrderEntryID': dataArray[i].HPOOrderEntryID
+                            , 'HPOOrderBillNo': dataArray[i].HPOOrderBillNo
+
+                            , "HSeOrderInterID": dataArray[i].HSeOrderInterID
+                            , "HSeOrderEntryID": dataArray[i].HSeOrderEntryID
+                            , "HSeOrderBillNo": dataArray[i].HSeOrderBillNo
+                        }
+                    );
+                }
+                option.data = rowdata;
+                table.render(option);
+                tableShow = true;
             }
             //#endregion
 
@@ -999,11 +1173,23 @@
                     layer.msg("璇烽�夋嫨缁撶畻鍗曚綅锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
                 }
-        
+
 
                 //鑾峰彇琛ㄥご鏁版嵁骞跺簭鍒楀寲
                 var sMainStr = JSON.stringify(data.field);              //涓昏〃鏁版嵁
-                var sSubStr = JSON.stringify([]);                     //瀛愯〃鏁版嵁
+                //瀛愯〃鏁版嵁
+                if (tableShow == true) {
+                    var num = [];
+                    for (var i = 0; i < table.cache["mainTable"].length; i++) {
+                        if (table.cache["mainTable"][i] != "") {
+                            table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
+                            num.push(table.cache["mainTable"][i])
+                        }
+                    }
+                    var sSubStr = JSON.stringify(num);
+                } else {
+                    var sSubStr = JSON.stringify([]);
+                }                 
 
                 //鎷兼帴搴忓垪鍖栫殑鏁版嵁
                 var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav + ';' + sessionStorage["HUserName"];
@@ -1060,13 +1246,13 @@
                                 , "HDate": formatDate(data.鏃ユ湡)
                                 , "HDeptID": data.HDeptID
                                 , "HDeptName": data.閮ㄩ棬
-                                , "HEmpID": data.hempid
+                                , "HEmpID": data.HEmpID
                                 , "HEmpName": data.涓氬姟鍛�
-                                , "HCurID": data.hcurid
+                                , "HCurID": data.HCurID
                                 , "HCurName": data.甯佸埆
                                 , "HExRate": data.姹囩巼
-                                , "HSSID": data.hssid
-                                , "HSupID": data.hsupid
+                                , "HSSID": data.HSSID
+                                , "HSupID": data.HSupID
                                 , "HSupName": data.涓氬姟鍗曚綅
                                 , "HSSName": data.缁撶畻鏂瑰紡
                                 , "HSSNum": data.缁撶畻鍙�
@@ -1097,6 +1283,53 @@
 
                             HOrgIDBar = data.HOrgID == null ? 0 : data.HOrgID;
 
+                            if (data.hsubid != null) {
+                                //瀛愯〃  璧嬪��
+                                var rowdata = [];
+                                for (var i = 0; i < result.data.length; i++) {
+                                    rowdata.push(
+                                        {
+                                            "HMaterID": result.data[i].瀛愯〃涓婚敭 == null ? 0 : result.data[i].瀛愯〃涓婚敭
+                                            , "鐗╂枡浠g爜": result.data[i].鐗╂枡浠g爜
+                                            , "鐗╂枡鍚嶇О": result.data[i].鐗╂枡鍚嶇О
+                                            , "瑙勬牸鍨嬪彿": result.data[i].瑙勬牸鍨嬪彿
+                                            , "HUnitID": result.data[i].HUnitID == null ? 0 : result.data[i].HUnitID
+                                            , "璁¢噺鍗曚綅": result.data[i].璁¢噺鍗曚綅鍚嶇О
+                                            , "HQty": dealDoubleToFixed(result.data[i].鏁伴噺, 1)
+                                            , "HPrice": dealDoubleToFixed(result.data[i].鍗曚环, 3)                                                   //
+                                            , "HMoney": dealDoubleToFixed(result.data[i].缁撶畻閲戦, 2)
+                                            , "HReceiveBillInterID": result.data[i].婧愬崟涓诲唴鐮�
+                                            , "HReceiveBillEntryID": result.data[i].婧愬崟瀛愬唴鐮�
+                                            , "HReceiveBillNo": result.data[i].婧愬崟鍗曞彿
+                                            , "HSourceDate": Format(result.data[i].婧愬崟鏃ユ湡, "yyyy-MM-dd")
+                                            , "HSourceMoney": dealDoubleToFixed(result.data[i].婧愬崟閲戦, 2)
+                                            , "HSourceMoneyBB": dealDoubleToFixed(result.data[i].婧愬崟閲戦鏈綅甯�, 2)
+                                            , "HInovceExRate": result.data[i].褰撴湡姹囩巼
+
+                                            , "HSourceRemark": result.data[i].婧愬崟澶囨敞
+
+                                            , "HSourceInterID": result.data[i].婧愬崟涓诲唴鐮�
+                                            , "HSourceEntryID": result.data[i].婧愬崟瀛愬唴鐮�
+                                            , "HSourceBillNo": result.data[i].婧愬崟鍗曞彿
+                                            , "HSourceBillType": 1114
+                                            , "HRelationQty": result.data[i].鍏宠仈鏁伴噺
+                                            , "HRelationMoney": result.data[i].鍏宠仈閲戦
+
+                                            , 'HPOOrderInterID': result.data[i].閲囪喘璁㈠崟涓诲唴鐮�
+                                            , 'HPOOrderEntryID': result.data[i].閲囪喘璁㈠崟瀛愬唴鐮�
+                                            , 'HPOOrderBillNo': result.data[i].閲囪喘璁㈠崟鍙�
+
+                                            , "HSeOrderInterID": result.data[i].閿�鍞鍗曚富鍐呯爜
+                                            , "HSeOrderEntryID": result.data[i].閿�鍞鍗曞瓙鍐呯爜
+                                            , "HSeOrderBillNo": result.data[i].閿�鍞鍗曞彿
+                                        }
+                                    );
+                                }
+                                option.data = rowdata;
+                                table.render(option);
+                                tableShow = true;
+                            }
+
                             layer.close(ajaxLoad);
                         } else {
                             layer.close(ajaxLoad);
@@ -1118,8 +1351,8 @@
                 var ref1 = /^\d+$/;                 //鍒ゆ柇鏄惁鏄潪璐熸暣鏁�
                 var value1 = ["#HWantPay"];  //瀛愯〃闇�瑕佽繘琛屾诞鐐规暟楠岃瘉鐨勫睘鎬ф竻鍗�
                 var value1_ = ["鏈熸湜钖按"];  ////瀛愯〃闇�瑕佽繘琛屾诞鐐规暟楠岃瘉鐨勫睘鎬ф竻鍗曞搴旂殑鍒楀悕娓呭崟
-                var value2 = ["#HAge","#HContractYear"];  //瀛愯〃闇�瑕佹暣鏁版楠岀殑灞炴�ф竻鍗�
-                var value2_ = ["骞撮緞","鍚堝悓鏈熼檺"]; //瀛愯〃闇�瑕佹暣鏁版楠岀殑灞炴�ф竻鍗曞搴旂殑鍒楀悕娓呭崟
+                var value2 = ["#HAge", "#HContractYear"];  //瀛愯〃闇�瑕佹暣鏁版楠岀殑灞炴�ф竻鍗�
+                var value2_ = ["骞撮緞", "鍚堝悓鏈熼檺"]; //瀛愯〃闇�瑕佹暣鏁版楠岀殑灞炴�ф竻鍗曞搴旂殑鍒楀悕娓呭崟
                 var value3 = [];       //瀛愯〃闇�瑕佽繘琛岄潪绌烘楠岀殑灞炴�ф竻鍗�
                 var value3_ = [];                                 //瀛愯〃闇�瑕佽繘琛岄潪绌烘楠岀殑灞炴�ф竻鍗曞搴旂殑鍒楀悕娓呭崟
                 //#endregion
@@ -1159,6 +1392,42 @@
                 return true;
             }
             //#endregion
+
+            //#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
             //#endregion
             //#endregion
 
@@ -1177,26 +1446,26 @@
             $("#HBankID").val(obj[0].HItemID);
         }
 
-        
+
         function GetHSupNameValue(obj)  //杩斿洖渚涘簲鍟�
-       {
+        {
             $("#HSupName").val(obj[0].渚涘簲鍟嗗悕绉�);
             $("#HSupID").val(obj[0].HItemID);
-        } 
+        }
 
-         function GetSettleStyleValue(obj)  //杩斿洖缁撶畻鏂瑰紡
+        function GetSettleStyleValue(obj)  //杩斿洖缁撶畻鏂瑰紡
         {
             $("#HSSName").val(obj[0].缁撶畻鏂瑰紡鍚嶇О);
             $("#HSSID").val(obj[0].HItemID);
         }
 
-         function GetHDeptNameValue(obj)  //杩斿洖閮ㄩ棬
-       {
-           $("#HDeptName").val(obj[0].閮ㄩ棬鍚嶇О);
-           $("#HDeptID").val(obj[0].HItemID);
-        } 
+        function GetHDeptNameValue(obj)  //杩斿洖閮ㄩ棬
+        {
+            $("#HDeptName").val(obj[0].閮ㄩ棬鍚嶇О);
+            $("#HDeptID").val(obj[0].HItemID);
+        }
 
-         function GetHAccSupNameValue(obj)  //杩斿洖缁撶畻鍗曚綅
+        function GetHAccSupNameValue(obj)  //杩斿洖缁撶畻鍗曚綅
         {
             $("#HAccSupName").val(obj[0].渚涘簲鍟嗗悕绉�);
             $("#HAccSupID").val(obj[0].HItemID);

--
Gitblit v1.9.1