Commit d5e8dcc1 authored by 黄奎's avatar 黄奎

页面修改

parent ba059653
...@@ -23,13 +23,23 @@ namespace Edu.Model.Entity.Bonus ...@@ -23,13 +23,23 @@ namespace Edu.Model.Entity.Bonus
public int BonusId { get; set; } public int BonusId { get; set; }
/// <summary> /// <summary>
/// 订单人数 /// 抵扣金额
/// </summary> /// </summary>
public int OrderGuestNum { get; set; } public decimal DeductionMoney { get; set; }
/// <summary> /// <summary>
/// 订单金额 /// 创建人
/// </summary> /// </summary>
public decimal OrderMoney { get; set; } public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 抵扣内容
/// </summary>
public string DeductionContent { get; set; }
} }
} }
...@@ -121,17 +121,17 @@ namespace Edu.Module.Course ...@@ -121,17 +121,17 @@ namespace Edu.Module.Course
Dictionary<string, object> detailFileds = new Dictionary<string, object>(); Dictionary<string, object> detailFileds = new Dictionary<string, object>();
detailFileds.Clear(); detailFileds.Clear();
var tempCurMonthOrder = orderModel; var tempCurMonthOrder = orderModel;
if (dItem.OrderState != (tempCurMonthOrder?.OrderState)) if (dItem.OrderId==orderModel.OrderId)
{ {
var newMoney = tempCurMonthOrder.Income - tempCurMonthOrder.Refund - tempCurMonthOrder.PlatformTax; var newMoney = tempCurMonthOrder.Income - tempCurMonthOrder.Refund - tempCurMonthOrder.PlatformTax;
dItem.OrderGuestNum = 0;
dItem.OrderMoney = newMoney;
detailFileds.Add(nameof(RB_Personnel_BonusDetail_Extend.OrderGuestNum), 0); detailFileds.Add(nameof(RB_Personnel_BonusDetail_Extend.OrderGuestNum), 0);
detailFileds.Add(nameof(RB_Personnel_BonusDetail_Extend.OrderMoney), newMoney); detailFileds.Add(nameof(RB_Personnel_BonusDetail_Extend.OrderMoney), newMoney);
string _log1 = $"订单号【{dItem.OrderId}】的订单状态由:{dItem.OrderState.ToName()}=>{tempCurMonthOrder?.OrderState.ToName()}" + string _log1 = $"订单号【{dItem.OrderId}】的订单状态由:{dItem.OrderState.ToName()}=>{tempCurMonthOrder?.OrderState.ToName()}" +
$"订单人数由:{dItem.OrderGuestNum}=>0,订单金额由:{dItem.OrderMoney}=>{newMoney}" $"订单人数由:{dItem.OrderGuestNum}=>0,订单金额由:{dItem.OrderMoney}=>{newMoney}"
; ;
personnel_BonusLogRepository.AddPersonnelBonusLogRepository(sItem.Id, 1, dItem.OrderId, _log1); personnel_BonusLogRepository.AddPersonnelBonusLogRepository(sItem.Id, 1, dItem.OrderId, _log1);
dItem.OrderGuestNum = 0;
dItem.OrderMoney = newMoney;
} }
if (detailFileds != null && detailFileds.Count > 0) if (detailFileds != null && detailFileds.Count > 0)
{ {
...@@ -143,7 +143,7 @@ namespace Edu.Module.Course ...@@ -143,7 +143,7 @@ namespace Edu.Module.Course
var curRewardMoney = GetStepAwardAmount(planModel, sumNum); var curRewardMoney = GetStepAwardAmount(planModel, sumNum);
deductionMoney = sItem.CurRewardMoney - curRewardMoney; deductionMoney = sItem.CurRewardMoney - curRewardMoney;
//修改已发放 //修改已发放
string _bonusLog = $"订单号变更::{sItem.CurGuestNum}=>{sumNum},订单完成金额由:{sItem.CurOrderMoney}=>{sumOrderMoney}" string _bonusLog = $"订单号变更:完成人数:{sItem.CurGuestNum}=>{sumNum},订单完成金额由:{sItem.CurOrderMoney}=>{sumOrderMoney}"
+ $"奖励金额由:{sItem.CurRewardMoney}=>{curRewardMoney}" + $"奖励金额由:{sItem.CurRewardMoney}=>{curRewardMoney}"
; ;
Dictionary<string, object> bonusFileds = new Dictionary<string, object>() Dictionary<string, object> bonusFileds = new Dictionary<string, object>()
...@@ -180,6 +180,7 @@ namespace Edu.Module.Course ...@@ -180,6 +180,7 @@ namespace Edu.Module.Course
PlanType=item.PlanType, PlanType=item.PlanType,
IsNoBalance=1, IsNoBalance=1,
}); });
//计算差额
var chaE = saleBonusList?.Sum(qitem => qitem.DeductionMoney - qitem.FinishDeductionMoney) ?? 0; var chaE = saleBonusList?.Sum(qitem => qitem.DeductionMoney - qitem.FinishDeductionMoney) ?? 0;
decimal DeductionMoney = 0; decimal DeductionMoney = 0;
...@@ -219,8 +220,50 @@ namespace Edu.Module.Course ...@@ -219,8 +220,50 @@ namespace Edu.Module.Course
} }
//写抵扣记录表信息 //写抵扣记录表信息
if (pModel.BeforeMoney > 0) if (pModel.BeforeMoney > 0)
{ {
decimal tempChaE = chaE;
foreach (var sItem in saleBonusList)
{
if (tempChaE > 0)
{
if (sItem.DeductionMoney <= tempChaE)
{
var deductionModel = new RB_Personnel_Deduction()
{
BonusId = sItem.Id,
CreateBy = 1,
CreateTime = DateTime.Now,
DeductionMoney = sItem.DeductionMoney,
DeductionContent = "抵扣" + sItem.YearNum + "年" + sItem.MonthNum + "月的待抵扣金额" + sItem.DeductionMoney,
};
personnel_DeductionRepository.Insert(deductionModel);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Personnel_Bonus_Extend.FinishDeductionMoney),(sItem?.FinishDeductionMoney??0)+sItem.DeductionMoney }
};
personnel_BonusRepository.Update(fileds, new WhereHelper(nameof(RB_Personnel_Bonus_Extend.Id), sItem.Id));
tempChaE -= sItem.DeductionMoney;
}
else
{
var deductionModel = new RB_Personnel_Deduction()
{
BonusId = sItem.Id,
CreateBy = 1,
CreateTime = DateTime.Now,
DeductionMoney= tempChaE,
DeductionContent = "抵扣" + sItem.YearNum + "年" + sItem.MonthNum + "月的待抵扣金额" + tempChaE,
};
personnel_DeductionRepository.Insert(deductionModel);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Personnel_Bonus_Extend.FinishDeductionMoney),(sItem?.FinishDeductionMoney??0)+tempChaE }
};
personnel_BonusRepository.Update(fileds, new WhereHelper(nameof(RB_Personnel_Bonus_Extend.Id), sItem.Id));
tempChaE = 0;
}
}
}
} }
var newId = personnel_BonusRepository.Insert(pModel); var newId = personnel_BonusRepository.Insert(pModel);
pModel.Id = newId; pModel.Id = newId;
......
...@@ -52,7 +52,7 @@ namespace Edu.Repository.Sell ...@@ -52,7 +52,7 @@ namespace Edu.Repository.Sell
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.CourseId)} ={demodel.CourseId}"; where += $@" and o.{nameof(RB_Order_ViewModel.CourseId)} ={demodel.CourseId}";
} }
if (!string.IsNullOrEmpty(demodel.ClassIds)) if (!string.IsNullOrEmpty(demodel.ClassIds))
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.ClassId)} in({demodel.ClassIds})"; where += $@" and o.{nameof(RB_Order_ViewModel.ClassId)} in({demodel.ClassIds})";
} }
...@@ -99,7 +99,7 @@ namespace Edu.Repository.Sell ...@@ -99,7 +99,7 @@ namespace Edu.Repository.Sell
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.LXConfirmDate)} <='{demodel.ConfirmETime} 23:59:59'"; where += $@" and o.{nameof(RB_Order_ViewModel.LXConfirmDate)} <='{demodel.ConfirmETime} 23:59:59'";
} }
if (demodel.JoinType == OrderJoinTypeEnum.InsertClass ) if (demodel.JoinType == OrderJoinTypeEnum.InsertClass)
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.JoinType)} ={(int)OrderJoinTypeEnum.InsertClass}"; where += $@" and o.{nameof(RB_Order_ViewModel.JoinType)} ={(int)OrderJoinTypeEnum.InsertClass}";
} }
...@@ -148,7 +148,7 @@ ORDER BY {orderBy} ...@@ -148,7 +148,7 @@ ORDER BY {orderBy}
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.OrderType)} ={(int)OrderTypeEnum.CourseOrder} "; where += $@" and o.{nameof(RB_Order_ViewModel.OrderType)} ={(int)OrderTypeEnum.CourseOrder} ";
} }
if (demodel.Group_Id > 0) if (demodel.Group_Id > 0)
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.Group_Id)} ={demodel.Group_Id}"; where += $@" and o.{nameof(RB_Order_ViewModel.Group_Id)} ={demodel.Group_Id}";
...@@ -627,7 +627,7 @@ GROUP BY ClassId;"; ...@@ -627,7 +627,7 @@ GROUP BY ClassId;";
/// <param name="courseModel"></param> /// <param name="courseModel"></param>
/// <param name="FinishHours"></param> /// <param name="FinishHours"></param>
/// <returns></returns> /// <returns></returns>
public decimal CalcBackMoneyRepository(RB_Order orderModel,RB_Course courseModel,decimal FinishHours,out decimal newClassHourPrice) public decimal CalcBackMoneyRepository(RB_Order orderModel, RB_Course courseModel, decimal FinishHours, out decimal newClassHourPrice)
{ {
newClassHourPrice = 0; newClassHourPrice = 0;
//课时单价 //课时单价
...@@ -641,7 +641,7 @@ GROUP BY ClassId;"; ...@@ -641,7 +641,7 @@ GROUP BY ClassId;";
decimal backMoney = 0; decimal backMoney = 0;
//违约金 //违约金
decimal breakContractPrice = (courseModel.ClassHours - FinishHours) * classHourPrice * Convert.ToDecimal(0.1); decimal breakContractPrice = (courseModel.ClassHours - FinishHours) * classHourPrice * Convert.ToDecimal(0.1);
backMoney = (orderModel.Income + orderModel.PlatformTax-orderModel.Refund) / orderModel.GuestNum - FinishHours * classHourPrice - breakContractPrice; backMoney = (orderModel.Income + orderModel.PlatformTax - orderModel.Refund) / orderModel.GuestNum - FinishHours * classHourPrice - breakContractPrice;
return backMoney; return backMoney;
} }
...@@ -653,7 +653,7 @@ GROUP BY ClassId;"; ...@@ -653,7 +653,7 @@ GROUP BY ClassId;";
/// <param name="eDate">开班时间</param> /// <param name="eDate">开班时间</param>
/// <param name="courseIds">内部班课程</param> /// <param name="courseIds">内部班课程</param>
/// <returns></returns> /// <returns></returns>
public List<RB_Order_ViewModel> GetAllMoneyCollectedOrderList(int group_Id, string eDate,string courseIds, string enableDate) public List<RB_Order_ViewModel> GetAllMoneyCollectedOrderList(int group_Id, string eDate, string courseIds, string enableDate)
{ {
string where = ""; string where = "";
if (!string.IsNullOrEmpty(courseIds)) if (!string.IsNullOrEmpty(courseIds))
...@@ -711,10 +711,12 @@ and LXConfirmState =1 and IFNULL(CommissionMoney,0) = -1 and LXConfirmDate <='{e ...@@ -711,10 +711,12 @@ and LXConfirmState =1 and IFNULL(CommissionMoney,0) = -1 and LXConfirmDate <='{e
public List<RB_Order_ViewModel> GetSaleAchievementsRankStatistics(int pageIndex, int pageSize, out long count, int saleId, int schoolId, string startMonth, string endMonth, int group_Id) public List<RB_Order_ViewModel> GetSaleAchievementsRankStatistics(int pageIndex, int pageSize, out long count, int saleId, int schoolId, string startMonth, string endMonth, int group_Id)
{ {
string where = ""; string where = "";
if (saleId > 0) { if (saleId > 0)
{
where += $@" and o.EnterID ={saleId}"; where += $@" and o.EnterID ={saleId}";
} }
if (schoolId >= 0) { if (schoolId >= 0)
{
where += $@" and o.School_Id ={schoolId}"; where += $@" and o.School_Id ={schoolId}";
} }
...@@ -984,7 +986,7 @@ left join rb_teacher t on c.Teacher_Id = t.TId ...@@ -984,7 +986,7 @@ left join rb_teacher t on c.Teacher_Id = t.TId
LEFT JOIN rb_course AS course ON (o.CourseId=course.CourseId AND o.CourseId>0 AND o.OrderType=1) LEFT JOIN rb_course AS course ON (o.CourseId=course.CourseId AND o.CourseId>0 AND o.OrderType=1)
where {where} order by {orderBy} where {where} order by {orderBy}
"; ";
return Get<RB_Order_ViewModel>( sql).ToList(); return Get<RB_Order_ViewModel>(sql).ToList();
} }
#endregion #endregion
...@@ -1074,7 +1076,7 @@ where {where} order by {orderBy} ...@@ -1074,7 +1076,7 @@ where {where} order by {orderBy}
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.LXConfirmDate)} <='{demodel.ConfirmETime} 23:59:59'"; where += $@" and o.{nameof(RB_Order_ViewModel.LXConfirmDate)} <='{demodel.ConfirmETime} 23:59:59'";
} }
if (demodel.JoinType == OrderJoinTypeEnum.InsertClass) if (demodel.JoinType == OrderJoinTypeEnum.InsertClass)
{ {
where += $@" and o.{nameof(RB_Order_ViewModel.JoinType)} ={(int)OrderJoinTypeEnum.InsertClass}"; where += $@" and o.{nameof(RB_Order_ViewModel.JoinType)} ={(int)OrderJoinTypeEnum.InsertClass}";
} }
...@@ -1181,8 +1183,10 @@ group by o.OrderId ...@@ -1181,8 +1183,10 @@ group by o.OrderId
/// </summary> /// </summary>
/// <param name="group_Id">集团编号</param> /// <param name="group_Id">集团编号</param>
/// <param name="eDate">结束日期</param> /// <param name="eDate">结束日期</param>
/// <param name="PlanType">1-市场人员,2-课程顾问</param>
/// <param name="SaleId">员工编号</param>
/// <returns></returns> /// <returns></returns>
public List<RB_Order_ViewModel> GetAllBonusOrderListRepository(int group_Id, string eDate,int PlanType,int SaleId) public List<RB_Order_ViewModel> GetAllBonusOrderListRepository(int group_Id, string eDate, int PlanType, int SaleId)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
...@@ -1206,7 +1210,16 @@ WHERE 1=1 ...@@ -1206,7 +1210,16 @@ WHERE 1=1
} }
if (SaleId > 0) if (SaleId > 0)
{ {
builder.AppendFormat(" AND ( EnterID={0} OR CreateBy={0} ) ", SaleId); //市场人员
if (PlanType == 1)
{
builder.AppendFormat(" AND (EnterID={0}) ", SaleId);
}
//课程顾问
else
{
builder.AppendFormat(" AND (CourseConsultantId={0}) ", SaleId);
}
} }
builder.AppendFormat(" ORDER BY o.CreateTime ASC "); builder.AppendFormat(" ORDER BY o.CreateTime ASC ");
return Get<RB_Order_ViewModel>(builder.ToString()).ToList(); return Get<RB_Order_ViewModel>(builder.ToString()).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