Commit 00c2c71c authored by 黄奎's avatar 黄奎

人头奖励修改

parent 30d45433
......@@ -344,5 +344,10 @@ namespace Edu.Model.ViewModel.Sell
/// 返佣总金额 (rb_order_returncomission)
/// </summary>
public decimal BrokerageMoney { get; set; }
/// <summary>
/// 订单学员编号
/// </summary>
public int Student_Id { get; set; }
}
}
\ No newline at end of file
......@@ -363,8 +363,17 @@ namespace Edu.Module.Course
/// <param name="saleId"></param>
private void CalcPersionBonusModule(RB_Personnel_Period period, RB_Bonus_PlanExtend item, int GroupId, string startDate, string endDate, int saleId)
{
if (saleId == 3478)
{
string str = "";
}
var orderList = GetSaleOrderList(item, GroupId,startDate,endDate, saleId, out List<RB_Order_ViewModel> allOrderList,out int IsOpenOrder);
var curNum = orderList?.Where(qitem => !item.NotUseCourseIds.Contains(qitem.CourseId.ToString())).Sum(qitem => qitem.GuestNum) ?? 0;
var tempOrderList = orderList?.Where(qitem => !item.NotUseCourseIds.Contains(qitem.CourseId.ToString()))?.ToList();
var numList = tempOrderList
?.GroupBy(qitem => new { qitem.Student_Id })
?.Select(qitem => new { qitem.Key.Student_Id })
;
var curNum = numList?.Count() ?? 0;
var curOrderMoney = orderList?.Where(qitem=>!item.NotUseCourseIds.Contains(qitem.CourseId.ToString())).Sum(qitem => qitem.OrderMoney) ?? 0;
//查询未平账的人员
......@@ -567,13 +576,14 @@ namespace Edu.Module.Course
//按照年份、月份统计订单人数和金额
var groupList = orderList
.GroupBy(qitem => new { qitem.CreateTime.Year, qitem.CreateTime.Month,qitem.CourseId, })
.GroupBy(qitem => new { qitem.CreateTime.Year, qitem.CreateTime.Month,qitem.CourseId,qitem.Student_Id })
.Select(qitem => new
{
qitem.Key.Year,
qitem.Key.Month,
qitem.Key.CourseId,
GuestNum = qitem.Sum(s => s.GuestNum),
qitem.Key.Student_Id,
GuestNum = qitem.Count(),
OrderMoney = qitem.Sum(s => s.Income - s.Refund - s.PlatformTax)
});
......@@ -584,6 +594,7 @@ namespace Edu.Module.Course
Year = gItem.Year,
Month = gItem.Month,
GuestNum = gItem.GuestNum,
Student_Id=gItem.Student_Id,
OrderMoney = gItem.OrderMoney,
CourseId=gItem.CourseId,
});
......@@ -964,6 +975,11 @@ namespace Edu.Module.Course
/// </summary>
public int Month { get; set; }
/// <summary>
/// 学员编号
/// </summary>
public int Student_Id { get; set; }
/// <summary>
/// 人数
/// </summary>
......
......@@ -1261,8 +1261,8 @@ group by o.OrderId
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT o.*
FROM rb_order o
SELECT o.*,B.Student_Id
FROM rb_order o INNER JOIN rb_student_orderguest AS B ON o.OrderId=B.OrderId
WHERE 1=1
");
builder.AppendFormat(" AND o.OrderState IN({0}) ", (int)OrderStateEnum.Normal);
......
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