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.137.168.126
<?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["clsnames"];
$period = $aobj_context->mobj_data["period"];
$noofclass = $aobj_context->mobj_data["noofcls"];
$date = $aobj_context->mobj_data["date"];
$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_format(STR_TO_DATE('{$date}', '%d/%m/%Y'),'%Y-%m-%d')
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 = '{$fdate}'
and fcollcode='{$collcode}'";
$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;
}
}
?>
|