Commit 4c712aa6 authored by liudong1993's avatar liudong1993

1

parent be661f15
...@@ -518,15 +518,17 @@ GROUP BY tt.TeacherId,tt.ClassId;"; ...@@ -518,15 +518,17 @@ GROUP BY tt.TeacherId,tt.ClassId;";
public List<RB_Class_Check_ViewModel> GetStudentHoursList(int groupId, string userIds, string startMonth, string endMonth) public List<RB_Class_Check_ViewModel> GetStudentHoursList(int groupId, string userIds, string startMonth, string endMonth)
{ {
string sql = $@"SELECT q.TeacherId,q.OrderGuestId,q.CurrentDeductionHours, string sql = $@"SELECT q.TeacherId,q.OrderGuestId,q.CurrentDeductionHours,
case when q.ClassUnitPrice >0 then q.ClassUnitPrice else
case when q.ClassHours>0 and q.TotalSub >0 then case when q.ClassHours>0 and q.TotalSub >0 then
(q.CourseFee - q.DiscountMoney) /q.ClassHours (q.CourseFee - q.DiscountMoney) /q.ClassHours
else 0 END AS UnitPrice else 0 END END AS UnitPrice
FROM ( FROM (
SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours
,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
string sql = $@" string sql = $@"
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
...@@ -692,6 +695,7 @@ SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.Teache ...@@ -692,6 +695,7 @@ SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.Teache
,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(t2.TotalHours,0) as ClassHours ,IFNULL(t2.TotalHours,0) as ClassHours
,IFNULL(t2.ClassUnitPrice,0) as ClassUnitPrice
,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,9 +765,10 @@ ORDER BY tt.ClassDate ASC ...@@ -761,9 +765,10 @@ ORDER BY tt.ClassDate ASC
string sql = $@" string sql = $@"
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
...@@ -771,6 +776,7 @@ SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.Teache ...@@ -771,6 +776,7 @@ SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.Teache
,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(t2.TotalHours,0) as ClassHours ,IFNULL(t2.TotalHours,0) as ClassHours
,IFNULL(t2.ClassUnitPrice,0) as ClassUnitPrice
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
...@@ -821,15 +827,17 @@ WHERE p.`Status` =0 and p.Group_Id ={groupId} and case when cp.PlanType=2 then t ...@@ -821,15 +827,17 @@ WHERE p.`Status` =0 and p.Group_Id ={groupId} and case when cp.PlanType=2 then t
{ {
string sql = $@"SELECT hq.ClassId, SUM(hq.CurrentDeductionHours * hq.UnitPrice) AS UnitPrice FROM ( string sql = $@"SELECT hq.ClassId, SUM(hq.CurrentDeductionHours * hq.UnitPrice) AS UnitPrice FROM (
SELECT q.ClassId,q.OrderGuestId,q.CurrentDeductionHours, SELECT q.ClassId,q.OrderGuestId,q.CurrentDeductionHours,
case when q.ClassUnitPrice >0 then q.ClassUnitPrice else
case when q.ClassHours>0 and q.TotalSub >0 then case when q.ClassHours>0 and q.TotalSub >0 then
(q.CourseFee - q.DiscountMoney) /q.ClassHours (q.CourseFee - q.DiscountMoney) /q.ClassHours
else 0 END AS UnitPrice else 0 END END AS UnitPrice
FROM ( FROM (
SELECT tt.ClassId,tt.OrderGuestId,tt.CurrentDeductionHours SELECT tt.ClassId,tt.OrderGuestId,tt.CurrentDeductionHours
,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
......
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