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 ...@@ -514,18 +514,17 @@ case when q.ClassHours>0 and q.TotalSub >0 then
else 0 END AS UnitPrice else 0 END AS UnitPrice
FROM ( FROM (
SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee ,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney ,IFNULL(o.DiscountMoney,0) as DiscountMoney
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee ,IFNULL(o.PreferPrice,0) as TotalSub
+ec.FirstBookFee + ec.SecondBookFee + ec.ThirdBookFee ,IFNULL(g.TotalHours,0) as ClassHours
+ec.FirstClassFee + ec.SecondClassFee + ec.ThirdClassFee as TotalSub
,ec.FirstClassHours + ec.SecondClassHours + ec.ThirdClassHours as ClassHours
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'
GROUP BY p.TeacherId,p.OrderGuestId GROUP BY p.TeacherId,p.OrderGuestId
)tt )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 GROUP BY tt.TeacherId,tt.OrderGuestId
)q"; )q";
...@@ -680,12 +679,10 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then ...@@ -680,12 +679,10 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
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
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee ,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney ,IFNULL(o.DiscountMoney,0) as DiscountMoney
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee ,IFNULL(o.PreferPrice,0) as TotalSub
+ec.FirstBookFee + ec.SecondBookFee + ec.ThirdBookFee ,IFNULL(t2.TotalHours,0) as ClassHours
+ec.FirstClassFee + ec.SecondClassFee + ec.ThirdClassFee as TotalSub
,ec.FirstClassHours + ec.SecondClassHours + ec.ThirdClassHours as ClassHours
,o.JoinType,o.TargetJoinType,o.SourceOrderId,o.TargetOrderId ,o.JoinType,o.TargetJoinType,o.SourceOrderId,o.TargetOrderId
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
...@@ -761,12 +758,10 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then ...@@ -761,12 +758,10 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
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
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee ,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney ,IFNULL(o.DiscountMoney,0) as DiscountMoney
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee ,IFNULL(o.PreferPrice,0) as TotalSub
+ec.FirstBookFee + ec.SecondBookFee + ec.ThirdBookFee ,IFNULL(t2.TotalHours,0) as ClassHours
+ec.FirstClassFee + ec.SecondClassFee + ec.ThirdClassFee as TotalSub
,ec.FirstClassHours + ec.SecondClassHours + ec.ThirdClassHours as ClassHours
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
...@@ -822,12 +817,10 @@ case when q.ClassHours>0 and q.TotalSub >0 then ...@@ -822,12 +817,10 @@ case when q.ClassHours>0 and q.TotalSub >0 then
else 0 END AS UnitPrice else 0 END AS UnitPrice
FROM ( FROM (
SELECT tt.ClassId,tt.OrderGuestId,tt.CurrentDeductionHours SELECT tt.ClassId,tt.OrderGuestId,tt.CurrentDeductionHours
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee ,IFNULL(o.PreferPrice,0) -IFNULL(o.TextbookFee,0) -IFNULL(o.CoursewareFee,0) as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney ,IFNULL(o.DiscountMoney,0) as DiscountMoney
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee ,IFNULL(o.PreferPrice,0) as TotalSub
+ec.FirstBookFee + ec.SecondBookFee + ec.ThirdBookFee ,IFNULL(g.TotalHours,0) as ClassHours
+ec.FirstClassFee + ec.SecondClassFee + ec.ThirdClassFee as TotalSub
,ec.FirstClassHours + ec.SecondClassHours + ec.ThirdClassHours as ClassHours
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
...@@ -836,7 +829,8 @@ LEFT JOIN rb_order_guest t2 on p.OrderGuestId = t2.Id ...@@ -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 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 GROUP BY case when cp.PlanType=2 then t2.ClassId else p.ClassId end,p.OrderGuestId
)tt )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 GROUP BY tt.ClassId,tt.OrderGuestId
)q)hq GROUP BY hq.ClassId"; )q)hq GROUP BY hq.ClassId";
return Get<RB_Class_Check_ViewModel>(sql).ToList(); 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