| 
					
				 | 
			
			
				@@ -11,6 +11,7 @@ using OASystem.Domain.ViewModels.Statistics; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using OASystem.Infrastructure.Repositories.Groups; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using OASystem.Domain.Entities.Customer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -26,6 +27,7 @@ namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private readonly SqlSugarClient _sqlSugar; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private readonly DelegationInfoRepository _groupRep; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private readonly SetDataRepository _setDataRep; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private readonly TeamRateRepository _teamRateRep; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// Init 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,12 +36,13 @@ namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="sqlSugar"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="groupRep"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="setDataRep"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        public StatisticsController(IMapper mapper, SqlSugarClient sqlSugar, DelegationInfoRepository groupRep, SetDataRepository setDataRep) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public StatisticsController(IMapper mapper, SqlSugarClient sqlSugar, DelegationInfoRepository groupRep, SetDataRepository setDataRep, TeamRateRepository teamRate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _mapper = mapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _groupRep = groupRep; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _setDataRep = setDataRep; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _sqlSugar = sqlSugar; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _teamRateRep = teamRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -132,7 +135,7 @@ namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #region  参数验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (_dto.PageId < 1) return Ok(JsonView(false, "页面Id为空")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_dto.PageId < 1) _dto.PageId = 38; //团组报表页面Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -147,9 +150,10 @@ namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 GroupStatementDetailsView _view = new GroupStatementDetailsView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                #region 费用类型 币种,转账 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 费用类型 币种,转账,客户信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 List<Sys_SetData> _setDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var _clientDatas = await _sqlSugar.Queryable<Crm_DeleClient>().Where(it => it.IsDel == 0).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -272,19 +276,243 @@ namespace OASystem.API.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 GroupExpenditureView _geView = new GroupExpenditureView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 #region 酒店预定费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<GroupHotelFeeView> groupHotelFeeViews = new List<GroupHotelFeeView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string hotelFeeSql = string.Format(@"Select hr.Id As HrId,hr.DiId As HrDiId,hr.City,hr.HotelName,hr.CheckInDate,hr.CheckOutDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     sd1.Name As PaymentCurrency,hr.SingleRoomPrice,hr.SingleRoomCount,hr.DoubleRoomPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     hr.DoubleRoomCount,hr.SuiteRoomPrice,hr.SuiteRoomCount,hr.OtherRoomPrice,hr.OtherRoomCount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     hr.BreakfastPrice,sd4.Name As BreakfastCurrency,hr.Isoppay,hr.GovernmentRent, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     sd5.Name As GovernmentRentCurrency,hr.CityTax,sd6.Name As CityTaxCurrency, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     ccp.PayMoney,ccp.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As OpName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     From Grp_HotelReservations  hr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Grp_CreditCardPayment ccp On hr.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_Users u On ccp.CreateUserId = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd4 On hr.BreakfastCurrency = sd4.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd5 On hr.GovernmentRentCurrency = sd5.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd6 On hr.CityTaxCurrency = sd6.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Where hr.IsDel = 0 And ccp.IsDel = 0 And ccp.CTable = 76 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     And hr.DiId = {0}", _dto.DiId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupHotelFeeViews = await _sqlSugar.SqlQueryable<GroupHotelFeeView>(hotelFeeSql).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal HotelCNYTotalPrice = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var teamRateData = await _teamRateRep.PostGroupRateInfoByDiId(_dto.DiId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in groupHotelFeeViews) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    HotelCNYTotalPrice += item.CNYPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string currencyRateStr = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    List<string> currencys = new List<string>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.PaymentCurrency)) currencys.Add(item.PaymentCurrency); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.BreakfastCurrency)) currencys.Add(item.BreakfastCurrency); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.GovernmentRentCurrency)) currencys.Add(item.GovernmentRentCurrency); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.PaymentCurrency)) currencys.Add(item.PaymentCurrency); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    currencyRateStr = await GeneralMethod.PostGroupRateByCTableAndCurrency(teamRateData, 76, currencys); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    item.CurrencyRateStr = currencyRateStr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupHotelFeeViews = groupHotelFeeViews; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupHotelFeeStr = string.Format(@"人名币总费用:{0} CNY", HotelCNYTotalPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 地接费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<GroupCTGGRFeeView> groupCTGGRFeeViews = new List<GroupCTGGRFeeView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.Area,ctggrc.*,ccp.PayMoney, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     sd2.name As PaymentCurrency,ccp.PayPercentage,(ccp.PayMoney * ccp.PayPercentage / 100) As AmountPaid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     (ccp.PayMoney -(ccp.PayMoney * ccp.PayPercentage / 100)) As BalancePayment,ccp.DayRate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     ccp.RMBPrice As CNYPrice,ccp.Payee,ccp.AuditGMDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As OpName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     From Grp_CarTouristGuideGroundReservations ctggr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join ( Select cggrc.CTGGRId,sd1.Name As PriceName,cggrc.Price,sd2.Name As PriceCurrency, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     				   cggrc.PriceContent 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     			From Grp_CarTouristGuideGroundReservationsContent cggrc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     			Left Join Sys_SetData sd1 On cggrc.SId = sd1.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     			Left Join Sys_SetData sd2 On cggrc.Currency = sd2.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     			Where cggrc.ISdel = 0 And cggrc.Price != 0.00  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     			) ctggrc On ctggr.Id = ctggrc.CTGGRId  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Grp_CreditCardPayment ccp On ccp.IsDel = 0  And ccp.CTable = 79 And ctggr.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd1 On ccp.PayDId = sd1.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Left Join Sys_Users u On ccp.CreateUserId = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                     Where ctggr.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And ctggr.DiId = {0} ",_dto.DiId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupCTGGRFeeViews = await _sqlSugar.SqlQueryable<GroupCTGGRFeeView>(CTGGRFeeSql).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string CTGGRFeeStr = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal CTGGRCNYTotalPrice = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in groupCTGGRFeeViews) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.AuditGMDate)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    CTGGRFeeStr += string.Format(@"{0}总费用:{1} {2}(人名币:{3} CNY 当时支付汇率:{4})\r\n",  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.Area, item.AmountPaid.ConvertToDecimal1(), item.PaymentCurrency, item.CNYPrice, item.DayRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    CTGGRCNYTotalPrice += item.CNYPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupCTGGRFeeViews = groupCTGGRFeeViews; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupCTGGRFeeStr = string.Format(@"{0}人名币总费用:{1} CNY", CTGGRFeeStr,CTGGRCNYTotalPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 机票预订费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<GroupAirFeeView> groupAirFeeViews = new List<GroupAirFeeView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string groupAirFeeSql = string.Format(@"Select atr.Id As AirId,atr.DIId As AirDiId,atr.FlightsCode,atr.FlightsCity,sd4.Name As AirTypeName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        atr.FlightsDate,atr.FlightsTime,atr.ClientName,atr.ClientNum,ccp.PayMoney, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        sd1.Name As PayMoneyCurrency,ccp.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.AuditGMDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As OpName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        From Grp_AirTicketReservations atr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 85 And atr.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        Left Join Sys_SetData sd4 On atr.CType = sd4.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        Left Join Sys_Users u On ccp.CreateUserId = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        Where atr.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And atr.DiId = {0} ", _dto.DiId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupAirFeeViews = await _sqlSugar.SqlQueryable<GroupAirFeeView>(groupAirFeeSql).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string str = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal AirCNYTotalPrice = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal JJCCNYTotalPrice = 0.00M, JJCPeopleNum = 0.00M, JJCAveragePrice = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal GWCCNYTotalPrice = 0.00M, GWCPeopleNum = 0.00M, GWCAveragePrice = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JJCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.CNYPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JJCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("经济舱")).Sum(it => it.ClientNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JJCAveragePrice = (JJCCNYTotalPrice / JJCPeopleNum).ConvertToDecimal1(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                GWCCNYTotalPrice = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.CNYPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                GWCPeopleNum = groupAirFeeViews.Where(it => it.AirTypeName.Equals("公务舱")).Sum(it => it.ClientNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                GWCAveragePrice = (GWCCNYTotalPrice / GWCPeopleNum).ConvertToDecimal1(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int Index = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in groupAirFeeViews) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    string itemClientName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.ClientName)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        string[] clientIds = new string[] { }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (item.ClientName.Contains(',')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            clientIds = item.ClientName.Split(','); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            clientIds = new string[] { item.ClientName }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (clientIds.Length > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            int[] output = Array.ConvertAll<string, int>(clientIds, delegate (string s) { return int.Parse(s); }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            string clientPinYinName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            decimal unitCost = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            foreach (var client in clients) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Index += 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                int clienIndex = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                itemClientName += string.Format(@"{0}.{1} ;", clienIndex, client); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                clientPinYinName += string.Format(@"{0}.{1}出票价为:{2} CNY;", Index,client.Pinyin, unitCost); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                clienIndex++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    item.ClientName = itemClientName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.AuditGMDate)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupAirFeeViews = groupAirFeeViews; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!string.IsNullOrEmpty(str)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    str = string.Format(@"其中:{0}", str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupAirFeeStr = string.Format(@"人名币总费用:{0} CNY\r\n{1}\r\n经济舱均价为:{2}CNY/人;公务舱均价为:{3}CNY/人;", AirCNYTotalPrice, str, JJCAveragePrice, GWCAveragePrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          //      Select hr.Id As HrId,hr.DiId As HrDiId,hr.City,hr.HotelName,hr.CheckInDate,hr.CheckOutDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-										//ccp.PaymentCurrency,sd1.Name As PaymentCurrencyName,hr.SingleRoomPrice,hr.SingleRoomCount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-										//hr.DoubleRoomPrice,hr.DoubleRoomCount,hr.SuiteRoomPrice,hr.SuiteRoomCount,hr.OtherRoomPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-										//hr.OtherRoomCount,hr.GovernmentRent,hr.CityTax,hr.Commission,ccp.PayMoney,ccp.RMBPrice As CNYPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-										//ccp.DayRate,ccp.Payee, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-										//From Grp_HotelReservations  hr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          //                              Inner Join Grp_CreditCardPayment ccp On hr.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          //                              Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          //                              Where hr.IsDel = 0 And ccp.IsDel = 0 And ccp.CTable = 76 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          //                              And hr.DiId = 2337 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 签证费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<GroupVisaFeeView> groupVisaFeeViews = new List<GroupVisaFeeView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string groupVisaFeeSql = string.Format(@"Select vi.Id As VisaId,vi.DIId As VisaDiId,vi.VisaClient,ccp.PayMoney,sd1.Name As PayMoneyCurrency, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         sd3.Name As CardTypeName,ccp.IsPay,u.CnName As OpName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         From Grp_VisaInfo vi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 80 And vi.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         Left Join Sys_Users u On ccp.CreateUserId = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                         Where vi.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And vi.DIId = {0}",_dto.DiId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupVisaFeeViews = await _sqlSugar.SqlQueryable<GroupVisaFeeView>(groupVisaFeeSql).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal VisaCNYTotalPirce = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in groupVisaFeeViews) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    VisaCNYTotalPirce += item.PayMoney; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.AuditGMDate)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupVisaFeeViews = groupVisaFeeViews; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupVisaFeeStr = string.Format(@"人名币总费用:{0} CNY", VisaCNYTotalPirce.ConvertToDecimal1()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 邀请/公务活动费用 InvitationalService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 保险费用 insurance 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<GroupInsuranceFeeView> groupInsuranceFeeViews = new List<GroupInsuranceFeeView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string groupInsuranceFeeSql = string.Format(@"Select ic.Id As InsuranceId,ic.Diid As InsuranceDiId,ClientName,ccp.PayMoney,ccp.RMBPrice As CNYPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              sd1.Name As PayMoneyCurrency,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              sd2.Name As PayWay,ccp.IsPay,u.CnName As OpName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              From Grp_Customers ic 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 82 And ic.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              Left Join Sys_Users u On ccp.CreateUserId = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                              Where ic.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And ic.DiId = {0}", _dto.DiId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupInsuranceFeeViews = await _sqlSugar.SqlQueryable<GroupInsuranceFeeView>(groupInsuranceFeeSql).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal insuranceCNYTotalPrice = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in groupInsuranceFeeViews) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    insuranceCNYTotalPrice += item.CNYPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!string.IsNullOrEmpty(item.AuditGMDate)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupInsuranceFeeViews = groupInsuranceFeeViews; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _geView.GroupInsuranceFeeStr = string.Format(@"人名币总费用:{0} CNY", insuranceCNYTotalPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 其他款项费用 OtherMoney 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 _view.GroupExpenditure = _geView; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 #endregion 
			 |