0xV3NOMx
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 : 18.117.156.26


Current Path : /var/www/html/collportal/src/
Upload File :
Current File : /var/www/html/collportal/src/duringExam.php

<?php

function getAbEntryQPData($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data["funivcode"];
    $fexamdate = $aobj_context->mobj_data["fexamdate"];
    $ftype = $aobj_context->mobj_data["ftype"];

    $join = "";

    if($univcode == '052'){
        $join = "inner join timetable t on s.fqpcode = t.fqpcode
        and c.fyear = t.fyear
        and c.fexamtype = t.fexamtype";
    }
    
    $query = "select DISTINCT s.FQPCODE,s.FSUBCODE,
            concat(s.FSUBNAME,' ',s.FSSUBNAME) as FSSUBNAME,
            date_format(s.FDOE,'%d/%m/%Y') as FDOE,
            ifnull(s.fvalmax,'')as fvalmax,
            count(c.FREGNO) as prcnt,
            sum(if(ifnull(a.fregno,'') <> '',1,0)) as abcnt
            from subject s
            inner join canddet c on s.fdegree = c.fdegree
            and s.fexamno = c.fexamno
            and s.fsubcode = c.fsubcode
            {$join}
            left join absent a on s.fqpcode = a.fqpcode
            and c.fcollcode = a.fcollcode
            and s.fdoe = a.fdoe
            and a.fregno = c.fregno
            and c.fyear = a.fyear
            and c.fexamtype = a.fexamtype
            and a.FABSTYPE = '{$ftype}'
            where ifnull(s.FQPCODE,'')<>'' 
            and c.fpresent = 'P'
            and s.FDOE = '{$fexamdate}'
            group by s.fqpcode";
    
    $result = $aobj_context->mobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "Success");
        return;
    }else {
        $arr['msg'] = 'Something went please try later';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getAbEntryStdDet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data["funivcode"];
    $qp_code = $aobj_context->mobj_data["fqpcode"];
    $fdoe = $aobj_context->mobj_data["fdoe"];
    $ftype = $aobj_context->mobj_data["ftype"];
    
    $query = "select DISTINCT st.fregno,st.fname,
            if(ifnull(a.fregno,'') <> '','T','F') as ab,
            ifnull(s.fqpcode,'')as fqpcode,
            ifnull(st.fdegree,'')as fdegree,
            ifnull(st.fexamno,'')as fexamno,
            ifnull(s.FSUBCODE,'')as FSUBCODE,
            c.fyear,c.fexamtype,
            CASE WHEN LEFT(s.FSESSION,1)='M' THEN 'AM' ELSE 'PM' END AS FSESSION
            from student st
            inner join subject s on st.fdegree = s.fdegree
            and st.fexamno = s.fexamno
            inner join canddet c on s.fdegree = c.fdegree
            and st.fdegree = c.fdegree
            and st.fexamno = c.fexamno
            and s.fexamno = c.fexamno
            and s.fsubcode = c.fsubcode
            and st.fregno = c.fregno
            left join absent a on s.fqpcode = a.fqpcode
            and c.fcollcode = a.fcollcode
            and s.fdoe = a.fdoe
            and a.fregno = c.fregno
            and c.fyear = a.fyear
            and c.fexamtype = a.fexamtype
            and a.FABSTYPE = '{$ftype}'
            where ifnull(s.FQPCODE,'') = '{$qp_code}' 
            and c.fpresent = 'P'
            and date_format(s.FDOE,'%d/%m/%Y') = '{$fdoe}'
            group by c.fregno
            order by ab desc";

    $result = $aobj_context->mobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "Success");
        return;
    }else {
        $arr['msg'] = 'Degree Group not defined';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function saveAbStdDetails($aobj_context){
    $val=json_decode($aobj_context->mobj_data["abstddata"],true);
    $univcode = $aobj_context->mobj_data["univcode"];
    $fdoe = $aobj_context->mobj_data["fdoe"];
    $ftype = $aobj_context->mobj_data["ftype"];
    $fcollcode = $aobj_context->mobj_data["fcollcode"];
    $userName = $aobj_context->mobj_data["fuserName"];
    
    if($val['ab'] == 'T'){
        $update_record = "INSERT IGNORE INTO absent (FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,
        FDOE,FSESSION,FABSTYPE,FLOGNAME,FLOGDATE,FDELETED,FQPCODE,FYEAR,FEXAMTYPE)
        VALUES ('{$val['fdegree']}','{$val['fexamno']}','{$fcollcode}','{$val['fregno']}',
        '{$fdoe}','{$val['FSESSION']}','{$ftype}','{$userName}',
        now(),'F','{$val['fqpcode']}','{$val['fyear']}','{$val['fexamtype']}')";
    }else if($val['ab'] == 'F'){
        $update_record = "delete FROM absent 
            where FCOLLCODE ='{$fcollcode}' and FREGNO = '{$val['fregno']}' 
            and FQPCODE = '{$val['fqpcode']}' and FYEAR = '{$val['fyear']}'
            and FEXAMTYPE = '{$val['fexamtype']}' and FDOE = '{$fdoe}'
            and FSESSION = '{$val['FSESSION']}' and FABSTYPE = '{$ftype}'";
    }
    
    $result = $aobj_context->mobj_db->Execute($update_record);
    
    if($result){
        $arr['msg'] = "Successfully Updated";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
    }else{
        $arr['msg'] = "No Data Found";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
        return;
    }
}

function bundleDispatchDet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data["funivcode"];
    $fexamdate = $aobj_context->mobj_data["fexamdate"];

    $join = "";

    if($univcode == '052'){
        $join = "inner join timetable t on s.fqpcode = t.fqpcode
        and c.fyear = t.fyear
        and c.fexamtype = t.fexamtype";
    }
    
    $query = "";
    
    $result = $aobj_context->mobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "Success");
        return;
    }else {
        $arr['msg'] = 'Something went please try later';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}
?>