From cb2fc709d4e2aec6bbea3e6f4e8ccc24f3d27756 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期日, 06 十月 2024 17:27:08 +0800
Subject: [PATCH] 工艺路线工价

---
 WebTM/views/销售管理/收款单/YS_ReceiveBill.html |  553 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 534 insertions(+), 19 deletions(-)

diff --git "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\346\224\266\346\254\276\345\215\225/YS_ReceiveBill.html" "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\346\224\266\346\254\276\345\215\225/YS_ReceiveBill.html"
index 38778e6..defdbba 100644
--- "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\346\224\266\346\254\276\345\215\225/YS_ReceiveBill.html"
+++ "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\346\224\266\346\254\276\345\215\225/YS_ReceiveBill.html"
@@ -285,6 +285,18 @@
                                                 <input class="layui-input" name="HAvailableBalance" id="HAvailableBalance" autocomplete="off" readonly>
                                             </div>
                                         </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label">婧愬崟鍙�</label>
+                                            <div class="layui-input-inline">
+                                                <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="text" name="HMainSourceBillNo" id="HMainSourceBillNo" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HMainSource" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
+                                            </div>
+                                        </div>
                                     </div>
                                     <div class="layui-row" style="margin-top:10px;">
                                         <div class="layui-inline">
@@ -298,7 +310,7 @@
                                     </div>
 
                                     <!--闅愯棌瀛楁-->
-                                    <div class="layui-row" style="display:none;">
+                                    <!--<div class="layui-row" style="display:none;">
                                         <div class="layui-inline">
                                             <div class="layui-input-block">
                                                 <input class="layui-input" name="HMainSourceInterID" id="HMainSourceInterID" value="0" autocomplete="off">
@@ -307,7 +319,7 @@
                                                 <input class="layui-input" name="HMainSourceBillType" id="HMainSourceBillType" value="" autocomplete="off">
                                             </div>
                                         </div>
-                                    </div>
+                                    </div>-->
                                 </div>
                             </div>
                             <!--鍏朵粬淇℃伅-->
@@ -404,11 +416,19 @@
                             </div>
                         </div>
                     </div>
+                    <table id="mainTable" lay-filter="mainTable"></table>
+                    <script type="text/html" id="toolbarDemo">
+                        <div class="layui-btn-container">
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
+                        </div>
+                    </script>
                 </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({
@@ -446,7 +466,7 @@
             //閫氳繃鍗曟嵁绫诲瀷锛屼粠鏁版嵁搴撳姩鎬佽幏鍙栧崟鎹ā鍧楀懡鍚�,寮曠敤js鏂囦欢 PageTitle.js
             var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
             $("h1").html('<b>' + HPageTitle + '</b>');
-		    //#endregion
+            //#endregion
 
             //#endregion
 
@@ -464,12 +484,16 @@
 
                 //閿�鍞憳銆侀攢鍞儴闂ㄣ�侀攢鍞富绠″垵濮嬪寲
                 getCzyglByUser();
+                //鍒濆鍖栧瓙琛�
+                set_InitGrid();
             }
-            else if (OperationType == 3) {                                                 //缂栬緫
+            else if (OperationType == 3) {//缂栬緫
+                //鍒濆鍖栧瓙琛�
+                set_InitGrid();
                 if (closeType == 10) {
                     $('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);
                     $('#set_CheckBill').addClass("layui-btn-disabled").attr("disabled", true);
-                  
+
                 }
                 //鍔犺浇缂栬緫椤甸潰
                 RoadBillMain(linterid);
@@ -490,10 +514,54 @@
 
             //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
 
+            //澶村伐鍏锋爮浜嬩欢
+            table.on('toolbar(mainTable)', function (obj) {   //鐩戝惉mainTable琛ㄦ牸涓婄殑宸ュ叿鏍忎簨浠� 瑙﹀彂鍥炶皟鍑芥暟obj鍙傛暟
+                var checkStatus = table.checkStatus('mainTable')  //  鐩戝惉閫変腑鐨勭殑鐘舵��
+                    , data = checkStatus.data;          //浠庨�変腑鐘舵�佷腑鎻愬彇鏁版嵁锛岃繖浜涙暟鎹槸琛ㄦ牸涓閫変腑鐨勮   
+                switch (obj.event) { // switch (obj.event)鐢ㄤ簬鏍规嵁obj.event鐨勫�兼潵鍐冲畾鎵ц鍝釜case鍧�
+                    ////鍒楄缃�
+                    case 'set_HideColumn':
+                        get_HideColumn();
+                        break;
+                }
+            });
+            //#region 琛屽唴浜嬩欢
+            table.on('tool(mainTable)', function (obj) {
+                set_GridDelete(obj);   //琛屽唴鍒犻櫎
+            });
+            //#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 閫夋嫨閿�鍞儴闂ㄦ寜閽�
             form.on('submit(HDeptList)', function () {
                 get_checkDept();
+            });
+            //#endregion
+
+            //#region 閫夋嫨婧愬崟鎸夐挳
+            form.on('submit(HMainSource)', function () {
+                get_checkMainSource();
             });
             //#endregion
 
@@ -565,8 +633,11 @@
                     var HSumMoney = newHSumMoney * 1;                       //閲戦
                     var HDiscountRate = $("#HDiscountRate").val() * 1;      //鏁村崟鎶樻墸
                     var HRelSumMoney = HSumMoney * HDiscountRate * 0.01;    //鎶樻墸鍚庨噾棰�
+                    HRelSumMoney = dealDoubleToFixed(HRelSumMoney, 2);
+
                     var HGiftRate = $("#HGiftRate").val() * 1;              //璧犻�佹瘮渚�
                     var HGiftMoney = HSumMoney * HGiftRate * 0.01;
+                    HGiftMoney = dealDoubleToFixed(HGiftMoney, 2);
 
                     $("#HSumMoney").val(HSumMoney);
                     $("#HDiscountRate").val(HDiscountRate);
@@ -595,6 +666,7 @@
                     var HSumMoney = $("#HSumMoney").val() * 1;                   //閲戦
                     var HDiscountRate = newHDiscountRate * 1;                      //鏁村崟鎶樻墸
                     var HRelSumMoney = HSumMoney * HDiscountRate * 0.01;        //鎶樻墸鍚庨噾棰�
+                    HRelSumMoney = dealDoubleToFixed(HRelSumMoney, 2);
 
                     $("#HSumMoney").val(HSumMoney);
                     $("#HDiscountRate").val(HDiscountRate);
@@ -610,6 +682,7 @@
                 var HSumMoney = $("#HSumMoney").val() * 1;                       //閲戦
                 var HGiftRate = $("#HGiftRate").val() * 1;              //璧犻�佹瘮渚�
                 var HGiftMoney = HSumMoney * HGiftRate * 0.01;
+                HGiftMoney = dealDoubleToFixed(HGiftMoney, 2);
 
                 $("#HGiftMoney").val(HGiftMoney);
             });
@@ -757,6 +830,70 @@
             }
             //#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, edit: 'text'}
+                        , { 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 }
+                    ]]
+                }
+                option.data = [];
+                table.render(option);
+            }
+            //#endregion
+
             //#region 鏃堕棿缁勪欢鍒濆鍖�
             function set_InitDate() {
                 var dateList = ["#HAccDate"];
@@ -805,7 +942,7 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '閿�鍞儴闂ㄥ垪琛�'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_DepartmentList.html', 'yes']
+                    , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_DepartmentList.html', 'yes']
                     //, btn: ['纭畾', '鍙栨秷']
                     //, btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                     //    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -830,7 +967,7 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '閿�鍞憳鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_EmployeeList.html?Type=HEmp', 'yes']
+                    , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_EmployeeList.html?Type=HEmp', 'yes']
                     //, btn: ['纭畾', '鍙栨秷']
                     //, btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                     //    var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -882,7 +1019,7 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '涓氬姟瀹㈡埛鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_CustomerList.html?Type=1&openType=3&HEmp='+HEmpID, 'yes']
+                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_CustomerList.html?Type=1&openType=3&HEmp=' + HEmpID, 'yes']
                     , btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                         var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -912,7 +1049,7 @@
                     , area: ['90%', '90%']//澶у皬
                     , title: '缁撶畻鏂瑰紡鍒楄〃'//鏍囬
                     , shift: 2//寮瑰嚭鍔ㄧ敾
-                    , content: ['../../Baseset/鍩虹璧勬枡/Gy_SettleStyle.html', 'yes']
+                    , content: ['../../鍩虹璧勬枡/鍩虹璧勬枡/Gy_SettleStyle.html', 'yes']
                     , btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                         var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -920,7 +1057,7 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        $("#HSSName").val(checkStatus.data[0].HName);
+                        $("#HSSName").val(checkStatus.data[0].缁撶畻鏂瑰紡鍚嶇О);
                         $("#HSSID").val(checkStatus.data[0].HItemID);
                         layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
@@ -1004,8 +1141,140 @@
                 })
             }
             //#endregion
+
+            //#region 閫夋嫨婧愬崟
+            function get_checkMainSource() {
+                var url = "";
+                var HOrgID = $("#HOrgID").val();
+                url = "../../閿�鍞鐞�/搴旀敹鍗�/Xs_ReceivableBillList.html?openType=2&HOrgID=" + HOrgID;
+                layer.open({
+                    type: 2//寮圭獥绫诲瀷
+                    , skin: 'layui-layer-rim' //鍔犱笂杈规
+                    , area: ['90%', '90%']//澶у皬
+                    , 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 === 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁');
+                        }
+                        var HCusID = $("#HCusID").val();//鍒ゆ柇瀹㈡埛
+                        if (HCusID == 0 || HCusID == '') {
+                            HCusID = checkStatus.data[0]["HCusID"];
+                        }
+                        for (var i = 0; i < checkStatus.data.length; i++) {
+                            if (checkStatus.data[i]["HCusID"] != HCusID) {
+                                layer.msg("涓嬫帹澶辫触!宸茬粡閫変腑鐨勮褰曚腑瀛樺湪涓嶅悓瀹㈡埛!");
+                                layer.close(index);
+                                return;
+                            }
+                        }
+                        setReceivableBill(checkStatus);
+
+                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
+                })
+            }
             //#endregion
-            
+
+            //#region 閫夋嫨婧愬崟-搴旀敹鍗�
+            function setReceivableBill(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": '1426'
+
+                    , "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
+                    , "HSSName": dataArray[0].缁撶畻鏂瑰紡
+                    , "HCusID": dataArray[0].HCusID
+                    , "HCusName": dataArray[0].瀹㈡埛
+                    /*, "HSSNum": checkStatus[0].缁撶畻鍙�*/
+                    , "HSumMoney": dataArray[0].閲戦
+                });
+
+                //瀛愯〃  璧嬪��
+                var rowdata = [];
+                var sumMoney = 0;
+                for (var i = 0; i < dataArray.length; i++) {
+                    sumMoney = sumMoney + dealDoubleToFixed(dataArray[i].閲戦, 2);
+                    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": 1426
+                            , "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
+                        }
+                    );
+                }
+                $("#HSumMoney").val(sumMoney);
+                $("#HRelSumMoney").val(sumMoney);
+                option.data = rowdata;
+                table.render(option);
+            }
+            //#endregion
+
+            //#endregion
+
             //#region 淇濆瓨HMaker
             function set_AddNew(data) {
                 //鑾峰彇鎿嶄綔鏂瑰紡
@@ -1028,7 +1297,21 @@
 
                 //鑾峰彇琛ㄥご鏁版嵁骞跺簭鍒楀寲
                 var sMainStr = JSON.stringify(data.field);              //涓昏〃鏁版嵁
-                var sSubStr = JSON.stringify([]);                     //瀛愯〃鏁版嵁
+                //鑾峰彇琛ㄥご鏁版嵁骞跺簭鍒楀寲
+                var sMainStr = JSON.stringify(data.field);              //涓昏〃鏁版嵁
+                //瀛愯〃鏁版嵁
+                if (table.cache["mainTable"].length != 0) {
+                    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"];
@@ -1043,7 +1326,11 @@
                         if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                             layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
                                 $('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);
-                                layer.msg("鎻愪氦鎴愬姛");
+                                if (data.Verify == "Y") //鑷姩瀹℃牳
+                                {
+                                    $("#HInterID").val(data.HInterID);//鑾峰彇鎻愪氦鎴愬姛杩斿洖鐨勫崟鎹富ID
+                                    set_CheckBill(0); //瀹℃牳
+                                }
                             });
                         }
                         else {
@@ -1126,7 +1413,59 @@
                             });
 
                             HOrgIDBar = data.HOrgID == null ? 0 : data.HOrgID;
+                            if (data.hsubid != null) {
+                                //瀛愯〃  璧嬪��
+                                var rowdata = [];
+                                var allMoney = 0;
+                                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": result.data[i].婧愬崟绫诲瀷
+                                            , "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].閿�鍞鍗曞彿
+                                        }
+                                    );
+                                    allMoney = Number(result.data[i]["缁撶畻閲戦"]) + allMoney
+                                }
+                                option.data = rowdata;
+                                table.render(option);
+
+                                //璁剧疆涓昏〃閲戦
+                                $("#HSumMoney").val(allMoney);
+                                var HDiscountRate = $("#HDiscountRate").val() * 1;      //鏁村崟鎶樻墸
+                                var HRelSumMoney = allMoney * HDiscountRate * 0.01;    //鎶樻墸鍚庨噾棰�
+                                $("#HRelSumMoney").val(HRelSumMoney);
+                            }
                             layer.close(ajaxLoad);
                         } else {
                             layer.close(ajaxLoad);
@@ -1243,7 +1582,7 @@
                     return false;
                 }
 
-                
+
 
                 if ($("#HSSID").val() == "0") {
                     layer.msg("缁撶畻鏂瑰紡鏈�夋嫨!");
@@ -1358,19 +1697,146 @@
             }
             //#endregion
             //#endregion
+
+
+            //#region 闅愯棌鍒楄缃�
+            function get_HideColumn() {
+                var colName = "";
+                for (var i = 1; i < option.cols[0].length; i++) {
+                    colName += option.cols[0][i]["title"] + ",";
+                }
+
+                colName = encodeURI(colName.substring(0, colName.length - 1));//瀵� URI 杩涜缂栫爜
+                layer.open({
+                    type: 2
+                    , skin: "layui-layer-rim" //鍔犱笂杈规
+                    , title: "闅愯棌鍒楄缃�"  //鏍囬
+                    , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                    , shift: 2 //寮瑰嚭鍔ㄧ敾
+                    , area: ["50%", "90%"] //绐椾綋澶у皬
+                    , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                    , content: ['../../鍩虹璧勬枡/闅愯棌鍒楄缃�/Gy_GridView_Hide_New.html?HModName=' + HModName + '&colName=' + colName, "yes"]
+                    , btn: ["纭畾", "鍙栨秷"]
+                    , btn1: function (index, laero) {
+                        //鍒锋柊琛ㄦ牸鏁版嵁
+                        DisPlay_HideColumn();
+                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                        layer.close(index);//鍏抽棴寮圭獥
+                    }
+                })
+            }
+            //#endregion
+
+            //#region 鏄剧ず鍒楁暟鎹�
+            function DisPlay_HideColumn() {
+                $.ajax({
+                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
+                    type: "GET",
+                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
+                    success: function (data1) {
+                        if (data1.data.length != 0) {
+
+                            var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁
+                            var titleData = ["hmainid", "HBillType", "HSupID", "涓氬姟鐘舵��", "HUnitID", "渚涘簲鍟嗕唬鐮�", "涓氬姟鍛樹唬鐮�", "HPriority", "HPSStyleID", "HSSID", "HCurID", "HDeptID", "HManagerID", "HEmpID", "hsubid", "HMaterID"];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+                            var newCols = [[]];//瀵瑰簲鏁版嵁搴撳垪椤哄簭col
+                            newCols[0].push(option.cols[0][0]);//鏀惧叆绗竴涓猚heckbox
+                            dataCol = data1.data[0].HGridString.split(',');
+                            //鍒楄缃垪鏁颁笌椤甸潰鍒楁暟鏄惁涓�鑷�
+                            if (dataCol.length == option.cols[0].length - 1) {
+                                //閬嶅巻瀵绘壘鍒楄缃搴斿垪鎸夐『搴忔彃鍏�
+                                for (var j = 0; j < option.cols[0].length - 1; j++) {
+                                    for (var i = 0; i < option.cols[0].length - 1; i++) {
+                                        var dataCols = dataCol[j].split('|');
+                                        //閫夋嫨涓巇atacols鐩稿簲鍒楄繘琛屼慨鏀�
+                                        if (option.cols[0][i + 1]["field"] == dataCols[5]) {
+                                            //闅愯棌鍒�
+                                            if (dataCols[1] == 1) {
+                                                option.cols[0][i + 1]["hide"] = true;
+                                            }
+                                            //璁剧疆鍒楀
+                                            if (dataCols[3] > 0) {
+                                                option.cols[0][i + 1]["width"] = dataCols[3];
+                                            }
+                                            //璁剧疆鍐呭瀛椾綋澶у皬
+                                            if (data1.data[0].HFontSize != 0) {
+                                                option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
+                                            } else {
+                                                option.cols[0][i + 1]["style"] = "font-size:100%";
+                                            }
+                                            //鏄剧ず鍒�
+                                            if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
+                                                option.cols[0][i + 1]["hide"] = false;
+                                            }
+                                            //瀛椾綋鎵�鍦ㄤ綅缃�(宸� 灞呬腑 鍙�)
+                                            switch (dataCols[2]) {
+                                                case "L":
+                                                    option.cols[0][i + 1]["align"] = "left";
+                                                    break;
+                                                case "M":
+                                                    option.cols[0][i + 1]["align"] = "center";
+                                                    break;
+                                                case "R":
+                                                    option.cols[0][i + 1]["align"] = "right";
+                                                    break;
+                                            }
+                                            newCols[0].push(option.cols[0][i + 1]);
+                                        }
+                                    }
+                                }
+                                //閬嶅巻寰幆鍚庡垽鏂搴斿垪鏁版槸鍚︿竴鑷�
+                                if (dataCol.length == newCols[0].length - 1) {
+                                    option.cols = newCols;
+                                    //鍙栨秷鍐荤粨鍒�
+                                    for (var i = 1; i < option.cols[0].length - 1; i++) {
+                                        if (option.cols[0][i]["fixed"] != null) {
+                                            option.cols[0][i]["fixed"] = null;
+                                        }
+                                        else {
+                                            break;
+                                        }
+                                    }
+                                    //鍐荤粨鍒�
+                                    if (data1.data[0].HFixCols != 0) {
+                                        for (var i = 0; i < data1.data[0].HFixCols; i++) {
+                                            if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
+                                                data1.data[0].HFixCols += 1;
+                                            }
+                                            option.cols[0][i + 1]["fixed"] = "left";
+                                        }
+                                    }
+                                }
+                            }
+                            table.render(option);
+                            var HBillType = "1102";
+                            //鍒锋柊鎸夐挳鏄剧ず
+                            var btns = document.getElementsByTagName("button");     //鑾峰彇鏈〉鎵�鏈夋寜閽璞�
+                            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
+                        } else {
+                            table.render(option);
+                            var HBillType = "1102";
+                            //鍒锋柊鎸夐挳鏄剧ず
+                            var btns = document.getElementsByTagName("button");     //鑾峰彇鏈〉鎵�鏈夋寜閽璞�
+                            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                })
+            }
+            //#endregion
             //#endregion
 
         });
 
         function GetHDeptNameValue(obj)  //杩斿洖閿�鍞儴闂�
         {
-            $("#HDeptName").val(obj[0].HName);
+            $("#HDeptName").val(obj[0].閮ㄩ棬鍚嶇О);
             $("#HDeptID").val(obj[0].HItemID);
         }
 
         function GetHEmpValue(obj)  //杩斿洖閿�鍞憳
         {
-            $("#HEmpName").val(obj[0].HName);
+            $("#HEmpName").val(obj[0].鑱屽憳鍚嶇О);
             $("#HEmpID").val(obj[0].HItemID);
 
             getEmpInfoByHEmpID(obj[0].HItemID)
@@ -1402,8 +1868,14 @@
 
         function GetSettleStyleValue(obj)           //杩斿洖缁撶畻鏂瑰紡
         {
-            $("#HSSName").val(obj[0].HName);
+            $("#HSSName").val(obj[0].缁撶畻鏂瑰紡鍚嶇О);
             $("#HSSID").val(obj[0].HItemID);
+        }
+
+        function GetHAccCusValue(obj)  //杩斿洖缁撶畻鍗曚綅
+        {
+            $("#HAccCusName").val(obj[0].HName);
+            $("#HAccCusID").val(obj[0].HItemID);
         }
 
         //#region 鏍规嵁瀹㈡埛鑾峰彇甯佸埆銆佹眹鐜囥�佺粨绠楁柟寮�
@@ -1453,6 +1925,7 @@
                 type: "GET",
                 data: {
                     "HCusID": HCusID
+                    , "CurUserName": sessionStorage["HUserName"]
                 },
                 success: function (result) {
                     if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
@@ -1462,10 +1935,16 @@
                         $("#HCreditRating_Now").val(data.HCreditRating_Now == null ? 0 : data.HCreditRating_Now);
                         $("#HAvailableBalance").val(data.HAvailableBalance == null ? 0 : data.HAvailableBalance);
                     } else {
-                        layer.alert(result.Message, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                        $("#HCusBalance").val("");
+                        $("#HCreditRating_Now").val("");
+                        $("#HAvailableBalance").val("");
+                        //layer.alert(result.Message, { icon: 5});
                     }
                 }, error: function () {
                     layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                    $("#HCusBalance").val("");
+                    $("#HCreditRating_Now").val("");
+                    $("#HAvailableBalance").val("");
                 }
             });
         }
@@ -1524,6 +2003,42 @@
             });
         }
         //#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
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1