@@ -222,8 +222,6 @@ WHERE o.GroupId ={rB_Group_id} and o.IsSaleDrainage =1 and o.OrderStatus <>2 and
{
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.OrderId)} ={demodel.OrderId}";
}
else
{
if(demodel.GuestId>0)
{
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.GuestId)} ={demodel.GuestId}";
...
...
@@ -249,6 +247,10 @@ WHERE o.GroupId ={rB_Group_id} and o.IsSaleDrainage =1 and o.OrderStatus <>2 and
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.CreateBy)} ={demodel.CreateBy}";
}
}
if(demodel.OpEmpId>0)
{
where+=$" and aop.OPId="+demodel.OpEmpId;
}
if(!string.IsNullOrEmpty(demodel.StartCityName))
{
where+=$@" and t.{nameof(RB_CRMTicket_Order_Extend.StartCityName)} like @StartCityName";
...
...
@@ -295,7 +297,7 @@ or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
{
where+=string.Format(" AND FIND_IN_SET('{0}', t.OrderType) ",demodel.OrderType);
}
}
//if (demodel.OpEmpId > 0)
//{
// where += $@" and t.OrderId in(select * from )";
...
...
@@ -314,8 +316,10 @@ or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
stringsql=$@"
SELECT t.*,cd.Commission
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