From 1854e7a1b76b9c63ab232571219642b65074c489 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 30 十二月 2021 13:58:24 +0800
Subject: [PATCH] 会员提款西要关联账户支出

---
 zhengcaioa/zhengcaioa/Views/AdmAsk/CustomerWithdrawal.cshtml |  121 ++++++++++++++++++++++++++++++++++++++-
 zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs  |   51 ++++++++++++++++
 zhengcaioa/DTO/AdmCustomerWithdrawalDTO.cs                   |    3 +
 3 files changed, 169 insertions(+), 6 deletions(-)

diff --git a/zhengcaioa/DTO/AdmCustomerWithdrawalDTO.cs b/zhengcaioa/DTO/AdmCustomerWithdrawalDTO.cs
index e2df8cb..7dc02b6 100644
--- a/zhengcaioa/DTO/AdmCustomerWithdrawalDTO.cs
+++ b/zhengcaioa/DTO/AdmCustomerWithdrawalDTO.cs
@@ -31,5 +31,8 @@
         public string BankAcount { get; set; }
         public string BankName { get; set; }
         public string Username { get; set; }
+        public string Accounttype { get; set; }
+        public string AccountId { get; set; }
+        public string SubjectId { get; set; }
     }
 }
diff --git a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
index 91cc7d4..2188ea7 100644
--- a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
@@ -31,6 +31,10 @@
         private readonly IIntentionCustomerService _intentionCustomerService;
         private readonly IHrPositionService _hrPositionService;
         private readonly IAdmGoodsRecordService _admGoodsRecordService;
+        private readonly IFiSubjectService _ifiSubjectService;
+        private readonly IFiAccountService _fiAccountService;
+
+        private readonly IFiAccountRecordService _iFiAccountRecordService;
 
         public AdmAskController(ILogger<AdmAskController> logger, IAskService askService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService
             , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService
@@ -41,7 +45,10 @@
             , ICooperatecustomCustomerService cooperatecustomCustomerService
             , IIntentionCustomerService intentionCustomerService
             , IHrPositionService hrPositionService
-            , IAdmGoodsRecordService admGoodsRecordService)
+            , IAdmGoodsRecordService admGoodsRecordService
+            , IFiSubjectService ifiSubjectService
+            , IFiAccountService fiAccountService
+            , IFiAccountRecordService iFiAccountRecordService)
         {
             _logger = logger;
             _hrDeptService = hrDeptService;
@@ -57,6 +64,9 @@
             _intentionCustomerService = intentionCustomerService;
             _hrPositionService = hrPositionService;
             _admGoodsRecordService = admGoodsRecordService;
+            _ifiSubjectService = ifiSubjectService;
+            _fiAccountService = fiAccountService;
+            _iFiAccountRecordService = iFiAccountRecordService;
         }
 
         public IActionResult Askcost(string id = "")
@@ -1293,6 +1303,12 @@
 
             //ViewBag.CooperatecustomCustomerDTOs = 
 
+            if (dangqianbuzhou == "璐㈠姟瀹℃壒")
+            {
+                ViewBag.accounttype = _liaotianService.GetSYScode("fi_account", "accounttype");
+                ViewBag.FiSubject = _ifiSubjectService.GetList().Where(x => x.Subjecttype == "02").ToList();
+            }
+
             ViewData.Model = dto;
             return View();
         }
@@ -1327,6 +1343,39 @@
                     }
                 }
 
+                if(data.Step == "璐㈠姟瀹℃壒")
+                {
+                    WfRunProcessDTO wfRunProcessDTO = _wfRunProcessService.GetList(data.Id, "20").FirstOrDefault();
+
+                    FiAccountRecordDTO datafi = new FiAccountRecordDTO();
+                    datafi.Creater = curentuser.Id;
+                    datafi.Createtime = DateTime.Now;
+                    datafi.Modifier = curentuser.Id;
+                    datafi.Modifytime = DateTime.Now;
+                    datafi.AccountId = data.AccountId;
+                    datafi.Accounttype = data.Accounttype;
+                    datafi.SubjectId = data.SubjectId;
+                    datafi.Money = data.Jine;
+                    if(wfRunProcessDTO!=null)
+                        datafi.OperationalMatters = data.Tittle + wfRunProcessDTO.Applyno;
+                    datafi.PaymentUnit = data.Username;
+                    FiAccountDTO firmAccount = _fiAccountService.Get(data.AccountId);
+
+
+                    datafi.RecordTypeId = "2";//鏀嚭
+                                            //data.Department = "";
+
+                    //resultEntity = _iFiAccountRecordService.save(data);
+
+                    firmAccount.AllExpenses = (firmAccount.AllExpenses ?? 0) + datafi.Money;
+                    firmAccount.Balance = (firmAccount.Balance ?? 0) - datafi.Money;
+
+                    datafi.AccountMoney = firmAccount.Balance;
+
+                    resultEntity = _iFiAccountRecordService.save(datafi);
+
+                    resultEntity = _fiAccountService.save(firmAccount);
+                }
 
 
                 //鍙戣捣娴佺▼鐩稿叧
diff --git a/zhengcaioa/zhengcaioa/Views/AdmAsk/CustomerWithdrawal.cshtml b/zhengcaioa/zhengcaioa/Views/AdmAsk/CustomerWithdrawal.cshtml
index afa3bab..6473db7 100644
--- a/zhengcaioa/zhengcaioa/Views/AdmAsk/CustomerWithdrawal.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/AdmAsk/CustomerWithdrawal.cshtml
@@ -11,8 +11,11 @@
 
     List<WfHistoryDTO> lishiyijian = ViewData["lishiyijian"] as List<WfHistoryDTO>; //瀹℃壒杩涘害
 
+    List<FiSubjectDTO> FiSubject = ViewData["FiSubject"] as List<FiSubjectDTO>; //绉戠洰
 
- 
+
+    List<SysCodeDtl> accounttype = ViewData["accounttype"] as List<SysCodeDtl>; //璐︽埛绫诲瀷
+
 }
 
 <!DOCTYPE html>
@@ -127,6 +130,60 @@
                                     </div>
                                 </div>
 
+                                @if (dangqianbuzhou == "璐㈠姟瀹℃壒")
+                                {
+                                    <div class="clearfix layer-area" style="padding-bottom:15px;">
+                                        <label class="text-right col-sm-1 col-md-1 control-label">璐︽埛绫诲瀷 </label>
+                                        <div class="col-sm-2 col-md-2">
+                                            <select id="Accounttype" class="form-control" name="Accounttype" data-placeholder="閫夋嫨 搴忓垪 ..." style="font-weight:normal;">
+                                                @foreach (var item in accounttype)
+                                                {
+                                                    
+                                                        <option value="@item.CodeSn" hassubinfo="true" >
+                                                            @item.Comments
+                                                        </option>
+                                                   
+                                                }
+
+                                            </select>
+                                           
+                                        </div>
+                                    </div>
+                                    <div class="clearfix layer-area" style="padding-bottom:15px;">
+
+                                        <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">璐︽埛鍚嶇О<i class="red">*</i></label>
+                                        <div class="col-sm-2 col-md-2" grouptype="Vdata">
+                                            <select id="AccountId" class="form-control" name="AccountId" data-placeholder="閫夋嫨 搴忓垪 ...">
+                                                <option value="" hassubinfo="true">璇烽�夋嫨</option>
+
+
+                                            </select>
+
+                                        </div>
+                                    </div>
+                                    <div class="clearfix layer-area" style="padding-bottom:15px;">
+
+                                        <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">绉戠洰鍚嶇О<i class="red">*</i></label>
+                                        <div class="col-sm-2 col-md-2" grouptype="Vdata">
+                                            <select id="SubjectId" class="form-control" name="SubjectId" data-placeholder="閫夋嫨 搴忓垪 ...">
+                                                <option value="" hassubinfo="true">璇烽�夋嫨</option>
+                                                @foreach (var item in FiSubject)
+                                                {
+                                                     
+                                                        <option value="@item.Id" hassubinfo="true" >
+                                                            @item.Subjectname
+                                                        </option>
+                                                    
+                                               
+                                                }
+
+                                            </select>
+
+                                        </div>
+
+                                    </div>
+                                }
+
 
                                 <div class="clearfix layer-area" style="padding-bottom:15px;" id="shenpiyijian">
                                     <label class="text-right col-sm-1 col-md-1 control-label">瀹℃壒鎰忚</label>
@@ -162,6 +219,8 @@
                                         </table>
                                     </div>
                                 </div>
+
+
                                 <div class="clearfix layer-area" style="padding-bottom:60px;">
 
                                 </div>
@@ -246,6 +305,10 @@
                      $('#shenpiyijian').hide();
                  }
 
+                 $("#Accounttype").attr('disabled', false);
+                 $("#AccountId").attr('disabled', false);
+                 $("#SubjectId").attr('disabled', false);
+
             } else {
 
 
@@ -254,7 +317,7 @@
                  if ("@sifoudangqian" == "A") {
                      $('#tongyi').hide();
                      $('#jujue').hide();
-                    
+
 
                      $(".ldate").each(function (el) {
                          laydate({
@@ -270,7 +333,7 @@
                                  // console.log("234234234234324");
                                  // end.min = datas; //寮�濮嬫棩閫夊ソ鍚庯紝閲嶇疆缁撴潫鏃ョ殑鏈�灏忔棩鏈�
                                  // end.start = datas //灏嗙粨鏉熸棩鐨勫垵濮嬪�艰瀹氫负寮�濮嬫棩
-                                 checktime();
+                                 //checktime();
                              }
                          });
 
@@ -299,13 +362,28 @@
                 toastr.warning("浼氬憳鍚嶇О涓嶈兘涓虹┖");
                 return;
             }
-             
+
             if ($.trim($("#Jine").val()) == '') {
                 toastr.warning("鎻愮幇閲戦涓嶈兘涓虹┖");
                 return;
             }
 
-            
+            if ("@Html.Raw(dangqianbuzhou)" == "璐㈠姟瀹℃壒") {
+                if ($.trim($("#Accounttype").val()) == '') {
+                    toastr.warning("璐︽埛绫诲瀷涓嶈兘涓虹┖");
+                    return;
+                }
+                if ($.trim($("#AccountId").val()) == '') {
+                    toastr.warning("璐︽埛鍚嶇О涓嶈兘涓虹┖");
+                    return;
+                }
+                if ($.trim($("#SubjectId").val()) == '') {
+                    toastr.warning("绉戠洰鍚嶇О涓嶈兘涓虹┖");
+                    return;
+                }
+            }
+
+
 
             $("#Tongguojujue").val(tongyi);
 
@@ -356,6 +434,39 @@
             }
 
         }
+
+        $("#Accounttype").change(function () {
+
+            var Accounttype = $("#Accounttype").val();
+            $.ajax({
+                type: "GET",
+                url: "/FiAccountIncome/getAccount?Accounttype=" + Accounttype,
+                dataType: "json",
+                global: false,
+                data: "",
+                success: function (data) {
+
+                    var city = $("#AccountId");
+                    city.find('option').remove();
+                    var aaa = '<option value="" hassubinfo="true">璇烽�夋嫨</option>';
+                    city.append(aaa);
+                    if (data.length > 0) {
+                        for (var i = 0; i < data.length; i++) {
+
+                            var o = '<option value="' + data[i].Id + '" hassubinfo="true">' + data[i].Accountname + '</option>';
+                            city.append(o);
+                        }
+                    }
+                },
+                error: function () {
+
+
+                    parent.layer.msg('澶辫触', { icon: 5 });
+                }
+            });
+        });
+
+        $("#Accounttype").trigger("change");
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1