Commit 52de307a authored by liudong1993's avatar liudong1993

1 业绩提成

parent b96b8d54
......@@ -142,5 +142,10 @@ namespace Edu.Model.Entity.Sell
/// </summary>
public decimal FirstRate { get; set; }
/// <summary>
/// 人头奖励
/// </summary>
public decimal PeopleNumMoney { get; set; }
}
}
......@@ -86,5 +86,11 @@ namespace Edu.Model.Entity.Sell
/// 订单业绩
/// </summary>
public decimal OrderSaleMoney { get; set; }
/// <summary>
/// 人头奖励
/// </summary>
public decimal PeopleNumMoney { get; set; }
}
}
......@@ -39,5 +39,10 @@ namespace Edu.Model.ViewModel.Sell
/// 当前订单金额
/// </summary>
public decimal OrderMoney { get; set; }
/// <summary>
/// 订单退款金额
/// </summary>
public decimal Refund { get; set; }
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -80,12 +80,12 @@ WHERE a.`Status`=0 and s.Group_Id ={group_Id} and s.`Status`=0 and a.AssistId ={
/// </summary>
/// <param name="orderIds"></param>
/// <returns></returns>
public List<RB_Student_Assist_Extend> GetAssistTeacherForOrder(string orderIds) {
public List<RB_Student_Assist_Extend> GetAssistTeacherForOrder(string orderIds,bool IsZJS = true ) {
string sql = $@"SELECT og.OrderId,a.AssistId FROM rb_student_orderguest og
INNER JOIN rb_student_assist a on og.Student_Id =a.StuId
INNER JOIN rb_student s on og.Student_Id =s.StuId
INNER JOIN rb_account ac on a.AssistId = ac.Id
WHERE og.`Status` =0 and a.`Status` =0 and og.OrderId in({orderIds}) and a.AssistType =4 and s.CreateType =4 and ac.AccountType =2";
WHERE og.`Status` =0 and a.`Status` =0 and og.OrderId in({orderIds}) and a.AssistType =4 {(IsZJS ? "and s.CreateType =4" : "")} and ac.AccountType =2";
return Get<RB_Student_Assist_Extend>(sql).ToList();
}
......
......@@ -223,7 +223,7 @@ from RB_Sell_Achievements_Details r where {where} order by r.Id asc";
}
string sql = $@" select r.UserId,r.Depart_Id,r.School_Id,sum(r.StudentCount) as StudentCount,sum(r.CurrentPeriodMoney + r.DeductionMoney) as CurrentPeriodMoney
string sql = $@" select r.UserId,r.Depart_Id,r.School_Id,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";
return Get<RB_Sell_Achievements_Details_ViewModel>(sql).ToList();
}
......@@ -236,7 +236,7 @@ from RB_Sell_Achievements_Details r where {where} group by r.UserId,r.Depart_Id,
/// <returns></returns>
public List<RB_Sell_Achievements_Details_ViewModel> GetSchoolCommission(int schoolId, string periodsIds)
{
string sql = $@"select PeriodId,SUM(CurrentPeriodMoney) as CurrentPeriodMoney from RB_Sell_Achievements_Details
string sql = $@"select PeriodId,SUM(CurrentPeriodMoney+PeopleNumMoney) as CurrentPeriodMoney from RB_Sell_Achievements_Details
WHERE School_Id ={schoolId} and PeriodId in ({periodsIds})
GROUP BY PeriodId ";
......@@ -290,7 +290,7 @@ GROUP BY PeriodId ";
}
string sql = $@" select sum(r.CurrentPeriodMoney + r.DeductionMoney) from RB_Sell_Achievements_Details r where {where}";
string sql = $@" select sum(r.CurrentPeriodMoney + r.DeductionMoney + r.PeopleNumMoney) from RB_Sell_Achievements_Details r where {where}";
var obj = ExecuteScalar(sql);
return obj == null ? 0 : Convert.ToDecimal(obj);
}
......
......@@ -171,7 +171,7 @@ GROUP BY g.RenewState";
public List<RB_Sell_Achievements_Emp_ViewModel> GetSellAchievementsRankStat(List<string> monthList, int group_Id)
{
string sql = $@"SELECT e.Type,e.EmpId,e.Rate,e.IsDept,p.Periods,SUM(e.PushMoney) as PushMoney,Max(e.SaleMoney) as SaleMoney,
SUM(e.OrderSaleMoney) as OrderSaleMoney,SUM(o.PreferPrice - o.DiscountMoney - e.OrderSaleMoney) as CommissionMoney
SUM(e.OrderSaleMoney) as OrderSaleMoney,SUM(o.PreferPrice - o.DiscountMoney - o.PlatformTax - o.CoursewareFee - o.TotalClassHours - e.OrderSaleMoney) as CommissionMoney
FROM rb_sell_achievements_emp e
INNER JOIN rb_sell_achievements_periods p on e.PeriodsId = p.Id
INNER JOIN rb_order o on e.OrderId = o.OrderId
......@@ -188,9 +188,9 @@ GROUP BY e.Type,e.EmpId,e.Rate,e.IsDept,p.Periods";
/// <returns></returns>
public List<RB_Sell_Achievements_Emp_ViewModel> GetAllRefundWaitPendingList(int group_Id)
{
string sql = $@"SELECT e.*,(o.Income + o.PlatformTax -o.Refund) as OrderMoney FROM rb_sell_achievements_emp e
string sql = $@"SELECT e.*,(o.Income - o.Refund - o.CoursewareFee - o.TotalClassHours) as OrderMoney,o.Refund FROM rb_sell_achievements_emp e
LEFT JOIN rb_order o on e.OrderId =o.OrderId
WHERE e.Group_Id={group_Id} and (e.Type=2 or (e.Type=1 and e.IsDept=1)) and e.OrderSaleMoney <> (o.Income + o.PlatformTax -o.Refund) and e.OrderId>0 and e.Remark not like '%退款回扣%'
WHERE e.Group_Id={group_Id} and o.CreateTime >='2023-10-01' and (e.Type=2 or (e.Type=1 and e.IsDept=1)) and e.OrderSaleMoney <> (o.Income - o.Refund - o.CoursewareFee - o.TotalClassHours) and e.OrderId>0 and e.Remark not like '%退款回扣%'
ORDER BY e.OrderId ASC ";
return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).ToList();
}
......
......@@ -265,7 +265,8 @@ namespace Edu.WebApi.Controllers.Course
x.UserId,
x.UserName,
x.StudentCount,
x.CurrentPeriodMoney
x.CurrentPeriodMoney,
x.PeopleNumMoney
}));
}
......@@ -313,7 +314,8 @@ namespace Edu.WebApi.Controllers.Course
x.DeductionMoney,
YFMoney = x.CurrentPeriodMoney + x.DeductionMoney,
x.UserType,
x.IsDept
x.IsDept,
x.PeopleNumMoney
}));
}
......@@ -360,7 +362,8 @@ namespace Edu.WebApi.Controllers.Course
x.DeductionMoney,
YFMoney = x.CurrentPeriodMoney + x.DeductionMoney,
x.UserType,
x.IsDept
x.IsDept,
x.PeopleNumMoney
}));
}
......@@ -408,7 +411,8 @@ namespace Edu.WebApi.Controllers.Course
x.DeductionMoney,
YFMoney = x.CurrentPeriodMoney + x.DeductionMoney,
x.UserType,
x.IsDept
x.IsDept,
x.PeopleNumMoney
})
};
return ApiResult.Success("", pageModel);
......@@ -448,6 +452,7 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: "当期应发") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "当期抵扣") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "最终发放") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "人头奖励") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "期数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "备注") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
}
......@@ -483,6 +488,7 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: (item.CurrentPeriodMoney).ToString("#0.00")){ },
new ExcelColumn(value: (item.DeductionMoney).ToString("#0.00")){ },
new ExcelColumn(value: (item.CurrentPeriodMoney + item.DeductionMoney).ToString("#0.00")){ },
new ExcelColumn(value: (item.PeopleNumMoney).ToString("#0.00")){ },
new ExcelColumn(value: item.Periods){ },
new ExcelColumn(value: item.Remark){ },
},
......@@ -513,9 +519,10 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: ""){ },
new ExcelColumn(value: ""){ },
new ExcelColumn(value: ""){ },
new ExcelColumn(value: list.Sum(x=>x.CurrentPeriodMoney + x.DeductionMoney).ToString("#0.00")){ },
new ExcelColumn(value: list.Sum(x=>x.PeopleNumMoney).ToString("#0.00")){ },
new ExcelColumn(value: TotalMoney.ToString("#0.00")){ },
new ExcelColumn(value: ""){ },
new ExcelColumn(value: ""){ },
},
ColumnHight = 30
};
......
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