Commit 738b9c69 authored by liudong1993's avatar liudong1993

班级月度课耗统计

parent 8f7f868c
......@@ -3230,10 +3230,8 @@ namespace Edu.Module.Finance
{
int Minutes = (int)(Convert.ToDateTime("2021-06-29 " + item.EndDate) - Convert.ToDateTime("2021-06-29 " + item.StartDate)).TotalMinutes;
decimal Hours = Math.Round(Convert.ToDecimal(Minutes) / 60, 2, MidpointRounding.AwayFromZero);//小时
//上课课时
decimal ClassHourMinute = configModel.BasicMinutes;//课时分钟数
if (item.ClassHourMinute > 0) { ClassHourMinute = item.ClassHourMinute; }
decimal KSNum = Math.Round(Convert.ToDecimal(Minutes) / ClassHourMinute, 2, MidpointRounding.AwayFromZero); // 未达到一课时时间 算不算一课时
//上课课时
decimal KSNum = item.CurrentDeductionHours;//签到课时长度
var typeModel = cTypeList.Where(x => x.CTypeId == item.ClassType).FirstOrDefault();
......@@ -3241,6 +3239,8 @@ namespace Edu.Module.Finance
//课时费 需要每个班级 单独计算 因为 班级有附加费用
decimal KSMoney = KSNum * unitPrice;
decimal ClassHourMinute = configModel.BasicMinutes;//课时分钟数
if (item.ClassHourMinute > 0) { ClassHourMinute = item.ClassHourMinute; }
decimal HourMoney = Math.Round(unitPrice / ClassHourMinute * 60, 2, MidpointRounding.AwayFromZero);//每小时课时费
......@@ -3259,7 +3259,9 @@ namespace Edu.Module.Finance
Hours = Hours,
HourMoney = HourMoney,
UnitPrice = unitPrice,
Money = KSMoney
Money = KSMoney,
BaseHoursEnabled = item.BaseHoursEnabled,
EnableTime = item.EnableTime
});
}
......@@ -3268,10 +3270,10 @@ namespace Edu.Module.Finance
while (true)
{
DateTime ETime = STime.AddMonths(1).AddDays(-1);
var mlist = TeacherHoursList.Where(x => x.Date >= STime && x.Date <= ETime).ToList();
var mlist = TeacherHoursList.Where(x => x.Date >= STime && x.Date <= ETime && x.BaseHoursEnabled == 1 && STime >= Convert.ToDateTime(x.EnableTime)).ToList();
#region 基础课时处理
decimal DeductionMoney = 0;
if (configModel.BasicHours > 0)
if (configModel.BasicHours > 0 && mlist.Any())
{
//遍历所有老师
List<int> TeacherIdList = mlist.Select(x => x.TeacherId).Distinct().ToList();
......@@ -3414,6 +3416,18 @@ namespace Edu.Module.Finance
return RList;
}
/// <summary>
/// 获取班级月度分摊统计
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetAllClassNowMonthStatistics(string startTime, string endTime, UserInfo userInfo)
{
return null;
}
#endregion
}
}
......@@ -476,7 +476,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,Max(p.CurrentDeductionHours) as CurrentDeductionHours 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
......
......@@ -1989,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
}
}
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