Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.142.55.138
<?php
function loaddayteachname($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $aobj_context->mobj_data["collcode"];
$funivcode = $aobj_context->mobj_data['univcode'];
$usertype = $aobj_context->mobj_data['usertype'];
$usr = $aobj_context->mobj_data['user'];
$cnd = '';
if($usertype == "T")
{
$cnd = "and m.fteachcode = '{$usr}'";
}
if($funivcode == "097"){
$cnd1="order by fteachname";
}else{
$cnd1="";
}
$query = "select distinct ifnull(at.fteachcode,'') as `key`,
ifnull(at.fteachcode,'') as `value`,
CONCAT(ifnull(m.FTEACHNAME,''),'[',ifnull(at.fteachcode,''),']') as label
from attclass at
inner join masteach m on at.fteachcode = m.fteachcode
where at.fcollcode = '{$collcode}' {$cnd} {$cnd1}";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loadclassnameday($aobj_context)
{
$collcode = $aobj_context->mobj_data['collcode'];
$usertype =$aobj_context->mobj_data['usertype'];
$usr = $aobj_context->mobj_data['user'];
$teachcode = $aobj_context->mobj_data["teachcode"];
$cnd = '';
if($usertype == 'T')
{
$cnd = "and fteachcode = '{$usr}'";
}
$query=" select ifnull(fclassid,'') as `key`, ifnull(fclassid,'') as `value`,
CONCAT(ifnull(fclassname,''),'[',ifnull(fclassid,''),']') as label from
attclass where fteachcode = '{$teachcode}' and fcollcode = '{$collcode}' and ifnull(fdeleted,'') <> 'T'{$cnd}";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function viewattendanceentry($aobj_context){
$fclassid = $aobj_context->mobj_data["cls"];
$period = $aobj_context->mobj_data["period"];
$noofclass = $aobj_context->mobj_data["noofcls"];
$date = $aobj_context->mobj_data["dates"];
$collcode = $aobj_context->mobj_data['collcode'];
$fsort = $aobj_context->mobj_data["sort"];
$query = "select * from attclass where fclassid = '{$fclassid}'
and ifnull(fblock,'') = 'T'";
$res1 = $aobj_context->mobj_db->GetRow($query);
if($res1)
{
$data="Attendace Entry Bloked Contact Admin. Reason: ".$res1['fblockremarks'];
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}else
{
}
if($fsort == "fname"){
$cond = "s.fname";
}elseif($fsort == "fregno"){
$cond = "a.fregno";
}
$query = "select ifnull(a.FDEGREE,'') as fdegree,
ifnull(a.FEXAMNO,'') as fexamno,ifnull(a.fregno,'') as fregno,ifnull(s.FNAME,'') as fname, ifnull(ad.FPRESENT,'') as fpresent
from attendsum a inner join student s on s.FREGNO = a.FREGNO
and s.fcollcode = a.fcollcode and s.fdegree = a.fdegree
left join attend_det ad on ad.fregno = a.fregno and ad.FSUBCODE = a.FSUBCODE
and ad.FCLASSID = a.FCLASSID and ad.fdegree = a.fdegree
and ad.fexamno = a.fexamno
and ad.fcollcode = a.fcollcode and ad.FDATE = '{$date}'
and ad.FPERIOD = '{$period}' and ad.FNOCLASS = '{$noofclass}' and ad.FCOLLCODE = '{$collcode}'
where a.fclassid = '{$fclassid}'
group by fregno
order by $cond";
$lobj_get_data = $aobj_context->mobj_db->GetAll($query);
if($lobj_get_data)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success");
return;
}
else
{
$data="not found";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
function saveattendanceentry($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$fclassid = $aobj_context->mobj_data["cls"];
$period = $aobj_context->mobj_data["period"];
$syllabus = $aobj_context->mobj_data["syllabus"];
$noofclass = $aobj_context->mobj_data["noofcls"];
$date = $aobj_context->mobj_data["dates"];
$collcode = $aobj_context->mobj_data['collcode'];
$univcode = $aobj_context->mobj_data['univcode'];
$usr = $aobj_context->mobj_data['usr'];
$sort = $aobj_context->mobj_data['sort'];
$teach = $aobj_context->mobj_data['teach'];
$data = $aobj_context->mobj_data["data"];
$array = json_decode($data,true);
$query = "select fblock, ifnull(fblockremarks, '')as fremarks from attclass
where fteachcode='{$teach}' and fcollcode='{$collcode}' and fclassid='{$fclassid}'";
$blkres = $aobj_context->mobj_db->GetRow($query);
if($blkres['fblock']=='T'){
if($blkres['fremarks'] == ''||$blkres['fremarks']=='null'){
$arr['msg'] = "Blocked";
}else{
$arr['msg'] = $blkres['fremarks'];
}
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
foreach($array as $key => $value){
$reg = $value['fregno'];
$str = "ATTENDANCE ENTRY DAYWISE: USER : $usr, COLLCODE: $collcode, REGNO : $reg, CLASSID : $fclassid, DATE : $date";
$remark = $str;
$enttype = "ATTCD";
$query = "INSERT INTO attend_det (FCOLLCODE, FDEGREE, FEXAMNO, FSUBCODE, FREGNO, FDATE, FPERIOD, FNOCLASS, FPRESENT,FCLASSID,FUPDUSER,FCREATEDATE,fsyllabus,FTEACHCODE,FSECTION)
select s.fcollcode,s.fdegree,a.fexamno,a.fsubcode,s.fregno,'{$date}','{$period}','{$noofclass}','{$value['fpresent']}','{$fclassid}','{$usr}',NOW(),'{$syllabus}',a.fteachcode,a.FSECTION
from student s
inner join attendsum a on s.fcollcode = a.fcollcode
and s.fdegree = a.fdegree
where a.fclassid = '{$fclassid}'
and a.fclassid = '{$fclassid}'
and s.fregno = '{$value['fregno']}'
on DUPLICATE KEY UPDATE FPRESENT = '{$value['fpresent']}', FNOCLASS='{$noofclass}', FUPDDATE = NOW()";
$lobj_get_data = $aobj_context->mobj_db->Execute($query);
}
if($lobj_get_data)
{
$arr['msg'] = "Saved Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$arr['msg']="Failed to Save";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function viewDeleteAddStudDet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$teachfrom = $aobj_context->mobj_data["fromteach"];
$teachto = $aobj_context->mobj_data["toteach"];
if($teachfrom==""){
$fromteach='0';
}else{
$fromteach=$teachfrom;
}
if($teachto==""){
$toteach='z';
}else{
$toteach=$teachto;
}
$usertype = $aobj_context->mobj_data['usertype'];
$usr = $aobj_context->mobj_data['user'];
$college_code = $aobj_context->mobj_data['collcode'];
$cnd = '';
if($usertype== 'T')
{
$cnd = "and at.fteachcode = '{$usr}'";
}
$query = "select concat(at.fteachcode,' - ',m.FTEACHNAME) as fteach,
ifnull(ad.fclassid,'') as fclassid,ifnull(at.fclassname,'') as fclassname,ifnull(at.fteachcode,'') as fteachcode,
ifnull(m.FTEACHNAME,'') as fteachname,
ifnull(ad.fperiod,'') as fperiod,ifnull(ad.fnoclass,'') as fnoclass,ifnull(fdate,'') as fdate,
sum(if(ad.fpresent = 'P','1',0)) as pcnt,sum(if(ad.fpresent = 'A','1',0)) as acnt
from attend_det ad
inner join attclass at on at.fclassid = ad.fclassid
inner join masteach m on m.FTEACHCODE = at.fteachcode
where ad.fcollcode = '{$college_code}'
$cnd
and at.fteachcode between '{$fromteach}' and '{$toteach}'
group by ad.FDATE,ad.fclassid,ad.FPERIOD,ad.FNOCLASS
order by at.fteachcode,ad.FDATE";
$lobj_get_data = $aobj_context->mobj_db->GetAll($query);
if($lobj_get_data)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success");
return;
}
else
{
$data="not found";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
function deleteAddstudentry($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$fclassid = $aobj_context->mobj_data["clsid"];
$fperiod = $aobj_context->mobj_data["period"];
$fnoclass = $aobj_context->mobj_data["noofcls"];
$fdate = $aobj_context->mobj_data["date"];
$collcode = $aobj_context->mobj_data["collcode"];
$query = "delete from attend_det
where FPERIOD = '{$fperiod}' and FNOCLASS = '{$fnoclass}'
and FCLASSID = '{$fclassid}' and fdate = date_format(str_to_date('{$fdate}','%d-%m-%Y'),'%Y-%m-%d')
and fcollcode='{$collcode}'";
var_dump($query);die();
$lobj_get_data = $aobj_context->mobj_db->Execute($query);
if($lobj_get_data)
{
$data="Successfully Deleted";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
return;
}
else
{
$data="not found";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
function modifyAddstudentry($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$fteachcode = $aobj_context->mobj_data["teachcode"];
$fclassid = $aobj_context->mobj_data["clsid"];
$fperiod = $aobj_context->mobj_data["period"];
$fnoclass = $aobj_context->mobj_data["noofcls"];
$fdate = $aobj_context->mobj_data["date"];
$collcode = $aobj_context->mobj_data["collcode"];
$query = "select ifnull(a.FDEGREE,'') as fdegree,
ifnull(a.FEXAMNO,'') as fexamno,ifnull(a.fregno,'') as fregno,
ifnull(s.FNAME,'') as fname, ifnull(ad.FPRESENT,'') as fpresent,
ifnull(ad.fsyllabus,'') as fsyllabus
from attendsum a inner join student s on s.FREGNO = a.FREGNO
and s.fcollcode = a.fcollcode and s.fdegree = a.fdegree
left join attend_det ad on ad.fregno = a.fregno and ad.FSUBCODE = a.FSUBCODE
and ad.FCLASSID = a.FCLASSID and ad.fdegree = a.fdegree
and ad.fexamno = a.fexamno
and ad.fcollcode = a.fcollcode and ad.FDATE = date_format(str_to_date('{$fdate}','%d/%m/%Y'),'%Y-%m-%d')
and ad.FPERIOD = '{$fperiod}' and ad.FNOCLASS = '{$fnoclass}' and ad.FCOLLCODE = '{$collcode}'
where a.fclassid = '{$fclassid}'
order by a.fregno,s.fname";
$lobj_get_data = $aobj_context->mobj_db->GetAll($query);
if($lobj_get_data)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success");
return;
}
else
{
$data="not found";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
// function loadssubcreateclass($aobj_context)
// {
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// $degreecode = $aobj_context->mobj_data["degree"];
// $sem = $aobj_context->mobj_data["sem"];
// $collcode = $_SESSION['collcode'];
// $univcode = $_SESSION['FUNIVCODE'];
// $fild = "concat(ifnull(s.FSUBNAME,''),' (',fsubshort, ')', ' - ', fssubname) as fsubname";
// if($univcode == '052')
// $fild = "concat(ifnull(s.FSUBNAME,''),' - ',s.fsubshort) as fsubname";
// if($univcode == '052')
// {
// $query = "select ifnull(s.FCSUBCODE,'') as fsubcode,
// {$fild}
// from subject s
// inner join student a on s.FDEGREE = a.FDEGREE
// inner join subdet su on s.fdegree = su.fdegree and
// s.fexamno = su.fexamno and s.fsubcode = left(su.fcsubcode,4)
// where s.FDEGREE = '{$degreecode}' and s.FEXAMNO = '{$sem}'
// group by s.FSUBCODE";
// #and s.fretain = 'F'
// #and ifnull(s.fsuspend, '')<> 'T'
// #group by s.FSUBCODE
// }else if($univcode == '055')
// {
// $query = "select ifnull(s.FCSUBCODE,'') as fsubcode,
// concat(s.fsubshort,' - ',ifnull(s.FSUBNAME,''),' - ',fssubname) as fsubname
// from subject s
// inner join student a on s.FDEGREE = a.FDEGREE
// where s.FDEGREE = '{$degreecode}' and s.FEXAMNO = '{$sem}'
// #and s.fretain = 'F'
// and ifnull(s.fsuspend, '')<> 'T'
// group by s.FSUBCODE";
// }
// else
// {
// $query = "select ifnull(s.FCSUBCODE,'') as fsubcode,
// {$fild}
// from subject s
// inner join student a on s.FDEGREE = a.FDEGREE
// where s.FDEGREE = '{$degreecode}' and s.FEXAMNO = '{$sem}'
// #and s.fretain = 'F'
// and ifnull(s.fsuspend, '')<> 'T'
// group by s.FSUBCODE";
// }
// // var_dump($query);die();
// $result = $aobj_context->mobj_db->GetAll($query);
// if($univcode == "052"){
// $cnd = "ifnull(fsectionnew,'') as fsection";
// $cnd1 = "";
// }else{
// $cnd = "ifnull(FSECTION,'') as fsection";
// $cnd1 = "and ifnull(FSECTION,'') <> ''";
// }
// $query1 = "select distinct {$cnd}
// from student
// where fcollcode = '{$collcode}' and FDEGREE = '{$degreecode}' {$cnd1}";
// $result1 = $aobj_context->mobj_db->GetAll($query1);
// if($result)
// {
// $arr['sub'] = $result;
// $arr['sec'] = $result1;
// echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
// }
// else
// {
// $data['msg'] = 'Faile to load';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// }
// }
// function loadteachercreateclass($aobj_context)
// {
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// $collcode = $_SESSION['collcode'];
// $query = "select ifnull(FTEACHCODE,'') as fteachcode,ifnull(FTEACHNAME,'') as fteachname
// from masteach
// where fcollcode = '{$collcode}'";
// $result = $aobj_context->mobj_db->GetAll($query);
// if($result)
// {
// echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
// }
// else
// {
// $data['msg'] = 'Failed to load';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// }
// }
// function viewcreateclass($aobj_context)
// {
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// $collcode = $_SESSION['collcode'];
// $degreecode = $aobj_context->mobj_data["degree"];
// $sem = $aobj_context->mobj_data["sem"];
// $sub = $aobj_context->mobj_data["sub"];
// $classname = $aobj_context->mobj_data["fclassid"];
// $mode = $aobj_context->mobj_data["mode"];
// $teachcode = $aobj_context->mobj_data["teachcode"];
// $fclassid = $aobj_context->mobj_data["fclassid"];
// $section = $aobj_context->mobj_data["section"];
// $univcode = $_SESSION['FUNIVCODE'];
// if($section == 'All'){
// $cnd = "";
// }else{
// if($univcode == '052'){
// $cnd = "and s.fsectionnew = '{$section}'";
// }else{
// $cnd = "and s.fsection = '{$section}'";
// }
// }
// $cnd1 = "";
// $cnd2 = "";
// $cnd3 = "and s.fexamno = '{$sem}'";
// if($mode == 'Improvement')
// {
// $cnd1 = "inner join regfee r on s.fregno = r.fregno and r.FSUBCODE = '{$sub}'";
// $cnd3 = "";
// }
// $orderby = "order by s.fregno";
// if($univcode == '049' || $univcode == '097')
// $orderby = "order by s.fname";
// if($univcode != '021' && $mode != 'Improvement' && $univcode != '097' && $univcode != '098')
// {
// $query = "select count(*) as cnt from regcanddet where fcollcode = '{$collcode}'
// and fdegree = '{$degreecode}' and fexamno = '{$sem}' and fsubcode = left('{$sub}',4)";
// $res1 = $aobj_context->mobj_db->GetRow($query);
// if($res1['cnt'] > 0)
// {
// }else
// {
// $data['msg'] = 'Subjects are not attached. kindly do subject registration';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// return;
// }
// }
// if($univcode == '021' || $univcode == '097' || $univcode == '098' )
// {
// $query = "select distinct ifnull(s.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
// if(ifnull(a.fregno,'') <> '' ,'T','F') as fstatus
// from student s
// {$cnd1}
// left join attendsum a on s.fregno = a.fregno
// and s.fdegree = a.fdegree
// and s.fexamno = a.fexamno
// and s.fcollcode = a.fcollcode
// and a.fclassid = '{$classname}'
// where s.fdegree = '{$degreecode}'
// and s.FCOLLCODE = '{$collcode}'
// and ifnull(s.fdeleted,'') <> 'T'
// $cnd
// $cnd3
// {$orderby}";
// //var_dump($query);
// }else if($mode == 'Improvement')
// {
// $query = "select distinct ifnull(s.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
// if(ifnull(a.fregno,'') <> '' ,'T','F') as fstatus
// from student s
// {$cnd1}
// left join attendsum a on s.fregno = a.fregno and s.fdegree = a.fdegree
// and s.fexamno = a.fexamno
// and s.fcollcode = a.fcollcode
// and a.fclassid = '{$classname}'
// where s.fdegree = '{$degreecode}'
// and s.FCOLLCODE = '{$collcode}'
// and ifnull(s.fdeleted,'') <> 'T'
// $cnd
// {$orderby}";
// }
// else
// {
// $query = "select distinct ifnull(s.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
// if(ifnull(a.fregno,'') <> '' ,'T','F') as fstatus
// from student s
// inner join regcanddet cd on s.fregno = cd.fregno
// and cd.fdegree = s.fdegree and cd.fcollcode = s.fcollcode
// {$cnd1}
// left join attendsum a on s.fregno = a.fregno and s.fdegree = a.fdegree and s.fexamno = a.fexamno
// and s.fcollcode = a.fcollcode
// and a.fclassid = '{$classname}'
// where s.fdegree = '{$degreecode}'
// and s.FCOLLCODE = '{$collcode}'
// and left(cd.fsubcode,4) = left('{$sub}',4)
// and ifnull(s.fdeleted,'') <> 'T'
// {$cnd3}
// $cnd
// {$orderby}";
// }
// //var_dump($query);
// $result = $aobj_context->mobj_db->GetAll($query);
// if($result)
// {
// echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
// }
// else
// {
// $data['msg'] = 'Faile to load';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// }
// }
// function savecreateclass($aobj_context)
// {
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// $collcode = $_SESSION['collcode'];
// $univcode = $_SESSION['FUNIVCODE'];
// include("error_log.php");
// $usr = $_SESSION['usr'];
// $mob = $_SESSION['FMOBILE'];
// $degreecode = $aobj_context->mobj_data["degree"];
// $sem = $aobj_context->mobj_data["sem"];
// $sub = $aobj_context->mobj_data["sub"];
// $mode = $aobj_context->mobj_data["mode"];
// $classname = $aobj_context->mobj_data["classname"];
// $teachcode = $aobj_context->mobj_data["teachcode"];
// $fclassid = $aobj_context->mobj_data["fclassid"];
// $section = $aobj_context->mobj_data["section"];
// $_data = $aobj_context->mobj_data["data"];
// $data = json_decode($_data,true);
// $secCond = "";
// if($univcode == "049"){
// if($section === "All" || $section === ""){
// $data['msg'] = 'select the section';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// return;
// }
// $secCond = "and fsection='{$section}'";
// }
// $qry="select distinct ifnull(fclassid, '')as fclassid from attendsum where fsubcode='{$sub}'
// and fteachcode='{$teachcode}' and fdegree = '{$degreecode}'";
// $res = $aobj_context->mobj_db->GetRow($qry);
// // if(count($res)===1 && $res['fclassid'] != $fclassid){
// // $data['msg'] = 'Subject already added to the different classnames';
// // echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// // return;
// // }
// // and fdegree = '{$degreecode}'
// $qry="select ifnull(fclassid, '')as fclassid from attendsum
// where fteachcode='{$teachcode}' and fsubcode='{$sub}' and fexamno='{$sem}'
// {$secCond}";
// $res = $aobj_context->mobj_db->GetRow($qry);
// // if(count($res)===1 && $res['fclassid'] !== $fclassid){
// // $data['msg'] = 'Students already added to the different classname';
// // echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// // return;
// // }
// $qrtype = "select ifnull(fatyear,'') as fyear,ifnull(fatexamtype,'') as fexamtype,
// FMEYEAR, FMEEXAMTYP
// from degree
// where FDEGREE = '{$degreecode}' and FEXAMNO = '{$sem}'";
// $resqrtype = $aobj_context->mobj_db->GetRow($qrtype);
// $fyear = $resqrtype['fyear'];
// $fexamtype = $resqrtype['fexamtype'];
// $FMEYEAR = $resqrtype['FMEYEAR'];
// $FMEEXAMTYP = $resqrtype['FMEEXAMTYP'];
// if (!empty($_SERVER['HTTP_CLIENT_IP']))
// {
// $ip_address = $_SERVER['HTTP_CLIENT_IP'];
// }
// else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
// {
// $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
// }
// else
// {
// $ip_address = $_SERVER['REMOTE_ADDR'];
// }
// $univcode = $_SESSION['FUNIVCODE'];
// $mob = $_SESSION['FMOBILE'];
// $usr = $_SESSION['usr'];
// $college_code = $_SESSION['collcode'];
// foreach($data as $key => $val){
// $regno = $val['regno'];
// if($val['classid'] == 'T'){
// $str = "ADD STUDENTS TO CLASS: CLASSID : $fclassid, THEACHERCODE : $teachcode, REGNO: $regno,SUBJECT : $sub";
// $remark = $str;
// $enttype = "ATTA";
// $res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
// $Insertquery = "insert ignore into attendsum (fclassid,fcreatedate,fteachcode,fcollcode,fdegree,fexamno,fsubcode,fclassname,fregno,fyear,fexamtype,fsection,fmode,fdeleted)
// values('{$fclassid}',now(),'{$teachcode}','{$collcode}','{$degreecode}','{$sem}','{$sub}','{$classname}','{$val['regno']}','{$fyear}','{$fexamtype}','{$section}','{$mode}','F')";
// $resupdquery = $aobj_context->mobj_db->Execute($Insertquery);
// }else{
// $str = "DELETE STUDENTS TO CLASS: CLASSID : $fclassid, THEACHERCODE : $teachcode, REGNO : $regno,SUBJECT : $sub";
// $remark = $str;
// $enttype = "ATTD";
// $res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
// $updquery = "DELETE FROM attendsum
// WHERE fregno='{$val['regno']}'
// and fclassid = '{$fclassid}'
// and fteachcode = '{$teachcode}'
// and fcollcode = '{$collcode}'
// and fdegree = '{$degreecode}'
// and fexamno = '{$sem}'
// and fsubcode = '{$sub}'
// and fclassname = '{$classname}'
// and fsection = '{$section}'";
// $resupdquery = $aobj_context->mobj_db->Execute($updquery);
// // $Insertquery = "insert ignore into marksint(fcollcode,fexamno,fdegree,fregno,fsubcode,fyear,fexamtype)
// // select a.fcollcode,a.fexamno,a.fdegree,a.fregno,concat(s.fcsubcode,s.fsubcode),'{$FMEYEAR}','{$FMEEXAMTYP}' from attendsum a
// // inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno
// // inner join subdet s on a.fdegree = s.fdegree and s.fexamno = a.fexamno
// // and left(s.fcsubcode,4) = left(a.fsubcode,4)
// // where d.fexamno = '{$sem}'
// // and d.fdegree = '{$degreecode}'";
// // $res = $aobj_context->mobj_db->Execute($Insertquery);
// // $Insertquery = "INSERT IGNORE INTO attend(FDEGREE, FEXAMNO, FCOLLCODE, fregno, FSUBCODE, FYEAR, FEXAMTYPE,FCREATEDATE)
// // SELECT DISTINCT a.FDEGREE, a.FEXAMNO, a.FCOLLCODE,a.fregno, s.FcSUBCODE, '{$FMEYEAR}','{$FMEEXAMTYP}',now()
// // FROM subject s
// // INNER JOIN attendsum a ON a.fdegree = s.fdegree
// // AND a.fsubcode = s.fcsubcode
// // WHERE a.fdegree LIKE '{$degreecode}'
// // AND a.fexamno = '{$sem}'
// // GROUP BY a.FDEGREE,a.fregno,s.FSUBCODE";
// // $res = $aobj_context->mobj_db->Execute($Insertquery);
// }
// }
// $Insertquery = "insert ignore into marksint(fcollcode,fexamno,fdegree,fregno,fsubcode,fyear,fexamtype)
// select a.fcollcode,a.fexamno,a.fdegree,a.fregno,concat(s.fcsubcode,s.fsubcode),'{$FMEYEAR}','{$FMEEXAMTYP}' from attendsum a
// inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno
// inner join subdet s on a.fdegree = s.fdegree and s.fexamno = a.fexamno
// and left(s.fcsubcode,4) = left(a.fsubcode,4)
// where d.fexamno = '{$sem}'
// and d.fdegree = '{$degreecode}'";
// // var_dump($Insertquery);die();
// $res = $aobj_context->mobj_db->Execute($Insertquery);
// $Insertquery = "INSERT IGNORE INTO attend(FDEGREE, FEXAMNO, FCOLLCODE, fregno, FSUBCODE, FYEAR, FEXAMTYPE,FCREATEDATE)
// SELECT DISTINCT a.FDEGREE, a.FEXAMNO, a.FCOLLCODE,a.fregno, s.Fcsubcode, '{$FMEYEAR}','{$FMEEXAMTYP}',now()
// FROM subject s
// INNER JOIN attendsum a ON a.fdegree = s.fdegree
// AND a.fsubcode = s.fcsubcode
// WHERE a.fdegree LIKE '{$degreecode}'
// AND a.fexamno = '{$sem}'
// GROUP BY a.FDEGREE,a.fregno,s.FSUBCODE";
// $res = $aobj_context->mobj_db->Execute($Insertquery);
// if($resupdquery)
// {
// $data['msg'] = 'Save Successfully...!';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
// }
// else
// {
// $data['msg'] = 'Faile to Save';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// }
// }
// function viewStuds($aobj_context)
// {
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// $collcode = $_SESSION['collcode'];
// $usertype = $_SESSION['user_type'];
// $usr = $_SESSION['usr'];
// $cnd = '';
// if(strtolower($usertype) == 'user' && strtolower($_SESSION['super_wiser']) !== 't')
// {
// $cnd = "and a.fteachcode = '{$usr}'";
// }
// $query = "select ifnull(a.fteachcode,'') as fteachcode,ifnull(m.fteachname,'') as fteachname,
// ifnull(a.fclassid,'') as fclassid,
// ifnull(ac.fclassname,'') as fclassname,
// count(a.fclassid) as count from attendsum a
// inner join masteach m on m.fteachcode = a.fteachcode
// and m.fcollcode = a.fcollcode
// left join attclass ac on a.fclassid = ac.fclassid
// where a.fcollcode = '{$collcode}' $cnd
// group by a.fclassid";
// $result = $aobj_context->mobj_db->GetAll($query);
// if($result)
// {
// echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
// }
// else
// {
// $data['msg'] = 'Faile to load';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// }
// }
// function viewAddClassstuds($aobj_context)
// {
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// $collcode = $_SESSION['collcode'];
// $teachcode = $aobj_context->mobj_data["teachcode"];
// $fclassid = $aobj_context->mobj_data["fclassid"];
// $usertype = $_SESSION['user_type'];
// $usr = $_SESSION['usr'];
// $cnd = '';
// if(strtolower($usertype) == 'user' && strtolower($_SESSION['super_wiser']) !== 't')
// {
// $cnd = "and a.fteachcode = '{$usr}'";
// }
// $query = "select ifnull(a.fclassid,'') as fclassid ,
// ifnull(a.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
// ifnull(a.fdeleted, '')as fdeleted
// from attendsum a
// inner join student s on a.fregno = s.fregno
// where a.fcollcode = '{$collcode}' and a.fclassid = '{$fclassid}' $cnd";
// $result = $aobj_context->mobj_db->GetAll($query);
// if($result)
// {
// echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
// }
// else
// {
// $data['msg'] = 'Faile to load';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// }
// }
?>
|