,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
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(g.TotalHours,0) as ClassHours
,IFNULL(g.TotalHours,0) as ClassHours
,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.Group_Id ={groupId} and p.TeacherId in ({userIds}) and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
...
@@ -682,9 +684,10 @@ ORDER BY p.ClassDate ASC
...
@@ -682,9 +684,10 @@ ORDER BY p.ClassDate ASC
stringsql=$@"
stringsql=$@"
SELECT tt.*,
SELECT tt.*,
case when tt.ClassUnitPrice>0 then tt.ClassUnitPrice else
case when tt.ClassHours>0 and tt.TotalSub >0 then
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 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,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
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
...
@@ -761,9 +765,10 @@ ORDER BY tt.ClassDate ASC
...
@@ -761,9 +765,10 @@ ORDER BY tt.ClassDate ASC
stringsql=$@"
stringsql=$@"
SELECT tt.*,
SELECT tt.*,
case when tt.ClassUnitPrice >0 then tt.ClassUnitPrice else
case when tt.ClassHours>0 and tt.TotalSub >0 then
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 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,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
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(g.TotalHours,0) as ClassHours
,IFNULL(g.TotalHours,0) as ClassHours
,IFNULL(g.ClassUnitPrice,0) as ClassUnitPrice
FROM(
FROM(
SELECT case when cp.PlanType=2 then t2.ClassId else p.ClassId end as ClassId,p.OrderGuestId,SUM(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
SELECT case when cp.PlanType=2 then t2.ClassId else p.ClassId end as ClassId,p.OrderGuestId,SUM(p.CurrentDeductionHours) 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