Commit 803ba604 authored by liudong1993's avatar liudong1993

教育报表

parent 958d8830
......@@ -53,6 +53,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public int CheckNum { get; set; }
/// <summary>
/// 合同课时单价
/// </summary>
public decimal UnitPrice { get; set; }
/// <summary>
/// 订单id
/// </summary>
......@@ -92,11 +97,41 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 班级类型
/// </summary>
public int ClassType { get; set; }
/// <summary>
/// 课程id
/// </summary>
public int CouseId { get; set; }
/// <summary>
/// 课程名称
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 教师增加课时费
/// </summary>
public decimal BaseHourFee { get; set; }
/// <summary>
/// 合同编号
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 业务人员
/// </summary>
public int EnterID { get; set; }
/// <summary>
/// 相关老师
/// </summary>
public int HelpEnterId { get; set; }
/// <summary>
/// 教室名称
/// </summary>
......
......@@ -30,6 +30,31 @@ namespace Edu.Model.ViewModel.Course
#region 统计相关
/// <summary>
/// 下单开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 下单结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 消费课时开始时间
/// </summary>
public string XFStartTime { get; set; }
/// <summary>
/// 消费课时结束时间
/// </summary>
public string XFEndTime { get; set; }
/// <summary>
/// 业务员id
/// </summary>
public int SaleId { get; set; }
/// <summary>
/// 班级名称
/// </summary>
......
......@@ -49,6 +49,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public string GuestName { get; set; }
/// <summary>
/// 业务员名称
/// </summary>
public string EnterName { get; set; }
/// <summary>
/// 订单查询状态 1正常 2取消
/// </summary>
......@@ -122,6 +127,16 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public int CancelNum { get; set; }
/// <summary>
/// 结课数量
/// </summary>
public int JKNum { get; set; }
/// <summary>
/// 已上课金额(学生)
/// </summary>
public decimal YSKMoney { get; set; }
/// <summary>
/// 留学就业产品名称
/// </summary>
......
......@@ -97,6 +97,21 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public string EndBirthDate { get; set; }
/// <summary>
/// 老师消耗课时统计 1是
/// </summary>
public int IsHoursStatistics { get; set; }
/// <summary>
/// 课时消费 开始时间
/// </summary>
public string HoursStartTime { get; set; }
/// <summary>
/// 课时消费 结束时间
/// </summary>
public string HoursEndTime { get; set; }
/// <summary>
/// 部门层级
/// </summary>
......@@ -171,5 +186,10 @@ namespace Edu.Model.ViewModel.User
/// 直接主管ids
/// </summary>
public string DirectSupervisorIds { get; set; }
/// <summary>
/// 基础课时费
/// </summary>
public decimal BaseHourFee { get; set; }
}
}
......@@ -2282,7 +2282,7 @@ namespace Edu.Module.Course
}
}
//查询所有学生的已上课时间
var stuTimeList = class_CheckRepository.GetClassGuestStudentTimeList(dmodel.Group_Id, guestIds);
var stuTimeList = class_CheckRepository.GetClassGuestStudentTimeList(dmodel.Group_Id, guestIds, dmodel.XFStartTime, dmodel.XFEndTime);
//查询基础课时时长
//var configModel = class_ConfigRepository.GetClassConfigRepository(new RB_Class_Config_ViewModel() { Group_Id = dmodel.Group_Id });
//用户信息
......
This diff is collapsed.
......@@ -224,6 +224,19 @@ namespace Edu.Repository.Course
{
where += $@" AND t.AccountId ={demodel.AccountId}";
}
if (demodel.SaleId > 0)
{
where += $@" AND o.EnterID ={demodel.SaleId}";
}
if (!string.IsNullOrEmpty(demodel.StartTime))
{
where += $@" AND o.CreateTime >={demodel.StartTime}";
}
if (!string.IsNullOrEmpty(demodel.EndTime))
{
where += $@" AND o.CreateTime <={demodel.EndTime} 23:59:59";
}
string sql = $@" SELECT c.*,c1.ClassName,ca.AdjustPrice FROM RB_Education_Contract c
left join RB_Education_ContractAdjust ca on c.Id = ca.ContractId
left join rb_order o on c.OrderId = o.OrderId
......
......@@ -581,6 +581,108 @@ WHERE o.Group_Id ={group_Id} and o.OrderState =1 and o.EffectStatus in(1,2) and
var obj = ExecuteScalar(sql);
return obj != null ? Convert.ToInt32(obj) : 0;
}
#endregion
#region 销售业绩统计
/// <summary>
/// 销售业绩统计
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="saleId"></param>
/// <param name="schoolId"></param>
/// <param name="startMonth"></param>
/// <param name="endMonth"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
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 = "";
if (saleId > 0) {
where += $@" and o.EnterID ={saleId}";
}
if (schoolId >= 0) {
where += $@" and o.School_Id ={schoolId}";
}
string sql = $@"SELECT o.EnterID,SUM(o.PreferPrice) as PreferPrice,SUM(o.Income) AS Income,sum(o.PlatformTax) as PlatformTax,SUM(o.Refund) AS Refund,SUM(o.GuestNum) AS GuestNum,
SUM(CASE WHEN c.ClassStatus =3 then o.GuestNum else 0 END) AS JKNum,COUNT(0) AS CancelNum, SUM(IFNULL(ttt.XFMoney,0)) AS YSKMoney
FROM rb_order o
LEFT JOIN rb_class c on o.ClassId = c.ClassId
LEFT JOIN (SELECT q.OrderId,
SUM((case when q.ClassHours>0 and q.TotalSub >0 then
(q.CourseFee - q.DiscountMoney / q.TotalSub * q.CourseFee) /q.ClassHours
else 0 END) * IFNULL(q.CurrentDeductionHours,0)) AS XFMoney
FROM(
SELECT g.Id,g.OrderId
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee
+ec.FirstBookFee + ec.SecondBookFee + ec.ThirdBookFee
+ec.FirstClassFee + ec.SecondClassFee + ec.ThirdClassFee as TotalSub
,ec.FirstClassHours + ec.SecondClassHours + ec.ThirdClassHours as ClassHours
,cc.CurrentDeductionHours
FROM rb_order_guest g
INNER JOIN rb_education_contract ec on g.Id = ec.GuestId
LEFT JOIN (SELECT ch.OrderGuestId, SUM(ch.CurrentDeductionHours) AS CurrentDeductionHours FROM rb_class_check ch WHERE `Status` =0 GROUP BY ch.OrderGuestId) cc on cc.OrderGuestId = g.Id
)q GROUP BY q.OrderId) ttt on ttt.OrderId = o.OrderId
WHERE o.Group_Id={group_Id} and o.OrderState <> 3 and o.EnterID >0 {where} and o.CreateTime >='{startMonth}' and o.CreateTime <='{endMonth}'
GROUP BY o.EnterID ORDER BY SUM(o.Income + o.PlatformTax - o.Refund) DESC
";
return GetPage<RB_Order_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取销售业绩统计
/// </summary>
/// <param name="saleId"></param>
/// <param name="schoolId"></param>
/// <param name="startMonth"></param>
/// <param name="endMonth"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Order_ViewModel> GetSaleAchievementsRankStatisticsToList(int saleId, int schoolId, string startMonth, string endMonth, int group_Id)
{
string where = "";
if (saleId > 0)
{
where += $@" and o.EnterID ={saleId}";
}
if (schoolId >= 0)
{
where += $@" and o.School_Id ={schoolId}";
}
string sql = $@"SELECT o.EnterID,SUM(o.PreferPrice) as PreferPrice,SUM(o.Income) AS Income,sum(o.PlatformTax) as PlatformTax,SUM(o.Refund) AS Refund,SUM(o.GuestNum) AS GuestNum,
SUM(CASE WHEN c.ClassStatus =3 then o.GuestNum else 0 END) AS JKNum,COUNT(0) AS CancelNum, SUM(IFNULL(ttt.XFMoney,0)) AS YSKMoney
FROM rb_order o
LEFT JOIN rb_class c on o.ClassId = c.ClassId
LEFT JOIN (SELECT q.OrderId,
SUM((case when q.ClassHours>0 and q.TotalSub >0 then
(q.CourseFee - q.DiscountMoney / q.TotalSub * q.CourseFee) /q.ClassHours
else 0 END) * IFNULL(q.CurrentDeductionHours,0)) AS XFMoney
FROM(
SELECT g.Id,g.OrderId
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee
+ec.FirstBookFee + ec.SecondBookFee + ec.ThirdBookFee
+ec.FirstClassFee + ec.SecondClassFee + ec.ThirdClassFee as TotalSub
,ec.FirstClassHours + ec.SecondClassHours + ec.ThirdClassHours as ClassHours
,cc.CurrentDeductionHours
FROM rb_order_guest g
INNER JOIN rb_education_contract ec on g.Id = ec.GuestId
LEFT JOIN (SELECT ch.OrderGuestId, SUM(ch.CurrentDeductionHours) AS CurrentDeductionHours FROM rb_class_check ch WHERE `Status` =0 GROUP BY ch.OrderGuestId) cc on cc.OrderGuestId = g.Id
)q GROUP BY q.OrderId) ttt on ttt.OrderId = o.OrderId
WHERE o.Group_Id={group_Id} and o.OrderState <> 3 and o.EnterID >0 {where} and o.CreateTime >='{startMonth}' and o.CreateTime <='{endMonth}'
GROUP BY o.EnterID ORDER BY SUM(o.Income + o.PlatformTax - o.Refund) DESC
";
return Get<RB_Order_ViewModel>(sql).ToList();
}
#endregion
}
}
......@@ -439,12 +439,17 @@ FROM
{
where.AppendFormat($@" AND STR_TO_DATE( CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') <= DATE_FORMAT('{query.EndBirthDate}' , '%Y-%m-%d') ");
}
if (query.IsHoursStatistics == 1)
{
where.AppendFormat(" AND ((B.LeaveStatus=4 AND b.{0}>='{1}') or ", nameof(Employee_ViewModel.LeaveTime), query.HoursStartTime);
where.AppendFormat(" (B.LeaveStatus<>4 and b.{0}<='{1} 23:59:59')) ", nameof(Employee_ViewModel.EntryTime), query.HoursEndTime);
}
}
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,IFNULL(A.DirectSupervisor,0) AS DirectSupervisor
,A.LeaveStatus,A.LeaveTime,A.EmployeeTel,A.AccountType,A.Email,A.BaseHourFee,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')
......@@ -458,6 +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
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
......@@ -466,6 +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
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
......@@ -474,6 +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
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
......
{
"version": 1,
"dgSpecHash": "LgL2Kme2KdvBDmiwLBiZSHZQIhSbftVOYLF3cgdRTqmOIupjnzmMAo8WGNm0w11fwaLgctzrNYHOF9O2LJ0Izw==",
"dgSpecHash": "bcBFqC0lSOf2P/OcaIHptdi94ZP7u8NeMXGMUcFUhol4ZQWk+2PSkX9H+JuS9rgjAK7d95C5EAseRQkcK41O9Q==",
"success": true
}
\ No newline at end of file
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