Reports_model.php edited online with Bitbucket

This commit is contained in:
gandhimathi 2018-09-05 05:12:21 +00:00
parent 8bfd4823b2
commit 7cd52a55e0

View File

@ -444,7 +444,8 @@ left join BalFees bal on bal.student=sms.sid and bal.feestype=sms.cid and bal.se
}
public function app_pending($bat=null,$br=null,$u=null){
$sql = "SELECT * FROM (SELECT
$sql = "SELECT
APFS.ID as id,
APFS.Registration_Details_ID AS regid,
APFS.ListCode as StatusCode,
APFS.AppFormDate as StatusUpdationOn,
@ -463,14 +464,18 @@ left join BalFees bal on bal.student=sms.sid and bal.feestype=sms.cid and bal.se
CFD.Sem_Year as Sem_Year,
RD.RegistrationType as FormType,
STU.StudentID as Student_id
FROM T_ApplicationFormStatus AS APFS LEFT JOIN T_Registration_Details AS RD ON RD.ID = APFS.Registration_Details_ID
LEFT JOIN T_PickListDetails AS PKL ON PKL.ListCode = APFS.ListCode LEFT JOIN T_StudentDetails AS STU ON STU.StudentID = RD.StudentID LEFT JOIN T_CourseMaster AS COUR ON COUR.CourseID = RD.CourseID LEFT JOIN T_Student_CourseDetails AS STU_COUR ON STU_COUR.StudentID = RD.StudentID AND STU_COUR.CourseID = RD.CourseID
FROM T_ApplicationFormStatus AS APFS
LEFT JOIN T_Registration_Details AS RD ON RD.ID = APFS.Registration_Details_ID
LEFT JOIN T_PickListDetails AS PKL ON PKL.ListCode = APFS.ListCode
LEFT JOIN T_StudentDetails AS STU ON STU.StudentID = RD.StudentID
LEFT JOIN T_CourseMaster AS COUR ON COUR.CourseID = RD.CourseID
LEFT JOIN T_Student_CourseDetails AS STU_COUR ON STU_COUR.StudentID = RD.StudentID AND STU_COUR.CourseID = RD.CourseID
LEFT JOIN T_Course_Fees_Details AS CFD ON CFD.ID = RD.FeeType
LEFT JOIN T_UniversityMaster AS UNIV ON UNIV.UniversityID = COUR.UniversityID
LEFT JOIN (SELECT FeesId AS FeeID, min(CreatedOn), BillDate AS BILL FROM T_Students_Fees_PaidDetails GROUP BY FeesId) AS sfpd ON sfpd.FeeID = RD.Student_Fee_Status_Id
where COUR.UniversityID = '$u' and RD.BatchCode = '$bat'and STU_COUR.BranchID = '$br' and STU.IsActive = '1'
ORDER BY StatusUpdationOn DESC) x
GROUP BY x.regid";
where STU.IsActive = '1' and APFS.ID in (select max(ID) from T_ApplicationFormStatus group by Registration_Details_ID)
";
// SELECT * FROM (SELECT APFS.Registration_Details_ID AS regid, APFS.ListCode AS StatusCode, APFS.AppFormDate AS StatusUpdationOn, APFS.Comments AS StatusComments, PKL.ListName AS StatusName, concat(STU.Firstname,' ', STU.Lastname) AS StudentName, STU.Fathername AS FatherName, STU.MobileNumber AS Phone_number, COUR.CourseName AS CourseName, UNIV.UniversityName AS UniversityName, sfpd.BILL AS InitialPayDate, RD.Student_Fee_Status_Id AS FeesStatusID, STU_COUR.EnrollmentID AS EnrollmentNumber, CFD.Sem_Year AS Sem_Year, RD.RegistrationType AS FormType, STU.StudentID
// FROM T_ApplicationFormStatus AS APFS LEFT JOIN T_Registration_Details AS RD ON RD.ID = APFS.Registration_Details_ID
@ -510,6 +515,20 @@ GROUP BY x.regid";
// LEFT JOIN (Select FeesId as FeeID, min(CreatedOn), BillDate as BILL FROM T_Students_Fees_PaidDetails group by FeesId) as sfpd on sfpd.FeeID = RD.Student_Fee_Status_Id
// where COUR.UniversityID = '$u' and RD.BatchCode = '$bat'and STU_COUR.BranchID = '$br' and STU.IsActive = '1'
// group by APFS.Registration_Details_ID";
if ($bat!= ''){
$sql.=" and RD.BatchCode = '".$bat."'";
}
if ($u!= ''){
$sql.=" and COUR.UniversityID = '".$u."'";
}
$sql.=" group by regid,Student_id ";
$sql.=" ORDER BY StatusUpdationOn DESC ";
$leadDet=$this->db->query($sql);
$answer = $leadDet->result();
if (count($answer) > 0) {