Commit 7262b9b1 authored by 黄奎's avatar 黄奎

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

parents c9a2f25d 738b9c69
......@@ -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-已确认
......
......@@ -192,5 +192,15 @@ namespace Edu.Model.Entity.User
/// 老师特长
/// </summary>
public string Specialty { get; set; }
/// <summary>
/// 基础课时启用 1是
/// </summary>
public int BaseHoursEnabled { get; set; }
/// <summary>
/// 启用时间 (存到月)
/// </summary>
public string EnableTime { get; set; }
}
}
\ No newline at end of file
......@@ -122,6 +122,16 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public decimal BaseHourFee { get; set; }
/// <summary>
/// 是否启用基础课时 1是
/// </summary>
public int BaseHoursEnabled { get; set; }
/// <summary>
/// 启用时间 (存到月)
/// </summary>
public string EnableTime { get; set; }
/// <summary>
/// 班级课时分钟数
/// </summary>
......
......@@ -82,6 +82,16 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public decimal HourMoney { get; set; }
/// <summary>
/// 是否启用基础课时 1是
/// </summary>
public int BaseHoursEnabled { get; set; }
/// <summary>
/// 启用时间 (存到月)
/// </summary>
public string EnableTime { get; set; }
#endregion
}
}
\ No newline at end of file
......@@ -191,5 +191,15 @@ namespace Edu.Model.ViewModel.User
/// 基础课时费
/// </summary>
public decimal BaseHourFee { get; set; }
/// <summary>
/// 是否启用基础课时 1是
/// </summary>
public int BaseHoursEnabled { get; set; }
/// <summary>
/// 启用时间 (存到月)
/// </summary>
public string EnableTime { get; set; }
}
}
......@@ -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();
......@@ -607,11 +628,18 @@ namespace Edu.Module.Course
List<int> TeacherIdList = blist.Select(x => x.TeacherId).Distinct().ToList();
foreach (var item in TeacherIdList)
{
var teacherModel = teacherList.Where(x => x.TId == item).FirstOrDefault();
if (teacherModel == null) {
continue;
}
if (!(teacherModel.BaseHoursEnabled == 1 && Convert.ToDateTime(dmodel.Month) >= Convert.ToDateTime(teacherModel.EnableTime))){
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;
......
This diff is collapsed.
......@@ -295,6 +295,8 @@ namespace Edu.Module.User
fileds.Add(nameof(RB_Teacher_ViewModel.BaseStuNum), model.BaseStuNum);
fileds.Add(nameof(RB_Teacher_ViewModel.BaseHourFee), model.BaseHourFee);
fileds.Add(nameof(RB_Teacher_ViewModel.Specialty), model.Specialty);
fileds.Add(nameof(RB_Teacher_ViewModel.BaseHoursEnabled), model.BaseHoursEnabled);
fileds.Add(nameof(RB_Teacher_ViewModel.EnableTime), model.EnableTime);
#region 修改日志
string logContent = "";
if (model.TeacherName != oldModel.TeacherName)
......
......@@ -323,6 +323,10 @@ WHERE 1=1
builder.AppendFormat(" AND A.{0} LIKE @ClassName ", nameof(RB_Class_ViewModel.ClassName));
parameters.Add("ClassName", "%" + query.ClassName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.ClassNo))
{
builder.AppendFormat(" AND A.{0} ='{1}' ", nameof(RB_Class_ViewModel.ClassNo), query.ClassNo);
}
if (!string.IsNullOrWhiteSpace(query.CourseName))
{
builder.AppendFormat(" AND B.{0} LIKE @CourseName ", nameof(RB_Class_ViewModel.CourseName));
......
......@@ -398,7 +398,7 @@ GROUP BY tt.TeacherId,tt.OrderGuestId
}
string sql = $@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,c.ClassName,co.CourseName,p.ClassId,c.ClassType,c.ClassNo,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate FROM rb_class_check p
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,c.ClassName,co.CourseName,p.ClassId,c.ClassType,c.ClassNo,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
......@@ -436,7 +436,7 @@ ORDER BY p.ClassDate ASC
}
string sql = $@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,c.ClassName,co.CourseName,p.ClassId,c.ClassType,c.ClassNo,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate FROM rb_class_check p
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,c.ClassName,co.CourseName,p.ClassId,c.ClassType,c.ClassNo,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
......
......@@ -106,6 +106,10 @@ namespace Edu.Repository.Finance
{
where += string.Format(" AND A." + nameof(RB_Edu_RevenueReport_Extend.ClassId) + "=" + model.ClassId);
}
if (!string.IsNullOrEmpty(model.ClassNo))
{
where += string.Format(" AND A." + nameof(RB_Edu_RevenueReport_Extend.ClassNo) + " ='{0}'", model.ClassNo);
}
if (!string.IsNullOrEmpty(model.ClassName))
{
where += string.Format(" AND A." + nameof(RB_Edu_RevenueReport_Extend.ClassName) + " like '%{0}%'", model.ClassName);
......@@ -167,6 +171,10 @@ namespace Edu.Repository.Finance
{
where += string.Format(" AND A." + nameof(RB_Edu_RevenueReport_Extend.ClassId) + "=" + model.ClassId);
}
if (!string.IsNullOrEmpty(model.ClassNo))
{
where += string.Format(" AND A." + nameof(RB_Edu_RevenueReport_Extend.ClassNo) + " ='{0}'", model.ClassNo);
}
if (!string.IsNullOrEmpty(model.ClassName))
{
where += string.Format(" AND A." + nameof(RB_Edu_RevenueReport_Extend.ClassName) + " like '%{0}%'", model.ClassName);
......
......@@ -449,7 +449,7 @@ FROM
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT ar.AccountRemark,A.Id,A.Account,A.AccountId,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon,A.IDCard,A.Sex,A.Education,A.EntryTime,A.Address,A.BirthDate
,A.LeaveStatus,A.LeaveTime,A.EmployeeTel,A.AccountType,A.Email,A.BaseHourFee,IFNULL(A.DirectSupervisor,0) AS DirectSupervisor
,A.LeaveStatus,A.LeaveTime,A.EmployeeTel,A.AccountType,A.Email,A.BaseHourFee,A.BaseHoursEnabled,A.EnableTime,IFNULL(A.DirectSupervisor,0) AS DirectSupervisor
,IFNULL(G.GroupName,'') AS GroupName,IFNULL(s.SName,'') AS SchoolName
,IFNULL(d.DeptId,0) AS Dept_Id,IFNULL(d.DeptName,'') AS DeptName,IFNULL(p.PostId,0) AS Post_Id, IFNULL(p.PostName,'') AS PostName
,(CASE WHEN CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(BirthDate,'%m-%d')) >= DATE_FORMAT(now(),'%Y-%m-%d')
......@@ -463,7 +463,7 @@ FROM
,b.School_Id,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard
,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.MTel AS EmployeeTel,IFNULL(B.Email,'') AS Email
,0 as BaseHourFee
,0 as BaseHourFee,0 as BaseHoursEnabled,'' as EnableTime
FROM rb_manager AS B LEFT JOIN rb_account AS A ON A.AccountId=B.MId AND A.AccountType=1
WHERE 1=1 {0} {1}
UNION ALL
......@@ -472,7 +472,7 @@ FROM
,b.School_Id,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard
,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.TeacherTel AS EmployeeTel,IFNULL(B.Email,'') AS Email
,B.BaseHourFee
,B.BaseHourFee,B.BaseHoursEnabled,B.EnableTime
FROM rb_teacher AS B LEFT JOIN rb_account AS A ON A.AccountId=B.TId AND A.AccountType=2
WHERE 1=1 {0} {2}
UNION ALL
......@@ -481,7 +481,7 @@ FROM
,b.School_Id,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard
,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.AssistTel AS EmployeeTel,IFNULL(B.Email,'') AS Email
,0 as BaseHourFee
,0 as BaseHourFee,0 as BaseHoursEnabled,'' as EnableTime
FROM rb_assist AS B LEFT JOIN rb_account AS A ON A.AccountId=B.AId AND A.AccountType=3
WHERE 1=1 {0} {3}
) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId
......
......@@ -90,12 +90,6 @@ namespace Edu.WebApi.Controllers.Finance
PayReceive = (financeList != null && financeList.Any()) ? financeList.Where(x => x.Type == WFTempLateClassEnum.OUT).Sum(x => x.Money ?? 0) : 0;
PayActual = (financeList != null && financeList.Any()) ? financeList.Where(x => x.Type == WFTempLateClassEnum.OUT).Sum(x => x.PayMoney ?? 0) : 0;
//利润
decimal ProfitActual = 0;//实际利润
decimal ProfitNow = 0;//当前利润
ProfitActual = (IncomeActual + OtherIncomeActual) - PayReceive;
ProfitNow = (IncomeActual + OtherIncomeActual) - PayActual;
//提成
decimal SaleCommission = (orderList != null && orderList.Any()) ? orderList.Where(x => x.IsCommissionGive == 1).Sum(x => x.CommissionMoney + x.ExtraCommissionMoney) : 0;//销售提成
var teacherProfitList = teachingRewardsModule.GetBonusDetailList(new RB_Teaching_BonusDetail_ViewModel { Group_Id = base.UserInfo.Group_Id, ClassId = classId, School_Id = schoolId });
......@@ -103,7 +97,16 @@ namespace Edu.WebApi.Controllers.Finance
var meritsProfitList = teachingRewardsModule.GetTeachingPerfList(new RB_Teaching_Perf_ViewModel { Group_Id = base.UserInfo.Group_Id, ClassId = classId, School_Id = schoolId });
decimal MeritsProfit = (meritsProfitList != null && meritsProfitList.Any()) ? (meritsProfitList.Where(x => x.PerfState == Common.Enum.Course.PerfStateEnum.Confirmed).OrderByDescending(x => x.CreateTime).FirstOrDefault()?.Money ?? 0) : 0;//绩效提成
PayReceive += (SaleCommission + TeacherProfitNow + MeritsProfit);//支出加上提成的
PayActual += (SaleCommission + TeacherProfitNow + MeritsProfit);
//利润
decimal ProfitActual = 0;//实际利润
decimal ProfitNow = 0;//当前利润
ProfitActual = (IncomeActual + OtherIncomeActual) - PayReceive;
ProfitNow = (IncomeActual + OtherIncomeActual) - PayActual;
//项目信息
var projectInfo = new object();
if (classId > 0)
......@@ -212,12 +215,6 @@ namespace Edu.WebApi.Controllers.Finance
PayReceive = (financeList != null && financeList.Any()) ? financeList.Where(x => x.Type == WFTempLateClassEnum.OUT).Sum(x => x.Money ?? 0) : 0;
PayActual = (financeList != null && financeList.Any()) ? financeList.Where(x => x.Type == WFTempLateClassEnum.OUT).Sum(x => x.PayMoney ?? 0) : 0;
//利润
decimal ProfitActual = 0;//实际利润
decimal ProfitNow = 0;//当前利润
ProfitActual = (IncomeReceive + OtherIncomeReceive) - PayReceive;
ProfitNow = (IncomeActual + OtherIncomeActual) - PayActual;
//提成
decimal SaleCommission = (orderList != null && orderList.Any()) ? orderList.Where(x => x.IsCommissionGive == 1).Sum(x => x.CommissionMoney) : 0; ;//销售提成
var teacherProfitList = teachingRewardsModule.GetBonusDetailList(new RB_Teaching_BonusDetail_ViewModel { Group_Id = base.UserInfo.Group_Id, ClassId = classId, School_Id = schoolId });
......@@ -226,6 +223,15 @@ namespace Edu.WebApi.Controllers.Finance
var meritsProfitList = teachingRewardsModule.GetTeachingPerfList(new RB_Teaching_Perf_ViewModel { Group_Id = base.UserInfo.Group_Id, ClassId = classId, School_Id = schoolId });
decimal MeritsProfit = (meritsProfitList != null && meritsProfitList.Any()) ? (meritsProfitList.OrderByDescending(x => x.CreateTime).FirstOrDefault()?.Money ?? 0) : 0;//绩效提成
PayReceive += (SaleCommission + TeacherProfitNow + MeritsProfit);//支出加上
PayActual += (SaleCommission + TeacherProfitNow + MeritsProfit);
//利润
decimal ProfitActual = 0;//实际利润
decimal ProfitNow = 0;//当前利润
ProfitActual = (IncomeReceive + OtherIncomeReceive) - PayReceive;
ProfitNow = (IncomeActual + OtherIncomeActual) - PayActual;
string title = "班级情况";
string subtitle = "班级名称";
string thirdTitle = "课程名称:";
......@@ -1308,7 +1314,7 @@ namespace Edu.WebApi.Controllers.Finance
new ExcelColumn(value: item.StudentName){ },
new ExcelColumn(value: item.CreateByName){ },
new ExcelColumn(value: item.TotalClassHours.ToString()){ },
new ExcelColumn(value: Math.Round(item.TotalCourseFee / item.TotalClassHours, 2, MidpointRounding.AwayFromZero).ToString()){ },
new ExcelColumn(value: (item.TotalClassHours > 0 ? Math.Round(item.TotalCourseFee / item.TotalClassHours, 2, MidpointRounding.AwayFromZero) : 0).ToString()){ },
new ExcelColumn(value: item.TotalCourseFee.ToString()){ },
new ExcelColumn(value: item.TotalBookFee.ToString()){ },
new ExcelColumn(value: item.TotalClassFee.ToString()){ },
......@@ -1983,6 +1989,37 @@ namespace Edu.WebApi.Controllers.Finance
return ApiResult.Success("", list);
}
/// <summary>
/// 获取班级月度分摊统计
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAllClassNowMonthStatistics() {
var userInfo = base.UserInfo;
string StartTime = base.ParmJObj.GetStringValue("StartTime");//开始时间
string EndTime = base.ParmJObj.GetStringValue("EndTime");//结束时间
if (string.IsNullOrEmpty(StartTime))
{
return ApiResult.ParamIsNull();
}
if (string.IsNullOrEmpty(EndTime))
{
return ApiResult.ParamIsNull();
}
try
{
StartTime = Convert.ToDateTime(StartTime).ToString("yyyy-MM-dd");
EndTime = Convert.ToDateTime(EndTime).ToString("yyyy-MM-dd");
}
catch (Exception)
{
return ApiResult.Failed("日期格式有误,请核实后再试");
}
var Robj = financeModule.GetAllClassNowMonthStatistics(StartTime, EndTime, userInfo);
return ApiResult.Success("", Robj);
}
#endregion
}
}
......@@ -404,7 +404,9 @@ namespace Edu.WebApi.Controllers.User
BaseStuNum = base.ParmJObj.GetInt("BaseStuNum"),
BaseHourFee = base.ParmJObj.GetDecimal("BaseHourFee"),
AuditStatus = AccountStatusEnum.Pass,
Specialty=base.ParmJObj.GetStringValue("Specialty"),
Specialty = base.ParmJObj.GetStringValue("Specialty"),
BaseHoursEnabled = base.ParmJObj.GetInt("BaseHoursEnabled", 0),
EnableTime = base.ParmJObj.GetStringValue("EnableTime")
};
extModel.TeachTag = base.ParmJObj.GetStringValue("TeachTag");
extModel.CreateBy = base.UserInfo.Id;
......
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