Commit 1bfa60b4 authored by 黄奎's avatar 黄奎

页面修改

parent 708514ec
......@@ -50,11 +50,20 @@ namespace Edu.Module.Course
/// <summary>
/// 生成业绩
/// </summary>
public void CreateEmployeeBonusModule(int GroupId)
public void CreateEmployeeBonusModule(int GroupId,string startDate="")
{
DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
d1 = new DateTime(2021, 11, 1);
DateTime d1 = DateTime.Now;
if (!string.IsNullOrEmpty(startDate))
{
var tempDate = Convert.ToDateTime(startDate);
d1 = new DateTime(tempDate.Year, tempDate.Month, 1);
}
else
{
d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
}
DateTime endTime = d1.AddMonths(1).AddDays(-1);
int CurrentYear = endTime.Year;
int CurrentMonth = endTime.Month;
string endDate = Common.ConvertHelper.FormatDate(endTime);
......@@ -90,14 +99,17 @@ namespace Edu.Module.Course
var curNum = orderList?.Where(qitem => qitem.Year == CurrentYear && qitem.Month == CurrentMonth)?.Sum(qitem => qitem.GuestNum) ?? 0;
var curOrderMoney = orderList?.Where(qitem => qitem.Year == CurrentYear && qitem.Month == CurrentMonth)?.Sum(qitem => qitem.OrderMoney) ?? 0;
int DeductionNum = 0;
decimal DeductionMoney = 0;
//查询销售已发放的奖励
var saleBonusList = personnel_BonusRepository.GetPersonnelBonusListRepository(new RB_Personnel_Bonus_Extend()
{
EmployeeId = saleId,
RewardType=item.PlanType,
});
if (saleBonusList != null && saleBonusList.Count > 0)
{
//计算抵扣
foreach (var bItem in saleBonusList)
{
//查询此月份的订单列表
......@@ -123,9 +135,8 @@ namespace Edu.Module.Course
}
}
}
}
else
{
//新增当月的人头奖励
var pModel = new RB_Personnel_Bonus()
{
Id = 0,
......@@ -141,12 +152,14 @@ namespace Edu.Module.Course
CreateTime = DateTime.Now,
UpdateBy = 1,
UpdateTime = DateTime.Now,
DeductionNum= DeductionNum,
DeductionMoney= DeductionMoney,
};
pModel.IsReach = pModel.CurOrderMoney > item.MonthGoalMoney ? 1 : 0;
var newId = personnel_BonusRepository.Insert(pModel);
pModel.Id = newId;
foreach (var oItem in allOrderList)
foreach (var oItem in allOrderList.Where(qitem=>qitem.CreateTime.Year==CurrentYear&&qitem.CreateTime.Month==CurrentMonth))
{
var detailModel = new RB_Personnel_BonusDetail()
{
......@@ -161,7 +174,6 @@ namespace Edu.Module.Course
detailModel.Id = newDetailId;
}
}
}
/// <summary>
......
......@@ -1197,7 +1197,7 @@ WHERE 1=1
builder.AppendFormat(" AND o.PreferPrice = (o.Income - o.Refund + o.DiscountMoney + o.PlatformTax) ");
if (group_Id > 0)
{
builder.AppendFormat(" o.Group_Id ={0} ", group_Id);
builder.AppendFormat(" AND o.Group_Id ={0} ", group_Id);
}
if (!string.IsNullOrEmpty(eDate))
{
......
......@@ -59,7 +59,8 @@ namespace Edu.WebApi.Controllers.User
{
//new DutyPlanModule().TransVisitorToStu();
var userInfo = base.UserInfo;
employeeBonusModule.CreateEmployeeBonusModule(userInfo.Group_Id);
var startDate = base.ParmJObj.GetStringValue("StartDate");
employeeBonusModule.CreateEmployeeBonusModule(100000, startDate);
return ApiResult.Success();
}
......
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