From 3ffbffba87bfe3a8a9acdc75e38be01db0d3cd1b Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期五, 17 十一月 2023 12:22:38 +0800
Subject: [PATCH] ../../Baseset/基础资料/Gy_SellStyle.html:单选改为复选,单击选中,双击返回

---
 WebTM/views/销售管理/销售订单/Add_Edit_Xs_SeOrderBillList.html |  247 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 226 insertions(+), 21 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 2a91c05..c1b36ff 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"
@@ -45,6 +45,8 @@
                     <div class="layui-card-header">
                         <div class="layui-btn-group">
                             <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_SaveBill">淇濆瓨</button>
+                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_CheckBill">瀹℃牳</button>
+                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="btn-print">鎵撳嵃</button>
                             <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">閫�鍑�</button>
                         </div>
                     </div>
@@ -69,8 +71,8 @@
                                         </div>
                                         <div class="layui-inline">
                                             <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 class="layui-input-block">
+                                                <input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="width:190px;">
                                             </div>
                                         </div>
                                         <div class="layui-inline">
@@ -164,7 +166,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">鑱旂郴浜�</label>
                                             <div class="layui-input-inline">
-                                                <input class="layui-input" name="HLinkMan" id="HLinkMan" autocomplete="off" value="" >
+                                                <input class="layui-input" name="HLinkMan" id="HLinkMan" autocomplete="off" value="">
                                             </div>
                                         </div>
                                         <div class="layui-inline">
@@ -188,6 +190,26 @@
                                             </div>
                                         </div>
                                     </div>
+                                    <div class="layui-row">
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label">瀹㈡埛浣欓</label>
+                                            <div class="layui-input-inline">
+                                                <input class="layui-input" name="HCusBalance" id="HCusBalance" autocomplete="off" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label">淇$敤棰濆害</label>
+                                            <div class="layui-input-inline">
+                                                <input class="layui-input" name="HCreditRating_Now" id="HCreditRating_Now" autocomplete="off" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label">鍙敤棰濆害</label>
+                                            <div class="layui-input-inline">
+                                                <input class="layui-input" name="HAvailableBalance" id="HAvailableBalance" autocomplete="off" readonly>
+                                            </div>
+                                        </div>
+                                    </div>
                                     <div class="layui-row" style="margin-top:10px;">
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;">缁勭粐<label style="color:red"> * </label></label>
@@ -195,18 +217,6 @@
                                                 <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
                                                     <!--鍔ㄦ�佹覆鏌撶粍缁�-->
                                                 </select>
-                                            </div>
-                                        </div>
-                                        <div class="layui-inline">
-                                            <label class="layui-form-label">瀹㈡埛浣欓</label>
-                                            <div class="layui-input-inline">
-                                                <input class="layui-input" name="" id="" autocomplete="off" readonly>
-                                            </div>
-                                        </div>
-                                        <div class="layui-inline">
-                                            <label class="layui-form-label">瀹㈡埛淇$敤棰濆害</label>
-                                            <div class="layui-input-inline">
-                                                <input class="layui-input" name="HCreditRating_Now" id="HCreditRating_Now" autocomplete="off" readonly>
                                             </div>
                                         </div>
                                     </div>
@@ -392,11 +402,27 @@
             //#endregion 
 
             //#region 鍒ゆ柇骞惰缃搷浣滅被鍨嬨�侀〉闈㈠垵濮嬪寲
-            if (OperationType == null || OperationType == 1) {                            //鏂板
+            if (OperationType == null || OperationType == 1) {                          //鏂板
                 //鏂板椤甸潰鍒濆鍖�
                 Init_setAdd();
             }
-            else if (OperationType == 3) {                                                 //缂栬緫
+            else if (OperationType == 2) {                                              //澶嶅埗
+                //瀛愯〃鍒濆鍖�
+                set_InitGrid();
+                //鍔犺浇琛ㄤ綋鍜岃〃浣撴暟鎹�
+                RoadBillMain(linterid);
+
+                //鐢熸垚骞惰缃富琛ㄧ殑鍐呯爜鍜屽崟鎹彿
+                createBillNo();
+
+                //鐩稿叧鏂囨湰妗嗕俊鎭垵濮嬪寲
+                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HSSDate").val(Format(new Date(), "yyyy-MM-dd"));
+                $("#HMaker").val(sessionStorage["HUserName"]);
+                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
+
+            }
+            else if (OperationType == 3) {                                              //缂栬緫
                 $("#HInterID").val(linterid);
                 //瀛愯〃鍒濆鍖�
                 set_InitGrid();
@@ -407,6 +433,10 @@
 
             //#region 鍒濆鍖栫粍缁�
             Organ();
+            //#endregion
+
+            //#region 椤甸潰鍒濆鍖栧悗锛屾牴鎹鎴疯幏鍙栧鎴蜂綑棰�
+            getCustomerBalance( $("#HCusID").val() );
             //#endregion
 
             //#region 鍒楄缃細瀛愯〃1
@@ -471,6 +501,18 @@
                 if (AllowLoadData(data)) {
                     set_SaveBill(data);
                 }
+            });
+            //#endregion
+
+            //#region 瀹℃牳鎸夐挳
+            form.on('submit(set_CheckBill)', function (data) {
+                set_CheckBill(0);
+            });
+            //#endregion
+
+            //#region 鎵撳嵃鎸夐挳
+            form.on('submit(btn-print)', function (data) {
+                get_PrintReport();
             });
             //#endregion
 
@@ -694,6 +736,46 @@
                         });
                         table.render(option);
                         break;
+                    case "HTaxPrice":                                                       //鏁伴噺
+                        //鏁版嵁鏍煎紡鏍¢獙
+                        temp = value + "";
+                        if (!ref.test(temp)) {
+                            //鎭㈠鏁版嵁鍒扮紪杈戝墠
+                            obj.update({
+                                HTaxPrice: oldText
+                            });
+                            table.render(option);
+
+                            layer.msg("鍚◣鍗曟嵁璇疯緭鍏ヤ笉灏忎簬0鐨勬暟瀛�!");
+                            return;
+                        }
+                        //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                        var HQty = obj.data.HQty * 1;                   //鏁伴噺
+                        var HTaxRate = obj.data.HTaxRate * 0.01;        //绋庣巼
+                        var HTaxPrice = value * 1;                          //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                        var HPrice = HTaxPrice / (1 + HTaxRate);        //鍗曚环=鍚◣鍗曟嵁/(1+绋庣巼)
+                        
+                        /*var HDiscountRate = obj.data.HDiscountRate * 1; //鎶樻墸鐜�*/
+                        
+                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
+                        //鎶樻墸棰� = 鍚◣鍗曚环 * (1 - 鎶樻墸鐜�) * 鏁伴噺
+                        var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
+                        var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
+                        var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+
+
+
+                        //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                        obj.update({
+                            HQty: HQty
+                            , HPrice: HPrice
+                            , HTaxRate: HTaxRate * 100
+                            , HTaxPrice: HTaxPrice
+                            , HMoney: HMoney
+                            , HlineTotal: HlineTotal
+                        });
+                        table.render(option);
+                        break;
                     default:
                 }
             });
@@ -822,7 +904,7 @@
                         , { 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, style: 'background-color:#efefef4d;' }
+                        , { field: 'HTaxPrice', title: '鍚◣鍗曚环', width: 100, edit: 'text' }
                         , { 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 }
@@ -949,6 +1031,8 @@
 
                             //缁勭粐鐨勫�糎OrgID鍙樺寲锛岄噸鏂版覆鏌�
                             HOrgIDBar = data.HOrgID;
+                            //鑾峰彇绋庣巼(鐢ㄤ簬瀛愯〃绋庣巼鐨勯粯璁ゅ��)
+                            getHTaxRateByCusID(data.HCusID);
 
                             //瀛愯〃  璧嬪��
                             var rowdata = [];
@@ -1040,6 +1124,9 @@
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
                         getCustomerByCusID(checkStatus.data[0].HItemID);
+                        //鏍规嵁瀹㈡埛鑾峰彇瀹㈡埛浣欓
+                        getCustomerBalance(checkStatus.data[0].HItemID);
+
                         layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) { }
@@ -1870,10 +1957,61 @@
             }
             //#endregion
 
+            //#region 鍙嶅鏍�/瀹℃牳鏁版嵁
+            function set_CheckBill(num) {
+                var InterID = $("#HInterID").val();
+                //閫昏緫瀹℃牳鏂规硶
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Xs_SeOrderBill/AuditXs_SeOrderBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                // 寰楀埌frame绱㈠紩
+                                var index = layer.getFrameIndex(window.name);
+                                //鍏抽棴褰撳墠frame
+                                layer.close(index);
+                            });
 
+                        } else {
+                            layer.alert(result.code + result.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+            //#endregion
 
-            
-
+            //#region 鎵撳嵃
+            function get_PrintReport() {
+                var InterID = $("#HInterID").val();
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Xs_SeOrderBill/CheckSeOrderBill_IsExist", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: { "HInterID": InterID},
+                    success: function (result) {
+                        if (result.count == 1) {
+                            layer.open({
+                                type: 2
+                                , area: ['50%', '50%']
+                                , title: '鎵撳嵃妯$増閫夋嫨'
+                                , shade: 0.6 //閬僵閫忔槑搴�
+                                , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲
+                                , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                                , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + InterID + '&MyMsg=' + InterID + '&Type=Xs_SeOrderBill', 'yes']
+                                , resize: false
+                            })
+                        } else {
+                            layer.alert(result.code + result.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+            //#endregion
             //#endregion
 
 
@@ -1893,7 +2031,10 @@
         {
             //$("#HCusName").val(obj[0].HName);
             //$("#HCusID").val(obj[0].HItemID);
+            //鏍规嵁瀹㈡埛鑾峰彇鐩稿叧淇℃伅
             getCustomerByCusID(obj[0].HItemID);
+            //鏍规嵁瀹㈡埛鑾峰彇瀹㈡埛浣欓
+            getCustomerBalance(obj[0].HItemID);
         }
 
         function GetHManagerValue(obj)  //杩斿洖涓荤
@@ -1908,7 +2049,19 @@
             $("#HDeptID").val(obj[0].HItemID);
         }
 
-        //#region 鏍规嵁瀹㈡埛鑾峰彇甯佸埆銆佹眹鐜囥�佺粨绠楁柟寮�
+        function GetSettleStyleValue(obj)           //杩斿洖缁撶畻鏂瑰紡
+        {
+            $("#HSSName").val(obj[0].HName);
+            $("#HSSID").val(obj[0].HItemID);
+        }
+
+        function GetSellStyleValue(obj)           //杩斿洖閿�鍞柟寮�
+        {
+            $("#HSellSName").val(obj[0].HName);
+            $("#HSellSID").val(obj[0].HItemID);
+        }
+
+        //#region 鏍规嵁瀹㈡埛鑾峰彇甯佸埆銆佹眹鐜囥�佺粨绠楁柟寮忋�佸鎴蜂俊鐢ㄩ搴︺�佽仈绯讳汉銆佽仈绯荤數璇�
         function getCustomerByCusID(HCusID) {
             $.ajax({
                 url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
@@ -1929,6 +2082,8 @@
                         $("#HSSID").val(data.HSSID);
                         $("#HSSName").val(data.HSSName);
                         $("#HCreditRating_Now").val(data.HCreditRating_Now);
+                        $("#HLinkMan").val(data.HLinkMan);
+                        $("#HLinkPhone").val(data.HLinkPhone);
 
                         subHTaxRate = data.HTaxRate;
 
@@ -1941,6 +2096,56 @@
             });
         }
         //#endregion
+
+        //#region 鏍规嵁瀹㈡埛鑾峰彇瀹㈡埛瀵瑰簲绋庣巼
+        function getHTaxRateByCusID(HCusID) {
+            $.ajax({
+                url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
+                async: false,
+                type: "GET",
+                data: {
+                    "HCusID": HCusID
+                },
+                success: function (result) {
+                    if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                        var data = result.data[0];
+                        subHTaxRate = data.HTaxRate;
+
+                    } else {
+                        layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                    }
+                }, error: function () {
+                    layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                }
+            });
+        }
+        //#endregion
+
+        //#region 鏍规嵁瀹㈡埛鑾峰彇瀹㈡埛浣欓
+        function getCustomerBalance(HCusID) {
+            $.ajax({
+                url: GetWEBURL() + "/Xs_CusRatingChangeBill/getCustomerBalance",
+                async: false,
+                type: "GET",
+                data: {
+                    "HCusID": HCusID
+                },
+                success: function (result) {
+                    if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                        var data = result.data[0];
+
+                        $("#HCusBalance").val(data.HCusBalance == null ? 0 : data.HCusBalance);
+                        $("#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' });
+                    }
+                }, error: function () {
+                    layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                }
+            });
+        }
+        //#endregion
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1