Commit be0f7ed1 authored by wuchun's avatar wuchun

提交代码

parent 3aac1d8b
...@@ -725,7 +725,7 @@ namespace Edu.Module.Course ...@@ -725,7 +725,7 @@ namespace Edu.Module.Course
//查询 班级订单 1.尾款收齐 //查询 班级订单 1.尾款收齐
string SDate = Config.NewAchievementsEnable; string SDate = Config.NewAchievementsEnable;
string EDate = Convert.ToDateTime(month + "-01").AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"); string EDate = Convert.ToDateTime(month + "-01").AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
var orderList = orderRepository.GetAllAchievementsSendOrderList(userInfo.Group_Id, SDate, EDate, 1, "", SchoolIds);//查询所有的 var orderList = orderRepository.GetAllAchievementsSendOrderList(userInfo.Group_Id, SDate, EDate, 1, "", SchoolIds,2);//查询所有的
List<RB_Sell_Achievements_Emp_ViewModel> AchEmpList = new List<RB_Sell_Achievements_Emp_ViewModel>();//需要新增当月的 List<RB_Sell_Achievements_Emp_ViewModel> AchEmpList = new List<RB_Sell_Achievements_Emp_ViewModel>();//需要新增当月的
if (orderList.Any()) { if (orderList.Any()) {
//首先查询 根据规则 适配当月业绩 并生成对应的 订单人员业绩提成 //首先查询 根据规则 适配当月业绩 并生成对应的 订单人员业绩提成
......
...@@ -272,7 +272,7 @@ ORDER BY {orderBy} ...@@ -272,7 +272,7 @@ ORDER BY {orderBy}
where += $@" and o.{nameof(RB_Order_ViewModel.CustomerId)} = {demodel.CustomerId}"; where += $@" and o.{nameof(RB_Order_ViewModel.CustomerId)} = {demodel.CustomerId}";
} }
//HK 03 - 15修改 //HK 03 - 15修改
if (demodel.CreateBy > 0|| demodel.EnterID > 0) if (demodel.CreateBy > 0 || demodel.EnterID > 0)
{ {
var createBy = 0; var createBy = 0;
if (demodel.CreateBy > 0) if (demodel.CreateBy > 0)
...@@ -281,7 +281,7 @@ ORDER BY {orderBy} ...@@ -281,7 +281,7 @@ ORDER BY {orderBy}
} }
if (createBy <= 0 && demodel.EnterID > 0) if (createBy <= 0 && demodel.EnterID > 0)
{ {
createBy = demodel.EnterID; createBy = demodel.EnterID;
} }
where += $@" and (o.{nameof(RB_Order_ViewModel.CreateBy)} = {createBy} OR o.{nameof(RB_Order_ViewModel.EnterID)}={createBy} OR o.{nameof(RB_Order_ViewModel.CourseConsultantId)}={createBy} )"; where += $@" and (o.{nameof(RB_Order_ViewModel.CreateBy)} = {createBy} OR o.{nameof(RB_Order_ViewModel.EnterID)}={createBy} OR o.{nameof(RB_Order_ViewModel.CourseConsultantId)}={createBy} )";
} }
...@@ -355,7 +355,7 @@ WHERE {where} ORDER BY {orderBy} ...@@ -355,7 +355,7 @@ WHERE {where} ORDER BY {orderBy}
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.OrderForm)} ={(int)demodel.OrderForm}"; where += $@" and o.{nameof(RB_Order_ViewModel.OrderForm)} ={(int)demodel.OrderForm}";
} }
if (demodel.Dept_Id > 0) if (demodel.Dept_Id > 0)
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.Dept_Id)} ={demodel.Dept_Id}"; where += $@" and o.{nameof(RB_Order_ViewModel.Dept_Id)} ={demodel.Dept_Id}";
...@@ -1216,8 +1216,9 @@ ORDER BY {orderBy} ...@@ -1216,8 +1216,9 @@ ORDER BY {orderBy}
/// <param name="eDate"></param> /// <param name="eDate"></param>
/// <param name="courseType">类型 1包含 2不包含</param> /// <param name="courseType">类型 1包含 2不包含</param>
/// <param name="courseIds"></param> /// <param name="courseIds"></param>
/// <param name="OrderType">0-查询所以,其他请参考枚举</param>
/// <returns></returns> /// <returns></returns>
public List<RB_Order_ViewModel> GetAllAchievementsSendOrderList(int group_Id, string sDate, string eDate, int courseType, string courseIds, string schoolIds) public List<RB_Order_ViewModel> GetAllAchievementsSendOrderList(int group_Id, string sDate, string eDate, int courseType, string courseIds, string schoolIds, int OrderType = 0)
{ {
string where = ""; string where = "";
if (!string.IsNullOrEmpty(courseIds)) if (!string.IsNullOrEmpty(courseIds))
...@@ -1235,7 +1236,10 @@ ORDER BY {orderBy} ...@@ -1235,7 +1236,10 @@ ORDER BY {orderBy}
{ {
where += $" and (c.School_Id in ({schoolIds}) or (s.School_Id in ({schoolIds}))) "; where += $" and (c.School_Id in ({schoolIds}) or (s.School_Id in ({schoolIds}))) ";
} }
if (OrderType > 0)
{
where += $" and o.OrderType = {OrderType}";
}
string sql = $@"SELECT o.*,IF(o.OrderType =1,c.School_Id,s.School_Id) as ClassSchoolId FROM rb_order o string sql = $@"SELECT o.*,IF(o.OrderType =1,c.School_Id,s.School_Id) as ClassSchoolId FROM rb_order o
left join rb_class c on o.ClassId = c.ClassId left join rb_class c on o.ClassId = c.ClassId
left join rb_studyabroad s on o.SourceId = s.Id left join rb_studyabroad s on o.SourceId = s.Id
...@@ -1257,7 +1261,7 @@ group by o.OrderId ...@@ -1257,7 +1261,7 @@ group by o.OrderId
/// <param name="PlanType">1-市场人员,2-课程顾问</param> /// <param name="PlanType">1-市场人员,2-课程顾问</param>
/// <param name="SaleId">员工编号</param> /// <param name="SaleId">员工编号</param>
/// <returns></returns> /// <returns></returns>
public List<RB_Order_ViewModel> GetAllBonusOrderListRepository(int group_Id,string startDate, string eDate, int PlanType, int SaleId) public List<RB_Order_ViewModel> GetAllBonusOrderListRepository(int group_Id, string startDate, string eDate, int PlanType, int SaleId)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
...@@ -1307,7 +1311,7 @@ WHERE 1=1 ...@@ -1307,7 +1311,7 @@ WHERE 1=1
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="qType">1-市场部,2-课程顾问部</param> /// <param name="qType">1-市场部,2-课程顾问部</param>
/// <returns></returns> /// <returns></returns>
public Dictionary<string, List<RB_Order_ViewModel>> GetMarketConsultantStaticRepository(RB_Order_ViewModel query,int qType=1) public Dictionary<string, List<RB_Order_ViewModel>> GetMarketConsultantStaticRepository(RB_Order_ViewModel query, int qType = 1)
{ {
Dictionary<string, List<RB_Order_ViewModel>> dicList = new Dictionary<string, List<RB_Order_ViewModel>>(); Dictionary<string, List<RB_Order_ViewModel>> dicList = new Dictionary<string, List<RB_Order_ViewModel>>();
string sql = ""; string sql = "";
...@@ -1433,7 +1437,7 @@ WHERE 1=1 AND A.OrderState IN(1,2) {0} ...@@ -1433,7 +1437,7 @@ WHERE 1=1 AND A.OrderState IN(1,2) {0}
,SUM(o.Income) as Income,SUM(Refund) AS Refund,SUM(o.PlatformTax) as PlatformTax ,SUM(o.Income) as Income,SUM(Refund) AS Refund,SUM(o.PlatformTax) as PlatformTax
,SUM(o.PreferPrice - o.Income + o.Refund - o.DiscountMoney - o.PlatformTax) AS DueInMoney ,SUM(o.PreferPrice - o.Income + o.Refund - o.DiscountMoney - o.PlatformTax) AS DueInMoney
,COUNT(0) as CancelNum ,COUNT(0) as CancelNum
FROM rb_order o WHERE o.Group_Id ={group_Id} and o.OrderState <>3 and o.CreateTime >='{startMonth}' and o.CreateTime <='{endMonth} 23:59:59' and o.CourseConsultantId >0 {(empId>0? " and o.CourseConsultantId ="+empId : "")} FROM rb_order o WHERE o.Group_Id ={group_Id} and o.OrderState <>3 and o.CreateTime >='{startMonth}' and o.CreateTime <='{endMonth} 23:59:59' and o.CourseConsultantId >0 {(empId > 0 ? " and o.CourseConsultantId =" + empId : "")}
GROUP BY o.CourseConsultantId"; GROUP BY o.CourseConsultantId";
return Get<RB_Order_ViewModel>(sql).ToList(); return Get<RB_Order_ViewModel>(sql).ToList();
} }
......
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