builder.AppendFormat($@"SELECT A.RB_Group_id,A.OrderSource,A.OrderId,A.GuestNum,A.EnterID,b.StartDate,B.PriceTeamType,c.Title,A.FinalPriceTips from rb_travel_order AS A INNER JOIN rb_travel_price AS B ON A.TCID=B.TCID
builder.AppendFormat($@"SELECT A.RB_Group_id,A.OrderSource,A.OrderId,A.GuestNum,A.EnterID,b.StartDate,B.PriceTeamType,c.Title,A.FinalPriceTips from rb_travel_order AS A INNER JOIN rb_travel_price AS B ON A.TCID=B.TCID
LEFT JOIN rb_travel_config as c on c.ID=b.ConfigID
LEFT JOIN rb_travel_config as c on c.ID=b.ConfigID
where FinalPriceTips>0 and ifnull(a.IsChargeLossOrders,0)=0 and a.OrderState<>4 and b.StartDate>NOW() and a.RB_Group_Id in({groupId})
where FinalPriceTips>0 AND DATE_SUB(b.StartDate, INTERVAL A.FinalPriceTips DAY) < NOW() and ifnull(a.IsChargeLossOrders,0)=0 and a.OrderState<>4 and b.StartDate>NOW() and a.RB_Group_Id in({groupId})
and (IFNULL(a.PreferPrice,0)-IFNULL(a.Income,0)-IFNULL(a.ZaiTuMoney,0)+IFNULL(a.Refund,0)-IFNULL(a.PlatformTax,0)-IFNULL(a.ZaiTuMoney,0)-IFNULL(a.DiscountMoney,0)-IFNULL(a.RedEnvelopeMoney,0))<> 0
and (IFNULL(a.PreferPrice,0)-IFNULL(a.Income,0)-IFNULL(a.ZaiTuMoney,0)+IFNULL(a.Refund,0)-IFNULL(a.PlatformTax,0)-IFNULL(a.ZaiTuMoney,0)-IFNULL(a.DiscountMoney,0)-IFNULL(a.RedEnvelopeMoney,0))<> 0
builderVisaOrder.AppendFormat($@"SELECT A.RB_Group_id,A.Id,a.PeopleNum,a.CreateBy,b.`Name`,a.SignOutTime,A.FinalPriceTips from rb_sell_visaorder as a
LogHelper.Write(ex,"跟团游订单");
LEFT JOIN RB_Sell_VisaProduct as b on a.VisaId=b.Id where FinalPriceTips>0 and a.RB_Group_Id in({groupId}) and a.VisaOrderStatus <>2 and IFNULL(a.TotalPrice,0) <> (IFNULL(a.Income,0) + IFNULL(a.PlatformTax,0)+ IFNULL(a.PlatformTax,0) - IFNULL(a.RefundMoney,0)) and a.SignOutTime>NOW()");
builderVisaOrder.AppendFormat($@"SELECT A.RB_Group_id,A.Id,a.PeopleNum,a.CreateBy,b.`Name`,a.SignOutTime,A.FinalPriceTips from rb_sell_visaorder as a
builderHotelOrder.AppendFormat($@"SELECT A.RB_Group_id,a.OrderNo,A.EnterID,c.`Name` as HotelName,a.CheckIn,A.FinalPriceTips from rb_customer_hotelorder as a
LEFT JOIN RB_Sell_VisaProduct as b on a.VisaId=b.Id where FinalPriceTips>0 and a.RB_Group_Id in({groupId}) and a.VisaOrderStatus <>2 and IFNULL(a.TotalPrice,0) <> (IFNULL(a.Income,0) + IFNULL(a.PlatformTax,0)+ IFNULL(a.PlatformTax,0) - IFNULL(a.RefundMoney,0)) and a.SignOutTime>NOW() AND DATE_SUB(a.SignOutTime, INTERVAL A.FinalPriceTips DAY) < NOW()");
builderHotelOrder.AppendFormat($@"SELECT A.RB_Group_id,a.OrderNo,a.OrderId,A.EnterID,c.`Name` as HotelName,a.CheckIn,A.FinalPriceTips from rb_customer_hotelorder as a
LEFT JOIN rb_customer_hotelorderdetail as b on a.OrderId=b.OrderId INNER JOIN rb_hotel as c on c.ID=b.HotelId where FinalPriceTips>0 and a.GroupId in({groupId}) and a.CheckIn>NOW()
LEFT JOIN rb_customer_hotelorderdetail as b on a.OrderId=b.OrderId INNER JOIN rb_hotel as c on c.ID=b.HotelId where FinalPriceTips>0 and a.GroupId in({groupId}) and a.CheckIn>NOW()
and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund)
and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund) AND DATE_SUB(a.CheckIn, INTERVAL A.FinalPriceTips DAY) < NOW()
builderTicketOrder.AppendFormat($@"SELECT A.GroupId,A.OrderNo,a.EnterID,b.`Name` as CouponsName,a.UseDate,A.FinalPriceTips from rb_customer_ticketorder as a
//邮轮订单
LEFT JOIN rb_ticketcoupons as b on a.CouponsId=b.ID where FinalPriceTips>0 and a.GroupId in({groupId}) and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund) and a.UseDate>NOW()");
builderTicketOrder.AppendFormat($@"SELECT A.GroupId,A.OrderNo,a.OrderId,a.EnterID,b.`Name` as CouponsName,a.UseDate,A.FinalPriceTips from rb_customer_ticketorder as a
LEFT JOIN rb_ticketcoupons as b on a.CouponsId=b.ID where a.FinalPriceTips>0 AND DATE_SUB(a.UseDate, INTERVAL A.FinalPriceTips DAY) < NOW() and a.GroupId in({groupId}) and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund) and a.UseDate>NOW()");
builderCRMTicketOrder.AppendFormat($@"SELECT A.GroupId,A.GuestCount,A.DepartTime,A.EnterID,A.FinalPriceTips from {(Config.IsOnline?"uat_reborn_sell":"reborn_sell")}.RB_Ticket_Order as A
//单机票订单
where FinalPriceTips>0 and a.DepartTime>NOW() and a.GroupId in({groupId}) and a.OrderStatus <>2 and a.Money <> (a.IncomeMoney + a.TaxMoney+a.PlatformMoney - a.BackMoney)");
builderCRMTicketOrder.AppendFormat($@"SELECT A.GroupId,A.GuestCount,a.OrderId,A.DepartTime,A.EnterID,A.FinalPriceTips from {(Config.IsOnline?"uat_reborn_sell":"reborn_sell")}.RB_Ticket_Order as A
#endregion
where a.FinalPriceTips>0 and a.DepartTime>NOW() AND DATE_SUB(a.DepartTime, INTERVAL A.FinalPriceTips DAY) < NOW() and a.GroupId in({groupId}) and a.OrderStatus <>2 and a.Money <> (a.IncomeMoney + a.TaxMoney+a.PlatformMoney - a.BackMoney)");
<addname="MySQL Data Provider"invariant="MySql.Data.MySqlClient"description=".Net Framework Data Provider for MySQL"type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />