Commit 49f43117 authored by 黄奎's avatar 黄奎

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 4288c3e2 6cf43737
......@@ -49,6 +49,11 @@ namespace Edu.Model.ViewModel.Sell
/// </summary>
public string ClassTypeName { get; set; }
/// <summary>
/// 班级Ids
/// </summary>
public string ClassIds { get; set; }
/// <summary>
/// 订单ids
/// </summary>
......
......@@ -14,5 +14,10 @@ namespace Edu.Model.ViewModel.Sell
/// 只查询正常的
/// </summary>
public int IsSelectNor { get; set; }
/// <summary>
/// 订单ids
/// </summary>
public string OrderIds { get; set; }
}
}
\ No newline at end of file
......@@ -336,25 +336,37 @@ namespace Edu.Module.Course
int EnterId = 0;
string EnterName = "";
var empModel = accountRepository.GetEmployeeInfo(userInfo.Id);
if (empModel.UserRole == UserRoleEnum.MarketPersion)
int SaleId = StuList.FirstOrDefault().CreateBy;
if (SaleId >0)
{
EnterId = empModel.Id;
EnterName = empModel.EmployeeName;
}
else {
int SaleId = StuList.FirstOrDefault().CreateBy;
if (SaleId != userInfo.Id)
//自己负责的
var empModel = accountRepository.GetEmployeeInfo(SaleId);
if (empModel.UserRole == UserRoleEnum.MarketPersion)
{
//自己负责的
empModel = accountRepository.GetEmployeeInfo(SaleId);
if (empModel.UserRole == UserRoleEnum.MarketPersion)
{
EnterId = empModel.Id;
EnterName = empModel.EmployeeName;
}
EnterId = empModel.Id;
EnterName = empModel.EmployeeName;
}
}
//2021-12-24 取消
//var empModel = accountRepository.GetEmployeeInfo(userInfo.Id);
//if (empModel.UserRole == UserRoleEnum.MarketPersion)
//{
// EnterId = empModel.Id;
// EnterName = empModel.EmployeeName;
//}
//else {
// int SaleId = StuList.FirstOrDefault().CreateBy;
// if (SaleId != userInfo.Id)
// {
// //自己负责的
// empModel = accountRepository.GetEmployeeInfo(SaleId);
// if (empModel.UserRole == UserRoleEnum.MarketPersion)
// {
// EnterId = empModel.Id;
// EnterName = empModel.EmployeeName;
// }
// }
//}
return new
{
CustomerId,
......
......@@ -123,6 +123,10 @@ namespace Edu.Module.Finance
/// </summary>
private readonly RB_Sell_Commission_DetailsRepository sell_Commission_DetailsRepository = new RB_Sell_Commission_DetailsRepository();
/// <summary>
/// 业绩提成
/// </summary>
private readonly RB_Sell_Achievements_EmpRepository sell_Achievements_EmpRepository = new RB_Sell_Achievements_EmpRepository();
/// <summary>
/// 学校仓储层对象
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
......@@ -342,6 +346,7 @@ namespace Edu.Module.Finance
List<RB_Teaching_Perf_ViewModel> meritsProfitList = new List<RB_Teaching_Perf_ViewModel>();
List<RB_Class_Check_ViewModel> classHoursList = new List<RB_Class_Check_ViewModel>();
List<RB_Class_Check_ViewModel> classStuList = new List<RB_Class_Check_ViewModel>();
List<RB_Sell_Achievements_Emp_ViewModel> AchDetailList = new List<RB_Sell_Achievements_Emp_ViewModel>();
if (classList.Any())
{
string classIds = string.Join(",", classList.Select(x => x.ClassId));
......@@ -355,6 +360,13 @@ namespace Edu.Module.Finance
classHoursList = class_CheckRepository.GetClassLearnHoursList(GroupId, classIds);
//查询班级下所有学生的上课金额
classStuList = class_CheckRepository.GetClassStuLearnMoneyList(GroupId, classIds);
#region 查询订单下所有的业绩提成
if (orderAllList.Any())
{
string orderIds = string.Join(",", orderAllList.Select(x => x.OrderId));
AchDetailList = sell_Achievements_EmpRepository.GetList(new RB_Sell_Achievements_Emp_ViewModel() { Group_Id = GroupId, OrderIds = orderIds });
}
#endregion
}
//排序取消/删除班级
var oldlist = edu_RevenueReportRepository.GetList(new RB_Edu_RevenueReport_Extend() { StartTime = STime, EndTime = ETime, DateType = 1, Rb_Group_Id = GroupId });
......@@ -421,6 +433,10 @@ namespace Edu.Module.Finance
demodel.QTShouRu -= cfinanceList.Where(x => x.Is_Cashier == 1 && x.Fee > 0).GroupBy(x => new { x.FrID, x.Fee }).Sum(x => x.Key.Fee ?? 0);
//支出
demodel.TiCheng = orderList.Where(x => x.IsCommissionGive == 1).Sum(x => x.CommissionMoney + x.ExtraCommissionMoney);//销售提成
var achList = AchDetailList.Where(x => orderList.Select(x => x.OrderId).Contains(x.OrderId)).ToList();
if (achList.Any()) {
demodel.TiCheng += achList.Sum(x => x.GiveOutMoney);// 业绩提成
}
demodel.ClassFee = teacherBonusList.Where(x => x.ClassId == item.ClassId).Sum(x => x.Money);//老师提成
demodel.JiXiaoMoney = meritsProfitList.Where(x => x.ClassId == item.ClassId && x.PerfState == Common.Enum.Course.PerfStateEnum.Confirmed).OrderByDescending(x => x.CreateTime).FirstOrDefault()?.Money ?? 0;//绩效提成
......@@ -2889,6 +2905,19 @@ namespace Edu.Module.Finance
#endregion
#region 业绩提成
/// <summary>
/// 获取订单提成明细
/// </summary>
/// <param name="orderIds"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Sell_Achievements_Emp_ViewModel> GetAchListForOrderIds(string orderIds, int group_Id)
{
return sell_Achievements_EmpRepository.GetList(new RB_Sell_Achievements_Emp_ViewModel() { Group_Id = group_Id, OrderIds = orderIds });
}
#endregion
#region 月结窗口
......
......@@ -45,6 +45,10 @@ namespace Edu.Repository.Sell
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.ClassId)} ={demodel.ClassId}";
}
if (!string.IsNullOrEmpty(demodel.ClassIds))
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.ClassId)} in({demodel.ClassIds})";
}
if (demodel.OrderId > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.OrderId)} ={demodel.OrderId}";
......
......@@ -57,6 +57,10 @@ namespace Edu.Repository.Sell
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.PeriodsId)} >0";
}
if (!string.IsNullOrEmpty(demodel.OrderIds))
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.OrderId)} in({demodel.OrderIds})";
}
string sql = $@" select r.* from RB_Sell_Achievements_Emp r where {where} order by r.Id desc";
return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).ToList();
......
......@@ -97,6 +97,13 @@ namespace Edu.WebApi.Controllers.Finance
//提成
decimal SaleCommission = (orderList != null && orderList.Any()) ? orderList.Where(x => x.IsCommissionGive == 1).Sum(x => x.CommissionMoney + x.ExtraCommissionMoney) : 0;//销售提成
if (orderList.Any()) {
string OrderIds = string.Join(",", orderList.Select(x => x.OrderId));
var achList = financeModule.GetAchListForOrderIds(OrderIds, base.UserInfo.Group_Id);
if (achList.Any()) {
SaleCommission += achList.Sum(x => x.GiveOutMoney);// 业绩提成
}
}
decimal TeacherProfitNow = 0, MeritsProfit = 0;
if (classId > 0)
......
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