SELECT A.Id AS GuestId,A.OrderId,A.GuestName,A.GuestState,IFNULL(B.EnterID,0) AS EnterID,IFNULL(D.AssistId,0) AS HeadMasterId,B.CourseId,A.TotalHours AS TotalTimes
SELECT A.Id AS GuestId,A.OrderId,A.GuestName,A.GuestState,IFNULL(B.EnterID,0) AS EnterID,IFNULL(D.AssistId,0) AS HeadMasterId,B.CourseId,A.TotalHours AS TotalTimes
,IFNULL(cs.CourseName,'') AS CourseName,IFNULL(cs.CourseRate,0) AS CourseRate
,IFNULL(cs.CourseName,'') AS CourseName,IFNULL(cs.CourseRate,0) AS CourseRate,IFNULL(A.ScheduleStatus,0) AS ScheduleStatus,IFNULL(A.TeachingMethod,0) AS TeachingMethod
,IFNULL(A.XGRemark,'') AS XGRemark,A.StopDeadline,IFNULL(A.ScheduleRemark,'') AS ScheduleRemark,C.Student_Id AS StuId
FROM rb_order_guest AS A INNER JOIN RB_Order AS B ON A.OrderId=B.OrderId
FROM rb_order_guest AS A INNER JOIN RB_Order AS B ON A.OrderId=B.OrderId
INNER JOIN rb_class AS E ON B.ClassId=E.ClassId
INNER JOIN rb_class AS E ON B.ClassId=E.ClassId
INNER JOIN rb_student_orderguest AS C ON A.Id=C.GuestId
INNER JOIN rb_student_orderguest AS C ON A.Id=C.GuestId
INNER JOIN RB_Course AS cs ON B.CourseId=cs.CourseId
INNER JOIN RB_Course AS cs ON B.CourseId=cs.CourseId
LEFT JOIN rb_student_assist AS D ON (C.Student_Id=D.StuId AND D.AssistType=4)
LEFT JOIN rb_student_assist AS D ON (C.Student_Id=D.StuId AND D.AssistType=4)
WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.ClassScrollType=2
WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
@@ -64,11 +93,11 @@ WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.Cl
...
@@ -64,11 +93,11 @@ WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.Cl
SELECT A.Date,A.AccountId,A.State,A.GuestId,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,IFNULL(C.ClassCheckId,0) AS ClassCheckId,IFNULL(C.CurrentDeductionHours,0) AS CurrentDeductionHours
SELECT A.Date,A.AccountId,A.State,A.GuestId,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,IFNULL(C.ClassCheckId,0) AS ClassCheckId,IFNULL(C.CurrentDeductionHours,0) AS CurrentDeductionHours
FROM rb_scroll_appointment AS A LEFT JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
FROM rb_scroll_appointment AS A LEFT JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
LEFT JOIN rb_class_check AS C ON B.ClassTimeId=C.ClassTimeId AND A.GuestId=C.OrderGuestId
LEFT JOIN rb_class_check AS C ON B.ClassTimeId=C.ClassTimeId AND A.GuestId=C.OrderGuestId
WHERE 1=1 AND A.State NOT IN(5)
WHERE 1=1 AND A.State IN(3) AND A.AppointType IN(1,2)
");
");
appointBuilder.AppendFormat(@" AND A.GuestId IN({0}) ",guestIds);
appointBuilder.AppendFormat(@" AND A.LearnCourseId IN ({0}) ",courseIds);
appointBuilder.AppendFormat(@" AND A.LearnCourseId IN ({0}) ",courseIds);
appointBuilder.AppendFormat(@" AND A.CourseGradeId IN ({0}) ",(int)query.QCourseRate);
appointBuilder.AppendFormat(@" AND A.CourseGradeId IN ({0}) ",(int)query.QCourseRate);
appointBuilder.AppendFormat(@" AND A.GuestId IN({0}) ",guestIds);
SELECT A.Date,A.AccountId,A.State,A.GuestId,g.GuestName,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,A.ClassPlanId,A.CourseETime AS EndTime,A.CourseSTime AS StartTime
FROM rb_scroll_appointment AS A LEFT JOIN rb_order_guest AS g ON A.GuestId=g.Id
WHERE 1=1 AND A.State IN(3) AND A.AppointType IN(1,2)
");
if(query!=null)
{
if(!string.IsNullOrEmpty(query.StartDate))
{
builder.AppendFormat(@" AND A.Date>='{0}' ",query.StartDate);
}
if(!string.IsNullOrEmpty(query.EndDate))
{
builder.AppendFormat(@" AND A.Date<='{0} 23:59:59 ' ",query.StartDate);
}
if(!string.IsNullOrEmpty(query.GuestName))
{
builder.AppendFormat(@" AND g.GuestName LIKE @GuestName ");