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.21.105.119
<?php
function getAttEntDegree($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $aobj_context->mobj_data['collcode'];
$funivcode=$aobj_context->mobj_data['univcode'];
if($funivcode == '098')
{
$query=" SELECT ifnull(a.fdegree,'')as `key`,ifnull(a.fdegree,'')as `value`,
ifnull(concat(a.fdegree,'-',d.fdescpn),'')as `label` FROM student a
INNER JOIN degree d ON a.fdegree=d.fdegree
WHERE a.fcollcode='{$collcode}'
and d.fdegree = 'BBA1'
GROUP BY a.fdegree";
$result = $aobj_context->mobj_db->GetAll($query);
}else
{
$query=" SELECT ifnull(a.fdegree,'')as `key`,ifnull(a.fdegree,'')as `value`,
ifnull(concat(a.fdegree,'-',d.fdescpn),'')as `label` FROM student a
INNER JOIN degree d ON a.fdegree=d.fdegree
WHERE a.fcollcode='{$collcode}'
GROUP BY a.fdegree";
$result = $aobj_context->mobj_db->GetAll($query);
}
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$arr['msg'] = 'No Degree Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function getSemAttMontwise($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $aobj_context->mobj_data['collcode'];
$funivcode=$aobj_context->mobj_data['univcode'];
$degree = $aobj_context->mobj_data["degree"];
if($funivcode == '098')
{
$query="SELECT DISTINCT ifnull(d.fexamno,'')as `key`, ifnull(d.fexamno,'')as `value`,
ifnull(concat(d.fexamno, '-',d.fexamname),'')as `label`
FROM degree d where fdegree='{$degree}'
and fexamno = 'D'";
}else
{
$query="SELECT DISTINCT ifnull(d.fexamno,'')as `key`, ifnull(d.fexamno,'')as `value`,
ifnull(concat(d.fexamno, '-',d.fexamname),'')as `label`
FROM degree d where fdegree='{$degree}'";
}
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$arr['msg'] = 'No Exam Number Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function getSubForAttEntMonth($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $aobj_context->mobj_data['collcode'];
$degree = $aobj_context->mobj_data["degree"];
$examno = $aobj_context->mobj_data["sem"];
$sec = $aobj_context->mobj_data["sec"];
$usertype=$aobj_context->mobj_data["usertype"];
$user=$aobj_context->mobj_data["user"];
if($sec=="all"){
$section='';
}else{
$section="AND u.fsection='{$sec}'";
}
// $query="SELECT DISTINCT concat(s.fsubname, ' - ', s.fssubname)as fsubname,s.fcsubcode as fsubcode,s.fsubshort,c.ffreezed
// FROM subject s INNER JOIN attend a ON s.fdegree=a.fdegree and a.fsubcode = s.fcsubcode
// INNER JOIN usrsection u ON u.fdegree=a.fdegree
// LEFT JOIN collatt c ON c.fdegree=a.fdegree AND c.fexamno=a.fexamno AND c.fsubcode=a.fsubcode
// WHERE a.fdegree='{$degree}' AND a.fcollcode='{$collcode}' {$section}
// AND s.fexamno='{$examno}'";
$query="SELECT concat(s.fsubname, ' - ', s.fssubname)as fsubname,
s.fcsubcode AS fsubcode,
s.fsubshort,
c.ffreezed,
COUNT(DISTINCT a.fregno) AS totstud,
COUNT(DISTINCT CASE WHEN a.FOVERALL_SEMA = '0' THEN a.fregno END) AS pending
FROM subject s
INNER JOIN attend a ON s.fdegree = a.fdegree AND a.fsubcode = s.fcsubcode
INNER JOIN usrsection u ON u.fdegree = a.fdegree
INNER JOIN student stu ON stu.fregno = a.fregno
LEFT JOIN collatt c ON c.fdegree = a.fdegree AND c.fexamno = a.fexamno AND c.fsubcode = a.fsubcode
WHERE a.fdegree = '{$degree}'
AND a.fcollcode = '{$collcode}'
AND IFNULL(a.fregno, '') <> ''
AND s.fexamno = '{$examno}' {$section}
GROUP BY a.fdegree, a.fsubcode";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$arr['msg'] = 'No Subject Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function getSectionForAttEntr($aobj_context)
{
@session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $aobj_context->mobj_data['collcode'];
$degree = $aobj_context->mobj_data["degree"];
$examno = $aobj_context->mobj_data["sem"];
$query="SELECT ifnull(a.fsection,'')as`key`,ifnull(a.fsection,'')as`value`, ifnull(a.fsection,'')as`label`
FROM usrsection a INNER JOIN attend b ON a.fdegree=b.fdegree
WHERE b.fcollcode='{$collcode}' AND b.fdegree='{$degree}' AND b.fexamno='{$examno}' GROUP BY a.fsection";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
return;
}
else
{
$arr['msg']='Data Not Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed");
return;
}
}
function studAttEntrMonthwise($aobj_context){
$collcode = $aobj_context->mobj_data['collcode'];
$degree = $aobj_context->mobj_data["degree"];
$examno = $aobj_context->mobj_data["sem"];
$sec = $aobj_context->mobj_data["sec"];
$month = $aobj_context->mobj_data["month"];
$subcode = $aobj_context->mobj_data["subcode"];
$conducted_field=" ifnull(F{$month}C,0) ";
$attended_field=" ifnull(F{$month}A,0) ";
if($sec=="all"){
$section='';
}else{
$section="AND stu.FSECTION ='{$sec}'";
}
$query=" SELECT mak.fintcode,stu.FREGNO, stu.FNAME ,{$conducted_field} AS conducted, {$attended_field} AS attended
FROM student stu
INNER JOIN attend mak ON stu.FREGNO=mak.FREGNO AND mak.fdegree='{$degree}' AND mak.fexamno='{$examno}'
AND mak.FCOLLCODE='{$collcode}'
INNER JOIN subject sub ON sub.FCSUBCODE = mak.FSUBCODE INNER JOIN degree d ON d.FDEGREE =mak.FDEGREE AND
d.Fexamno=mak.Fexamno AND d.FMEYEAR=mak.FYEAR AND d.FMEEXAMTYP=mak.FEXAMTYPE AND sub.FCSUBCODE='{$subcode}'
AND sub.FDEGREE='{$degree}' AND sub.FEXAMNO='{$examno}' WHERE stu.FREGNO != '' {$section}
GROUP BY stu.FREGNO ORDER BY stu.FREGNO LIMIT 0, 1000";
$res = $aobj_context->mobj_db->GetAll($query);
if($res)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
return;
}
else
{
$arr['msg']='Data Not Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed");
return;
}
}
function saveAttendanceMonthwise($aobj_context){
$Examno=$aobj_context->mobj_data["sem"];
$degree_code=$aobj_context->mobj_data["degree"];
$Sub_code = $aobj_context->mobj_data["subcode"];
$month_name = ($aobj_context->mobj_data["month"]);
$College_Code = $aobj_context->mobj_data['collcode'];
$funivcode = $aobj_context->mobj_data['funivcode'];
$User_code = $aobj_context->mobj_data['fuser'];
$conducted_field="F{$month_name}C ";
$attended_field="F{$month_name}A ";
$data = $aobj_context->mobj_data["data"];
$att_details = json_decode($data,true);
foreach($att_details as $ak=>$av)
{
if($av['conducted']==""){
$av['conducted']=0;
}else if($av['attended']==""){
$av['attended']=0;
}
if($funivcode != '051')
{
$query = "select {$conducted_field} as conduct, {$attended_field} as attend
from attend where fregno= '{$av['FREGNO']}' and fdegree = '{$degree_code}' and fexamno = '{$Examno}'
and fsubcode = '{$Sub_code}'";
$res = $aobj_context->mobj_db->getRow($query);
$conduct = $res['conduct'];
$attend = $res['attend'];
}
if($funivcode == '051')
{
$update="update attend set
{$conducted_field}='{$av['conducted']}',
{$attended_field}='{$av['attended']}',
ftotc = '{$av['conducted']}',
FTOTA = '{$av['attended']}',
fper = IFNULL(ROUND((('{$av['attended']}'/'{$av['conducted']}')*100),2),0),
FENTDATE=now()
where fregno= '{$av['FREGNO']}' and fexamno = '{$Examno}'
and fsubcode = '{$Sub_code}'
and fcollcode = '{$College_Code}'";
$lobj_insert_qry = $aobj_context->mobj_db->Execute($update);
}else
{
$update="update attend set
{$conducted_field}='{$av['conducted']}',
{$attended_field}='{$av['attended']}',
FENTDATE=now()
where fregno= '{$av['FREGNO']}' and fexamno = '{$Examno}'
and fsubcode = '{$Sub_code}'
and fcollcode = '{$College_Code}'";
$lobj_insert_qry = $aobj_context->mobj_db->Execute($update);
}
if($funivcode != '051' && $funivcode != '052')
{
$oldmarks = $res['fmarks'];
$univcode = $funivcode;
$mob = $_SESSION['FMOBILE'];
$usr =$User_code;
$college_code = $aobj_context->mobj_data['collcode'];
$remark = "ATT - Attendace Entry - $degree_code, $Examno, $Sub_code, $College_Code, $month_name, Conducted: ".$av['conducted'].", Attended: ".$av['attended']." Old Conducted: $conduct, Attended: ".$attend;
$enttype = "ATT";
// $res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
$query1 = "update attend set ftotc = IFNULL(FJANC,0)+IFNULL(FFEBC,0)+IFNULL(FMARC,0)+IFNULL(FAPRC,0)+IFNULL(FMAYC,0)+IFNULL(FJUNC,0)
+IFNULL(FJULC,0)+IFNULL(FAUGC,0)+IFNULL(FSEPC,0)+IFNULL(FOCTC,0)+IFNULL(FNOVC,0)+IFNULL(FDECC,0)+IFNULL(FOVERALL_SEMC,0)
where fregno= '{$av['FREGNO']}' and fexamno = '{$Examno}' and fsubcode = '{$Sub_code}'";
$results1 = $aobj_context->mobj_db->Execute($query1);
$query2 = "update attend set FTOTA = IFNULL(FJANA,0)+IFNULL(FFEBA,0)+IFNULL(FMARA,0)+IFNULL(FAPRA,0)+IFNULL(FMAYA,0)+IFNULL(FJUNA,0)
+IFNULL(FJULA,0)+IFNULL(FAUGA,0)+IFNULL(FSEPA,0)+IFNULL(FOCTA,0)+IFNULL(FNOVA,0)+IFNULL(FDECA,0)+IFNULL(FOVERALL_SEMA,0)
where fregno= '{$av['FREGNO']}' and fexamno = '{$Examno}' and fsubcode = '{$Sub_code}'";
$results2 = $aobj_context->mobj_db->Execute($query2);
$query3 = "UPDATE attend set fper = IFNULL(ROUND((IFNULL(FTOTA,0)*100)/IFNULL(FTOTC,0),2),0)
where fregno= '{$av['FREGNO']}' and fexamno = '{$Examno}' and fsubcode = '{$Sub_code}'";
$results3 = $aobj_context->mobj_db->Execute($query3);
}
}
if($funivcode == '017')
{
$get_studentInfo = "SELECT DISTINCT fcollcode, fdegree,fregno FROM attend
WHERE fdegree = '{$degree_code}' AND fexamno = '{$Examno}'
and fsubcode = '{$Sub_code}' and ifnull(fper,0) < 75
ORDER BY fcollcode,fdegree,fexamno";
$lobj_get_studentInfo = $aobj_context->mobj_db->getAll($get_studentInfo);
if($lobj_get_studentInfo > 0)
{
$query ="delete from attshort where fdegree = '{$degree_code}' AND fexamno = '{$Examno}' and fsubcode = '{$Sub_code}'";
$results = $aobj_context->mobj_db->Execute($query);
$query = "insert into attshort
(select fdegree,fexamno,fsubcode,fregno,'Shortage of Attendance. Not Eligilble' from attend
where fdegree = '{$degree_code}' AND fexamno = '{$Examno}' and fsubcode = '{$Sub_code}' and ifnull(fper,0) < 75)";
$results = $aobj_context->mobj_db->Execute($query);
}
}
if($lobj_insert_qry)
{
if($funivcode == '052' || $funivcode == '051' || $funivcode == '021')
{
$query = "update attend set ftotc = IFNULL(FJANC,0)+IFNULL(FFEBC,0)+IFNULL(FMARC,0)+IFNULL(FAPRC,0)+IFNULL(FMAYC,0)+IFNULL(FJUNC,0)
+IFNULL(FJULC,0)+IFNULL(FAUGC,0)+IFNULL(FSEPC,0)+IFNULL(FOCTC,0)+IFNULL(FNOVC,0)+IFNULL(FDECC,0)+IFNULL(FOVERALL_SEMC,0)
where fcollcode = '{$College_Code}'";
$results = $aobj_context->mobj_db->Execute($query);
$query = "update attend set FTOTA = IFNULL(FJANA,0)+IFNULL(FFEBA,0)+IFNULL(FMARA,0)+IFNULL(FAPRA,0)+IFNULL(FMAYA,0)+IFNULL(FJUNA,0)+IFNULL(FJULA,0)+IFNULL(FAUGA,0)+IFNULL(FSEPA,0)+IFNULL(FOCTA,0)+IFNULL(FNOVA,0)+IFNULL(FDECA,0)+IFNULL(FOVERALL_SEMA,0)
where fcollcode = '{$College_Code}'";
$results = $aobj_context->mobj_db->Execute($query);
$query = "UPDATE attend set fper = IFNULL(ROUND((IFNULL(FTOTA,0)*100)/IFNULL(FTOTC,0),2),0)
where fcollcode = '{$College_Code}'";
$results = $aobj_context->mobj_db->Execute($query);
}
$rdata = "Updated Successfully.";
print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$rdata = "No Updation / Add..!";
print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
return $rdata;
}
}
function saveSubFreezeforatt($aobj_context){
$Examno=$aobj_context->mobj_data["sem"];
$degree_code=$aobj_context->mobj_data["degree"];
$Sub_code = $aobj_context->mobj_data["subcode"];
$month_name = $aobj_context->mobj_data["month"];
$College_Code = $aobj_context->mobj_data['collcode'];
$funivcode = $aobj_context->mobj_data['funivcode'];
$User_code = $aobj_context->mobj_data['fuser'];
$status = $aobj_context->mobj_data['status'];
$currentDateTime = date('Y-m-d H:i:s');
$user_ip = $_SERVER['REMOTE_ADDR'];
if($status=="true"){
$freezed="T";
$qry="INSERT INTO collatt(fcollcode,fdegree,fexamno,fsubcode,fperiod,ffreezed,ffreezedate,ffreezeuser,ffreezip,fyear,fexamtype)
VALUES('{$College_Code}','{$degree_code}','{$Examno}','{$Sub_code}','{$month_name}','{$freezed}',
'{$currentDateTime}','{$User_code}','{$user_ip}','','')";
$results = $aobj_context->mobj_db->Execute($qry);
}else{
$qry="delete from collatt where fcollcode='{$College_Code}' and fdegree='{$degree_code}'
and fexamno='{$Examno}' and fsubcode='{$Sub_code}' and fperiod='{$month_name}'";
$results = $aobj_context->mobj_db->Execute($qry);
}
if($results){
echo $aobj_context->mobj_output->ToJSONEnvelope($results,0,"success");
return;
}else{
$arr['msg']='Data Not Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed");
return;
}
}
?>
|