builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Class_Check_ViewModel.OrderGuestId),query.OrderGuestId);
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Class_Check_ViewModel.OrderGuestId),query.OrderGuestId);
}
}
if(!string.IsNullOrEmpty(query.QOrderGuestIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ",nameof(RB_Class_Check_ViewModel.OrderGuestId),query.QOrderGuestIds);
}
if(!string.IsNullOrEmpty(query.Q_ClassIds))
if(!string.IsNullOrEmpty(query.Q_ClassIds))
{
{
builder.AppendFormat(" AND A.{0} in({1}) ",nameof(RB_Class_Check_ViewModel.ClassId),query.Q_ClassIds);
builder.AppendFormat(" AND A.{0} in({1}) ",nameof(RB_Class_Check_ViewModel.ClassId),query.Q_ClassIds);
...
@@ -518,12 +558,17 @@ GROUP BY tt.TeacherId,tt.OrderGuestId
...
@@ -518,12 +558,17 @@ GROUP BY tt.TeacherId,tt.OrderGuestId
}
}
stringsql=$@"
stringsql=$@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,c.ClassName,co.CourseName,p.ClassId,c.ClassType,c.ClassNo,s.SName,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
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,p.ClassId,
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.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
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_course co on c.CouseId = co.CourseId
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 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.Group_Id ={group_Id}{where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
ORDER BY p.ClassDate ASC
ORDER BY p.ClassDate ASC
...
@@ -558,12 +603,16 @@ ORDER BY p.ClassDate ASC
...
@@ -558,12 +603,16 @@ ORDER BY p.ClassDate ASC
}
}
stringsql=$@"
stringsql=$@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,c.ClassName,co.CourseName,p.ClassId,s.SName,c.ClassType,c.ClassNo,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
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,
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(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
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_course co on c.CouseId = co.CourseId
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 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.Group_Id ={group_Id}{where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
ORDER BY p.ClassDate ASC
ORDER BY p.ClassDate ASC
...
@@ -625,7 +674,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
...
@@ -625,7 +674,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
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
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
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
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
A.ClassRoomId,A.Group_Id,A.School_Id,A.TeacherId,B.ClassTimeId,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.StartTime,':00') AS NewPlanDateTime,
B.EndTime,B.StartTime,B.SuiPai,B.ClassStatus,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') AS NewEndPlanDateTime
FROM rb_class_plan AS A
INNER JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
INNER JOIN rb_scroll_appointment sa on A.ClassPlanId = sa.ClassPlanId
LEFT JOIN rb_teacher as t on A.TeacherId=t.TId
LEFT JOIN rb_course as cou on cou.CourseId=A.CourseId
LEFT JOIN rb_class_room as croom on croom.RoomId=a.ClassRoomId
where A.`Status`=0 and A.Group_Id={Group_Id} and sa.StuId ={StuId}
and DATE_FORMAT(A.ClassDate,'%Y-%m-%d')>=DATE_FORMAT(NOW(),'%Y-%m-%d') ORDER BY CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') asc LIMIT 10");
stringwhere=$@" 1=1 and r.{nameof(RB_Scroll_Appointment_ViewModel.Status)} =0 and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} <>5";
stringwhere=$@" 1=1 and r.{nameof(RB_Scroll_Appointment_ViewModel.Status)} =0 ";
if(demodel.Group_Id>0)
if(demodel.Group_Id>0)
{
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Group_Id)} ={demodel.Group_Id}";
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Group_Id)} ={demodel.Group_Id}";
...
@@ -93,7 +113,7 @@ ORDER BY r.Id asc ";
...
@@ -93,7 +113,7 @@ ORDER BY r.Id asc ";
}
}
if(demodel.CourseId>0)
if(demodel.CourseId>0)
{
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseId)} ={demodel.CourseId}";
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.LearnCourseId)} ={demodel.CourseId}";
}
}
if(!string.IsNullOrEmpty(demodel.StartTime))
if(!string.IsNullOrEmpty(demodel.StartTime))
{
{
...
@@ -103,13 +123,17 @@ ORDER BY r.Id asc ";
...
@@ -103,13 +123,17 @@ ORDER BY r.Id asc ";
{
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} <='{demodel.EntTime} 23:59:59'";
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} <='{demodel.EntTime} 23:59:59'";
}
}
if(demodel.Q_SelectNormal==1)
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} <>5";
}
stringsql=$@"
stringsql=$@"
SELECT r.*,c.AccountId as TeacherId,t.TeacherName,t.TeacherHead,s.StuName,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum,cou.CourseTimeId,cr.RoomName,sc.SName as RoomSchoolName From RB_Scroll_Appointment r
SELECT r.*,c.AccountId as TeacherId,t.TeacherName,t.TeacherHead,s.StuName,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum,cou.CourseTimeId,cr.RoomName,sc.SName as RoomSchoolName From RB_Scroll_Appointment r
inner join rb_account c on r.AccountId = c.Id
inner join rb_account c on r.AccountId = c.Id
inner join rb_teacher t on c.AccountId = t.TId
inner join rb_teacher t on c.AccountId = t.TId
inner join rb_student s on r.StuId = s.StuId
inner join rb_student s on r.StuId = s.StuId
inner join rb_course cou on r.CourseId = cou.CourseId
inner join rb_course cou on r.LearnCourseId = cou.CourseId
inner join rb_class_room cr on r.RoomId = cr.RoomId
inner join rb_class_room cr on r.RoomId = cr.RoomId
left join rb_school sc on sc.SId = cr.School_Id
left join rb_school sc on sc.SId = cr.School_Id
WHERE {where}
WHERE {where}
...
@@ -146,10 +170,26 @@ ORDER BY r.Id desc ";
...
@@ -146,10 +170,26 @@ ORDER BY r.Id desc ";
{
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} ={demodel.StuId}";
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} ={demodel.StuId}";
}
}
if(!string.IsNullOrEmpty(demodel.StuIds))
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} in({demodel.StuIds})";
}
if(demodel.CourseId>0)
if(demodel.CourseId>0)
{
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseId)} ={demodel.CourseId}";
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseId)} ={demodel.CourseId}";
}
}
if(demodel.RoomId>0)
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.RoomId)} ={demodel.RoomId}";
}
if(demodel.ChapterNo>0)
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.ChapterNo)} ={demodel.ChapterNo}";
}
if(demodel.CourseGradeId>0)
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseGradeId)} ={(int)demodel.CourseGradeId}";
}
if(!string.IsNullOrEmpty(demodel.StartTime))
if(!string.IsNullOrEmpty(demodel.StartTime))
{
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} >='{demodel.StartTime}'";
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} >='{demodel.StartTime}'";
...
@@ -158,10 +198,29 @@ ORDER BY r.Id desc ";
...
@@ -158,10 +198,29 @@ ORDER BY r.Id desc ";
{
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} <='{demodel.EntTime} 23:59:59'";
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} <='{demodel.EntTime} 23:59:59'";
}
}
if(!string.IsNullOrEmpty(demodel.AppointIds))
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Id)} in({demodel.AppointIds})";
}
if(!string.IsNullOrEmpty(demodel.ShiftSort))
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.ShiftSort)} ='{demodel.ShiftSort}'";
}
if(demodel.Q_AppointState>0){
if(demodel.Q_AppointState==1)
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} =1";
}
elseif(demodel.Q_AppointState==2)
{
where+=$@" and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} in(2,3,4)";
}
}
stringsql=$@"
stringsql=$@"
SELECT r.*,c.AccountId as TeacherId,c.WorkUserId,t.TeacherName,t.TeacherHead,s.StuName,sch.OpenId as StuOpenId,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum,cou.CourseTimeId,cr.RoomName,sc.SName as RoomSchoolName
SELECT r.*,c.AccountId as TeacherId,c.WorkUserId,t.TeacherName,t.TeacherHead,s.StuName,sch.OpenId as StuOpenId,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum,cou.CourseTimeId,cr.RoomName,cr.School_Id as RoomSchoolId,sc.SName as RoomSchoolName ,og.TotalChapterNo
@@ -160,7 +160,7 @@ where {where} order by bd.Date asc";
...
@@ -160,7 +160,7 @@ where {where} order by bd.Date asc";
where+=$@" and b.{nameof(RB_Teaching_BonusDetail.Type)} ={demodel.Type}";
where+=$@" and b.{nameof(RB_Teaching_BonusDetail.Type)} ={demodel.Type}";
}
}
stringsql=$@" select b.*,t.TeacherName,case when b.CouseClassify =1 then c.ClassName else tr.LessonName end as ClassName,
stringsql=$@" select b.*,t.TeacherName,case when b.CouseClassify =3 then '预约课' else case when b.CouseClassify =1 then c.ClassName else tr.LessonName end end as ClassName,
c.ClassNo,s.SName from RB_Teaching_BonusDetail b
c.ClassNo,s.SName from RB_Teaching_BonusDetail b
left join rb_teacher t on b.TeacherId = t.TId
left join rb_teacher t on b.TeacherId = t.TId
left join rb_class c on b.ClassId = c.ClassId and b.CouseClassify =1
left join rb_class c on b.ClassId = c.ClassId and b.CouseClassify =1
stringsql=$@"SELECT sog.Student_Id,sog.GuestId,s.StuName as GuestName,og.CourseChapterNo,DATE_FORMAT(sa.Date,'%Y-%m-%d') as AppointDate,sa.AppointNum FROM rb_student_orderguest sog
stringsql=$@"SELECT sog.Student_Id,sog.GuestId,s.StuName as GuestName,og.CourseChapterNo,DATE_FORMAT(sa.Date,'%Y-%m-%d') as AppointDate,sa.AppointNum FROM rb_student_orderguest sog
INNER JOIN rb_order_guest og on sog.GuestId = og.Id
INNER JOIN rb_order_guest og on sog.GuestId = og.Id
INNER JOIN rb_order o on sog.OrderId = o.OrderId
INNER JOIN rb_order o on sog.OrderId = o.OrderId
INNER JOIN rb_student s on sog.Student_Id = s.StuId
INNER JOIN rb_student s on sog.Student_Id = s.StuId
INNER JOIN rb_class c on o.ClassId = c.ClassId
INNER JOIN rb_class c on o.ClassId = c.ClassId
inner join rb_course_chapter cc on o.CourseId = cc.CourseId and cc.ParentId =0 and cc.ChapterNo ='{NextChapterNo}' and cc.CourseRate ={CourseGradeId}
LEFT JOIN (
LEFT JOIN (
SELECT StuId,MAX(Date) AS Date, COUNT(0) as AppointNum FROM rb_scroll_appointment
SELECT StuId,MAX(Date) AS Date, COUNT(0) as AppointNum FROM rb_scroll_appointment
WHERE `Status` =0 and State <>5 and CourseEndTime >=NOW() and Group_Id ={group_Id} GROUP BY StuId
WHERE `Status` =0 and State <>5 and CourseEndTime >=NOW() and Group_Id ={group_Id} GROUP BY StuId
) sa on sog.Student_Id = sa.StuId
) sa on sog.Student_Id = sa.StuId
WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState <>2 and o.OrderState <>3 and c.ClassScrollType =2
WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState <>2 and o.OrderState <>3 and c.ClassScrollType =2
and og.TotalChapterNo > og.CourseChapterNo ";
and og.TotalChapterNo > og.CourseChapterNo ";
if(courseId>0){
sql+=$@" and o.CourseId ={courseId}";
}
if(NextChapterNo>0){
if(NextChapterNo>0){
sql+=$@" and (og.CourseChapterNo + 1 + IFNULL(sa.AppointNum,0)) ={NextChapterNo}";
sql+=$@" and (og.CourseChapterNo + 1 + IFNULL(sa.AppointNum,0)) ={NextChapterNo}";
}
}
...
@@ -812,6 +810,26 @@ and og.TotalChapterNo > og.CourseChapterNo ";
...
@@ -812,6 +810,26 @@ and og.TotalChapterNo > og.CourseChapterNo ";
stringsql=$@"SELECT sog.Student_Id,sog.GuestId,sog.OrderId,o.CourseId,s.StuName as GuestName,og.TotalHours,og.CompleteHours FROM rb_student_orderguest sog
INNER JOIN rb_order_guest og on sog.GuestId = og.Id
INNER JOIN rb_order o on sog.OrderId = o.OrderId
INNER JOIN rb_student s on sog.Student_Id = s.StuId
WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState <>2 and o.OrderState <>3
and og.TotalHours > og.CompleteHours order by sog.OrderId asc ";