|  | @@ -46,6 +46,7 @@ using OfficeOpenXml;
 | 
												
													
														
															|  |  using Org.BouncyCastle.Asn1.Crmf;
 |  |  using Org.BouncyCastle.Asn1.Crmf;
 | 
												
													
														
															|  |  using EyeSoft.Extensions;
 |  |  using EyeSoft.Extensions;
 | 
												
													
														
															|  |  using System.Collections;
 |  |  using System.Collections;
 | 
												
													
														
															|  | 
 |  | +using SqlSugar.Extensions;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  namespace OASystem.API.Controllers
 |  |  namespace OASystem.API.Controllers
 | 
												
													
														
															|  |  {
 |  |  {
 | 
												
											
												
													
														
															|  | @@ -4573,6 +4574,7 @@ Group by PriceType ", dto.diId);
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |              if (AirTicket.Contains(userId))
 |  |              if (AirTicket.Contains(userId))
 | 
												
													
														
															|  |              {
 |  |              {
 | 
												
													
														
															|  | 
 |  | +                //提成方式:¥10/人×人数×段数(每个组团涉及的换机次数)
 | 
												
													
														
															|  |                  var listAir = _sqlSugar.Queryable<Grp_AirTicketReservations, Grp_DelegationInfo, Grp_CreditCardPayment>((x, a, b) => new
 |  |                  var listAir = _sqlSugar.Queryable<Grp_AirTicketReservations, Grp_DelegationInfo, Grp_CreditCardPayment>((x, a, b) => new
 | 
												
													
														
															|  |                  JoinQueryInfos(
 |  |                  JoinQueryInfos(
 | 
												
													
														
															|  |                      JoinType.Left, a.Id == x.DIId ,
 |  |                      JoinType.Left, a.Id == x.DIId ,
 | 
												
											
												
													
														
															|  | @@ -4707,8 +4709,75 @@ Group by PriceType ", dto.diId);
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |              else if (Hotel.Contains(userId))
 |  |              else if (Hotel.Contains(userId))
 | 
												
													
														
															|  |              {
 |  |              {
 | 
												
													
														
															|  | -                var listHotel = _sqlSugar.Queryable<Grp_HotelReservations, Grp_DelegationInfo>((x, a) => x.DiId == a.Id)
 |  | 
 | 
												
													
														
															|  | -                    .Where((x, a) => x.IsDel == 0 && x.CreateUserId == userId && a.VisitDate > StartDateTime && a.VisitDate < EndDateTime && a.IsDel == 0).ToList();
 |  | 
 | 
												
													
														
															|  | 
 |  | +                //标准团组:¥10/间/晚 * 实际订房间数 * 实际订房晚数;
 | 
												
													
														
															|  | 
 |  | +                var listHotel = _sqlSugar.Queryable<Grp_HotelReservations, Grp_DelegationInfo, Grp_CreditCardPayment>((x, a, b) => new JoinQueryInfos(
 | 
												
													
														
															|  | 
 |  | +                     JoinType.Left,x.DiId == a.Id,
 | 
												
													
														
															|  | 
 |  | +                     JoinType.Left,b.CTable == 76 && b.CId == x.Id  ))
 | 
												
													
														
															|  | 
 |  | +                    .Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && a.VisitDate > StartDateTime 
 | 
												
													
														
															|  | 
 |  | +                    && a.VisitDate < EndDateTime && a.IsDel == 0 && b.IsDel == 0 && x.CardPrice > 0).Select((x,a,b)=> new
 | 
												
													
														
															|  | 
 |  | +                    {
 | 
												
													
														
															|  | 
 |  | +                        a.Id,
 | 
												
													
														
															|  | 
 |  | +                        a.TeamName,
 | 
												
													
														
															|  | 
 |  | +                        a.VisitDate,
 | 
												
													
														
															|  | 
 |  | +                        a.TeamLevSId,
 | 
												
													
														
															|  | 
 |  | +                        a.VisitPNumber,
 | 
												
													
														
															|  | 
 |  | +                        x.SingleRoomCount,
 | 
												
													
														
															|  | 
 |  | +                        x.SuiteRoomCount,
 | 
												
													
														
															|  | 
 |  | +                        x.DoubleRoomCount,
 | 
												
													
														
															|  | 
 |  | +                        x.OtherRoomCount, 
 | 
												
													
														
															|  | 
 |  | +                        x.CheckInDate,
 | 
												
													
														
															|  | 
 |  | +                        x.CheckOutDate,
 | 
												
													
														
															|  | 
 |  | +                        x.HotelName
 | 
												
													
														
															|  | 
 |  | +                    }).ToList();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                var groupByid = listHotel.GroupBy(x => x.Id);
 | 
												
													
														
															|  | 
 |  | +                var propertys = new string[] { "SingleRoomCount", "SuiteRoomCount", "DoubleRoomCount", "OtherRoomCount" };
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                foreach (var group in groupByid)
 | 
												
													
														
															|  | 
 |  | +                {
 | 
												
													
														
															|  | 
 |  | +                    var infos = new ArrayList();
 | 
												
													
														
															|  | 
 |  | +                    var totalPrice = 0.00M;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    foreach (var item in group)
 | 
												
													
														
															|  | 
 |  | +                    {
 | 
												
													
														
															|  | 
 |  | +                        var hotelCount = 0;
 | 
												
													
														
															|  | 
 |  | +                        foreach (var property in propertys)
 | 
												
													
														
															|  | 
 |  | +                        {
 | 
												
													
														
															|  | 
 |  | +                            var value =  item.GetType().GetProperty(property).GetValue(item).ObjToInt();
 | 
												
													
														
															|  | 
 |  | +                            if (value > 0)
 | 
												
													
														
															|  | 
 |  | +                            {
 | 
												
													
														
															|  | 
 |  | +                                hotelCount += value;
 | 
												
													
														
															|  | 
 |  | +                            }
 | 
												
													
														
															|  | 
 |  | +                        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                        if (hotelCount > 0)
 | 
												
													
														
															|  | 
 |  | +                        {
 | 
												
													
														
															|  | 
 |  | +                            if (DateTime.TryParse(item.CheckInDate, out DateTime checkin) && DateTime.TryParse(item.CheckOutDate, out DateTime checkout))
 | 
												
													
														
															|  | 
 |  | +                            {
 | 
												
													
														
															|  | 
 |  | +                                var day = checkout - checkin;
 | 
												
													
														
															|  | 
 |  | +                                infos.Add($"{item.HotelName} 共有 {hotelCount} 间房 , 入住时间{item.CheckInDate} - {item.CheckOutDate} 共 { day.TotalDays }晚 提成数量:{hotelCount * day.TotalDays}  提成金额:{hotelCount * day.TotalDays * 10}");
 | 
												
													
														
															|  | 
 |  | +                                totalPrice += (decimal)(hotelCount * day.TotalDays * 10);
 | 
												
													
														
															|  | 
 |  | +                            }
 | 
												
													
														
															|  | 
 |  | +                            else
 | 
												
													
														
															|  | 
 |  | +                            {
 | 
												
													
														
															|  | 
 |  | +                                infos.Add(item.HotelName + " 时间有误!请检查 。");
 | 
												
													
														
															|  | 
 |  | +                            }
 | 
												
													
														
															|  | 
 |  | +                        }
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    var groupinfo = listHotel.First(x => x.Id == group.Key);
 | 
												
													
														
															|  | 
 |  | +                    var temp = "本团人数" + groupinfo.VisitPNumber + ",该人员" + user.CnName + "共操作酒店晚数" + totalPrice / 10 + ",每间每晚提成10元," + user.CnName + "提成共" + totalPrice.ToString("#0.00") + "元";
 | 
												
													
														
															|  | 
 |  | +                    resultArr.Add(new
 | 
												
													
														
															|  | 
 |  | +                    {
 | 
												
													
														
															|  | 
 |  | +                        groupinfo.TeamName,
 | 
												
													
														
															|  | 
 |  | +                        groupinfo.Id,
 | 
												
													
														
															|  | 
 |  | +                        chiArr = infos,
 | 
												
													
														
															|  | 
 |  | +                        teamLvStr = teamLv.Find(x => x.Id == groupinfo.TeamLevSId)?.Name,
 | 
												
													
														
															|  | 
 |  | +                        groupinfo.VisitDate,
 | 
												
													
														
															|  | 
 |  | +                        temp,
 | 
												
													
														
															|  | 
 |  | +                        price = totalPrice,
 | 
												
													
														
															|  | 
 |  | +                    });
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |              else if (OP.Contains(userId))
 |  |              else if (OP.Contains(userId))
 |