Commit 19d6016f authored by liudong1993's avatar liudong1993

1 订单列表 业绩提成显示

parent 200a9c3c
......@@ -319,5 +319,10 @@ namespace Edu.Model.ViewModel.Sell
/// 开班类型 1正常班 2滚动班
/// </summary>
public int ClassScrollType { get; set; }
/// <summary>
/// 业绩应发提成
/// </summary>
public decimal YFCommission { get; set; }
}
}
\ No newline at end of file
......@@ -221,6 +221,10 @@ namespace Edu.Module.Course
/// 学习目的仓储层对象
/// </summary>
private readonly RB_LearningGoalsRepository learningGoalsRepository = new RB_LearningGoalsRepository();
/// <summary>
/// 业绩提成
/// </summary>
private readonly RB_Sell_Achievements_EmpRepository sell_Achievements_EmpRepository = new RB_Sell_Achievements_EmpRepository();
private readonly RB_Order_ReturnComissionRepository returnComissionRepository = new RB_Order_ReturnComissionRepository();
......@@ -3275,7 +3279,7 @@ namespace Edu.Module.Course
//获取合同列表
var clist = education_ContractRepository.GetList(new RB_Education_Contract_ViewModel() { Group_Id = demodel.Group_Id, OrderIds = orderIds, Status = -1 }).Where(x => x.Status != 4).ToList();
//获取新的业绩提成
//var achList = sell_Achievements_EmpRepository.GetList(new RB_Sell_Achievements_Emp_ViewModel() { Group_Id = demodel.Group_Id, OrderIds = orderIds });
var achList = sell_Achievements_EmpRepository.GetList(new RB_Sell_Achievements_Emp_ViewModel() { Group_Id = demodel.Group_Id, OrderIds = orderIds });
foreach (var item in orderList)
{
......@@ -3326,6 +3330,13 @@ namespace Edu.Module.Course
subItem.ContractStatusStr = ContractStatusStr;
}
}
var achievementList = achList.Where(x => x.OrderId == item.OrderId).ToList();
if (achievementList.Any())
{
item.CommissionMoney = achievementList.Sum(x => x.GiveOutMoney);
item.YFCommission = achievementList.Sum(x => x.PushMoney);
}
}
}
return orderList;
......
......@@ -76,7 +76,7 @@ namespace Edu.Module.Course
continue;
}
#region 生成班级号
string ClassNo = "GD";int ClassLetterNum = 0;
string ClassNo = "GDKB";int ClassLetterNum = 0;
////查询最大的字母
//int CNum = classRepository.GetMaxClassNoPrefix(time + "-01");
//if (CNum == 0)
......@@ -272,7 +272,7 @@ namespace Edu.Module.Course
Status = 0,
ClassRoomId = item.Key.RoomId,
Group_Id = groupId,
School_Id = 0,// 暂时 应该要赋值 订单上的预约校区
School_Id = -1,// 暂时 应该要赋值 订单上的预约校区
TeacherId = item.Key.TeacherId,
BeiKeStatus = 0,
FanKuiStatus = 0,
......
......@@ -407,10 +407,14 @@ SELECT SUM(CASE WHEN o.OrderState <> 3 THEN o.PreferPrice ELSE 0 END) AS PreferP
SUM(CASE WHEN o.OrderState <> 3 THEN o.PreferPrice - o.Income + o.Refund - o.DiscountMoney - o.PlatformTax ELSE 0 END) AS DueInMoney,
SUM(CASE WHEN o.OrderState <> 3 THEN o.GuestNum ELSE 0 END) AS GuestNum,
SUM(CASE WHEN o.OrderState = 3 THEN o.GuestNum ELSE 0 END) AS CancelNum,
SUM(CASE WHEN o.CommissionMoney <> -1 AND o.OrderState <> 3 THEN o.CommissionMoney ELSE 0 END) AS CommissionMoney,
SUM(CASE WHEN ea.GiveOutMoney > 0 THEN ea.GiveOutMoney ELSE
CASE WHEN o.CommissionMoney <> -1 AND o.OrderState <> 3 THEN o.CommissionMoney ELSE 0 END END) AS CommissionMoney,
SUM(CASE WHEN o.OrderState <> 3 THEN o.ExtraRewardMoney - o.ExtraDeductMoney ELSE 0 END) AS ExtraRewardMoney
FROM RB_Order o LEFT JOIN rb_class c on o.ClassId = c.ClassId
LEFT JOIN rb_course AS course ON (o.CourseId=course.CourseId AND o.CourseId>0 AND o.OrderType=1)
LEFT JOIN rb_course AS course ON (o.CourseId=course.CourseId AND o.CourseId>0 AND o.OrderType=1)
LEFT JOIN (
SELECT em.OrderId,SUM(em.GiveOutMoney) as GiveOutMoney FROM rb_sell_achievements_emp em GROUP BY em.OrderId
) ea on ea.OrderId = o.OrderId
WHERE {where}
";
return Get<RB_Order_ViewModel>(sql).FirstOrDefault();
......
......@@ -438,9 +438,9 @@ namespace Edu.WebApi.Controllers.Applet
{
return ApiResult.ParamIsNull("请传递班级ID");
}
if (ClassScrollType == 2 && StuId <= 0)
if (ClassScrollType == 2 )
{
return ApiResult.ParamIsNull("请传递学生ID");
StuId = appletUserInfo.AccountId;
}
//获取课程回顾
int Day = 7;//默认最近7次上课
......
......@@ -235,12 +235,13 @@ namespace Edu.WebApi.Controllers.Course
CreateByName = UserReidsCache.GetUserLoginInfo(x.CreateBy)?.AccountName ?? "",
x.CourseConsultantId,
ConsultantName = UserReidsCache.GetUserLoginInfo(x.CourseConsultantId)?.AccountName ?? "",
YFCommissionMoney = GetOrderYFCommission(x),
IsAchievements = x.YFCommission > 0 ? 1 : 2,
YFCommissionMoney = x.YFCommission > 0 ? x.YFCommission : GetOrderYFCommission(x),
x.CommissionMoney,
x.ExtraCommissionMoney,
x.ExtraRewardMoney,
x.ExtraDeductMoney,
x.IsCommissionGive,
IsCommissionGive = x.YFCommission > 0 ? 1 : x.IsCommissionGive,
x.CommissionBack,
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
x.SaleRemark,
......@@ -356,7 +357,8 @@ namespace Edu.WebApi.Controllers.Course
CreateByName = UserReidsCache.GetUserLoginInfo(x.CreateBy)?.AccountName ?? "",
x.CourseConsultantId,
ConsultantName = UserReidsCache.GetUserLoginInfo(x.CourseConsultantId)?.AccountName ?? "",
YFCommissionMoney = GetOrderYFCommission(x),
IsAchievements = x.YFCommission > 0 ? 1 : 2,
YFCommissionMoney = x.YFCommission > 0 ? x.YFCommission : GetOrderYFCommission(x),
x.CommissionMoney,
x.ExtraCommissionMoney,
x.ExtraRewardMoney,
......@@ -1407,12 +1409,13 @@ namespace Edu.WebApi.Controllers.Course
CreateByName = UserReidsCache.GetUserLoginInfo(x.CreateBy)?.AccountName ?? "",
x.CourseConsultantId,
ConsultantName = UserReidsCache.GetUserLoginInfo(x.CourseConsultantId)?.AccountName ?? "",
YFCommissionMoney = GetOrderYFCommission(x),
IsAchievements = x.YFCommission > 0 ? 1 : 2,
YFCommissionMoney = x.YFCommission > 0 ? x.YFCommission : GetOrderYFCommission(x),
x.CommissionMoney,
x.ExtraCommissionMoney,
x.ExtraRewardMoney,
x.ExtraDeductMoney,
x.IsCommissionGive,
IsCommissionGive = x.YFCommission > 0 ? 1 : x.IsCommissionGive,
x.CommissionBack,
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
SaleRemark = x?.SaleRemark ?? "",
......@@ -1601,12 +1604,13 @@ namespace Edu.WebApi.Controllers.Course
CreateByName = UserReidsCache.GetUserLoginInfo(x.CreateBy)?.AccountName ?? "",
x.CourseConsultantId,
ConsultantName = UserReidsCache.GetUserLoginInfo(x.CourseConsultantId)?.AccountName ?? "",
YFCommissionMoney = GetOrderYFCommission(x),
IsAchievements = x.YFCommission > 0 ? 1 : 2,
YFCommissionMoney = x.YFCommission > 0 ? x.YFCommission : GetOrderYFCommission(x),
x.CommissionMoney,
x.ExtraCommissionMoney,
x.ExtraRewardMoney,
x.ExtraDeductMoney,
x.IsCommissionGive,
IsCommissionGive = x.YFCommission > 0 ? 1 : x.IsCommissionGive,
x.CommissionBack,
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
SaleRemark = x?.SaleRemark ?? "",
......
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