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
)tt
left join rb_order_guest g on g.Id = tt.OrderGuestId
...
...
@@ -570,10 +570,9 @@ GROUP BY tt.TeacherId,tt.OrderGuestId
{
where+=$@" and p.ClassId ={classId}";
}
stringsql=$@"
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
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
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
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 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'
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
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
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
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 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'
@@ -689,7 +688,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney) /tt.ClassHours
else 0 END END AS UnitPrice
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
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
@@ -770,7 +769,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney) /tt.ClassHours
else 0 END END AS UnitPrice
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
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee