Commit 6afbbcd2 authored by liudong1993's avatar liudong1993

1

parent c4910a26
......@@ -222,80 +222,82 @@ 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}";
}
if (demodel.GuestId > 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";
// parameters.Add("GuestName", "%" + demodel.GuestName.Trim() + "%");
//}
if (demodel.IsMyOrder == 1)
{
//查询我的订单 新增对引流人员查看支持
where += $@" and (t.{nameof(RB_CRMTicket_Order_Extend.EnterID)} ={demodel.EnterID} or t.{nameof(RB_CRMTicket_Order_Extend.CreateBy)} ={demodel.EnterID})";
}
else
{
if (demodel.GuestId > 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";
// parameters.Add("GuestName", "%" + demodel.GuestName.Trim() + "%");
//}
if (demodel.IsMyOrder == 1)
{
//查询我的订单 新增对引流人员查看支持
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";
parameters.Add("StartCityName", "%" + demodel.StartCityName.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.EndCityName))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.EndCityName)} like @EndCityName";
parameters.Add("EndCityName", "%" + demodel.EndCityName.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.StartTime))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.CreateTime)} >='{demodel.StartTime}'";
}
if (!string.IsNullOrEmpty(demodel.EndTime))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.CreateTime)} <='{demodel.EndTime} 23:59:59'";
}
if (!string.IsNullOrEmpty(demodel.DepartSTime))
if (demodel.EnterID > 0)
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.DepartTime)} >='{demodel.DepartSTime}'";
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.EnterID)} ={demodel.EnterID}";
}
if (!string.IsNullOrEmpty(demodel.DepartETime))
if (demodel.CreateBy > 0)
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.DepartTime)} <='{demodel.DepartETime} 23:59:59'";
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.CreateBy)} ={demodel.CreateBy}";
}
if (!string.IsNullOrEmpty(demodel.FinishSTime) && !string.IsNullOrEmpty(demodel.FinishETime))
{
where += $@" and ((t.OrderStatus =5 and t.FinishTime >='{demodel.FinishSTime}' and t.FinishTime <='{demodel.FinishETime} 23:59:59')
}
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";
parameters.Add("StartCityName", "%" + demodel.StartCityName.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.EndCityName))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.EndCityName)} like @EndCityName";
parameters.Add("EndCityName", "%" + demodel.EndCityName.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.StartTime))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.CreateTime)} >='{demodel.StartTime}'";
}
if (!string.IsNullOrEmpty(demodel.EndTime))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.CreateTime)} <='{demodel.EndTime} 23:59:59'";
}
if (!string.IsNullOrEmpty(demodel.DepartSTime))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.DepartTime)} >='{demodel.DepartSTime}'";
}
if (!string.IsNullOrEmpty(demodel.DepartETime))
{
where += $@" and t.{nameof(RB_CRMTicket_Order_Extend.DepartTime)} <='{demodel.DepartETime} 23:59:59'";
}
if (!string.IsNullOrEmpty(demodel.FinishSTime) && !string.IsNullOrEmpty(demodel.FinishETime))
{
where += $@" and ((t.OrderStatus =5 and t.FinishTime >='{demodel.FinishSTime}' and t.FinishTime <='{demodel.FinishETime} 23:59:59')
or (t.OrderStatus =6 and t.LossFinishTime >='{demodel.FinishSTime}' and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
}
else if (!string.IsNullOrEmpty(demodel.FinishSTime))
{
where += $@" and ((t.OrderStatus =5 and t.FinishTime >='{demodel.FinishSTime}')
}
else if (!string.IsNullOrEmpty(demodel.FinishSTime))
{
where += $@" and ((t.OrderStatus =5 and t.FinishTime >='{demodel.FinishSTime}')
or (t.OrderStatus =6 and t.LossFinishTime >='{demodel.FinishSTime}'))";
}
else if (!string.IsNullOrEmpty(demodel.FinishETime))
{
where += $@" and ((t.OrderStatus =5 and t.FinishTime <='{demodel.FinishETime} 23:59:59')
}
else if (!string.IsNullOrEmpty(demodel.FinishETime))
{
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'))";
}
//订单类型
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)
//{
// where += $@" and t.OrderId in(select * from )";
......@@ -314,8 +316,10 @@ or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
string sql = $@"
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
WHERE {where}
group by t.OrderId
ORDER BY t.CreateTime DESC";
return GetPage<RB_CRMTicket_Order_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
......@@ -370,6 +374,10 @@ ORDER BY t.CreateTime DESC";
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";
......@@ -428,15 +436,17 @@ or (t.OrderStatus =6 and t.LossFinishTime <='{demodel.FinishETime} 23:59:59'))";
}
string sql = $@"
SELECT sum(case when t.OrderStatus <>2 then t.Money else 0 end) as Money
,sum(case when t.OrderStatus <>2 then t.IncomeMoney else 0 end) as IncomeMoney
,sum(case when t.OrderStatus <>2 then t.TaxMoney else 0 end) as TaxMoney
,sum(case when t.OrderStatus <>2 then t.BackMoney else 0 end) as BackMoney
,sum(case when t.OrderStatus <>2 then t.PayMoney else 0 end) as PayMoney
,sum(case when t.OrderStatus <>2 then t.GuestCount else 0 end) as NorNumber
,sum(case when t.OrderStatus =2 then t.GuestCount else 0 end) as CancelNum
SELECT sum(case when t2.OrderStatus <>2 then t2.Money else 0 end) as Money
,sum(case when t2.OrderStatus <>2 then t2.IncomeMoney else 0 end) as IncomeMoney
,sum(case when t2.OrderStatus <>2 then t2.TaxMoney else 0 end) as TaxMoney
,sum(case when t2.OrderStatus <>2 then t2.BackMoney else 0 end) as BackMoney
,sum(case when t2.OrderStatus <>2 then t2.PayMoney else 0 end) as PayMoney
,sum(case when t2.OrderStatus <>2 then t2.GuestCount else 0 end) as NorNumber
,sum(case when t2.OrderStatus =2 then t2.GuestCount else 0 end) as CancelNum
select t.* from(
FROM RB_Ticket_Order t
WHERE {where} ";
left JOIN rb_appoint_op aop on aop.OrderId=o.OrderId and aop.ResourceType=8
WHERE {where} group by t.OrderId)t2 ";
return Get<RB_CRMTicket_Order_Extend>(sql, parameters).FirstOrDefault();
}
}
......
......@@ -2982,7 +2982,20 @@ namespace REBORN.Services.SellService
ResultPageModel pmodel = JsonHelper.DeserializeObject<ResultPageModel>(request.msg.ToString());
RB_CRMTicket_Order_Extend demodel = JsonHelper.DeserializeObject<RB_CRMTicket_Order_Extend>(request.msg.ToString());
demodel.GroupId = userInfo.RB_Group_id;
if (demodel.IsMyOrder == 1) { demodel.EnterID = userInfo.EmployeeId; }
if (demodel.IsMyOrder == 1) {
demodel.EnterID = userInfo.EmployeeId;
}
else {
demodel.OpEmpId = userInfo.EmployeeId;
if (userInfo != null && userInfo.RB_Post_Id > 0)
{
string actionMenu = CacheManager.User.RbUserCache.GetUserActionMenu(userInfo.RB_Post_Id);
if (!string.IsNullOrEmpty(actionMenu) && actionMenu.Contains("S_CheckAllOrder"))//查看全部的订单信息
{
demodel.OpEmpId = 0;
}
}
}
if (demodel.OrderStatus <= 0)
{
demodel.IsSelectNormal = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment