where+=$@" and (t.{nameof(RB_CRMTicket_Order_Extend.EnterID)} ={demodel.EnterID} or t.{nameof(RB_CRMTicket_Order_Extend.CreateBy)} ={demodel.EnterID})";
}
else
else
{
{
if(demodel.GuestId>0)
if(demodel.EnterID>0)
{
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.GuestId)} ={demodel.GuestId}";
}
//if (!string.IsNullOrEmpty(demodel.GuestName))
//{
// where += $@" and concat(g.SurName,g.Name) like @GuestName";
where+=$@" and (t.{nameof(RB_CRMTicket_Order_Extend.EnterID)} ={demodel.EnterID} or t.{nameof(RB_CRMTicket_Order_Extend.CreateBy)} ={demodel.EnterID})";
}
else
{
if(demodel.EnterID>0)
{
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.EnterID)} ={demodel.EnterID}";
}
if(demodel.CreateBy>0)
{
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.CreateBy)} ={demodel.CreateBy}";
}
}
if(!string.IsNullOrEmpty(demodel.StartCityName))
{
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.StartCityName)} like @StartCityName";
where+=$@" and ((t.OrderStatus =5 and t.FinishTime <='{demodel.FinishETime} 23:59:59')
where+=$@" and ((t.OrderStatus =5 and t.FinishTime <='{demodel.FinishETime} 23:59:59')
or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
}
//订单类型
if(!string.IsNullOrEmpty(demodel.OrderType))
{
where+=string.Format(" AND FIND_IN_SET('{0}', t.OrderType) ",demodel.OrderType);
}
}
}
//订单类型
if(!string.IsNullOrEmpty(demodel.OrderType))
{
where+=string.Format(" AND FIND_IN_SET('{0}', t.OrderType) ",demodel.OrderType);
}
//if (demodel.OpEmpId > 0)
//if (demodel.OpEmpId > 0)
//{
//{
// where += $@" and t.OrderId in(select * from )";
// where += $@" and t.OrderId in(select * from )";
...
@@ -314,8 +316,10 @@ or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
...
@@ -314,8 +316,10 @@ or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
stringsql=$@"
stringsql=$@"
SELECT t.*,cd.Commission
SELECT t.*,cd.Commission
FROM RB_Ticket_Order t
FROM RB_Ticket_Order t
left JOIN rb_appoint_op aop on aop.OrderId=o.OrderId and aop.ResourceType=8
left join (select d.OrderId,sum(d.Commission) as Commission from rb_ticket_commission_details d where d.Status =0 group by d.OrderId) cd on t.OrderId = cd.OrderId
left join (select d.OrderId,sum(d.Commission) as Commission from rb_ticket_commission_details d where d.Status =0 group by d.OrderId) cd on t.OrderId = cd.OrderId