1640 lines
85 KiB
PHP
Executable File
1640 lines
85 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Date: 11/9/17
|
|
* Time: 5:28 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Reports_model extends CI_Model
|
|
{
|
|
public function status($bat=null,$br=null,$u=null){
|
|
|
|
$sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sms.branch,'-') as Branch,ifnull(sms.date,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(sfs.batch,'-') as Batch_Code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.Status,'-') as Status,ifnull(bal.balpayable,0) as Balance_fee,ifnull(sfp.bdate,'-') as Initial_paid_date, ifnull(std.AlternateNumber,'-') as AlternateNumber,ifnull(std.address,'-') as address,cm.uid as univID,ifnull(apdate.appdate,'-') as appdate
|
|
from
|
|
(SELECT ID,StudentID as sid,CourseID as cid,ListCode as lcode,BranchCode as branch,SDate as date,Sem as sem FROM T_StudyMaterialStatus where ID in (SELECT max(ID) FROM T_StudyMaterialStatus group by StudentID,CourseID,BranchCode,Sem)
|
|
group by sid,sem,cid,branch) as sms
|
|
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 FROM T_Students_Fees_Status
|
|
group by sid,fid,cid,batch) as sfs on sfs.sid=sms.sid and sms.cid=sfs.ftype
|
|
left join
|
|
(SELECT StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails
|
|
where IsActive = 1
|
|
group by sid,fid) as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid
|
|
left join
|
|
(SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd
|
|
on cfd.cid=sms.cid
|
|
left join
|
|
(SELECT ListCode as lcode,ListName as status FROM T_PickListDetails) as list
|
|
on list.lcode=sms.lcode
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID) as cm
|
|
on cm.cid=cfd.ccid
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,AlternateNumber,PresentAddress as address FROM T_StudentDetails where IsActive = 1) as std on std.sid=sms.sid
|
|
left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid AND scd.cid = sfs.cid
|
|
left join BalFees bal on bal.student=sms.sid and bal.feestype=sms.cid and bal.semyr=sms.sem
|
|
left join (SELECT rd.StudentID as sid,rd.CourseID as cid,if(list.ListName = 'SENT TO UNIVERSITY', afs.AppFormDate,'-') as appdate,Sem_Year as sem
|
|
FROM T_Registration_Details rd
|
|
left join T_ApplicationFormStatus afs on afs.Registration_Details_ID=rd.ID
|
|
left join T_PickListDetails list on list.ListCode=afs.ListCode
|
|
left join T_Course_Fees_Details cf on cf.ID=rd.FeeType
|
|
where afs.ID in (Select max(ID) from T_ApplicationFormStatus group by Registration_Details_ID)
|
|
group by sid,sem) as apdate on apdate.sid=sms.sid and apdate.sem=sms.sem
|
|
where sms.branch = '".$br."'
|
|
";
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.batch = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and cm.uid = '".$u."'";
|
|
|
|
}
|
|
$sql.=" group by Student_id,Course_id,Branch,Batch_code,Sem,univID";
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$statusDetails = $leadDet->result();
|
|
//print_r($this->db->last_query());die();
|
|
|
|
if (count($statusDetails) > 0) {
|
|
$results['statusList'] = true;
|
|
$results['statusr'] = $statusDetails;
|
|
} else {
|
|
$results['statusList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function filters($br){
|
|
|
|
//University name
|
|
$sql = "SELECT distinct UniversityID as uid,UniversityName as university FROM T_UniversityMaster
|
|
where BranchCode = '".$br."'";
|
|
$b=$this->db->query($sql);
|
|
$batch = $b->result();
|
|
//staff Name
|
|
$sql_staf = "select StaffID,concat(Firstname,Lastname) as staff_name from T_StaffDetails where IsActive = 1 and BranchCode = '".$br."'";
|
|
$staff=$this->db->query($sql_staf);
|
|
$staff_list = $staff->result();
|
|
//Activity Name
|
|
$sql_act = "select ActivityID,ActivityName from T_ActivityMaster where IsActive = 1 and BranchCode = '".$br."'";
|
|
$act=$this->db->query($sql_act);
|
|
$act_name = $act->result();
|
|
//Status
|
|
$sql_staf = "select StaffID,concat(Firstname,Lastname) as staff_name from T_StaffDetails where IsActive = 1 and BranchCode = '".$br."'";
|
|
$staff=$this->db->query($sql_staf);
|
|
$staff_list = $staff->result();
|
|
|
|
if (count($batch) > 0) {
|
|
$results['univlist'] = true;
|
|
$results['university'] = $batch;
|
|
$results['staff'] = $staff_list;
|
|
$results['activity_name'] = $act_name;
|
|
$results['activity_name'] = $act_name;
|
|
} else {
|
|
$results['univlist'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
return $results;
|
|
|
|
}
|
|
public function BatchName($br,$batch){
|
|
$sql = "SELECT distinct BatchCode as batchcode,BatchName as batch,BatchDate FROM T_BatchMaster
|
|
where BranchCode = '".$br."' and BatchName = '".$batch."'";
|
|
$b=$this->db->query($sql);
|
|
$batch = $b->result();
|
|
if (count($batch) > 0) {
|
|
$results['batchlists'] = true;
|
|
$results['batchName'] = $batch;
|
|
} else {
|
|
$results['batchlists'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
|
|
|
|
}
|
|
public function markcard($bat=null,$br=null,$u=null,$st=null,$from=null,$to=null){
|
|
|
|
$sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(sfs.rollno,'-') as Roll_NO,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sms.cdate,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(sfp.bdate,'-') as Initial_paid_date,bal.balpayable as Balance_Fee,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber,ifnull(appdate,'-') as appdate,ifnull(ansdate,'-') as ansdate
|
|
,scd.coursestatus as Course_Status,ifnull(andate.courierdetails,'-') as Courier_Details,IFNULL(sfs.batchname, '-') AS Batch_Name
|
|
from
|
|
(SELECT c.ID,StudentID as sid,c.CourseID as cid,c.BranchCode as branch,c.ListCode as lcode,p.ListName,c.CertificationType as ctype,c.CDate as cdate,c.Sem as sem,c.CreatedOn FROM T_CertificationStatus c
|
|
left join T_PickListDetails p on p.ListCode=c.ListCode
|
|
WHERE c.ID IN (SELECT max(ID) FROM T_CertificationStatus group by StudentID,CourseID,BranchCode,Sem)
|
|
group by sid,sem,cid,lcode,branch) as sms
|
|
left join
|
|
(SELECT FeesID as fid,T_Students_Fees_Status.BatchCode AS batch,T_BatchMaster.BatchName as batchname,StudentID as sid,RollNO as rollno,CourseID as cid,FeesType as ftype,sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others
|
|
FROM T_Students_Fees_Status
|
|
left join T_BatchMaster on T_BatchMaster.BatchCode = T_Students_Fees_Status.BatchCode
|
|
group by sid,fid,cid,batch) as sfs on sfs.sid=sms.sid and sms.cid=sfs.ftype
|
|
left join
|
|
(SELECT StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails
|
|
where IsActive = 1
|
|
group by sid,fid) as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid
|
|
left join
|
|
(SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd
|
|
on cfd.cid=sms.cid
|
|
left join
|
|
(SELECT ListCode as lcode,ListName as status FROM T_PickListDetails) as list
|
|
on list.lcode=sms.lcode
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID) as cm
|
|
on cm.cid=cfd.ccid
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch,ifnull(Status,'-') as coursestatus FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and (scd.coursestatus != 'Cancelled' or scd.coursestatus != 'Discontinued' or scd.coursestatus != 'Refund_issued')
|
|
left join (select ID,StudentID as sid,Sem,
|
|
if(ListName = 'SENT TO UNIVERSITY', AnsDate,'-') as ansdate,CourierDetails as courierdetails
|
|
from T_AnswerBookletStatus abs
|
|
left join T_PickListDetails list on list.ListCode=abs.ListCode
|
|
where AnsDate is not null and ID in (select max(ID) from T_AnswerBookletStatus where AnsDate is not null group by StudentID,Sem)
|
|
group by sid,Sem) as andate on andate.sid=sms.sid and andate.Sem=cfd.syear
|
|
left join (SELECT rd.StudentID as sid,rd.CourseID as cid,max(if(list.ListName = 'SENT TO UNIVERSITY', afs.AppFormDate,'-')) as appdate,Sem_Year as sem
|
|
FROM T_Registration_Details rd
|
|
left join T_ApplicationFormStatus afs on afs.Registration_Details_ID=rd.ID
|
|
left join T_PickListDetails list on list.ListCode=afs.ListCode
|
|
left join T_Course_Fees_Details cf on cf.ID=rd.FeeType
|
|
group by sid,sem) as apdate on apdate.sid=sms.sid and apdate.sem=cfd.syear
|
|
left join BalFees bal on bal.student=sms.sid and bal.feestype=sms.cid and bal.semyr=sms.sem
|
|
where std.active = 1 and sms.branch = '".$br."'
|
|
";
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.batch = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and cm.uid = '".$u."'";
|
|
|
|
}
|
|
if ($st != ''){
|
|
$sql.="and list.lcode = '".$st."'";
|
|
}
|
|
if ($from != ''){
|
|
$fromd= date("Y-m-d",strtotime($from));
|
|
$sql.="and sms.CreatedOn >= '".$fromd."'";
|
|
}
|
|
if ($to != ''){
|
|
$tod=date("Y-m-d",strtotime($to));
|
|
$sql.=" and sms.CreatedOn <= '".$tod."'";
|
|
}
|
|
$sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem,Sem_year";
|
|
$leadDet=$this->db->query($sql);
|
|
$mstatusDetails = $leadDet->result();
|
|
if (count($mstatusDetails) > 0) {
|
|
$results['markcardList'] = true;
|
|
$results['markcard_data'] = $mstatusDetails;
|
|
} else {
|
|
$results['markcardList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function certificate_status($bat=null,$br=null,$u=null,$from=null,$to=null,$st=null){
|
|
|
|
// $sql = "select sms.sid as Student_id,sms.cid,ifnull(sms.status,'-') as status,ifnull(sms.adate,'-') as adate,ifnull(sms.acmts,'-') as acmts,ifnull(sms.ctype,'-') as ctype,ifnull(sms.certname,'-') as certname,ifnull(balance,'-') as balance,ifnull(sfp.BillDate,'-') as initialPaid,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,cm.uid as univID,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber
|
|
// from
|
|
// (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,CertificateName as certname,sum(bal.balpayable) as balance
|
|
// FROM T_ApplicationStatus as app
|
|
// left join T_CertificationMaster cm on cm.CertificationID=app.CertificationType
|
|
// 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 CertificateName not like 'APPLICATION%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,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 and bal.feestype = app.CertificationType
|
|
// where app.CertificationType not like 'CERT%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,BranchCode,CertificationType)
|
|
// group by app.ID) as sms
|
|
// 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
|
|
// FROM T_Students_Fees_Status
|
|
// group by sid,cid)
|
|
// as sfs on sfs.sid=sms.sid and sfs.cid=sms.cid
|
|
// left join
|
|
// (SELECT sfp.StudentID as sid,sfp.FeesId as fid,sfs.CourseID as cid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails sfp
|
|
// left join T_Students_Fees_Status sfs on sfs.FeesId=sfp.FeesId
|
|
// where IsActive = 1
|
|
// group by sid,cid)
|
|
// as sfb on sfb.sid=sms.sid
|
|
// left join
|
|
// (select ID,StudentId,FeesID,BillDate from T_Students_Fees_PaidDetails where ID in
|
|
// (select min(ID) from T_Students_Fees_PaidDetails group by FeesID)
|
|
// group by FeesID) as sfp on sfp.FeesID=sfb.fid
|
|
// left join
|
|
// (SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
// UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
// left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
// group by cid
|
|
// order by CourseID)
|
|
// as cm on cm.cid=sms.cid
|
|
// left join
|
|
// (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
// left join
|
|
// (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid
|
|
$sql ="SELECT sms.sid AS Student_id,sms.cid,ifnull(sms.status,'-') AS STATUS,ifnull(DATE_FORMAT(sms.adate, '%d-%m-%Y'),'-') AS adate,ifnull(sms.acmts,'-') AS acmts,ifnull(sms.ctype,'-') AS ctype,ifnull(sms.certname,'-') AS certname,ifnull(balance,'-') AS balance,ifnull(sfb.bdate,'-') AS initialPaid,ifnull(scd.eid,'-') AS Enrollment_id,ifnull(std.name,'-') AS Student_name,ifnull(std.father,'-') AS Father_name,ifnull(std.phone,'-') AS Phone_number,ifnull(cm.course,'-') AS Course_name,ifnull(cm.uname,'-') AS University,cm.uid AS univID,ifnull(std.address,'-') AS address,ifnull(std.AlternateNumber,'') AS AlternateNumber,sfs.batch as Batch,IFNULL(sfs.batchname, '-') AS Batch_Name,scd.coursestatus as Course_Status,IFNULL(certiSt.courierdetails, '-') AS Courier_Details
|
|
FROM
|
|
(
|
|
SELECT app.ID,app.StudentID AS sid,app.CourseID AS cid,app.BranchCode AS branch,app.ListCode AS lcode,p.ListName AS STATUS,STR_TO_DATE(AppDate, '%d-%m-%Y'
|
|
)
|
|
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 AND bal.feestype = app.CertificationType
|
|
WHERE app.CertificationType NOT LIKE 'CERT%' AND app.ID IN (SELECT max(ID) FROM T_ApplicationStatus GROUP BY StudentID,CourseID,BranchCode,CertificationType)
|
|
GROUP BY app.ID) AS sms
|
|
LEFT JOIN
|
|
(SELECT FeesID AS fid,T_Students_Fees_Status.BatchCode AS batch,StudentID AS sid,CourseID AS cid,FeesType AS ftype,sum(CourseFees) AS cf,Sum(STFOrWR) AS stf,sum(Others) AS others,T_BatchMaster.BatchName as batchname
|
|
FROM T_Students_Fees_Status
|
|
left join T_BatchMaster on T_BatchMaster.BatchCode = T_Students_Fees_Status.BatchCode
|
|
GROUP BY sid,cid,fid)
|
|
AS sfs ON sfs.sid=sms.sid AND sfs.cid=sms.cid AND sfs.ftype=sms.ctype
|
|
LEFT JOIN
|
|
(SELECT sfp.StudentID AS sid,sfp.FeesId AS fid,sfs.CourseID AS cid,STR_TO_DATE(BillDate,'%d-%m-%Y') AS bdate,sum(BillAmount) AS bamount,BillNO AS billno FROM T_Students_Fees_PaidDetails sfp
|
|
LEFT JOIN T_Students_Fees_Status sfs ON sfs.FeesId=sfp.FeesId
|
|
WHERE IsActive = 1
|
|
GROUP BY sid,cid,fid)
|
|
AS sfb ON sfb.sid=sms.sid AND sfb.fid=sfs.fid
|
|
|
|
LEFT JOIN
|
|
(SELECT CourseID AS cid,cm.UniversityID AS cuid,u.UniversityID AS uid,CourseName AS course,
|
|
UniversityName AS uname,cm.BranchCode AS branch FROM T_CourseMaster AS cm
|
|
LEFT JOIN T_UniversityMaster AS u ON u.UniversityID=cm.UniversityID
|
|
GROUP BY cid
|
|
ORDER BY CourseID)
|
|
AS cm ON cm.cid=sms.cid
|
|
LEFT JOIN
|
|
(SELECT StudentID AS sid,MobileNumber AS phone,IsActive AS active,concat(FirstName,' ',Lastname) AS NAME,Fathername AS father,PermanentAddress AS address,AlternateNumber FROM T_StudentDetails) AS std ON std.sid=sms.sid
|
|
LEFT JOIN
|
|
(SELECT StudentID AS sid,UniversityID AS uid,CourseID AS cid,EnrollmentID AS eid,BranchID AS branch,ifnull(Status,'-') as coursestatus
|
|
FROM T_Student_CourseDetails) AS scd ON scd.sid=sms.sid AND scd.cid=sms.cid And scd.coursestatus not in ('Cancelled','Discontinued','Refund_issued')
|
|
LEFT JOIN
|
|
(SELECT StudentID AS sid, CourierDetails AS courierdetails FROM T_CertificationStatus cs
|
|
WHERE CDate IS NOT NULL AND ID IN (SELECT MAX(ID) FROM T_CertificationStatus WHERE CDate IS NOT NULL GROUP BY StudentID , Sem)
|
|
GROUP BY sid , Sem) AS certiSt ON certiSt.sid = sms.sid
|
|
|
|
|
|
where sms.branch = '".$br."'";
|
|
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.batch = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and cm.uid = '".$u."'";
|
|
|
|
}
|
|
if ($from != ''){
|
|
$fromd= date("Y-m-d",strtotime($from));
|
|
|
|
|
|
$sql.="and sfb.bdate >= '".$fromd."'
|
|
";
|
|
|
|
}
|
|
if ($to != ''){
|
|
$tod=date("Y-m-d",strtotime($to));
|
|
|
|
$sql.=" and sfb.bdate <= '".$tod."'";
|
|
|
|
}
|
|
if ($st != ''){
|
|
$sql.=" and sms.lcode = '".$st."'";
|
|
}
|
|
$sql.=" group by Student_id,cid,ctype";
|
|
$sql.=" ORDER BY sfb.bdate ASC";
|
|
//echo $sql;
|
|
|
|
// print_r($sql);die();
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$cert_statusDetails = $leadDet->result();
|
|
if (count($cert_statusDetails) > 0) {
|
|
$results['certList'] = true;
|
|
$results['cert_data'] = $cert_statusDetails;
|
|
} else {
|
|
$results['certList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function mark_cert_status($bat=null,$br=null,$u=null,$from=null,$to=null){
|
|
|
|
// $sql = "select sms.ID,sms.sid,sms.cid,sms.fid,sms.sem as Sem_year,ifnull(sms.certname,'-') as Certificate_name,sms.ctype,
|
|
// ifnull(sms.issuedate,'') as issuedate,sms.istatus,
|
|
// ifnull(sms.rcvedate,'-') as rdate,ifnull(sms.rstatus,'-') as rstatus,sms.acmts,ifnull(sms.balance,0) as Balance_fee,std.name as Student_name,std.father as Father_name,std.phone as Phone_number,cm.course as Course_name,cm.uname as University,mdate,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber
|
|
// from
|
|
// (select c.ID,c.StudentID as sid,sfs.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,Sem as sem,c.CertificationType as certname,c.CertificationType as ctype,CDate as mdate,balpayable as balance,
|
|
// if(ListName = 'ISSUED TO STUDENT', CDate,'-') as issuedate,if(ListName = 'ISSUED TO STUDENT', ListName,'-') as istatus,
|
|
// if(ListName = 'RECEIVED', CDate,'-') as rcvedate,if(ListName = 'RECEIVED', ListName,'-') as rstatus,c.Comments as acmts
|
|
// from T_CertificationStatus c
|
|
// left join T_Students_Fees_Status sfs on sfs.FeesType=c.CourseID and sfs.StudentID=c.StudentID
|
|
// left join T_PickListDetails list on list.ListCode=c.ListCode
|
|
// left join BalFees bal on bal.student=c.StudentID and bal.course=sfs.CourseID and bal.semyr=c.Sem
|
|
// where CDate is not null and (list.ListName like 'ISSUED TO STUDENT' or list.ListName like 'RECEIVED%' )
|
|
// group by sid,cid,sem,ctype
|
|
// union
|
|
// 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,
|
|
// if(ListName = 'ISSUED TO STUDENT', AppDate,'-') as issuedate,if(ListName = 'ISSUED TO STUDENT', ListName,'-') as istatus,
|
|
// if(ListName = 'RECEIVED', AppDate,'-') as rcvedate,if(ListName = 'RECEIVED', ListName,'-') as rstatus,a.Comments as acmts
|
|
// from T_ApplicationStatus a
|
|
// left join
|
|
// T_Students_Fees_Status sfs on sfs.StudentID=a.StudentID and sfs.CourseID=a.CourseID
|
|
// left join T_CertificationMaster cm on cm.CertificationID=a.CertificationType
|
|
// left join T_PickListDetails list on list.ListCode=a.ListCode
|
|
// left join (select student, course, sum(balpayable) balpayable from BalFees group by student, course) bal on bal.student=a.StudentID and bal.course=a.CourseID
|
|
// where cm.CertificateName not like 'APPLICATION%' and a.ID in (select Max(a.ID) from T_ApplicationStatus a
|
|
// left join T_CertificationMaster cm on cm.CertificationID=a.CertificationType
|
|
// group by a.StudentID,a.CourseID,a.CertificationType,cm.CertificateName) and (list.ListName like 'ISSUED TO STUDENT' or list.ListName like 'RECEIVED%' )
|
|
// group by sid,cid,ctype
|
|
// union
|
|
// 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,
|
|
// if(ListName = 'ISSUED TO STUDENT', AppDate,'-') as issuedate,if(ListName = 'ISSUED TO STUDENT', ListName,'-') as istatus,
|
|
// if(ListName = 'RECEIVED', AppDate,'-') as rcvedate,if(ListName = 'RECEIVED', ListName,'-') as rstatus,a.Comments as acmts
|
|
// from T_ApplicationStatus a
|
|
// left join
|
|
// T_Students_Fees_Status sfs on sfs.StudentID=a.StudentID and sfs.CourseID=a.CourseID
|
|
// left join T_CertificationMaster cm on cm.CertificationID=a.CertificationType
|
|
// left join T_PickListDetails list on list.ListCode=a.ListCode
|
|
// left join (select student, course, sum(balpayable) balpayable from BalFees group by student, course) bal on bal.student=a.StudentID and bal.course=a.CourseID
|
|
// where a.CertificationType not like 'CERT%' and a.ID in (select Max(a.ID) from T_ApplicationStatus a
|
|
// left join T_CertificationMaster cm on cm.CertificationID=a.CertificationType
|
|
// group by a.StudentID,a.CourseID,a.CertificationType,cm.CertificateName,a.ListCode) and (list.ListName like 'ISSUED TO STUDENT' or list.ListName like 'RECEIVED%' )
|
|
// group by sid,cid,ctype
|
|
// ) as sms
|
|
// 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
|
|
// FROM T_Students_Fees_Status
|
|
// group by sid,cid)
|
|
// as sfs on sfs.sid=sms.sid and sfs.cid=sms.cid
|
|
// left join
|
|
// (SELECT sfp.StudentID as sid,sfp.FeesId as fid,sfs.FeesType as ftype,sfs.CourseID as cid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails sfp
|
|
// left join T_Students_Fees_Status sfs on sfs.FeesId=sfp.FeesId
|
|
// where IsActive = 1
|
|
// group by sid,cid)
|
|
// as sfb on sfb.sid=sms.sid and sfb.fid=sms.fid and (sfb.ftype=sms.cid or sfb.cid=sms.cid)
|
|
// left join
|
|
// (SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
// UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
// left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
// group by cid
|
|
// order by CourseID)
|
|
// as cm on cm.cid=sms.cid
|
|
// left join
|
|
// (SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
// left join
|
|
// (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid
|
|
|
|
$sql="select sms.ID,sms.sid,sms.cid,sms.fid,sms.sem as Sem_year,ifnull(sms.certname,'-') as Certificate_name,sms.ctype,
|
|
ifnull(sms.issuedate,'') as issuedate,
|
|
ifnull(sms.rcvedate,'-') as rdate,sms.acmts,ifnull(sms.balance,0) as Balance_fee,std.name as Student_name,std.father as Father_name,std.phone as Phone_number,cm.course as Course_name,cm.uname as University,mdate,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber
|
|
from
|
|
(
|
|
SELECT g.ID, g.sid,g.cid,g.sem,g.branch, g.fid, g.certname, g.ctype, g.issuedate, h.rcvedate,if ((g.acmts is null or g.acmts = ''), h.acmts, g.acmts)as acmts,h.balance,g.mdate FROM
|
|
(SELECT c.ID,c.StudentID AS sid,sfs.CourseID AS cid,sfs.BranchCode AS branch,sfs.FeesID AS fid,Sem AS sem,c.CertificationType AS certname,c.CertificationType AS ctype,CDate AS mdate,balpayable AS balance,
|
|
IF(ListName = 'ISSUED TO STUDENT', CDate,'-') AS issuedate,IF(ListName = 'ISSUED TO STUDENT', ListName,'-') AS istatus,
|
|
IF(ListName = 'RECEIVED', CDate,'-') AS rcvedate,IF(ListName = 'RECEIVED', ListName,'-') AS rstatus,c.Comments AS acmts
|
|
FROM T_CertificationStatus c
|
|
LEFT JOIN T_Students_Fees_Status sfs ON sfs.FeesType=c.CourseID AND sfs.StudentID=c.StudentID
|
|
LEFT JOIN T_PickListDetails `list` ON list.ListCode=c.ListCode
|
|
LEFT JOIN BalFees bal ON bal.student=c.StudentID AND bal.course=sfs.CourseID AND bal.semyr=c.Sem
|
|
WHERE CDate IS NOT NULL AND (list.ListName LIKE 'ISSUED TO STUDENT' )) g
|
|
JOIN
|
|
(SELECT c.ID,c.StudentID AS sid,sfs.CourseID AS cid,sfs.BranchCode AS branch,sfs.FeesID AS fid,Sem AS sem,c.CertificationType AS certname,c.CertificationType AS ctype,CDate AS mdate,balpayable AS balance,
|
|
IF(ListName = 'ISSUED TO STUDENT', CDate,'-') AS issuedate,IF(ListName = 'ISSUED TO STUDENT', ListName,'-') AS istatus,
|
|
IF(ListName = 'RECEIVED', CDate,'-') AS rcvedate,IF(ListName = 'RECEIVED', ListName,'-') AS rstatus,c.Comments AS acmts
|
|
FROM T_CertificationStatus c
|
|
LEFT JOIN T_Students_Fees_Status sfs ON sfs.FeesType=c.CourseID AND sfs.StudentID=c.StudentID
|
|
LEFT JOIN T_PickListDetails `list` ON list.ListCode=c.ListCode
|
|
LEFT JOIN BalFees bal ON bal.student=c.StudentID AND bal.course=sfs.CourseID AND bal.semyr=c.Sem
|
|
WHERE CDate IS NOT NULL AND ( list.ListName LIKE 'RECEIVED%' ))h
|
|
ON g.sid = h.sid AND g.cid = h.cid AND g.sem = h.sem AND g.ctype = h.ctype
|
|
GROUP BY sid,cid,sem,ctype
|
|
union
|
|
SELECT g.ID, g.sid,g.cid,g.sem,g.branch, g.fid, g.ctype, g.ctype, g.issuedate, h.rcvedate,if ((g.acmts is null or g.acmts = ''), h.acmts, g.acmts)as acmts,h.balance,g.mdate FROM
|
|
(SELECT a.ID,a.StudentID AS sid,a.CourseID AS cid,sfs.BranchCode AS branch,sfs.FeesID AS fid,'-' AS sem, a.CertificationType AS ctype,AppDate AS mdate,bal.balpayable AS balance,
|
|
AppDate AS issuedate, ListName AS istatus, a.Comments AS acmts
|
|
FROM T_ApplicationStatus a
|
|
LEFT JOIN
|
|
T_Students_Fees_Status sfs ON sfs.StudentID=a.StudentID AND sfs.CourseID=a.CourseID
|
|
LEFT JOIN T_PickListDetails `list` ON list.ListCode=a.ListCode
|
|
LEFT JOIN (SELECT student, course, feestype, sum(balpayable) balpayable FROM BalFees GROUP BY student, course, feestype) bal ON bal.student=a.StudentID AND bal.course=a.CourseID AND bal.feestype = a.CertificationType
|
|
WHERE a.CertificationType NOT LIKE 'CERT%'
|
|
AND list.ListName LIKE 'ISSUED TO STUDENT') g
|
|
LEFT JOIN
|
|
(SELECT a.ID,a.StudentID AS sid,a.CourseID AS cid,sfs.BranchCode AS branch,sfs.FeesID AS fid,'-' AS sem, a.CertificationType AS ctype,AppDate AS mdate,bal.balpayable AS balance,
|
|
AppDate AS rcvedate, ListName AS rstatus,a.Comments AS acmts
|
|
FROM T_ApplicationStatus a
|
|
LEFT JOIN
|
|
T_Students_Fees_Status sfs ON sfs.StudentID=a.StudentID AND sfs.CourseID=a.CourseID
|
|
LEFT JOIN T_PickListDetails `list` ON list.ListCode=a.ListCode
|
|
LEFT JOIN (SELECT student, course, feestype, sum(balpayable) balpayable FROM BalFees GROUP BY student, course, feestype) bal ON bal.student=a.StudentID AND bal.course=a.CourseID AND bal.feestype = a.CertificationType
|
|
WHERE a.CertificationType NOT LIKE 'CERT%'
|
|
AND list.ListName LIKE 'RECEIVED%')h
|
|
ON g.sid = h.sid AND g.cid = h.cid AND g.sem = h.sem AND g.ctype = h.ctype
|
|
GROUP BY sid,cid,sem,ctype
|
|
) as sms
|
|
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
|
|
FROM T_Students_Fees_Status
|
|
group by sid,cid)
|
|
as sfs on sfs.sid=sms.sid and sfs.cid=sms.cid
|
|
left join
|
|
(SELECT sfp.StudentID as sid,sfp.FeesId as fid,sfs.FeesType as ftype,sfs.CourseID as cid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails sfp
|
|
left join T_Students_Fees_Status sfs on sfs.FeesId=sfp.FeesId
|
|
where IsActive = 1
|
|
group by sid,cid)
|
|
as sfb on sfb.sid=sms.sid and sfb.fid=sms.fid and (sfb.ftype=sms.cid or sfb.cid=sms.cid)
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID)
|
|
as cm on cm.cid=sms.cid
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
left join
|
|
(SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid
|
|
where sms.branch = '".$br."' ";
|
|
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.batch = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and cm.uid = '".$u."'";
|
|
|
|
}
|
|
if ($from != ''){
|
|
$fromd= date("Y-m-d",strtotime($from));
|
|
|
|
|
|
$sql.=" and STR_TO_DATE(sms.mdate,'%d-%m-%Y') >= '".$fromd."'
|
|
";
|
|
|
|
}
|
|
if ($to != ''){
|
|
$tod=date("Y-m-d",strtotime($to));
|
|
|
|
$sql.="
|
|
and STR_TO_DATE(sms.mdate,'%d-%m-%Y') <= '".$tod."'";
|
|
|
|
}
|
|
|
|
|
|
// echo $sql;
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$mcert_statusDetails = $leadDet->result();
|
|
if (count($mcert_statusDetails) > 0) {
|
|
$results['mark_certList'] = true;
|
|
$results['mark_cert_data'] = $mcert_statusDetails;
|
|
} else {
|
|
$results['mark_certList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function expense($from=null,$to=null,$br=null){
|
|
|
|
$sql = "SELECT ifnull(exp.TypeName,'-') as Expense_name,b.BranchName as branch,
|
|
ifnull(dbm.Date,'-') as date,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 1, dbm.Amount, 0)) AS January,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 2, dbm.Amount, 0)) AS February,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 3, dbm.Amount, 0)) AS March,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 4, dbm.Amount, 0)) AS April,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 5, dbm.Amount, 0)) AS May,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 6, dbm.Amount, 0)) AS June,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 7, dbm.Amount, 0)) AS July,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 8, dbm.Amount, 0)) AS August,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 9, dbm.Amount, 0)) AS September,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 10, dbm.Amount, 0)) AS October,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) = 11, dbm.Amount, 0)) AS November,
|
|
SUM(IF(month(STR_TO_DATE(dbm.Date,'%d-%m-%Y')) =12, dbm.Amount, 0)) AS December,ifnull(sum(dbm.Amount),0) as total
|
|
FROM T_Income_Outcome_Master exp
|
|
join T_DayBookMaster dbm on dbm.Type=exp.ID
|
|
left join T_BranchMaster b on b.BranchCode=exp.BranchCode
|
|
where dbm.Name = 'I001' and exp.TypeName not like 'FEES' AND dbm.IsActive ='1' AND dbm.Status != 'Cancel' and exp.BranchCode = '".$br."'
|
|
";
|
|
|
|
if ($from != ''){
|
|
$fromd= date("Y-m-d",strtotime($from));
|
|
$sql.="and STR_TO_DATE(dbm.Date,'%d-%m-%Y') >= '".$fromd."'
|
|
";
|
|
|
|
}
|
|
if ($to != ''){
|
|
$tod=date("Y-m-d",strtotime($to));
|
|
$sql.=" and STR_TO_DATE(dbm.Date,'%d-%m-%Y') <= '".$tod."'";
|
|
|
|
}
|
|
$sql.=" group by Expense_name";
|
|
//echo $sql;
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$expense = $leadDet->result();
|
|
if (count($expense) > 0) {
|
|
$results['expenseList'] = true;
|
|
$results['expense_data'] = $expense;
|
|
} else {
|
|
$results['expenseList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function answer_booklet($bat=null,$br=null,$u=null){
|
|
|
|
$sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(sfs.batch,'-') as Batch_code,ifnull(sms.branch,'-') as Branch_code,ifnull(sms.adate,'-') as Date,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.sem,'-') as Sem,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(list.status,'-') as Status,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber,ifnull(idate.issuedate,'-') as issuedate,ifnull(rdate.rcvedate,'-') as rcvedate,ifnull(bal.balpayable,'-') as balance, sms.CourierDetails as CD
|
|
|
|
from
|
|
(SELECT ID,StudentID as sid,CourseID as cid,BranchCode as branch,ListCode as lcode,AnsDate as
|
|
adate,Sem as sem, CourierDetails FROM T_AnswerBookletStatus
|
|
WHERE ID IN (SELECT max(ID) FROM T_AnswerBookletStatus group by StudentID,CourseID,BranchCode,Sem)
|
|
group by sid,sem,cid,lcode,branch) as sms
|
|
|
|
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
|
|
FROM T_Students_Fees_Status
|
|
group by sid,fid,cid,batch)
|
|
as sfs on sfs.sid=sms.sid and sms.cid=sfs.ftype
|
|
left join
|
|
(SELECT StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails
|
|
where IsActive = 1
|
|
group by sid,fid)
|
|
as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid
|
|
left join
|
|
(SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=sfs.cid and cfd.cid=sfs.ftype
|
|
left join
|
|
(SELECT ListCode as lcode,ListName as status FROM T_PickListDetails)
|
|
as list on list.lcode=sms.lcode
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID)
|
|
as cm on cm.cid=cfd.ccid
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid
|
|
left join
|
|
(select ID,StudentID as sid,Sem as sem,
|
|
if(ListName like 'RECEIVED FROM STUDENT', AnsDate,'-') as rcvedate
|
|
from T_AnswerBookletStatus abs
|
|
left join T_PickListDetails list on list.ListCode=abs.ListCode where AnsDate is not null and
|
|
ID in (select max(ID) from T_AnswerBookletStatus where AnsDate is not null group by StudentID,Sem)
|
|
group by sid,Sem
|
|
) as rdate on rdate.sid=sms.sid and rdate.sem=sms.sem
|
|
left join
|
|
(select ID,StudentID as sid,Sem as sem,
|
|
if(ListName like 'ISSUED TO STUDENT', AnsDate,'-') as issuedate
|
|
from T_AnswerBookletStatus abs
|
|
left join T_PickListDetails list on list.ListCode=abs.ListCode where AnsDate is not null and
|
|
ID in (select min(ID) from T_AnswerBookletStatus where AnsDate is not null group by StudentID,Sem)
|
|
group by sid,Sem) as idate on idate.sid=sms.sid and idate.sem=sms.sem
|
|
left join BalFees bal on bal.student=sms.sid and bal.feestype=sms.cid and bal.semyr=sms.sem
|
|
where std.active = 1 and sms.branch = '".$br."'
|
|
";
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.batch = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and cm.uid = '".$u."'";
|
|
|
|
}
|
|
$sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem";
|
|
|
|
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
if (count($answer) > 0) {
|
|
$results['ans_bookletList'] = true;
|
|
$results['ans_book_data'] = $answer;
|
|
} else {
|
|
$results['ans_bookletList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function app_pending($bat=null,$br=null,$u=null,$st=null,$from=null,$to=null,$udate=null){
|
|
|
|
|
|
|
|
$sql1 = "SELECT
|
|
APFS.ID as id,
|
|
ifnull(APFS.Registration_Details_ID,'-') AS regid,
|
|
APFS.ListCode as StatusCode,
|
|
ifnull(APFS.AppFormDate,'-') as StatusUpdationOn,
|
|
ifnull(APFS.Comments,'-') as StatusComments,
|
|
PKL.ListName as StatusName,
|
|
concat(STU.Firstname,' ', STU.Lastname) as Student_name,
|
|
STU.Fathername as FatherName,
|
|
STU.MobileNumber as Phone_number,
|
|
STU.AlternateNumber as AlternateNumber,
|
|
STU.PresentAddress as address,
|
|
COUR.CourseName as Course_name,
|
|
UNIV.UniversityName as University,
|
|
ifnull(sfpd.BILL,'-') as InitialPayDate,
|
|
RD.Student_Fee_Status_Id as FeesStatusID,
|
|
ifnull(STU_COUR.EnrollmentID,'-') as EnrollmentNumber,
|
|
CFD.Sem_Year as Sem_Year,
|
|
RD.RegistrationType as FormType,
|
|
STU.StudentID as Student_id,ifnull(sfs.RollNo,'-') as StudentRollNo,
|
|
(sfs.CourseFees + sfs.STFOrWR + sfs.Others - sfs.Waiver) as CourseFees,
|
|
sfpd.BillAmount AS paidAmount,
|
|
((sfs.CourseFees + sfs.STFOrWR + sfs.Others - sfs.Waiver) - sfpd.BillAmount) AS balance
|
|
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, BillAmount AS BillAmount FROM T_Students_Fees_PaidDetails GROUP BY FeesId) AS sfpd ON sfpd.FeeID = RD.Student_Fee_Status_Id
|
|
LEFT JOIN T_Students_Fees_Status as sfs ON sfs.FeesID=RD.Student_Fee_Status_Id
|
|
WHERE STU.IsActive = '1' and APFS.ID in (select max(ID) from T_ApplicationFormStatus group by Registration_Details_ID)
|
|
|
|
";
|
|
|
|
|
|
$sql ="SELECT
|
|
APFS.ID as id,
|
|
ifnull(APFS.Registration_Details_ID,'-') AS regid,
|
|
APFS.ListCode as StatusCode,
|
|
ifnull(APFS.AppFormDate,'-') as StatusUpdationOn,
|
|
ifnull(APFS.Comments,'-') as StatusComments,
|
|
PKL.ListName as StatusName,
|
|
concat(STU.Firstname,' ', STU.Lastname) as Student_name,
|
|
STU.Fathername as FatherName,
|
|
STU.MobileNumber as Phone_number,
|
|
STU.AlternateNumber as AlternateNumber,
|
|
STU.PresentAddress as address,
|
|
COUR.CourseName as Course_name,
|
|
UNIV.UniversityName as University,
|
|
ifnull(sfpd.BILL,'-') as InitialPayDate,
|
|
RD.Student_Fee_Status_Id as FeesStatusID,
|
|
ifnull(STU_COUR.EnrollmentID,'-') as EnrollmentNumber,
|
|
CFD.Sem_Year as Sem_Year,
|
|
RD.RegistrationType as FormType,
|
|
STU.StudentID as Student_id,ifnull(sfs.RollNo,'-') as StudentRollNo,
|
|
ifnull(STU_COUR.Status,'-') as StuCourStatus,
|
|
BALFEE.totalpayable as CourseFees,
|
|
BALFEE.totalpaid AS paidAmount,
|
|
BALFEE.balpayable AS balance
|
|
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 and (STU_COUR.Status != 'Cancelled' or STU_COUR.Status != 'Discontinued' or STU_COUR.Status != 'Refund_issued')
|
|
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 BalFees AS BALFEE ON BALFEE.student = STU.StudentID
|
|
LEFT JOIN (SELECT FeesId AS FeeID, min(CreatedOn), BillDate AS BILL, BillAmount AS BillAmount FROM T_Students_Fees_PaidDetails GROUP BY FeesId) AS sfpd ON sfpd.FeeID = RD.Student_Fee_Status_Id
|
|
LEFT JOIN T_Students_Fees_Status as sfs ON sfs.FeesID=RD.Student_Fee_Status_Id and sfs.StudentID = RD.StudentID
|
|
WHERE STU.IsActive = '1' and APFS.ID in (select max(ID) from T_ApplicationFormStatus group by Registration_Details_ID)
|
|
|
|
";
|
|
//sfs.RollNo as StudentRollNo
|
|
|
|
// LEFT JOIN T_Students_Fees_Status as sfs ON sfs.FeesID=sfpd.FeeID
|
|
|
|
// 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
|
|
// 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
|
|
// ORDER BY StatusUpdationOn DESC) x
|
|
// GROUP BY x.regid
|
|
|
|
// $sql = "SELECT
|
|
// APFS.ListCode as StatusCode,
|
|
// APFS.AppFormDate as StatusUpdationOn,
|
|
// APFS.Comments as StatusComments,
|
|
// PKL.ListName as StatusName,
|
|
// concat(STU.Firstname,' ', STU.Lastname) as Student_name,
|
|
// STU.Fathername as FatherName,
|
|
// STU.MobileNumber as Phone_number,
|
|
// STU.AlternateNumber as AlternateNumber,
|
|
// STU.PresentAddress as address,
|
|
// COUR.CourseName as Course_name,
|
|
// UNIV.UniversityName as University,
|
|
// 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
|
|
// 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'
|
|
// group by APFS.Registration_Details_ID";
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and RD.BatchCode = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
if($u=="all"){
|
|
$this->db->select('UniversityID');
|
|
$this->db->where('IsActive','1');
|
|
$this->db->where('BranchCode',$br);
|
|
$university = $this->db->get(UNIVERSITY);
|
|
$q = [];
|
|
for($i = 0 ; $i<count($university->result());$i++)
|
|
{
|
|
$q[$i] = $university->result()[$i]->UniversityID;
|
|
}
|
|
$sql.=" and COUR.UniversityID in ('".implode("','",$q)."')";
|
|
|
|
}
|
|
else{
|
|
$sql.=" and COUR.UniversityID = '".$u."'";
|
|
}
|
|
}
|
|
|
|
if($st != ''){
|
|
if($st=="all"){
|
|
$resn = $this->db->query("select ListCode from T_PickListDetails where T_PickListDetails.IsActive = 1 and T_PickListDetails.BranchCode = ? and T_PickListDetails.ListName in ('RECEIVED','PENDING') order by T_PickListDetails.ListGroup desc;",array($br));
|
|
$list = $resn->result();
|
|
$q = [];
|
|
for($i = 0 ; $i<count($list);$i++)
|
|
{
|
|
$q[$i] = $list[$i]->UniversityID;
|
|
}
|
|
$sql.=" and APFS.ListCode in ('".implode("','",$q)."')";
|
|
|
|
}
|
|
else{
|
|
$sql.=" and APFS.ListCode = '".$st."'";
|
|
}
|
|
}
|
|
if ($from != ''){
|
|
$fromd= date("Y-m-d",strtotime($from));
|
|
$sql.="and STR_TO_DATE(BALFEE.CreatedOn,'%d-%m-%Y') >= '".$fromd."'";
|
|
}
|
|
if ($to != ''){
|
|
$tod=date("Y-m-d",strtotime($to));
|
|
$sql.=" and STR_TO_DATE(BALFEE.CreatedOn,'%d-%m-%Y') <= '".$tod."'";
|
|
}
|
|
if ($udate != ''){
|
|
$ud=date("Y-m-d",strtotime($udate));
|
|
$sql.=" and STR_TO_DATE(APFS.AppFormDate,'%d-%m-%Y') = '".$ud."'";
|
|
}
|
|
|
|
|
|
$sql.=" and STU_COUR.IsActive='1'";
|
|
$sql.=" and STU.BranchCode='".$br."'";
|
|
$sql.=" and sfs.FeesID IS not null";
|
|
$sql.=" group by regid,Student_id,RD.CourseID,Sem_Year ";
|
|
$sql.=" ORDER BY StatusUpdationOn,InitialPayDate ASC ";
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
if (count($answer) > 0) {
|
|
$results['app_pendingList'] = true;
|
|
$results['app_pending_data'] = $answer;
|
|
} else {
|
|
$results['app_pendingList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
|
|
//print_r($this->db->last_query());die();
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function app_pending_old($bat=null,$br=null,$u=null){
|
|
|
|
$sql = "select a.StudentID as Student_id,
|
|
a.CourseID as cid,
|
|
a.BranchCode as branch,
|
|
a.ListCode as lcode,
|
|
ifnull(a.AppDate,'-') as adate,
|
|
a.CertificationType as ctype,
|
|
ifnull(sfs.BatchCode,'-') as batch,
|
|
list.ListName as StatusName,
|
|
ifnull(sfp.bill,'-') as init_date,
|
|
concat(STU.Firstname,' ', STU.Lastname) as Student_name,
|
|
STU.Fathername as FatherName,
|
|
STU.MobileNumber as Phone_number,
|
|
STU.AlternateNumber as AlternateNumber,
|
|
STU.PermanentAddress as address,
|
|
ifnull(STU_COUR.EnrollmentID,'-') as eid,
|
|
COUR.CourseName as Course_name,
|
|
UNIV.UniversityName as University,ifnull(sfs.RollNo,'-') as StudentRollNo
|
|
from T_ApplicationStatus a
|
|
left join T_Students_Fees_Status sfs on sfs.StudentID = a.StudentID and sfs.CourseID = a.CourseID
|
|
left join (SELECT StudentID,FeesId AS FeesID, min(CreatedOn), BillDate AS bill FROM T_Students_Fees_PaidDetails GROUP BY FeesId) as sfp on sfp.StudentID = sfs.StudentID and sfp.FeesID = sfs.FeesID
|
|
left join T_PickListDetails list on list.ListCode = a.ListCode
|
|
left join T_StudentDetails AS STU ON STU.StudentID = a.StudentID
|
|
left join T_CourseMaster AS COUR ON COUR.CourseID = a.CourseID
|
|
LEFT JOIN T_UniversityMaster AS UNIV ON UNIV.UniversityID = COUR.UniversityID
|
|
LEFT JOIN T_Student_CourseDetails AS STU_COUR ON STU_COUR.StudentID = a.StudentID AND STU_COUR.CourseID = a.CourseID
|
|
left join T_CertificationMaster cert on cert.CertificationID=a.CertificationType
|
|
where a.ID in (select max(ID) from T_ApplicationStatus group by StudentID,CourseID,CertificationType) and cert.CertificateName like 'APPLICATION%'
|
|
|
|
";
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.BatchCode = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and UNIV.UniversityID = '".$u."'";
|
|
|
|
}
|
|
$sql.=" group by Student_id,cid,ctype";
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
if (count($answer) > 0) {
|
|
$results['app_pendingList'] = true;
|
|
$results['app_pending_oldData'] = $answer;
|
|
} else {
|
|
$results['app_pendingList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function doc_pending($bat=null,$br=null,$u=null){
|
|
// print_r($br);
|
|
// print_r($u);
|
|
// print_r($bat);die();
|
|
if ($u!= '' and $bat!= ''){
|
|
|
|
|
|
$sql ="select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sms.status,'-') as Status,sms.certname as certname,ifnull(sfp.bdate,'-') as Admission_date,ifnull(sms.follow_date,'-') as fdate,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber
|
|
from
|
|
(select StudentID as sid,CourseID as cid,Details as certname,DocumentDate as follow_date,StatusName as status
|
|
from T_Student_DocumentTrack_Details
|
|
where StatusName not like 'CLOSED' and CourseID is not null) as sms
|
|
left join
|
|
(SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,BranchCode as branch
|
|
FROM T_Students_Fees_Status
|
|
group by sid,fid,cid,batch)
|
|
as sfs on sfs.sid=sms.sid and sfs.cid = sms.cid
|
|
left join
|
|
(SELECT ID,StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails
|
|
WHERE IsActive = 1 and ID IN (SELECT min(ID) FROM T_Students_Fees_PaidDetails group by StudentID,FeesID)
|
|
group by sid,fid,billno)
|
|
as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid
|
|
left join
|
|
(SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=sms.cid
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID)
|
|
as cm on cm.cid=cfd.ccid
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber,BranchCode FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid
|
|
where std.active = 1 and sfs.batch = '".$bat."' and cm.uid = '".$u."' and std.BranchCode= '".$br."'
|
|
group by Student_id,Course_id,certname ";
|
|
|
|
}
|
|
//if ($u!= '' and $bat = '')
|
|
else{
|
|
|
|
$sql ="select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(sms.cid,'-') as Course_id,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sms.status,'-') as Status,sms.certname as certname,ifnull(sfp.bdate,'-') as Admission_date,ifnull(sms.follow_date,'-') as fdate,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber
|
|
from
|
|
(select StudentID as sid,CourseID as cid,Details as certname,DocumentDate as follow_date,StatusName as status
|
|
from T_Student_DocumentTrack_Details
|
|
where StatusName not like 'CLOSED' and CourseID is not null) as sms
|
|
left join
|
|
(SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,BranchCode as branch
|
|
FROM T_Students_Fees_Status
|
|
group by sid,fid,cid,batch)
|
|
as sfs on sfs.sid=sms.sid and sfs.cid = sms.cid
|
|
left join
|
|
(SELECT ID,StudentID as sid,FeesId as fid,BillDate as bdate,sum(BillAmount) as bamount,BillNO as billno FROM T_Students_Fees_PaidDetails
|
|
WHERE IsActive = 1 and ID IN (SELECT min(ID) FROM T_Students_Fees_PaidDetails group by StudentID,FeesID)
|
|
group by sid,fid,billno)
|
|
as sfp on sfp.sid=sfs.sid and sfp.fid=sfs.fid
|
|
left join
|
|
(SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=sms.cid
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID)
|
|
as cm on cm.cid=cfd.ccid
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber,BranchCode FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid
|
|
where std.active = 1 and cm.uid = '".$u."' and std.BranchCode= '".$br."'
|
|
group by Student_id,Course_id,certname ";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
if (count($answer) > 0) {
|
|
$results['doc_pendingList'] = true;
|
|
$results['doc_pending_data'] = $answer;
|
|
} else {
|
|
$results['doc_pendingList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function wav_ref($bat=null,$br=null,$u=null){
|
|
|
|
$sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(cfd.syear,'-') as Sem_year,ifnull(sfs.batch,'-') as Batch_code,ifnull(scd.branch,'-') as Branch_code,ifnull(sfs.cid,'-') as Course_id,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,staff.FirstName as staffname,ifnull(sms.waiver_bill,'-') as Waiver_bill,ifnull(sms.waiver,0) as Waiver_amount,ifnull(sms.referal_bill,'-') as Referal_bill,ifnull(sms.referal,0) as Referal_amount,concat(sta.FirstName,' ',sta.Lastname)as Stafname,ifnull(sms.cmts,'-') as Comments,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber
|
|
from
|
|
(SELECT StudentID as sid,CreatedBy as lid,CommentsForStudent as cmts,FeesId as fid,
|
|
IF(ModeOfPayment = 'WAIVER', BillNO,'-') AS waiver_bill,
|
|
IF(ModeOfPayment = 'WAIVER', sum(BillAmount), 0) AS waiver,
|
|
IF(ModeOfPayment = 'REFERRAL', BillNO,'-') AS referal_bill,
|
|
IF(ModeOfPayment = 'REFERRAL', sum(BillAmount), 0) AS referal FROM T_Students_Fees_PaidDetails
|
|
where IsActive = 1 and ModeOfPayment = 'WAIVER' or ModeOfPayment = 'REFERRAL'
|
|
group by fid,waiver_bill,referal_bill) as sms
|
|
left join
|
|
(SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype FROM T_Students_Fees_Status
|
|
group by sid,cid,fid,batch) as sfs on sfs.sid=sms.sid and sfs.fid=sms.fid
|
|
left join
|
|
(SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=sfs.cid and cfd.cid=sfs.ftype
|
|
left join
|
|
(SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sfs.sid and scd.cid=sfs.cid
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID)
|
|
as cm on cm.cid=cfd.ccid
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,AdmittedBy ,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
left join
|
|
T_Login as login on login.ID=sms.lid
|
|
left join
|
|
T_StaffDetails as staff on staff.StaffID=login.StaffID
|
|
left join
|
|
T_StaffDetails as sta on sta.StaffID=std.AdmittedBy
|
|
|
|
where std.active = 1 and scd.branch = '".$br."'
|
|
|
|
|
|
";
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.batch = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and cm.uid = '".$u."'";
|
|
|
|
}
|
|
$sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Waiver_bill,Referal_bill,Sem_year";
|
|
|
|
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
if (count($answer) > 0) {
|
|
$results['wav_refList'] = true;
|
|
$results['wav_ref_data'] = $answer;
|
|
} else {
|
|
$results['wav_refList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function examfee($bat=null,$br=null,$u=null){
|
|
|
|
$sql = "select ifnull(sms.sid,'-') as Student_id,ifnull(scd.eid,'-') as Enrollment_id,ifnull(std.name,'-') as Student_name,ifnull(std.father,'-') as Father_name,ifnull(std.phone,'-') as Phone_number,ifnull(cfd.syear,'-') as Sem_year,ifnull(sms.batch,'-') as Batch_code,ifnull(cm.course,'-') as Course_name,ifnull(cm.uname,'-') as University,ifnull(sms.cid,'-') as Course_id,ifnull(sms.cmts,'-') as Comments,ifnull(sms.stf,'-') as Amount,ifnull(sms.branch,'-') as Branch_code,ifnull(std.address,'-') as address,concat(sta.FirstName,' ',sta.Lastname)as Stafname,ifnull(std.AlternateNumber,'') as AlternateNumber
|
|
from
|
|
(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,Comments as cmts,BranchCode as branch FROM T_Students_Fees_Status
|
|
where STFOrWR != ''
|
|
group by sid,fid,batch,cid) as sms
|
|
left join
|
|
(SELECT StudentID as sid,UniversityID as uid,CourseID as cid,EnrollmentID as eid,BranchID as branch FROM T_Student_CourseDetails) as scd on scd.sid=sms.sid and scd.cid=sms.cid
|
|
|
|
left join
|
|
(SELECT ID as cid,CourseID as ccid,FeesType as ftype,Sem_Year as syear FROM T_Course_Fees_Details) as cfd on cfd.ccid=sms.cid and cfd.cid=sms.ftype
|
|
left join
|
|
(SELECT CourseID as cid,cm.UniversityID as cuid,u.UniversityID as uid,CourseName as course,
|
|
UniversityName as uname,cm.BranchCode as branch FROM T_CourseMaster as cm
|
|
left join T_UniversityMaster as u on u.UniversityID=cm.UniversityID
|
|
group by cid
|
|
order by CourseID)
|
|
as cm on cm.cid=sms.cid
|
|
|
|
left join
|
|
(SELECT StudentID as sid,MobileNumber as phone,IsActive as active,AdmittedBy,concat(FirstName,' ',Lastname) as name,Fathername as father,PermanentAddress as address,AlternateNumber FROM T_StudentDetails) as std on std.sid=sms.sid
|
|
|
|
left join
|
|
T_StaffDetails as sta on sta.StaffID=std.AdmittedBy
|
|
where std.active = 1 and sms.branch = '".$br."'
|
|
";
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sms.batch = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and cm.uid = '".$u."'";
|
|
|
|
}
|
|
$sql.=" group by Student_id,Course_id,Batch_code,Branch_code,Sem_year";
|
|
|
|
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
if (count($answer) > 0) {
|
|
$results['examfeeList'] = true;
|
|
$results['examfee_data'] = $answer;
|
|
} else {
|
|
$results['examfeeList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function balfee($bat=null,$br=null,$u=null){
|
|
|
|
$sql = "SELECT ifnull(sfp.StudentID,'-') as Student_id,scd.EnrollmentID as eid,IF(scd.Status IS NULL,scd.IsActive,scd.Status) as course_status,sfs.CourseID as cid,std.MobileNumber as Phone_number,concat(FirstName,' ',Lastname) as Student_name,Fathername as Father_name,PermanentAddress as address,AlternateNumber,ifnull(date_format(std.CreatedOn,'%d-%m-%Y'),'-') as regdate,cm.CourseName as Course_name,u.UniversityName as University,sfp.FeesID as fid,(sfs.CourseFees + sfs.STFOrWR + sfs.Others) as Total,ifnull(bal.totalpaid,0) as Paid_fee,sfs.CourseFees , sfs.STFOrWR , sfs.Others,((sfs.CourseFees + sfs.STFOrWR + sfs.Others) - ifnull(bal.totalpaid,0)) as balance,ifnull((sfs.CourseFees + sfs.STFOrWR + sfs.Others) - ifnull(bal.totalpaid,0),0) as bal,ifnull(cfd.Sem_Year,'-') as Sem_year,std.PermanentAddress as address,std.AlternateNumber as AlternateNumber,
|
|
ifnull(MAX(CASE WHEN Installment = 1 THEN sfp.BillNO END),'-') as billno1,
|
|
ifnull(MAX(CASE WHEN Installment = 1 THEN sfp.BillAmount END),0) as billamt1,
|
|
ifnull(MAX(CASE WHEN Installment = 2 THEN sfp.BillNO END),'-') as billno2,
|
|
ifnull(MAX(CASE WHEN Installment = 2 THEN sfp.BillAmount END),0) as billamt2,
|
|
ifnull(MAX(CASE WHEN Installment = 3 THEN sfp.BillNO END),'-') as billno3,
|
|
ifnull(MAX(CASE WHEN Installment = 3 THEN sfp.BillAmount END),0) as billamt3,
|
|
ifnull(MAX(CASE WHEN Installment = 4 THEN sfp.BillNO END),'-') as billno4,
|
|
ifnull(MAX(CASE WHEN Installment = 4 THEN sfp.BillAmount END),0) as billamt4,
|
|
ifnull(MAX(CASE WHEN Installment = 5 THEN sfp.BillNO END),'-') as billno5,
|
|
ifnull(MAX(CASE WHEN Installment = 5 THEN sfp.BillAmount END),0) as billamt5,
|
|
ifnull(MAX(CASE WHEN Installment = 6 THEN sfp.BillNO END),'-') as billno6,
|
|
ifnull(MAX(CASE WHEN Installment = 6 THEN sfp.BillAmount END),0) as billamt6,
|
|
ifnull(MAX(CASE WHEN Installment = 7 THEN sfp.BillNO END),'-') as billno7,
|
|
ifnull(MAX(CASE WHEN Installment = 7 THEN sfp.BillAmount END),0) as billamt7,
|
|
ifnull(MAX(CASE WHEN Installment = 8 THEN sfp.BillNO END),'-') as billno8,
|
|
ifnull(MAX(CASE WHEN Installment = 8 THEN sfp.BillAmount END),0) as billamt8,
|
|
ifnull(MAX(CASE WHEN Installment = 9 THEN sfp.BillNO END),'-') as billno9,
|
|
ifnull(MAX(CASE WHEN Installment = 9 THEN sfp.BillAmount END),0) as billamt9,
|
|
ifnull(MAX(CASE WHEN Installment = 10 THEN sfp.BillNO END),'-') as billno10,
|
|
ifnull(MAX(CASE WHEN Installment = 10 THEN sfp.BillAmount END),0) as billamt10
|
|
|
|
FROM T_Students_Fees_PaidDetails as sfp
|
|
right join T_Students_Fees_Status sfs on sfs.FeesID=sfp.FeesID
|
|
left join T_Course_Fees_Details cfd on cfd.ID=sfs.FeesType
|
|
left join T_CourseMaster cm on cm.CourseID=sfs.CourseID
|
|
left join T_UniversityMaster u on u.UniversityID=cm.UniversityID
|
|
left join T_StudentDetails std on std.StudentID=sfs.StudentID and std.IsActive = 1
|
|
left join T_Student_CourseDetails scd on scd.StudentID=sfs.StudentID and scd.CourseID=sfs.CourseID
|
|
left join BalFees as bal on bal.student=sfp.StudentID and bal.course=sfs.CourseID and bal.feestype=sfs.FeesType
|
|
where std.BranchCode='".$br."'
|
|
|
|
";
|
|
|
|
if ($bat!= ''){
|
|
|
|
$sql.=" and sfs.BatchCode = '".$bat."'";
|
|
|
|
}
|
|
if ($u!= ''){
|
|
|
|
$sql.=" and u.UniversityID = '".$u."'";
|
|
|
|
}
|
|
$sql.=" group by sfs.FeesID, sfs.StudentID";
|
|
|
|
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
|
|
|
|
|
|
if (count($answer) > 0) {
|
|
$results['balfeeList'] = true;
|
|
$results['balfee_data'] = $answer;
|
|
} else {
|
|
$results['balfeeList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
|
|
// print_r($this->db->last_query());die();
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function lead($univ=null,$act=null,$sta=null,$ass=null,$from=null,$to=null,$br=null){
|
|
|
|
$sql = "select InteractionID,ifnull(date_format(ltf.CreatedOn,'%d-%m-%Y'),'-') as date,ltf.TrackingID as tid,ifnull(ltf.FollowupOn,'-') as fup,ld.LeadName as name,ifnull(ld.MobileNumber,'-') as mobile,lt.University as univ,lt.Course as course,lt.Course as prvStatus,list.ListName as prsStatus,ltf.FollowupComments as cmnts,ifnull(am.ActivityName,'-') as activity,sd.FirstName as AssignTo
|
|
from T_Lead_Tracking_Followup as ltf
|
|
left join T_Lead_Tracking lt on lt.TrackingID=ltf.TrackingID
|
|
join T_Login l on l.ID=lt.AssignedTo
|
|
join T_StaffDetails sd on sd.StaffID=l.StaffID
|
|
left join T_Lead_Details ld on ld.LeadID=lt.LeadID
|
|
left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus
|
|
join T_PickListDetails list on list.ListCode=ltf.StatusName
|
|
where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) and lt.CreatedBranch = '".$br."'
|
|
|
|
";
|
|
if ($univ != ''){
|
|
$sql.=" and lt.University = '".$univ."'
|
|
";
|
|
}
|
|
if ($act != ''){
|
|
$sql.=" and am.ActivityID = '".$act."'
|
|
";
|
|
}
|
|
if ($sta != ''){
|
|
$sql.=" and list.ListCode = '".$sta."'
|
|
";
|
|
}
|
|
if ($ass != ''){
|
|
$sql.=" and sd.StaffID = '".$ass."'
|
|
";
|
|
}
|
|
if ($from != ''){
|
|
$fromd= date("Y-m-d",strtotime($from));
|
|
|
|
|
|
$sql.=" and date(ltf.CreatedOn) >= '".$fromd."'
|
|
";
|
|
|
|
}
|
|
if ($to != ''){
|
|
$tod=date("Y-m-d",strtotime($to));
|
|
|
|
$sql.="
|
|
and date(ltf.CreatedOn) <= '".$tod."'";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$leadDet=$this->db->query($sql);
|
|
$answer = $leadDet->result();
|
|
|
|
//echo $sql;
|
|
|
|
if (count($answer) > 0) {
|
|
$results['leadList'] = true;
|
|
$results['lead_data'] = $answer;
|
|
} else {
|
|
$results['leadList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
|
public function getUniversity($br=null)
|
|
{
|
|
$this->db->select('UniversityID,UniversityName');
|
|
$this->db->where('IsActive','1');
|
|
$this->db->where('BranchCode',$br);
|
|
$this->db->order_by('CreatedOn','DESC');
|
|
$university = $this->db->get(UNIVERSITY);
|
|
|
|
if($university->result()){
|
|
$result = array();
|
|
$result['univlist'] = true;
|
|
foreach ($university->result() as $row)
|
|
{
|
|
|
|
$university_array['universityID'] = $row->UniversityID;
|
|
$university_array['universityName'] = $row->UniversityName;
|
|
$university_array['batchDetails']= $this->getBatch($row->UniversityID,$br);
|
|
$result_array[]=$university_array;
|
|
}
|
|
$result['university']= $result_array;
|
|
}
|
|
else {
|
|
$result['univlist'] = false;
|
|
$result['message'] = "No records found!";
|
|
$result['universityID'] = "";
|
|
$result['universityName'] = "";
|
|
$result['batchDetails']= "";
|
|
}
|
|
// print_r( $this->db->last_query());
|
|
// die();
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
public function getBatch($universityID=null,$br=null)
|
|
{
|
|
$this->db->select('BatchCode,BatchName,str_to_date(BatchDate, "%d-%m-%Y") BatchDate');
|
|
$this->db->where('UniversityID',$universityID);
|
|
//$this->db->where('IsActive','1');
|
|
$this->db->where('BranchCode',$br);
|
|
$this->db->order_by('BatchDate','DESC');
|
|
$batchDetails = $this->db->get(BATCH);
|
|
return $batchDetails->result();
|
|
}
|
|
public function getUniversity2($br=null)
|
|
{
|
|
$this->db->select('UniversityID,UniversityName');
|
|
$this->db->where('BranchCode',$br);
|
|
$this->db->order_by('CreatedOn','DESC');
|
|
$university = $this->db->get(UNIVERSITY);
|
|
if($university->result()){
|
|
$result = array();
|
|
$result['univlist'] = true;
|
|
foreach ($university->result() as $row)
|
|
{
|
|
|
|
$university_array['universityID'] = $row->UniversityID;
|
|
$university_array['universityName'] = $row->UniversityName;
|
|
$university_array['batchDetails']= $this->getBatch($row->UniversityID,$br);
|
|
$result_array[]=$university_array;
|
|
}
|
|
$result['university']= $result_array;
|
|
}
|
|
else {
|
|
$result['univlist'] = false;
|
|
$result['message'] = "No records found!";
|
|
$result['universityID'] = "";
|
|
$result['universityName'] = "";
|
|
$result['batchDetails']= "";
|
|
}
|
|
// print_r( $this->db->last_query());
|
|
// die();
|
|
|
|
return $result;
|
|
|
|
}
|
|
public function GetAllUniversity($branchId)
|
|
{
|
|
$this->db->select('UniversityID,UniversityName');
|
|
$this->db->from('T_UniversityMaster');
|
|
$this->db->where('T_UniversityMaster.BranchCode',$branchId);
|
|
$searchDetails = $this->db->get();
|
|
|
|
if($searchDetails->result())
|
|
{
|
|
|
|
//print_r($searchDetails->result());
|
|
$result_array['UnivStatus'] = true;
|
|
$result_array['details'] = $searchDetails->result();
|
|
}
|
|
else
|
|
{
|
|
$result_array['UnivStatus'] = false;
|
|
$result_array['details'] = "No records found!";
|
|
}
|
|
|
|
|
|
return $result_array;
|
|
}
|
|
|
|
public function GetNewRegList($det)
|
|
{
|
|
|
|
$fdate=$det['from'];
|
|
$tdate=$det['to'];
|
|
|
|
$fromd= date("Y-m-d",strtotime($fdate));
|
|
$tod=date("Y-m-d",strtotime($tdate));
|
|
$university = $det['university'];
|
|
$regconst='New Registration';
|
|
$branch=$det['branch'];
|
|
|
|
// echo 'f'.$fromd.'t'.$tod;
|
|
// die();
|
|
|
|
|
|
// $subQuery="SELECT T_StudentDetails.StudentID,T_Student_CourseDetails.DOJ,T_Students_Fees_PaidDetails.BillDate,BatchName,CourseName ,T_Student_CourseDetails.UniversityID, T_Student_CourseDetails.CourseID, T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_StudentDetails. MobileNumber, T_StudentDetails.Fathername,CourseName,ReferredBy,ReferersMobileNumber,T_StaffDetails.Firstname as Fname,T_StaffDetails.Lastname as Lname,Sem_Year,UniversityName FROM T_Student_CourseDetails
|
|
// JOIN T_StudentDetails ON T_StudentDetails.StudentID=T_Student_CourseDetails.StudentID
|
|
// JOIN T_UniversityMaster ON T_UniversityMaster.UniversityID=T_Student_CourseDetails.UniversityID
|
|
// JOIN T_CourseMaster ON T_CourseMaster.CourseID=T_Student_CourseDetails.CourseID
|
|
// join T_Students_Fees_PaidDetails ON T_Students_Fees_PaidDetails.StudentID = T_StudentDetails.StudentID
|
|
// left JOIN T_Registration_Details ON T_Registration_Details.CourseID = T_Student_CourseDetails.CourseID and T_Registration_Details.StudentID=T_Student_CourseDetails.StudentID
|
|
// left JOIN T_BatchMaster ON T_BatchMaster.BatchCode = T_Registration_Details.BatchCode
|
|
// left JOIN T_StaffDetails ON T_StaffDetails.StaffID = T_StudentDetails.AdmittedBy
|
|
// left JOIN T_Course_Fees_Details on T_Course_Fees_Details.ID=T_Registration_Details.FeeType and T_Course_Fees_Details.CourseID=T_Registration_Details.CourseID
|
|
// WHERE T_Registration_Details.RegistrationType = '".$regconst."' and T_Registration_Details.RegistrationMode='".'1'."' and
|
|
// T_Registration_Details.BranchCode= '".$branch."'";
|
|
|
|
// left join T_Login on T_Login.id =T_Students_Fees_PaidDetails.CreatedBy
|
|
// left JOIN T_StaffDetails ON T_StaffDetails.StaffID =T_Login.StaffID
|
|
|
|
|
|
$subQuery="SELECT T_StudentDetails.StudentID,T_Student_CourseDetails.DOJ,T_Students_Fees_PaidDetails.BillDate,BatchName,CourseName ,T_Student_CourseDetails.UniversityID, T_Student_CourseDetails.CourseID, T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_StudentDetails. MobileNumber, T_StudentDetails.Fathername,CourseName,ReferredBy,ReferersMobileNumber,T_StaffDetails.Firstname as Fname,T_StaffDetails.Lastname as Lname,Sem_Year,UniversityName
|
|
FROM T_Student_CourseDetails
|
|
JOIN T_StudentDetails ON T_StudentDetails.StudentID=T_Student_CourseDetails.StudentID
|
|
JOIN T_UniversityMaster ON T_UniversityMaster.UniversityID=T_Student_CourseDetails.UniversityID JOIN T_CourseMaster ON T_CourseMaster.CourseID=T_Student_CourseDetails.CourseID
|
|
|
|
JOIN T_Registration_Details ON T_Registration_Details.CourseID = T_Student_CourseDetails.CourseID and T_Registration_Details.StudentID=T_Student_CourseDetails.StudentID
|
|
|
|
join T_Students_Fees_PaidDetails ON T_Students_Fees_PaidDetails.StudentID = T_StudentDetails.StudentID and T_Registration_Details.StudentID=T_Students_Fees_PaidDetails.StudentID and
|
|
T_Students_Fees_PaidDetails.FeesId=T_Registration_Details.Student_Fee_Status_Id and
|
|
T_Students_Fees_PaidDetails.Installment='1'
|
|
|
|
left JOIN T_BatchMaster ON T_BatchMaster.BatchCode = T_Registration_Details.BatchCode
|
|
left JOIN T_StaffDetails ON T_StaffDetails.StaffID = T_StudentDetails.AdmittedBy
|
|
|
|
|
|
left JOIN T_Course_Fees_Details on T_Course_Fees_Details.ID=T_Registration_Details.FeeType and T_Course_Fees_Details.CourseID=T_Registration_Details.CourseID
|
|
WHERE T_Registration_Details.RegistrationType = '".$regconst."' and T_Registration_Details.RegistrationMode='1' and T_Registration_Details.BranchCode= '".$branch."'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($fromd != ''){
|
|
// $fromd= date("Y-m-d",strtotime($from));
|
|
//and str_to_date(DOJ,?)>=?
|
|
|
|
// $subQuery.=" and str_to_date(T_Registration_Details.CreatedOn,'%Y-%m-%d')>='".$fromd."'";
|
|
|
|
$subQuery.=" and str_to_date(T_Students_Fees_PaidDetails.CreatedOn,'%Y-%m-%d')>='".$fromd."'";
|
|
|
|
}
|
|
if ($tod != ''){
|
|
// $tod=date("Y-m-d",strtotime($to));
|
|
|
|
/// $subQuery.="and str_to_date(T_Registration_Details.CreatedOn,'%Y-%m-%d')<='".$tod."'";
|
|
|
|
$subQuery.="and str_to_date(T_Students_Fees_PaidDetails.CreatedOn,'%Y-%m-%d')<='".$tod."'";
|
|
|
|
|
|
}
|
|
|
|
if($university !='')
|
|
{
|
|
$subQuery.="and T_Student_CourseDetails.UniversityID='".$university."'";
|
|
}
|
|
|
|
|
|
$subQuery.='group by T_Student_CourseDetails.ID';
|
|
|
|
$subQuery.=' order by str_to_date(T_Students_Fees_PaidDetails.BillDate,?) desc';
|
|
|
|
$query = $this->db->query($subQuery,array('%d-%m-%Y'));
|
|
|
|
|
|
$searchDetails =$query->result();
|
|
// print_r( $this->db->last_query());
|
|
// die();
|
|
|
|
//print_r($searchDetails);die();
|
|
|
|
|
|
if($searchDetails)
|
|
{
|
|
|
|
//print_r($searchDetails->result());
|
|
$result_array['searchst'] = true;
|
|
$result_array['details'] = $query->result();
|
|
}
|
|
else
|
|
{
|
|
$result_array['searchst'] = false;
|
|
$result_array['details'] = "No records found!";
|
|
}
|
|
|
|
|
|
return $result_array;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function GetFeePaidDetails($det)
|
|
{
|
|
|
|
$start_date= $det['from'];
|
|
$end_date = $det['to'];
|
|
|
|
|
|
$fromd= date("Y-m-d",strtotime($start_date));
|
|
$tod=date("Y-m-d",strtotime($end_date));
|
|
|
|
$sql="SELECT distinct d.UniversityName,c.UniversityID, sum(IF(ModeOfPayment ='CASH', BillAmount, 0)) AS Cash, sum(IF(ModeOfPayment ='CHEQUE', BillAmount, 0)) AS Cheque, sum(IF(ModeOfPayment ='REFERRAL', BillAmount, 0)) AS Referal, sum(IF(ModeOfPayment ='ONLINE TRANSACTION', BillAmount, 0)) AS Onlinec, sum(IF(ModeOfPayment ='WAIVER', BillAmount, 0)) AS WAIVER, sum(IF(ModeOfPayment ='Credit/Debit Card', BillAmount, 0)) AS Card, a.BillDate FROM T_Students_Fees_PaidDetails a
|
|
JOIN T_Students_Fees_Status b ON b.FeesId = a.FeesID and b.StudentID=a.StudentID
|
|
LEFT JOIN T_CourseMaster c ON c.CourseID = b.CourseID
|
|
left join T_UniversityMaster d on d.UniversityID=c.UniversityID and d.BranchCode = '".$det['branchId']."'
|
|
WHERE STR_TO_DATE(a.BillDate,'%d-%m-%Y') >= '".date('Y-m-d', strtotime($start_date))."' AND STR_TO_DATE(a.BillDate,'%d-%m-%Y') <= '".date('Y-m-d', strtotime($end_date))."' AND a.UpdatedBy = '".$det['branchId']."' AND a.IsActive = '1' ";
|
|
|
|
if($det['university']!='')
|
|
{
|
|
$sql.=" and c.UniversityID='".$det['university']."'";
|
|
|
|
}
|
|
|
|
$sql.=" GROUP BY c.UniversityID";
|
|
|
|
$res = $this->db->query($sql,array());
|
|
|
|
$result = $res->result();
|
|
|
|
$feeDetails = $result;
|
|
|
|
|
|
|
|
// $feeDetails = $this->db->get()->result();
|
|
|
|
|
|
if($feeDetails)
|
|
{
|
|
|
|
//print_r($searchDetails->result());
|
|
$result_array['searchst'] = true;
|
|
$result_array['details'] = $feeDetails;
|
|
}
|
|
else
|
|
{
|
|
$result_array['searchst'] = false;
|
|
$result_array['details'] = "No records found!";
|
|
}
|
|
|
|
|
|
// print_r( $this->db->last_query());
|
|
// die();
|
|
|
|
|
|
return $result_array;
|
|
|
|
}
|
|
public function getUniv($br=null)
|
|
{
|
|
$this->db->select('UniversityID,UniversityName');
|
|
$this->db->where('IsActive','1');
|
|
$this->db->where('BranchCode',$br);
|
|
$this->db->order_by('CreatedOn','DESC');
|
|
$university = $this->db->get(UNIVERSITY);
|
|
|
|
if($university->result()){
|
|
$result = array();
|
|
$result['univlist'] = true;
|
|
foreach ($university->result() as $row)
|
|
{
|
|
|
|
$university_array['universityID'] = $row->UniversityID;
|
|
$university_array['universityName'] = $row->UniversityName;
|
|
$result_array[]=$university_array;
|
|
}
|
|
$result['university']= $result_array;
|
|
}
|
|
else {
|
|
$result['univlist'] = false;
|
|
$result['message'] = "No records found!";
|
|
$result['universityID'] = "";
|
|
$result['universityName'] = "";
|
|
$result['batchDetails']= "";
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
public function getActivity($branchID = null)
|
|
{
|
|
$this->db->select('ActivityID,ActivityName');
|
|
$this->db->where('IsActive','1');
|
|
$this->db->where('BranchCode',$branchID);
|
|
$this->db->order_by('ActivityID','ASC');
|
|
$activity = $this->db->get(ACTIVITY);
|
|
if($activity->result()){
|
|
$result_activity = array();
|
|
foreach ($activity->result() as $row)
|
|
{
|
|
$activity_array['activityStatus'] = true;
|
|
$activity_array['activityID'] = $row->ActivityID;
|
|
$activity_array['activityName'] = $row->ActivityName;
|
|
$activity_array['activityStatus']= $this->getStatus($row->ActivityID);
|
|
$result_activity[]=$activity_array;
|
|
}
|
|
|
|
}
|
|
else{
|
|
$activity_array['activityStatus'] = false;
|
|
$activity_array['activityID'] = "";
|
|
$activity_array['activityName'] = "No activity";
|
|
$activity_array['activityStatus']= "";
|
|
$result_activity[]=$activity_array;
|
|
|
|
}
|
|
|
|
return $result_activity;
|
|
}
|
|
|
|
public function getStatus($activityID=null)
|
|
{
|
|
$this->db->select('AVS.StatusID,PLD.ListCode,PLD.ListName');
|
|
$this->db->from(ACTIVITY_STATUS .' as AVS');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = AVS.StatusName');
|
|
$this->db->where('AVS.ActivityID',$activityID);
|
|
$this->db->where('AVS.IsActive','1');
|
|
$this->db->where('PLD.IsActive','1');
|
|
$status = $this->db->get();
|
|
return $status->result();
|
|
}
|
|
public function getStaff($br){
|
|
|
|
|
|
//staff Name
|
|
$sql_staf = "select StaffID,Firstname as staff_name from T_StaffDetails where BranchCode = '".$br."'";
|
|
$staff=$this->db->query($sql_staf);
|
|
$staff_list = $staff->result();
|
|
|
|
|
|
if (count($staff_list) > 0) {
|
|
$results['staff'] = $staff_list;
|
|
|
|
} else {
|
|
$results['message'] = 'No record found';
|
|
}
|
|
return $results;
|
|
|
|
}
|
|
|
|
public function getDefaultActivity($code,$reqBranch)
|
|
{
|
|
$this->db->select('DA.StudentActivityCode,PLD.ListCode,PLD.ListName');
|
|
$this->db->from(DEFAULTACTIVITY .' as DA');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = DA.StatusCode');
|
|
$this->db->where('PLD.IsActive','1');
|
|
$this->db->where('DA.IsActive','1');
|
|
$this->db->where('DA.BranchCode', $reqBranch);
|
|
$this->db->where('DA.StudentActivityCode',$code);
|
|
$result=$this->db->get()->result();
|
|
return $result;
|
|
|
|
}
|
|
|
|
public function getAppPendingStatus($br){
|
|
$query = "select ListCode,ListName,BranchCode from T_PickListDetails where T_PickListDetails.IsActive = 1 and T_PickListDetails.BranchCode = ? and T_PickListDetails.ListName in ('RECEIVED','PENDING') order by T_PickListDetails.ListGroup desc;";
|
|
$resn = $this->db->query($query,array($br));
|
|
$list = $resn->result();
|
|
$result = count($list) > 0 ? $list : array();
|
|
return $result;
|
|
}
|
|
} |