Commit af3c863f authored by liudong1993's avatar liudong1993

1

parent 57c0292e
......@@ -514,18 +514,17 @@ case when q.ClassHours>0 and q.TotalSub >0 then
else 0 END AS UnitPrice
FROM (
SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours
,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
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,IFNULL(o.DiscountMoney,0) as DiscountMoney
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(g.TotalHours,0) as ClassHours
FROM(
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'
GROUP BY p.TeacherId,p.OrderGuestId
)tt
LEFT JOIN rb_education_contract ec on tt.OrderGuestId = ec.GuestId and ec.Status <>4
left join rb_order_guest g on g.Id = tt.OrderGuestId
left join rb_order o on o.OrderId =g.OrderId
GROUP BY tt.TeacherId,tt.OrderGuestId
)q";
......@@ -680,12 +679,10 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
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
,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId
,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
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,IFNULL(o.DiscountMoney,0) as DiscountMoney
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(t2.TotalHours,0) as ClassHours
,o.JoinType,o.TargetJoinType,o.SourceOrderId,o.TargetOrderId
FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
......@@ -761,12 +758,10 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
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
,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId
,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
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,IFNULL(o.DiscountMoney,0) as DiscountMoney
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(t2.TotalHours,0) as ClassHours
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
......@@ -822,12 +817,10 @@ case when q.ClassHours>0 and q.TotalSub >0 then
else 0 END AS UnitPrice
FROM (
SELECT tt.ClassId,tt.OrderGuestId,tt.CurrentDeductionHours
,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
,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,IFNULL(o.DiscountMoney,0) as DiscountMoney
,IFNULL(o.PreferPrice,0) as TotalSub
,IFNULL(g.TotalHours,0) as ClassHours
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
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
......@@ -836,7 +829,8 @@ LEFT JOIN rb_order_guest t2 on p.OrderGuestId = t2.Id
WHERE p.`Status`=0 and p.Group_Id ={groupId} and case when cp.PlanType=2 then t2.ClassId in({classIds}) else p.ClassId in({classIds}) end
GROUP BY case when cp.PlanType=2 then t2.ClassId else p.ClassId end,p.OrderGuestId
)tt
LEFT JOIN rb_education_contract ec on tt.OrderGuestId = ec.GuestId and ec.Status <>4
left join rb_order_guest g on g.Id = tt.OrderGuestId
left join rb_order o on o.OrderId =g.OrderId
GROUP BY tt.ClassId,tt.OrderGuestId
)q)hq GROUP BY hq.ClassId";
return Get<RB_Class_Check_ViewModel>(sql).ToList();
......
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