stringsql=$@"SELECT o.OrderId,o.IsFinish,o.OrderStatus,o.EnterID,o.OpEmpId,o.Money,o.Income,o.PlatformTax,o.Refund,o.CostMoney,o.PlatformMoney,o.UseDate,sum(d.Num) as Num,t.Country as CountryId,o.SaleRate,o.ManagerId,o.ManagerRate,o.PlacplaceDeparture FROM rb_customer_ticketorder o
stringsql=$@"SELECT o.OrderId,o.EmpBranchId,o.IsFinish,o.OrderStatus,o.EnterID,o.OpEmpId,o.Money,o.Income,o.PlatformTax,o.Refund,o.CostMoney,o.PlatformMoney,o.UseDate,sum(d.Num) as Num,t.Country as CountryId,o.SaleRate,o.ManagerId,o.ManagerRate,o.PlacplaceDeparture FROM rb_customer_ticketorder o
INNER JOIN rb_customer_ticketorderdetail d on o.OrderId = d.OrderId
left join rb_ticketcoupons t on o.CouponsId =t.ID
where o.GroupId ={rB_Group_id} and o.OrderStatus in(2,4) and o.IsFinish=1 {(IsAll?"":" and o.LureEmpId =0")}{(SaleId>0?" and o.EnterID ="+SaleId:"")} and IFNULL(o.Money,0) >0 and o.UseDate >='{startTime}' and o.UseDate <='{endTime} 23:59:59' and {(IsAll?"o.IsOPCommission <>1":"o.IsCommission <>1")}
@@ -894,11 +894,11 @@ and o.Id NOT IN (SELECT OrderId FROM rb_tw_sell_commission_details WHERE RB_Grou
{
startTime="2023-04-01";
stringsql=$@"
SELECT o.Id as OrderId,o.CreateBy,o.CreateTime,p.RB_Branch_Id,p.Name as PName,o.PeopleNum,o.TotalPrice,o.Income,o.PlatformTax,o.RefundMoney,o.CostMoney,o.PlatformMoney,o.Remark,o.IsFinish,p.SendVisaDate,p.TrafficToll,c.CountryId,case when o.FinishEmpId >0 then o.FinishEmpId else p.CreateBy end as OpEmpId,o.SaleRate
SELECT o.Id as OrderId,o.CreateBy,o.CreateTime,o.RB_Branch_Id,p.Name as PName,o.PeopleNum,o.TotalPrice,o.Income,o.PlatformTax,o.RefundMoney,o.CostMoney,o.PlatformMoney,o.Remark,o.IsFinish,p.SendVisaDate,p.TrafficToll,c.CountryId,case when o.FinishEmpId >0 then o.FinishEmpId else p.CreateBy end as OpEmpId,o.SaleRate
FROM rb_sell_visaorder o
INNER JOIN rb_sell_visaproduct p on o.VisaId = p.Id
left join rb_sell_visaproduct_country c on p.VisaCountryId =c.Id
WHERE o.RB_Group_Id ={rB_Group_id} and o.VisaOrderStatus =1 and o.IsFinish=1 {(IsOP?"":"and o.LureEmpId =0")}{(SaleId>0?" and o.CreateBy ="+SaleId:"")} and p.RB_Branch_Id <>1220 and IFNULL(o.TotalPrice,0) >0 and o.CreateTime >='{startTime}' and o.CreateTime <='{endTime} 23:59:59' and {(IsOP?"o.IsOPCommission <>1":"o.IsCommission <>1")}
WHERE o.RB_Group_Id ={rB_Group_id} and o.VisaOrderStatus =1 and o.IsFinish=1 {(IsOP?"":"and o.LureEmpId =0")}{(SaleId>0?" and o.CreateBy ="+SaleId:"")} and o.RB_Branch_Id <>1220 and IFNULL(o.TotalPrice,0) >0 and o.CreateTime >='{startTime}' and o.CreateTime <='{endTime} 23:59:59' and {(IsOP?"o.IsOPCommission <>1":"o.IsCommission <>1")}