Reports_model.php edited online with Bitbucket

This commit is contained in:
gandhimathi 2018-08-31 12:05:27 +00:00
parent 5426f9d045
commit 3dea8a1e0e

View File

@ -178,6 +178,13 @@ from
left join T_PickListDetails p on p.ListCode = app.ListCode left join T_PickListDetails p on p.ListCode = app.ListCode
left join BalFees bal on bal.student=app.StudentID and bal.course=app.CourseID left join BalFees bal on bal.student=app.StudentID and bal.course=app.CourseID
where CertificateName not like 'APPLICATION%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,ListCode,BranchCode,CertificationType) where CertificateName not like 'APPLICATION%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,ListCode,BranchCode,CertificationType)
group by app.ID
union
SELECT app.ID,app.StudentID as sid,app.CourseID as cid,app.BranchCode as branch,app.ListCode as lcode,p.ListName as status,AppDate as adate,app.Comments as acmts,CertificationType as ctype,app.CertificationType as certname,sum(bal.balpayable) as balance
FROM T_ApplicationStatus as app
left join T_PickListDetails p on p.ListCode = app.ListCode
left join BalFees bal on bal.student=app.StudentID and bal.course=app.CourseID
where app.CertificationType not like 'CERT%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,ListCode,BranchCode,CertificationType)
group by app.ID) as sms group by app.ID) as sms
left join left join
(SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others
@ -258,7 +265,7 @@ left join BalFees bal on bal.student=c.StudentID and bal.course=sfs.CourseID and
where CDate is not null and (list.ListName like 'ISSUED TO STUDENT' or list.ListName like 'RECEIVED%' ) where CDate is not null and (list.ListName like 'ISSUED TO STUDENT' or list.ListName like 'RECEIVED%' )
group by sid,cid,sem,ctype group by sid,cid,sem,ctype
union union
select a.ID,a.StudentID as sid,a.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,'-' as sem,cm.CertificateName as certname,a.CertificationType as ctype,AppDate as mdate,bal.balpayable as balance, select a.ID,a.StudentID as sid,a.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,'-' as sem,ifnull(cm.CertificateName,a.CertificationType) as certname,a.CertificationType as ctype,AppDate as mdate,bal.balpayable as balance,
max(if(ListName = 'ISSUED TO STUDENT', AppDate,'-')) as issuedate,max(if(ListName = 'ISSUED TO STUDENT', ListName,'-')) as istatus, max(if(ListName = 'ISSUED TO STUDENT', AppDate,'-')) as issuedate,max(if(ListName = 'ISSUED TO STUDENT', ListName,'-')) as istatus,
max(if(ListName = 'RECEIVED', AppDate,'-')) as rcvedate,max(if(ListName = 'RECEIVED', ListName,'-')) as rstatus,a.Comments as acmts max(if(ListName = 'RECEIVED', AppDate,'-')) as rcvedate,max(if(ListName = 'RECEIVED', ListName,'-')) as rstatus,a.Comments as acmts
from T_ApplicationStatus a from T_ApplicationStatus a