| 
					
				 | 
			
			
				@@ -27,6 +27,9 @@ using System.Net.Http; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Google.Protobuf; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using NPOI.SS.Formula.Functions; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Globalization; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using NPOI.POIFS.Properties; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using SixLabors.ImageSharp.ColorSpaces; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using OASystem.Domain.ViewModels.QiYeWeChat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1598,6 +1601,13 @@ namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int rowNumber = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 foreach (var item_rst in list_rst) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DateTime dtTemp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    bool b = DateTime.TryParse(item_rst.visitDate, out dtTemp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (b) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item_rst.visitDate = dtTemp.ToString("yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item_rst.No = rowNumber; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     rowNumber++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1738,6 +1748,37 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 付款申请 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 基础数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpPost] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<IActionResult> PostPayRequestInit() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var conpanyDatas = _sqlSugar.Queryable<Sys_Company>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            .Where(it => it.IsDel == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            .Select(it => new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                Id = it.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                ConpamyName = it.CompanyName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            }).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(true, "操作成功!",new { ConpanyData = conpanyDatas })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, ex.Message)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 付款申请 (PageId=51) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 查询 根据日期范围 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="dto"></param> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1758,11 +1799,26 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return Ok(JsonView(false, "结束日期格式不正确!正确格式:yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #region 页面操作权限验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tree_Group_DailyFeePaymentResult groupResult = PayRequest_PaymentByDateRange(dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                PaymentRequestCheckedView checkedView = new PaymentRequestCheckedView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var checkedStr = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>("paymentRequestCheckedData"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (checkedStr != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    checkedView = JsonConvert.DeserializeObject<PaymentRequestCheckedView>(checkedStr.ToString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(dto.Status, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange( dto.Status,checkedView.GroupIds, dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return Ok(JsonView(true, "获取成功", new { daily = dailyResult, group = groupResult })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1774,26 +1830,79 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// 付款申请(日付申请相关) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 根据团组类型类型处理团组费用所属公司 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="teamId"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private CompanyInfo ExpenseCompanyByTeamId(int teamId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CompanyInfo _companyInfo = new CompanyInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<int> _SiChuan = new List<int>() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                38 , // 政府团 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                39 , // 企业团 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                40 , // 散客团 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                102, // 未知 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                248, // 非团组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                691, // 四川-会务活动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                762, // 四川-赛事项目收入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<int> _ChengDu = new List<int>() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                302,  // 成都-会务活动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                1047, // 成都-赛事项目收入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_SiChuan.Contains(teamId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _companyInfo.Id = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _companyInfo.ConpanyName = "四川泛美交流有限公司"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_ChengDu.Contains(teamId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _companyInfo.Id = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _companyInfo.ConpanyName = "成都泛美商务有限公司"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return _companyInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 付款申请(团组费用申请相关)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 查询 根据日期范围 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <param name="dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="_groupIds"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="beginDt"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="endDt"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private tree_Group_DailyFeePaymentResult PayRequest_PaymentByDateRange(string beginDt, string endDt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private tree_Group_DailyFeePaymentResult PayRequest_GroupPaymentByDateRange(int status,List<int> _groupIds, string beginDt, string endDt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tree_Group_DailyFeePaymentResult _DailyFeePaymentResult = new tree_Group_DailyFeePaymentResult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<tree_Group_DailyFeePaymentPageListView> dataList = new List<tree_Group_DailyFeePaymentPageListView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #region sql条件处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            string sqlWhere = string.Format(@"And (AuditGMDate Between '{0} 00:00:00' And '{1} 23:59:59') ", beginDt, endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string sqlWhere = string.Format(@" And (AuditGMDate Between '{0} 00:00:00' And '{1} 23:59:59') ", beginDt, endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (status == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (_groupIds.Count < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _DailyFeePaymentResult.dataList = new List<tree_Group_DailyFeePaymentPageListView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return _DailyFeePaymentResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sqlWhere += string.Format(@" And Id In ({0})", string.Join(",", _groupIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string sql_1 = string.Format(@"Select * From Grp_CreditCardPayment Where IsDel = 0 And IsPay = 0 And IsAuditGM = 1 {0}", sqlWhere); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var _paymentDatas = _sqlSugar.SqlQueryable<Grp_CreditCardPayment>(sql_1).ToList();//付款信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _DailyFeePaymentResult.gz = _paymentDatas.Where(it => it.OrbitalPrivateTransfer == 0).Sum(it => ((it.PayMoney * it.DayRate) / 100) * it.PayPercentage); //公转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _DailyFeePaymentResult.sz = _paymentDatas.Where(it => it.OrbitalPrivateTransfer == 1).Sum(it => ((it.PayMoney * it.DayRate) / 100) * it.PayPercentage); ; //私转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<int> groupIds = _paymentDatas.Select(it => it.DIId).Distinct().ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<int> teamDids = new List<int> { 300, 302, 248 }; //团组类型 不含 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var _groupDatas = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && groupIds.Contains(it.Id) && !teamDids.Contains(it.TeamDid)).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var _groupDatas = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && groupIds.Contains(it.Id)).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //_groupDatas = (List<Grp_DelegationInfo>)_groupDatas.GroupBy(it => it.TeamDid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #region 相关基础数据源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var userDatas = _sqlSugar.Queryable<Sys_Users>().ToList(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1809,7 +1918,7 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var refundPaymentDatas = _sqlSugar.Queryable<Fin_PaymentRefundAndOtherMoney>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var ExtraCostDatas = _sqlSugar.Queryable<Fin_GroupExtraCost>().Where(it => it.IsDel == 0 && groupIds.Contains(it.DiId)).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //Expense company 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach ( var groupInfo in _groupDatas)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 List<Group_DailyFeePaymentContentInfolView> childList = new List<Group_DailyFeePaymentContentInfolView>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1818,8 +1927,9 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int rouNumber = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 foreach (var payInfo in groupPaymentDatas) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    string priName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string priName = "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string orbitalPrivateTransfer = payInfo.OrbitalPrivateTransfer == 0 ? "公转" : payInfo.OrbitalPrivateTransfer == 1 ? "私转" : "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     switch (payInfo.CTable) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 76:  //76	酒店预订 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1831,63 +1941,82 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if (payInfo.OrbitalPrivateTransfer == 0) //公转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    priName = "【四川泛美交流有限公司】" + "【公转】" + "【导游:" + opData.ServiceGuide + "】" + opData.Area; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    priName = $"【{orbitalPrivateTransfer}】【导游: {opData.ServiceGuide} 】{opData.Area}" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 else if (payInfo.OrbitalPrivateTransfer == 1) //私转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    priName = "【四川泛美交流有限公司】" + "【私转】" + "【导游:" + opData.ServiceGuide + "】" + opData.Area; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    priName = $"【{orbitalPrivateTransfer}】【导游:{opData.ServiceGuide}】{opData.Area}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 80:  // 80   签证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            priName = visaDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.VisaClient ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            priName = visaDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.VisaClient ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 81:  // 81	邀请/公务活动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            priName = ioaDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.Inviter ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            priName = ioaDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.Inviter ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 82:  // 82	团组客户保险 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            priName = insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            priName = insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 85:  // 85	机票预订 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            string flightsCode = airDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.FlightsCode ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            string airPayType = setDatas.Find(it => it.Id == payInfo.PayDId)?.Name ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            string flightsCode = airDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.FlightsCode ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            string airPayType = setDatas.Find(it => it.Id == payInfo.PayDId)?.Name ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             priName = $"{flightsCode}【{airPayType}】"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 98:  //  98	其他款项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            priName = otherMoneyDatas.Find(it => payInfo.DIId == it.Diid && payInfo.CId == it.Id)?.PriceName ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            priName = otherMoneyDatas.Find(it => payInfo.DIId == it.Diid && payInfo.CId == it.Id)?.PriceName ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 285:  //  285 收款退还 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            priName = refundPaymentDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            priName = refundPaymentDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         case 1015:  //  1015	超支费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            priName = ExtraCostDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            priName = ExtraCostDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.PriceName ?? "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             priName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    bool status1 = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (_groupIds != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        status1 = _groupIds.Contains(payInfo.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    childList.Add(new Group_DailyFeePaymentContentInfolView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var childInfo = new Group_DailyFeePaymentContentInfolView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        IsChecked = status1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Id = payInfo.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Payee = payInfo.Payee, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         RowNumber = rouNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Applicant = userDatas.Find(it => it.Id == payInfo.CreateUserId)?.CnName ??  "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Applicant = userDatas.Find(it => it.Id == payInfo.CreateUserId)?.CnName ?? "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ApplicantDt = payInfo.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         PayType = setDatas.Find(it => it.Id == payInfo.PayDId)?.Name ?? "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        TransferMark = orbitalPrivateTransfer, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         PriceName = priName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ModuleName = setDatas.Find(it => it.Id == payInfo.CTable)?.Name ?? "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         PayCurrCode = setDatas.Find(it => it.Id == payInfo.PaymentCurrency)?.Name ?? "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         PaymentAmount = payInfo.PayMoney, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         PayRate = payInfo.DayRate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         CNYSubTotalAmount = ((payInfo.DayRate * payInfo.PayMoney) / 100) * payInfo.PayPercentage //此次付款金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }) ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string remaksDescription = $"【{childInfo.PayType}】【{childInfo.ModuleName}】{rouNumber}、[申请人:{childInfo.Applicant}][收款方:{childInfo.Payee}]{priName}[{payInfo.ConsumptionPatterns}] {childInfo.PayCurrCode} {payInfo.PayMoney.ToString("#0.00")}、CNY:{childInfo.CNYSubTotalAmount.ToString("#0.00")}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    childInfo.RemaksDescription = remaksDescription; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    childList.Add(childInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     rouNumber++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                CompanyInfo companyInfo = new CompanyInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                companyInfo = ExpenseCompanyByTeamId(groupInfo.TeamDid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 dataList.Add(new tree_Group_DailyFeePaymentPageListView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Id = Guid.NewGuid().ToString("N"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     GroupName = groupInfo.TeamName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    CompanyId = companyInfo.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ConpanyName = companyInfo.ConpanyName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     CNYTotalAmount = childList.Sum(it => it.CNYSubTotalAmount), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ChildList = childList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1897,18 +2026,30 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return _DailyFeePaymentResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 付款申请(日付申请相关) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 查询 根据日期范围 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <param name="dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="_dailyIds"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="beginDt"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="endDt"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private tree_Fin_DailyFeePaymentResult PayRequest_DailyByDateRange(string beginDt, string endDt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private tree_Fin_DailyFeePaymentResult PayRequest_DailyByDateRange(int status, List<int> _dailyIds, string beginDt, string endDt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #region sql条件处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string sqlWhere = string.Format(@" And dfp.CreateTime between '{0} 00:00:00' And '{1} 23:59:59' ", beginDt, endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (status == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (_dailyIds.Count < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return new tree_Fin_DailyFeePaymentResult() { childList = new List<Fin_DailyFeePaymentContentInfolView>() }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sqlWhere += string.Format(@" And dfp.Id  In({0}) ", string.Join(",", _dailyIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string sql_1 = string.Format(@"Select * From (	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 Select row_number() over (order by dfp.Id Desc) as RowNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                     dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1917,7 +2058,7 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 From Fin_DailyFeePayment dfp 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 Inner Join Sys_Company c On dfp.CompanyId = c.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 Left Join Sys_Users u On dfp.CreateUserId = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                Where dfp.IsDel=0 {0} And dfp.FAudit = 1 And dfp.MAudit = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                Where dfp.IsDel=0 {0} And dfp.FAudit = 1 And dfp.MAudit = 1 And dfp.IsPay = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 ) temp ", sqlWhere); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1927,6 +2068,11 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach (var item in DailyFeePaymentData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (_dailyIds != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    item.IsChecked = _dailyIds.Contains(item.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (dic_setData.ContainsKey(item.PriceTypeId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item.priceTypeStr = dic_setData[item.PriceTypeId]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1966,7 +2112,15 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                         Where IsDel=0 And DFPId = {0} ", item.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 item.childList = _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int rowNumber = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var subItem in item.childList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string remaksDescription = $"{rowNumber}、【{item.priceTypeStr}】{item.Instructions}({subItem.PriceName}) CNY:{subItem.ItemTotal.ToString("#0.00")}(单价:{subItem.Price.ToString("#0.00")} * {subItem.Quantity})"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    subItem.RemaksDescription = remaksDescription; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string excelRemaksDescription = $"【{item.priceTypeStr}】{item.Instructions}({subItem.PriceName}) CNY:{subItem.ItemTotal.ToString("#0.00")}(单价:{subItem.Price.ToString("#0.00")} * {subItem.Quantity})【申请人:{item.CreateUser}  申请时间:{item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")}】"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    subItem.ExcelRemaksDescription = excelRemaksDescription; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    rowNumber++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             decimal total_gz = DailyFeePaymentData.Where(s => s.transferParentId == 62).Sum(d => d.SumPrice ?? 0M); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1977,6 +2131,438 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary>  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 付款申请 (PageId=51) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 团组,日付相关费用 选中状态变更 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpPost] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<IActionResult> PostPayRequestCheckedChange(PayRequestCheckedChangeDto dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #region 验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.Type < 1 || dto.Type > 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的Type参数! 1 checked 2 清除上次勾选")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                PaymentRequestCheckedView requestCheckedView =new PaymentRequestCheckedView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<int> groupIds = new List<int>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<int> dailyPaymentIds = new List<int>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 参数处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!string.IsNullOrEmpty(dto.GroupIds)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dto.GroupIds.Contains(",")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        groupIds = dto.GroupIds.Split(',').Select(int.Parse).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        groupIds.Add(int.Parse(dto.GroupIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!string.IsNullOrEmpty(dto.DailyPaymentIds)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dto.DailyPaymentIds.Contains(",")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dailyPaymentIds = dto.DailyPaymentIds.Split(',').Select(int.Parse).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dailyPaymentIds.Add(int.Parse(dto.DailyPaymentIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                requestCheckedView.GroupIds = groupIds; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                requestCheckedView.DailyPaymentIds = dailyPaymentIds; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (dto.Type == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TimeSpan ts = DateTime.Now.AddDays(180) - DateTime.Now; //设置redis 过期时间 半年(180) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var status = await RedisRepository.RedisFactory.CreateRedisRepository().StringSetAsync<string>("paymentRequestCheckedData", JsonConvert.SerializeObject(requestCheckedView),ts); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (status) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return Ok(JsonView(true, "操作成功!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else if(dto.Type == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var status = await RedisRepository.RedisFactory.CreateRedisRepository().KeyDeleteAsync("paymentRequestCheckedData" ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (status) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return Ok(JsonView(true, "操作成功!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "操作失败!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, ex.Message)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 付款申请 (PageId=51) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 团组,日付相关费用 汇率变更 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpPost] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<IActionResult> PostPayRequestRateChange(PayRequestRateChangeDto dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #region 验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DateTime beginDt, endDt; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string format = "yyyy-MM-dd"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!DateTime.TryParseExact(dto.beginDt, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out beginDt)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "开始日期格式不正确!正确格式:yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!DateTime.TryParseExact(dto.endDt, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out endDt)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "结束日期格式不正确!正确格式:yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.UserId < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的UserId参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.Id < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的Id参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.Rate <= 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的Rate参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var status = _sqlSugar.Updateable<Grp_CreditCardPayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      .SetColumns(it => it.DayRate == dto.Rate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      .Where(it => it.Id == dto.Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (status > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    PaymentRequestCheckedView checkedView = new PaymentRequestCheckedView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var checkedStr = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>("paymentRequestCheckedData"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (checkedStr != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        checkedView = JsonConvert.DeserializeObject<PaymentRequestCheckedView>(checkedStr.ToString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(1, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(1, checkedView.GroupIds, dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    decimal _gz = dailyResult.gz + groupResult.gz; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    decimal _sz = dailyResult.sz + groupResult.sz; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return Ok(JsonView(true, "操作成功!", new { gz = dailyResult, sz = groupResult })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "该项汇率修改失败!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, ex.Message)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 付款申请 (PageId=51) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 团组,日付相关费用 付款状态变更 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpPost] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<IActionResult> PostPayRequestPayChange(PayRequestPayChangeDto dto)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.UserId < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的UserId参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //if (string.IsNullOrEmpty(dto.GroupIds)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //    return Ok(JsonView(false, "请传入有效的GroupIds参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //if (string.IsNullOrEmpty(dto.DailyPaymentIds)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //    return Ok(JsonView(false, "请传入有效的DailyPaymentIds参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<int> groupIds = new List<int>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<int> dailyPaymentIds = new List<int>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 参数处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!string.IsNullOrEmpty(dto.GroupIds)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dto.GroupIds.Contains(",")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        groupIds = dto.GroupIds.Split(',').Select(int.Parse).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        groupIds.Add(int.Parse(dto.GroupIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!string.IsNullOrEmpty(dto.DailyPaymentIds)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dto.DailyPaymentIds.Contains(",")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dailyPaymentIds = dto.DailyPaymentIds.Split(',').Select(int.Parse).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dailyPaymentIds.Add(int.Parse(dto.DailyPaymentIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bool changeStatus = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _sqlSugar.BeginTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (groupIds.Count > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var groupStatus = _sqlSugar.Updateable<Grp_CreditCardPayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                               .SetColumns(it => it.IsPay == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                               .Where(it => groupIds.Contains(it.Id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                               .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (groupStatus > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        changeStatus = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (dailyPaymentIds.Count > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var dailyPaymentStatus = _sqlSugar.Updateable<Fin_DailyFeePayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                               .SetColumns(it => it.IsPay == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                               .Where(it => dailyPaymentIds.Contains(it.Id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                               .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dailyPaymentStatus > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        changeStatus = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (changeStatus) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _sqlSugar.CommitTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return Ok(JsonView(true, "操作成功!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _sqlSugar.RollbackTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "付款状态修改失败!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _sqlSugar.RollbackTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, ex.Message)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 付款申请 (PageId=51) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// File Download 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpPost] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<IActionResult> PostPayRequestFileDownload(PayRequestFileDownloadDto dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #region 参数,权限 验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.PortType < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的PortType参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.UserId < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的UserId参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.PageId < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dto.PageId = 51; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的PageId参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto.ConpanyId < 1 || dto.ConpanyId > 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, "请传入有效的ConpanyId参数!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #region 页面操作权限验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (pageFunAuthView.FilesDownloadAuth == 0) return Ok(JsonView(false, "您没有文件下载权限!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                PaymentRequestCheckedView checkedView = new PaymentRequestCheckedView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var checkedStr = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>("paymentRequestCheckedData"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (checkedStr != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    checkedView = JsonConvert.DeserializeObject<PaymentRequestCheckedView>(checkedStr.ToString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (checkedView == null ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return Ok(JsonView(false, "没有选中的数据!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (checkedView.GroupIds == null && checkedView.DailyPaymentIds == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return Ok(JsonView(false, "没有选中的数据!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(2, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(2, checkedView.GroupIds, dto.beginDt, dto.endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (dailyResult.childList == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dailyResult.childList = new List<Fin_DailyFeePaymentContentInfolView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<tree_Group_DailyFeePaymentPageListView> _GroupData = new List<tree_Group_DailyFeePaymentPageListView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<tree_Fin_DailyFeePaymentPageListView> _DailyData = new List<tree_Fin_DailyFeePaymentPageListView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //1	成都泛美商务有限公司 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (dto.ConpanyId == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 1).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 1).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //2	四川泛美交流有限公司 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else if (dto.ConpanyId == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 2).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 2).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //3 成都纽茵教育科技有限公司 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else if (dto.ConpanyId == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (groupResult.dataList != null && groupResult.dataList.Count > 0) _GroupData = groupResult.dataList.Where(it => it.CompanyId == 3).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dailyResult.dataList != null && dailyResult.dataList.Count > 0) _DailyData = dailyResult.dataList.Where(it => it.CompanyId == 3).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //4 成都鸿企中元科技有限公司 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else if (dto.ConpanyId == 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return Ok(JsonView(false, "暂未开放该类型!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return Ok(JsonView(false, "参数ConpanyId不可使用!")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string _requestPaymentDt = DateTime.Now.ToString("yyyy-MM-dd"),//申请付款日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                       _appliedAmount = "", //申请付款金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                       _GZStr = "",    //公转价格描述 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                       _SZStr = "";    //私转价格描述 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal groupGZAmout = 0.00M, groupSZAmout = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal dailyGZAmout = 0.00M, dailySZAmout = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string dailyGZStr = "", dailySZStr = "", groupGZStr = "", groupSZStr = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 数据处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //团组费用相关 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in _GroupData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string groupGZSubStr = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string groupSZSubStr = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    foreach (var subItem in item.ChildList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (subItem.TransferMark.Equals("公转")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            groupGZAmout += subItem.CNYSubTotalAmount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            groupGZSubStr += $"{subItem.RemaksDescription}\r\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else if (subItem.TransferMark.Equals("私转")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            groupSZAmout += subItem.CNYSubTotalAmount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            groupSZSubStr += $"{subItem.RemaksDescription}\r\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        groupGZSubStr += $"\t"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(groupGZSubStr)) groupGZStr += $"团组:{item.GroupName}\r\n{groupGZSubStr}\r\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(groupSZSubStr)) groupSZStr += $"团组:{item.GroupName}\r\n{groupSZSubStr}\r\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //日常费用相关 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in _DailyData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    foreach (var subItem in item.childList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (item.transferParentId == 62) //公转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            dailyGZAmout += item.SumPrice ?? 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            dailyGZStr += $"{item.RowNumber}、【{item.CompanyName}】{subItem.ExcelRemaksDescription}\r\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else if (item.transferParentId == 63) //私转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            dailySZAmout += item.SumPrice ?? 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            dailySZStr += $"{item.RowNumber}、【{item.CompanyName}】{subItem.ExcelRemaksDescription}\r\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _GZStr = $"【公转】团组相关费用(合计:CNY {groupGZAmout.ToString("#0.00")}):\r\n{groupGZStr}【公转】日常付款费用(合计:CNY {dailyGZAmout.ToString("#0.00")}):\r\n{dailyGZStr}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _SZStr = $"【私转】团组相关费用(合计:CNY {groupSZAmout.ToString("#0.00")}):\r\n{groupSZStr}【私转】日常付款费用(合计:CNY {dailySZAmout.ToString("#0.00")}):\r\n{dailySZStr}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _appliedAmount = $"公转:CNY {(groupGZAmout + dailyGZAmout).ToString("#0.00")}\r\n私转:CNY {(groupSZAmout + dailySZAmout).ToString("#0.00")}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                WorkbookDesigner designer = new WorkbookDesigner(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/付款申请书.xls"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                designer.SetDataSource("Date", _requestPaymentDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                designer.SetDataSource("Price", _appliedAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                designer.SetDataSource("Content", _GZStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                designer.SetDataSource("Content1", _SZStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //根据数据源处理生成报表内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                designer.Process(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string fileName = ("PayRequest/付款申请(" + dto.beginDt + "~" + dto.endDt + ").xlsx"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(true, "操作成功!", new { url = rst })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return Ok(JsonView(false, ex.Message)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #region 超支费用 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2303,6 +2889,10 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //信用卡类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<Sys_SetData> Card = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 15 && a.IsDel == 0).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<SetDataInfoView> _Card = _mapper.Map<List<SetDataInfoView>>(Card); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //超支费用类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<Sys_SetData> PriceType = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 79 && a.IsDel == 0).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<SetDataInfoView> _PriceType = _mapper.Map<List<SetDataInfoView>>(PriceType); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2315,6 +2905,7 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var data = new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Payment = _Payment, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Card = _Card, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 PriceType = _PriceType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 PriceDetailType = _PriceDetailType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }; 
			 |