Commit 0dc3135a authored by liudong1993's avatar liudong1993

1

parent 83019887
...@@ -73,5 +73,10 @@ namespace Edu.Model.ViewModel.Sell ...@@ -73,5 +73,10 @@ namespace Edu.Model.ViewModel.Sell
/// 总提成数 /// 总提成数
/// </summary> /// </summary>
public decimal TotalMoney { get; set; } public decimal TotalMoney { get; set; }
/// <summary>
/// 使用规则ID
/// </summary>
public int RuleId { get; set; }
} }
} }
\ No newline at end of file
...@@ -340,12 +340,11 @@ namespace Edu.Module.Course ...@@ -340,12 +340,11 @@ namespace Edu.Module.Course
decimal PeopleMoney = CommionList.Sum(x => x.PeopleNumMoney); decimal PeopleMoney = CommionList.Sum(x => x.PeopleNumMoney);
//开始拆分 //开始拆分
int ruleId = CommionList.FirstOrDefault()?.RuleId ?? 0;
var empData = sell_Achievements_EmpRepository.GetList(new RB_Sell_Achievements_Emp_ViewModel() { Type = 1, EmpId = CommionList.FirstOrDefault().UserId, PeriodsId = dmodel.PeriodId }); if (ruleId > 0)
if (empData.Where(x => x.RuleId > 0).Any())
{ {
//查询规则 //查询规则
var ruleModel = sell_Achievements_RuleRepository.GetEntity<RB_Sell_Achievements_Rule_ViewModel>(empData.Where(x => x.RuleId > 0).FirstOrDefault().RuleId); var ruleModel = sell_Achievements_RuleRepository.GetEntity<RB_Sell_Achievements_Rule_ViewModel>(ruleId);
ruleModel.DeptAwardList = new List<DeptAllotModel>(); ruleModel.DeptAwardList = new List<DeptAllotModel>();
if (!string.IsNullOrEmpty(ruleModel.DeptAwardAllotRule)) if (!string.IsNullOrEmpty(ruleModel.DeptAwardAllotRule))
{ {
...@@ -832,7 +831,7 @@ namespace Edu.Module.Course ...@@ -832,7 +831,7 @@ namespace Edu.Module.Course
string SchoolIds = string.Join(",", rulelist.Select(x => x.SchoolIds)); string SchoolIds = string.Join(",", rulelist.Select(x => x.SchoolIds));
//查询 班级订单 1.尾款收齐 //查询 班级订单 1.尾款收齐
string SDate = "2024-09-01"; string SDate = "2024-01-01";
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, languageRuleList, 1);//查询所有的 var orderList = orderRepository.GetAllAchievementsSendOrderList(userInfo.Group_Id, SDate, EDate, 1, "", SchoolIds, languageRuleList, 1);//查询所有的
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>();//需要新增当月的
...@@ -879,7 +878,7 @@ namespace Edu.Module.Course ...@@ -879,7 +878,7 @@ namespace Edu.Module.Course
if (orderList.Where(x => x.JoinType == Common.Enum.Sale.OrderJoinTypeEnum.RenewOrder && x.Refund <= 0).Any()) if (orderList.Where(x => x.JoinType == Common.Enum.Sale.OrderJoinTypeEnum.RenewOrder && x.Refund <= 0).Any())
{ {
var xfOrderList = orderList.Where(x => x.JoinType == Common.Enum.Sale.OrderJoinTypeEnum.RenewOrder && x.Refund <= 0).ToList(); var xfOrderList = orderList.Where(x => x.JoinType == Common.Enum.Sale.OrderJoinTypeEnum.RenewOrder && x.Refund <= 0).ToList();
string xforderIds = string.Join(",", xfOrderList); string xforderIds = string.Join(",", xfOrderList.Select(x => x.OrderId));
var xfStuList = orderRepository.GetXFOrderFirstEnterList(userInfo.Group_Id, xforderIds); var xfStuList = orderRepository.GetXFOrderFirstEnterList(userInfo.Group_Id, xforderIds);
foreach (var item in xfOrderList) foreach (var item in xfOrderList)
...@@ -1830,10 +1829,10 @@ namespace Edu.Module.Course ...@@ -1830,10 +1829,10 @@ namespace Edu.Module.Course
{ {
//查询该订单 已发提成记录 //查询该订单 已发提成记录
//先查询销售的 //先查询销售的
var salelist = dlist.Where(x => x.OrderId == item.OrderId && x.UserId == AchModel.EmpId && x.UserType == AchModel.Type && x.IsDept == AchModel.IsDept).ToList(); //var salelist = dlist.Where(x => x.OrderId == item.OrderId && x.UserId == AchModel.EmpId && x.UserType == AchModel.Type && x.IsDept == AchModel.IsDept).ToList();
if (salelist.Any()) if (false)//salelist.Any())
{ {
SetCommissionNext(month, CheckList, CurrentList, item, classModel, TotalHours, YFCommission, salelist, AchModel, true); //SetCommissionNext(month, CheckList, CurrentList, item, classModel, TotalHours, YFCommission, salelist, AchModel, true);
} }
else else
{ {
...@@ -1878,6 +1877,10 @@ namespace Edu.Module.Course ...@@ -1878,6 +1877,10 @@ namespace Edu.Module.Course
} }
} }
else { else {
var salelist = dlist.Where(x => x.OrderId == item.OrderId && x.UserId == AchModel.EmpId && x.UserType == AchModel.Type && x.IsDept == AchModel.IsDept).ToList();
if (!salelist.Any())
{
decimal FirstMoney = Math.Round(YFCommission * ruleModel.FirstRate / 100, 2, MidpointRounding.AwayFromZero); decimal FirstMoney = Math.Round(YFCommission * ruleModel.FirstRate / 100, 2, MidpointRounding.AwayFromZero);
CurrentList.Add(new RB_Sell_Achievements_Details_ViewModel() CurrentList.Add(new RB_Sell_Achievements_Details_ViewModel()
{ {
...@@ -1908,6 +1911,7 @@ namespace Edu.Module.Course ...@@ -1908,6 +1911,7 @@ namespace Edu.Module.Course
}); });
} }
} }
}
#endregion #endregion
} }
} }
......
...@@ -235,8 +235,13 @@ from RB_Sell_Achievements_Details r where {where} order by r.Id asc"; ...@@ -235,8 +235,13 @@ from RB_Sell_Achievements_Details r where {where} order by r.Id asc";
} }
string sql = $@" select r.UserId,r.Depart_Id,r.School_Id,r.IsCommonDept,sum(r.StudentCount) as StudentCount,sum(r.CurrentPeriodMoney + r.DeductionMoney) as CurrentPeriodMoney,sum(r.PeopleNumMoney) as PeopleNumMoney string sql = $@" select r.UserId,r.Depart_Id,r.School_Id,r.IsCommonDept,p.RuleId,sum(r.StudentCount) as StudentCount,sum(r.CurrentPeriodMoney + r.DeductionMoney) as CurrentPeriodMoney,sum(r.PeopleNumMoney) as PeopleNumMoney
from RB_Sell_Achievements_Details r where {where} group by r.UserId,r.Depart_Id,r.School_Id,r.IsCommonDept"; from RB_Sell_Achievements_Details r
left join(
select e.OrderId,e.EmpId,max(e.RuleId) as RuleId from rb_sell_achievements_emp e group by e.OrderId,e.EmpId
) p on r.OrderId = p.OrderId and r.UserId = p.EmpId
where {where} group by r.UserId,r.Depart_Id,r.School_Id,r.IsCommonDept";
return Get<RB_Sell_Achievements_Details_ViewModel>(sql).ToList(); return Get<RB_Sell_Achievements_Details_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