Commit bcceca2f authored by liudong1993's avatar liudong1993

老师课时发放 调整

parent 80483690
......@@ -45,7 +45,7 @@ namespace Edu.Model.Entity.Course
/// <summary>
/// 课时
/// </summary>
public int CourseHour { get; set; }
public decimal CourseHour { get; set; }
/// <summary>
/// 课时费
......@@ -101,7 +101,7 @@ namespace Edu.Model.Entity.Course
/// <summary>
/// 抵基础课时
/// </summary>
public int DeductionHour { get; set; }
public decimal DeductionHour { get; set; }
/// <summary>
/// 提成确认状态0-未确认,1-已确认
......
......@@ -503,15 +503,13 @@ namespace Edu.Module.Course
string EndTime = Convert.ToDateTime(dmodel.Month + "-01").AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
var plist = class_PlanRepository.GetClassPlanList_V2(new RB_Class_Plan_ViewModel() { Group_Id = userInfo.Group_Id, Q_TeacherIds = dmodel.TeacherIds, StartTime = StartTime, EndTime = EndTime });
//查询所有课程的上课时间
List<RB_Class_Time_ViewModel> timeList = new List<RB_Class_Time_ViewModel>();
List<RB_Class_Type_ViewModel> typeList = new List<RB_Class_Type_ViewModel>();
List<RB_Class_Check_ViewModel> checkList = new List<RB_Class_Check_ViewModel>();
List<RB_Teacher_ViewModel> teacherList = new List<RB_Teacher_ViewModel>();
List<RB_Teaching_BonusDetail_ViewModel> DateList = new List<RB_Teaching_BonusDetail_ViewModel>();
if (plist.Any())
{
string pids = string.Join(",", plist.Select(x => x.ClassPlanId));
timeList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = pids });
string classTypeIds = string.Join(",", plist.Select(x => x.ClassType).Distinct());
typeList = class_TypeRepository.GetClassTypeListRepository(new RB_Class_Type_ViewModel() { Group_Id = userInfo.Group_Id, Q_CTypeIds = classTypeIds });
//查询签到数据
......@@ -520,6 +518,38 @@ namespace Edu.Module.Course
//查询教师列表
string teacherIds = string.Join(",", plist.Select(x => x.TeacherId).Distinct());
teacherList = teacherRepository.GetTeacherListRepository(new RB_Teacher_ViewModel() { QTIds = teacherIds });
//根据学生签到表 查询
var list = class_CheckRepository.GetTeacherConsumptionHoursDetialList(teacherIds, -1, 0, StartTime, EndTime, userInfo.Group_Id);
if (list.Any())
{
foreach (var item in list)
{
//上课课时
decimal KSNum = item.CurrentDeductionHours;//使用签到表的课时
var typeModel = typeList.Where(x => x.CTypeId == item.ClassType).FirstOrDefault();
decimal unitPrice = configModel.BasicHourFee + (typeModel?.AddHourFee ?? 0) + (item?.BaseHourFee ?? 0);
//课时费 需要每个班级 单独计算 因为 班级有附加费用
decimal KSMoney = KSNum * unitPrice;
DateList.Add(new RB_Teaching_BonusDetail_ViewModel
{
Date = item.ClassDate,
TimeBucket = item.StartDate + "~" + item.EndDate,
TeacherId = item.TeacherId,
TeacherName = item.TeacherName,
ClassId = item.ClassId,
ClassName = item.ClassName,
CouseId = item.CouseId,
CourseName = item.CourseName,
KSNum = KSNum,
UnitPrice = unitPrice,
Money = KSMoney
});
}
}
}
var trans = teaching_BonusDetailRepository.DbTransaction;
try
......@@ -527,18 +557,9 @@ namespace Edu.Module.Course
decimal TotalMoney = 0;
foreach (var item in plist)
{
var dateqList = DateList.Where(x => x.TeacherId == item.TeacherId && x.Date == item.ClassDate).ToList();
//查询课时
var ctimelist = timeList.Where(x => x.ClassPlanId == item.ClassPlanId).ToList();
int minute = 0;
string nowTime = DateTime.Now.ToString("yyyy-MM-dd");
foreach (var qitem in ctimelist)
{
var ts = Convert.ToDateTime(nowTime + " " + qitem.EndTime) - Convert.ToDateTime(nowTime + " " + qitem.StartTime);
minute += (int)ts.TotalMinutes;
}
int ClassHourMinute = configModel.BasicMinutes;//课时分钟数
if (item.ClassHourMinute > 0) { ClassHourMinute = item.ClassHourMinute; }
int ksNum = minute / ClassHourMinute; // 未达到一课时时间 算不算一课时
decimal ksNum = dateqList.Sum(x => x.KSNum);
//查询课单价
var typeModel = typeList.Where(x => x.CTypeId == item.ClassType).FirstOrDefault();
var teacherModel = teacherList.Where(x => x.TId == item.TeacherId).FirstOrDefault();
......@@ -615,10 +636,10 @@ namespace Edu.Module.Course
continue;
}
var qblist = blist.Where(x => x.TeacherId == item).OrderBy(x => x.Date).ThenBy(x => x.UnitPrice).ToList();
int BasicHours = configModel.BasicHours;
decimal BasicHours = configModel.BasicHours;
foreach (var qitem in qblist)
{
int CourseHour = 0, DeductionHour = 0;
decimal CourseHour = 0, DeductionHour = 0;
if (BasicHours > qitem.CourseHour)
{
DeductionHour = qitem.CourseHour;
......
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