Commit bde6bb7c authored by liudong1993's avatar liudong1993

1

parent af94e626
......@@ -1432,7 +1432,7 @@ namespace Edu.Module.Course
#endregion
#region 计算累计应发
decimal SumPrice = NorList.Sum(x => x.CurrentPeriodMoney + x.CurrentExtraMoney + x.CurrentExtraMoney + x.DeductionExtraMoney);
decimal SumPrice = NorList.Sum(x => x.CurrentPeriodMoney + x.DeductionMoney + x.CurrentExtraMoney + x.DeductionExtraMoney);
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Sell_Commission_Periods.SumPrice),SumPrice}
};
......
......@@ -261,6 +261,10 @@ ORDER BY {orderBy}
{
where += $@" and o.{nameof(RB_Order_ViewModel.CustomerId)} = {demodel.CustomerId}";
}
if (demodel.CreateBy > 0)
{
where += $@" and o.{nameof(RB_Order_ViewModel.CreateBy)} = {demodel.CreateBy}";
}
string orderBy = " o.OrderId asc";
if (demodel.Q_OrderBy == 1)
{
......@@ -385,6 +389,10 @@ WHERE {where} ORDER BY {orderBy}
{
where += $@" and o.{nameof(RB_Order_ViewModel.CustomerId)} ={demodel.CustomerId}";
}
if (demodel.CreateBy > 0)
{
where += $@" and o.{nameof(RB_Order_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
if (demodel.CourseSubject > 0)
{
where += $@" and course.{nameof(RB_Order_ViewModel.CourseSubject)} = {(int)demodel.CourseSubject}";
......@@ -652,7 +660,7 @@ GROUP BY ClassId;";
}
string sql = $@"SELECT o.* FROM rb_order o
inner join rb_class c on o.ClassId = c.ClassId
WHERE o.Group_Id ={group_Id} and o.OrderState =1 and o.EffectStatus in(1,2) and o.CommissionRate >0 and c.OpenTime <= '{eDate} 23:59:59' {where} and o.PreferPrice = (o.Income - o.Refund + o.DiscountMoney + o.PlatformTax) and (o.IsCommissionGiveOK =0 or (o.ExtraRewardMoney -o.ExtraDeductMoney)<> o.ExtraCommissionMoney);";
WHERE o.Group_Id ={group_Id} and o.OrderState =1 and o.EffectStatus in(1,2) and o.CommissionRate >0 and o.CreateTime <'2021-12-01' and c.OpenTime <= '{eDate} 23:59:59' {where} and o.PreferPrice = (o.Income - o.Refund + o.DiscountMoney + o.PlatformTax) and (o.IsCommissionGiveOK =0 or (o.ExtraRewardMoney -o.ExtraDeductMoney)<> o.ExtraCommissionMoney);";
return Get<RB_Order_ViewModel>(sql).ToList();
}
......@@ -1124,5 +1132,40 @@ GROUP BY o.OrderId";
}
#endregion
#region 业绩提成
/// <summary>
/// 获取当月所有的订单
/// </summary>
/// <param name="group_Id"></param>
/// <param name="eDate"></param>
/// <param name="courseType">类型 1包含 2不包含</param>
/// <param name="courseIds"></param>
/// <returns></returns>
public List<RB_Order_ViewModel> GetAllAchievementsSendOrderList(int group_Id, string eDate, int courseType, string courseIds)
{
string where = "";
if (!string.IsNullOrEmpty(courseIds))
{
if (courseType == 1)
{
where += $" and c.CourseId in ({courseIds})";
}
else
{
where += $" and c.CourseId not in ({courseIds})";
}
}
string sql = $@"SELECT o.* FROM rb_order o
left join rb_sell_achievements_emp e on o.OrderId = e.OrderId
WHERE o.Group_Id ={group_Id} and o.OrderState =1 and o.CreateTime >='2021-12-01' and o.CreateTime <= '{eDate} 23:59:59'
and e.Id is null
and o.PreferPrice = (o.Income - o.Refund + o.DiscountMoney + o.PlatformTax) {where}
group by o.OrderId
;";
return Get<RB_Order_ViewModel>(sql).ToList();
}
#endregion
}
}
......@@ -534,23 +534,23 @@ WHERE 1=1 {4}
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.Id,A.Account,A.WorkUserId,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon,A.AccountType
SELECT A.Id,A.Account,A.WorkUserId,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon,A.AccountType,A.UserRole
,IFNULL(G.GroupName,'') AS GroupName,IFNULL(s.SName,'') AS SchoolName
,IFNULL(d.DeptId,0) AS Dept_Id,IFNULL(d.DeptName,'') AS DeptName,IFNULL(p.PostId,0) AS Post_Id, IFNULL(p.PostName,'') AS PostName
FROM
(
SELECT A.Id,A.Account,A.WorkUserId,A.`Password`,A.AccountType,A.AccountId,A.CreateBy,A.CreateTime,A.UpdateBy,A.UpdateTime,A.Group_Id,B.School_Id,A.`Status`
,A.AnnualLeaveDay, A.DirectSupervisor,A.OpenId,A.ActivationStatus,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id
,A.AnnualLeaveDay, A.DirectSupervisor,A.OpenId,A.ActivationStatus,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id,B.UserRole
FROM rb_account AS A INNER JOIN rb_manager AS B ON A.AccountId=B.MId AND A.AccountType=1
WHERE 1=1 {0}
UNION ALL
SELECT A.Id,A.Account,A.WorkUserId,A.`Password`,A.AccountType,A.AccountId,A.CreateBy,A.CreateTime,A.UpdateBy,A.UpdateTime,A.Group_Id,B.School_Id,A.`Status`
,A.AnnualLeaveDay, A.DirectSupervisor,A.OpenId,A.ActivationStatus,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id
,A.AnnualLeaveDay, A.DirectSupervisor,A.OpenId,A.ActivationStatus,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.UserRole
FROM rb_account AS A INNER JOIN rb_teacher AS B ON A.AccountId=B.TId AND A.AccountType=2
WHERE 1=1 {0}
UNION ALL
SELECT A.Id,A.Account,A.WorkUserId,A.`Password`,A.AccountType,A.AccountId,A.CreateBy,A.CreateTime,A.UpdateBy,A.UpdateTime,A.Group_Id,B.School_Id,A.`Status`
,A.AnnualLeaveDay, A.DirectSupervisor,A.OpenId,A.ActivationStatus,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id
,A.AnnualLeaveDay, A.DirectSupervisor,A.OpenId,A.ActivationStatus,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.UserRole
FROM rb_account AS A INNER JOIN rb_assist AS B ON A.AccountId=B.AId AND A.AccountType=3
WHERE 1=1 {0}
) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId
......
......@@ -1326,7 +1326,7 @@ namespace Edu.WebApi.Controllers.Course
CourseSubject=base.ParmJObj.GetInt("CourseSubject"),
};
demodel.Group_Id = userInfo.Group_Id;
demodel.EnterID = userInfo.Id;
demodel.CreateBy = userInfo.Id;
var orderList = orderModule.GetMyOrderPageList(pageModel.PageIndex, pageModel.PageSize, out long count, demodel);
var orderS = orderModule.GetMyOrderStatisticsModule(demodel);
......
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