From 8a8f4b04dd45a8e0cca558039b2e77dab82bd93c Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 09 十一月 2023 14:16:49 +0800
Subject: [PATCH] 信用额度申请单:根据客户带出相关信息、隐藏原黄线天数/新黄线天数/原红线天线/新红线天数

---
 WebTM/views/销售管理/销售订单/Add_Edit_Xs_SeOrderBillList.html |  177 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 114 insertions(+), 63 deletions(-)

diff --git "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html" "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
index 9a5ced5..a876bb1 100644
--- "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
+++ "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
@@ -16,7 +16,7 @@
     <script src="../../../layuiadmin/PubCustom.js"></script>
     <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
     <style type="text/css">
-        .layui-form-item .layui-inline {
+        /*.layui-form-item .layui-inline {
             margin-right: 0;
         }
 
@@ -33,7 +33,7 @@
             margin-top: -10px;
             margin-left: -15px;
             margin-right: -15px;
-        }
+        }*/
     </style>
 </head>
 <body>
@@ -60,7 +60,7 @@
                                 <div class="layui-form-item" style="padding-top: 10px;">
                                     <div class="layui-row">
                                         <div class="layui-inline">
-                                            <label class="layui-form-label">鍗曟嵁缂栧彿</label>
+                                            <label class="layui-form-label">鍗曟嵁缂栧彿<label style="color:red"> * </label></label>
                                             <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">
@@ -68,7 +68,7 @@
                                             </div>
                                         </div>
                                         <div class="layui-inline">
-                                            <label class="layui-form-label">鏃ユ湡</label>
+                                            <label class="layui-form-label">鏃ユ湡<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
                                                 <input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="padding-left: 80px;">
                                             </div>
@@ -76,7 +76,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">閿�鍞儴闂�</label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
                                                 <input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HDeptList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -86,7 +86,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">閿�鍞憳</label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HEmpName" id="HEmpName" " class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="text" name="HEmpName" id="HEmpName" " class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
                                                 <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -96,9 +96,9 @@
                                     </div>
                                     <div class="layui-row">
                                         <div class="layui-inline">
-                                            <label class="layui-form-label">閿�鍞竵鍒�</label>
+                                            <label class="layui-form-label">閿�鍞竵鍒�<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HCurName" id="HCurName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="text" name="HCurName" id="HCurName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;">
                                                 <input type="hidden" name="HCurID" id="HCurID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HCurList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -106,15 +106,15 @@
                                             </div>
                                         </div>
                                         <div class="layui-inline">
-                                            <label class="layui-form-label">姹囩巼</label>
+                                            <label class="layui-form-label">姹囩巼<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
-                                                <input class="layui-input" name="HExRate" id="HExRate" autocomplete="off" value="0" readonly>
+                                                <input class="layui-input" name="HExRate" id="HExRate" autocomplete="off" value="0" style="background-color: #efefef4d;" readonly>
                                             </div>
                                         </div>
                                         <div class="layui-inline" style="width:900px;">
-                                            <label class="layui-form-label">瀹㈡埛</label>
+                                            <label class="layui-form-label">瀹㈡埛<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline" style="width:700px;">
-                                                <input type="text" name="HCusName" id="HCusName" class="layui-input" value="" style="float:left;width:465px;">
+                                                <input type="text" name="HCusName" id="HCusName" class="layui-input" value="" style="float: left; width: 465px; background-color: #efefef4d;" readonly>
                                                 <input type="hidden" name="HCusID" id="HCusID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HCusList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -124,9 +124,9 @@
                                     </div>
                                     <div class="layui-row">
                                         <div class="layui-inline">
-                                            <label class="layui-form-label">缁撶畻鏂瑰紡</label>
+                                            <label class="layui-form-label">缁撶畻鏂瑰紡<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HSSName" id="HSSName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="text" name="HSSName" id="HSSName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
                                                 <input type="hidden" name="HSSID" id="HSSID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HSSList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -136,7 +136,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">閿�鍞柟寮�</label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HSellSName" id="HSellSName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="text" name="HSellSName" id="HSellSName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
                                                 <input type="hidden" name="HSellSID" id="HSellSID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HSellSList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -154,7 +154,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">閿�鍞富绠�</label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HManagerName" id="HManagerName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="text" name="HManagerName" id="HManagerName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
                                                 <input type="hidden" name="HManagerID" id="HManagerID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HManagerList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -176,7 +176,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">鍐呴儴璁㈠崟鍙�</label>
                                             <div class="layui-input-inline">
-                                                <input class="layui-input" name="HInnerBillNo" id="HInnerBillNo" autocomplete="off" readonly>
+                                                <input class="layui-input" name="HInnerBillNo" id="HInnerBillNo" style="background-color: #efefef4d;" autocomplete="off" readonly>
                                             </div>
                                         </div>
                                     </div>
@@ -657,14 +657,14 @@
                     case "HTaxRate":                                                       //鏁伴噺
                         //鏁版嵁鏍煎紡鏍¢獙
                         temp = value + "";
-                        if (!ref.test(temp) || temp == 0) {
+                        if (!ref.test(temp)) {
                             //鎭㈠鏁版嵁鍒扮紪杈戝墠
                             obj.update({
                                 HTaxRate: oldText
                             });
                             table.render(option);
 
-                            layer.msg("绋庣巼璇疯緭鍏ュぇ浜�0鐨勬暟瀛�!");
+                            layer.msg("绋庣巼璇疯緭鍏ヤ笉灏忎簬0鐨勬暟瀛�!");
                             return;
                         }
 
@@ -811,20 +811,20 @@
                     , height: 500
                     , loading: false
                     , cols: [[ //瀛愯〃
-                        { type: 'checkbox', totalRowText: '鍚堣琛�' }
-                        , { type: 'numbers', title: '搴忓彿', width: 100, totalRow: true }
-                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
+                        { type: 'checkbox', totalRowText: '鍚堣琛�', style: 'background-color:#efefef4d;' }
+                        , { type: 'numbers', title: '搴忓彿', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
+                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                         , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, edit: 'text', event: "HMaterID" }//f7
-                        , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, }
-                        , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, }
-                        , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true }
-                        , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100 }//f7
+                        , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, style: 'background-color:#efefef4d;' }
+                        , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, style: 'background-color:#efefef4d;' }
+                        , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
+                        , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, style: 'background-color:#efefef4d;' }//f7
                         , { field: 'HQty', title: '鏁伴噺', width: 100, edit: 'text' }
                         , { field: 'HPrice', title: '鍗曚环', width: 100, edit: 'text' }
                         , { field: 'HTaxRate', title: '绋庣巼', width: 100, edit: 'text' }
-                        , { field: 'HTaxPrice', title: '鍚◣鍗曚环', width: 100 }
-                        , { field: 'HMoney', title: '閲戦', width: 100 }
-                        , { field: 'HlineTotal', title: '浠风◣鍚堣', width: 100, }
+                        , { field: 'HTaxPrice', title: '鍚◣鍗曚环', width: 100, style: 'background-color:#efefef4d;' }
+                        , { field: 'HMoney', title: '閲戦', width: 100, style: 'background-color:#efefef4d;' }
+                        , { field: 'HlineTotal', title: '浠风◣鍚堣', width: 100, style: 'background-color:#efefef4d;' }
                         , { field: 'HDate', title: '浜よ揣鏃ユ湡', event: "HDate", width: 120 }
                         , { field: 'HRemark', title: '澶囨敞', width: 100, edit: 'text' }
 
@@ -1266,15 +1266,15 @@
                     return false;
                 }
 
-                if ($("#HDeptID").val() == "0") {
-                    layer.msg("閿�鍞儴闂ㄦ湭閫夋嫨!");
-                    return false;
-                }
+                //if ($("#HDeptID").val() == "0") {
+                //    layer.msg("閿�鍞儴闂ㄦ湭閫夋嫨!");
+                //    return false;
+                //}
 
-                if ($("#HEmpID").val() == "0") {
-                    layer.msg("閿�鍞憳鏈�夋嫨!");
-                    return false;
-                }
+                //if ($("#HEmpID").val() == "0") {
+                //    layer.msg("閿�鍞憳鏈�夋嫨!");
+                //    return false;
+                //}
 
                 if ($("#HCurID").val() == "0") {
                     layer.msg("閿�鍞竵鍒湭閫夋嫨!");
@@ -1300,15 +1300,15 @@
                     return false;
                 }
 
-                if ($("#HSellSID").val() == "0") {
-                    layer.msg("閿�鍞柟寮忔湭閫夋嫨!");
-                    return false;
-                }
+                //if ($("#HSellSID").val() == "0") {
+                //    layer.msg("閿�鍞柟寮忔湭閫夋嫨!");
+                //    return false;
+                //}
 
-                if ($("#HMangerID").val() == "0") {
-                    layer.msg("閿�鍞富绠℃湭閫夋嫨!");
-                    return false;
-                }
+                //if ($("#HMangerID").val() == "0") {
+                //    layer.msg("閿�鍞富绠℃湭閫夋嫨!");
+                //    return false;
+                //}
 
                 
 
@@ -1359,11 +1359,8 @@
 
                     //绋庣巼鏍煎紡鏍¢獙
                     temp = option.data[i]["HTaxRate"] + "";
-                    if (temp == "0") {
-                        layer.msg("绗�" + i + "琛岋細绋庣巼涓嶈兘涓�0锛�");
-                        return false;
-                    } else if (!ref.test(temp)) {
-                        layer.msg("绗�" + i + "琛岋細绋庣巼璇疯緭鍏ュぇ浜�0鐨勬暟瀛楋紒");
+                    if (!ref.test(temp)) {
+                        layer.msg("绗�" + i + "琛岋細绋庣巼璇疯緭鍏ヤ笉灏忎簬0鐨勬暟瀛楋紒");
                         return false;
                     }
 
@@ -1634,26 +1631,76 @@
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../Baseset/鍩虹璧勬枡/Gy_MaterialList.html', 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html', 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
                                     var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
                                     var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
 
-                                    if (checkStatus.data.length != 1) {
-                                        return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
-                                    }
+                                    //if (checkStatus.data.length != 1) {
+                                    //    return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
+                                    //}
 
-                                    //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
-                                    obj.update({
-                                        "HMaterID": checkStatus.data[0].HItemID
-                                        , "鐗╂枡浠g爜": checkStatus.data[0].HNumber
-                                        , "鐗╂枡鍚嶇О": checkStatus.data[0].HName
-                                        , "瑙勬牸鍨嬪彿": checkStatus.data[0].HModel
-                                        , "HUnitID": checkStatus.data[0].HUnitID
-                                        , "璁¢噺鍗曚綅": checkStatus.data[0].HUnitName
-                                    })
+                                    var rowIndex = $(obj.tr).attr("data-index") * 1;
+                                    for (var i = 0; i < checkStatus.data.length; i++) {
+                                        if (rowIndex + i >= option.data.length) {
+                                            var NewRow = {
+                                                "HMaterID": "0", "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": "0", "璁¢噺鍗曚綅": "", "HQty": "0", "HPrice": "0", "HTaxPrice": "0"
+                                                , "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0"
+                                                , "HDate": Format(new Date(), 'yyyy-MM-dd'), "HOutStockQty": "0", "HInvoiceQty": "0", "HRemark": ""
+                                            }
+                                            btnAddLine(NewRow);
+                                        }
+
+                                        //鑾峰彇閫変腑鐨勭墿鏂欎俊鎭�
+                                        var resultData = checkStatus.data[i];
+
+                                        //鏁板�兼牸寮忔牎楠屽伐鍏�
+                                        var ref = /^\d+(\.\d+)?$/;                                  //闈炶礋鏁版鍒欒〃杈惧紡
+                                        var temp = "";
+                                        //鑾峰彇閫夋嫨鐗╂枡鍓嶅悗鐨勭◣鐜�
+                                        var value = subHTaxRate;                                    //閫夋嫨鐗╂枡鍚庢牴鎹鎴峰緱鍒扮殑绋庣巼
+                                        var oldText = option.data[rowIndex + i].HTaxRate;           //璇ヨ褰曚腑鍘熸湁鐨勭◣鐜�
+
+                                        //绋庣巼鏁版嵁鏍煎紡鏍¢獙锛岃嫢鏍规嵁瀹㈡埛鑾峰彇鐨勭◣鐜囦笉鍚堟硶锛屽垯浣跨敤璁板綍涓師鏈夌殑绋庣巼锛屽苟鎻愮ず
+                                        temp = value + "";
+                                        if (!ref.test(temp)) {
+                                            value = oldText;
+                                            layer.msg("鑾峰彇鍒扮殑绋庣巼涓嶅悎娉曪紝宸茶嚜鍔ㄥ彉鏇翠负鍘熸湁绋庣巼!");
+                                        }
+
+                                        //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                                        var HQty = option.data[rowIndex + i].HQty;                  //鏁伴噺
+                                        var HPrice = option.data[rowIndex + i].HPrice;              //鍗曚环
+                                        var HTaxRate = value * 0.01;                                //绋庣巼
+                                        /*var HDiscountRate = obj.data.HDiscountRate * 1;           //鎶樻墸鐜�*/
+                                        var HTaxPrice = HPrice * (1 + HTaxRate);                    //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;             //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
+                                        //鎶樻墸棰� = 鍚◣鍗曚环 * (1 - 鎶樻墸鐜�) * 鏁伴噺
+                                        var HMoney = HQty * HPrice;                                 //閲戦=鏁伴噺*鍗曚环
+                                        var HTaxMoney = HMoney * HTaxRate;                          //绋庨=閲戦*绋庣巼
+                                        var HlineTotal = HMoney + HTaxMoney;                        //浠风◣鍚堣=閲戦+绋庨
+
+
+                                        option.data[rowIndex + i].HMaterID = resultData.HMaterID;
+                                        option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.鐗╂枡浠g爜;
+                                        option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.鐗╂枡鍚嶇О;
+                                        option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.瑙勬牸鍨嬪彿;
+                                        option.data[rowIndex + i].HUnitID = resultData.HUnitID;
+                                        option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.璁¢噺鍗曚綅鍚嶇О;
+
+                                        option.data[rowIndex + i].HQty = HQty;
+                                        option.data[rowIndex + i].HPrice = HPrice;
+                                        option.data[rowIndex + i].HTaxRate = HTaxRate * 100;
+                                        option.data[rowIndex + i].HTaxPrice = HTaxPrice;
+                                        option.data[rowIndex + i].HMoney = HMoney;
+                                        option.data[rowIndex + i].HlineTotal = HlineTotal;
+
+
+                                    }
+                                    table.render(option);
+
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
                             })
@@ -1831,6 +1878,9 @@
 
             //浠ヤ笂鏄痩ayui妯″潡
         });
+        //瀛愯〃绋庣巼锛屾牴鎹鎴峰甫鍑�
+        var subHTaxRate = 0;
+
         // 鍩虹璧勬枡杩斿洖鏁版嵁
         function GetHEmpValue(obj)  //杩斿洖涓氬姟鍛�
         {
@@ -1878,6 +1928,7 @@
                         $("#HSSID").val(data.HSSID);
                         $("#HSSName").val(data.HSSName);
 
+                        subHTaxRate = data.HTaxRate;
 
                     } else {
                         layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });

--
Gitblit v1.9.1