Commit 080d7001 authored by 吴春's avatar 吴春

1

parent 8f6b30ab
This diff is collapsed.
This diff is collapsed.
...@@ -531,7 +531,7 @@ SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours ...@@ -531,7 +531,7 @@ SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours
,IFNULL(g.ClassUnitPrice,0) as ClassUnitPrice ,IFNULL(g.ClassUnitPrice,0) as ClassUnitPrice
FROM( FROM(
SELECT p.TeacherId,p.OrderGuestId,SUM(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p SELECT p.TeacherId,p.OrderGuestId,SUM(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
WHERE p.`Status`=0 and p.Group_Id ={groupId} and p.TeacherId in ({userIds}) and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59' WHERE p.`Status`=0 and p.IsCalcTeacFee=1 and p.Group_Id ={groupId} and p.TeacherId in ({userIds}) and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
GROUP BY p.TeacherId,p.OrderGuestId GROUP BY p.TeacherId,p.OrderGuestId
)tt )tt
left join rb_order_guest g on g.Id = tt.OrderGuestId left join rb_order_guest g on g.Id = tt.OrderGuestId
...@@ -570,10 +570,9 @@ GROUP BY tt.TeacherId,tt.OrderGuestId ...@@ -570,10 +570,9 @@ GROUP BY tt.TeacherId,tt.OrderGuestId
{ {
where += $@" and p.ClassId ={classId}"; where += $@" and p.ClassId ={classId}";
} }
string sql = $@" string sql = $@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,t2.BaseHoursAdd,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,co2.AddHoursMoney,co.AddHoursMoney) as CourseAddHoursMoney, SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,t2.BaseHoursAdd,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,co2.AddHoursMoney,co.AddHoursMoney) as CourseAddHoursMoney,
c.ClassType,c.ClassNo,if(cp.PlanType=2,s2.SName,s.SName) as SName,c.ClassHourMinute,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.IsCalcTeacFee =1 then p.CurrentDeductionHours else 0 end) as CurrentDeductionHours c.ClassType,c.ClassNo,if(cp.PlanType=2,s2.SName,s.SName) as SName,c.ClassHourMinute,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(CASE p.IsCalcTeacFee WHEN 1 THEN p.CurrentDeductionHours ELSE 0 END) as CurrentDeductionHours
FROM rb_class_check p FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
...@@ -583,7 +582,7 @@ LEFT JOIN rb_course co on c.CouseId = co.CourseId ...@@ -583,7 +582,7 @@ LEFT JOIN rb_course co on c.CouseId = co.CourseId
left join rb_course co2 on cp.CourseId = co2.CourseId left join rb_course co2 on cp.CourseId = co2.CourseId
left join rb_school s on s.SId = c.School_Id left join rb_school s on s.SId = c.School_Id
left join rb_school s2 on s2.SId = cp.School_Id left join rb_school s2 on s2.SId = cp.School_Id
WHERE p.`Status`=0 and p.Group_Id ={group_Id} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59' WHERE p.`Status`=0 and p.IsCalcTeacFee=1 and p.Group_Id ={group_Id} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
ORDER BY p.ClassDate ASC ORDER BY p.ClassDate ASC
"; ";
...@@ -602,7 +601,7 @@ ORDER BY p.ClassDate ASC ...@@ -602,7 +601,7 @@ ORDER BY p.ClassDate ASC
/// <returns></returns> /// <returns></returns>
public List<RB_Class_Check_ViewModel> GetTeacherConsumptionHoursDetialList(string teacherIds, int schoolId, int classId, string startMonth, string endMonth, int group_Id) public List<RB_Class_Check_ViewModel> GetTeacherConsumptionHoursDetialList(string teacherIds, int schoolId, int classId, string startMonth, string endMonth, int group_Id)
{ {
string where = $@" "; string where = $@" and p.IsCalcTeacFee=1 ";
if (!string.IsNullOrEmpty(teacherIds) && teacherIds != "-1" && teacherIds != "0") if (!string.IsNullOrEmpty(teacherIds) && teacherIds != "-1" && teacherIds != "0")
{ {
where += $@" and p.TeacherId in({teacherIds})"; where += $@" and p.TeacherId in({teacherIds})";
...@@ -617,7 +616,7 @@ ORDER BY p.ClassDate ASC ...@@ -617,7 +616,7 @@ ORDER BY p.ClassDate ASC
} }
string sql = $@" string sql = $@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,if(cp.PlanType=2,co2.AddHoursMoney,co.AddHoursMoney) as CourseAddHoursMoney, SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,p.IsCalcTeacFee,t2.BaseHoursEnabled,t2.EnableTime,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,if(cp.PlanType=2,co2.AddHoursMoney,co.AddHoursMoney) as CourseAddHoursMoney,
p.ClassId,if(cp.PlanType=2,s2.SName,s.SName) as SName,c.ClassType,c.ClassNo,c.ClassHourMinute,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(case when p.IsCalcTeacFee =1 then p.CurrentDeductionHours else 0 end) as CurrentDeductionHours FROM rb_class_check p p.ClassId,if(cp.PlanType=2,s2.SName,s.SName) as SName,c.ClassType,c.ClassNo,c.ClassHourMinute,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(case when p.IsCalcTeacFee =1 then p.CurrentDeductionHours else 0 end) as CurrentDeductionHours FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
...@@ -627,7 +626,7 @@ LEFT JOIN rb_course co on c.CouseId = co.CourseId ...@@ -627,7 +626,7 @@ LEFT JOIN rb_course co on c.CouseId = co.CourseId
left join rb_course co2 on cp.CourseId = co2.CourseId left join rb_course co2 on cp.CourseId = co2.CourseId
left join rb_school s on s.SId = c.School_Id left join rb_school s on s.SId = c.School_Id
left join rb_school s2 on s2.SId = cp.School_Id left join rb_school s2 on s2.SId = cp.School_Id
WHERE p.`Status`=0 and p.Group_Id ={group_Id} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59' WHERE p.`Status`=0 and p.IsCalcTeacFee=1 and p.Group_Id ={group_Id} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
ORDER BY p.ClassDate ASC ORDER BY p.ClassDate ASC
"; ";
...@@ -652,7 +651,7 @@ ORDER BY p.ClassDate ASC ...@@ -652,7 +651,7 @@ ORDER BY p.ClassDate ASC
/// <returns></returns> /// <returns></returns>
public List<RB_Class_Check_ViewModel> GetStudentConsumptionHoursDetialPageList(int pageIndex, int pageSize, out long count, int teacherId, int schoolId, int classId, string startMonth, string endMonth, string studentName, int orderId, string contractNo, int groupId, int StudentId) public List<RB_Class_Check_ViewModel> GetStudentConsumptionHoursDetialPageList(int pageIndex, int pageSize, out long count, int teacherId, int schoolId, int classId, string startMonth, string endMonth, string studentName, int orderId, string contractNo, int groupId, int StudentId)
{ {
string where = $@" "; string where = $@" and p.IsCalcTeacFee=1 ";
if (teacherId > 0) if (teacherId > 0)
{ {
where += $@" and p.TeacherId ={teacherId}"; where += $@" and p.TeacherId ={teacherId}";
...@@ -689,7 +688,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then ...@@ -689,7 +688,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney) /tt.ClassHours (tt.CourseFee - tt.DiscountMoney) /tt.ClassHours
else 0 END END AS UnitPrice else 0 END END AS UnitPrice
FROM ( FROM (
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId SELECT p.OrderGuestId,p.CurrentDeductionHours,p.IsCalcTeacFee,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId
,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId ,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee ,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,IFNULL(o.DiscountMoney,0) as DiscountMoney ,IFNULL(o.DiscountMoney,0) as DiscountMoney
...@@ -729,7 +728,7 @@ ORDER BY tt.ClassDate ASC ...@@ -729,7 +728,7 @@ ORDER BY tt.ClassDate ASC
/// <returns></returns> /// <returns></returns>
public List<RB_Class_Check_ViewModel> GetStudentConsumptionHoursDetialList(int teacherId, int schoolId, int classId, string startMonth, string endMonth, string studentName, int orderId, string contractNo, int groupId, string classIds = "", int StudentId = 0) public List<RB_Class_Check_ViewModel> GetStudentConsumptionHoursDetialList(int teacherId, int schoolId, int classId, string startMonth, string endMonth, string studentName, int orderId, string contractNo, int groupId, string classIds = "", int StudentId = 0)
{ {
string where = $@" "; string where = $@" and p.IsCalcTeacFee=1 ";
if (teacherId > 0) if (teacherId > 0)
{ {
where += $@" and p.TeacherId ={teacherId}"; where += $@" and p.TeacherId ={teacherId}";
...@@ -770,7 +769,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then ...@@ -770,7 +769,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney) /tt.ClassHours (tt.CourseFee - tt.DiscountMoney) /tt.ClassHours
else 0 END END AS UnitPrice else 0 END END AS UnitPrice
FROM ( FROM (
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId SELECT p.OrderGuestId,p.CurrentDeductionHours,p.IsCalcTeacFee,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId
,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId ,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee ,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,IFNULL(o.DiscountMoney,0) as DiscountMoney ,IFNULL(o.DiscountMoney,0) as DiscountMoney
......
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