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 : 3.23.92.50


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/updatestudentsem.php

<?php
function updatestudentsem($aobj_context){
    $degree = $aobj_context->mobj_data["degree"];
    if($degree == 'all'){
        $join = "";
    }else{
        $join = "WHERE d.fdegree = '{$degree}'";
    }

    $query=" SELECT IFNULL(d.FEXAMNO,'') AS fexamno,
    IFNULL(d.FEXAMNAME,'') AS fexamname 
    FROM degree d 
    INNER JOIN student a ON d.fdegree = a.fdegree 
    $join
    GROUP BY d.FEXAMNO";
    
    $results=$aobj_context->mobj_db->GetAll($query);


    if($results){
        $data['data'] = $results;
        echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0,"success"); 
    }else{
        $data['data'] = "something went wrong";
        echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail"); 
        return;
    }
}

function saveupdatesemester($aobj_context){

    $FUNIVCODE = $_SESSION['FUNIVCODE'];
    
    $degree = $aobj_context->mobj_data["degree"];
    $regfrom=$aobj_context->mobj_data["reg_no_from"];
    $regto=$aobj_context->mobj_data["reg_no_to"];
    $semester = $aobj_context->mobj_data["semester"];

    $module = $aobj_context->mobj_data["module"];
    $year = $aobj_context->mobj_data["year"];
    $examtype = $aobj_context->mobj_data["examtype"];

    if($degree == "all"){
        $cond= "";
    }else{
        $cond= "and fdegree='{$degree}'";
    }
    
    switch ($module) {
        case "adm":
             $query= "insert ignore into student(FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,fname,ffatname,fmotname,FAYEAR,FDOB,FCASTE,FCONTACT_NO,
                FNATIONAL,
                FCURRADD1,FCURRADD2,FCURRADD3,FCURRADD4,
                FPERMADD1,FPERMADD2,FPERMADD3,FPERMADD4,FPHOTOPATH,FSTUMOBILE,FSTUEMAIL,faadharno)
                select FDEGREE,FEXAMNO,FCOLLCODE,FaREGNO,fname,ffatname,fmotname,FAYEAR,FDOB,
                FCASTE,FCONTACT_NO,FNATIONAL,
                FCURRADD1,FCURRADD2,FCURRADD3,FCURRADD4,
                FPERMADD1,FPERMADD2,FPERMADD3,FPERMADD4,
                FPHOTOPATH,FCONTACT_NO,femail,faadharno
                from studadm where ifnull(fdeleted,'') <> 'T'
                {$cond}";
               
                $result = $aobj_context->mobj_db->Execute($query);

                $query= "insert into regcandsum(FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFRESHEXAM,FLOGDATE,fyear,fexamtype)
                select FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FEXAMNO,now(),'{$year}','{$examtype}' 
                from student st
                where st.fregno between '{$regfrom}' AND '{$regto}' $cond 
                on duplicate key update FEXAMNO = st.FEXAMNO, FFRESHEXAM = st.fexamno,
                FLOGDATE = now()";
                $result = $aobj_context->mobj_db->Execute($query);

          break;
        case "reg":
                
                
                if($FUNIVCODE != '097')
                {
                    $query="UPDATE student
                    SET FEXAMNO='{$semester}'
                    WHERE fregno BETWEEN '{$regfrom}' AND '{$regto}' 
                    {$cond}";  
                    $result = $aobj_context->mobj_db->Execute($query);
                }

                $query= "insert into regcandsum(FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFRESHEXAM,FLOGDATE,fyear,fexamtype)
                select FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FEXAMNO,now(),'{$year}','{$examtype}' from student st
                where st.fregno between '{$regfrom}' AND '{$regto}' $cond 
                on duplicate key update FEXAMNO = st.FEXAMNO, FFRESHEXAM = st.fexamno,
                FLOGDATE = now()";
                $result = $aobj_context->mobj_db->Execute($query);

          break;
        case "exam":

                $query= "insert ignore into candsum(FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFRESHEXAM,fyear,fexamtype,fappear$semester,fcntrcode)
                select FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFRESHEXAM,'{$year}','{$examtype}','A',fcollcode 
                from regcandsum rg
                where rg.fregno between '{$regfrom}' AND '{$regto}'
                and FFRESHEXAM = '{$semester}'
                $cond ";
                $result = $aobj_context->mobj_db->Execute($query);

                $query= "insert into canddet(FDEGREE, FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE, FYEAR, FEXAMTYPE)
                select FDEGREE, FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE,'{$year}','{$examtype}'
                from regcanddet rg
                where rg.fregno between '{$regfrom}' AND '{$regto}'
                and fexamno = '{$semester}'
                $cond  ";

          break;
        case "promot":

                if($FUNIVCODE != '097')
                {
                    $query="UPDATE student
                    SET FEXAMNO='{$semester}'
                    WHERE fregno BETWEEN '{$regfrom}' AND '{$regto}' 
                    {$cond}";  
                    $result = $aobj_context->mobj_db->Execute($query);
                }
                
                $query= "insert into regcandsum(FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFRESHEXAM,FLOGDATE,fyear,fexamtype)
                select FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FEXAMNO,now(),'{$year}','{$examtype}' from student st
                where st.fregno between '{$regfrom}' AND '{$regto}' $cond 
                on duplicate key update FEXAMNO = st.FEXAMNO, FFRESHEXAM = st.fexamno,
                FLOGDATE = now()";
                $result = $aobj_context->mobj_db->Execute($query);
            break;
        case "examactive":
                $query = "update candsum set frecptdate = now(), ftotalfee = '1'
                where FFRESHEXAM = '{$semester}'
                and fyear = '{$year}' 
                and fregno between '{$regfrom}' AND '{$regto}'
                and fexamtype = '{$examtype}'
                and fdegree = '{$degree}'
                ";
                $result = $aobj_context->mobj_db->Execute($query);

                $query = "update canddet cd, candsum cs set cd.fpresent = 'P'
                where cd.fregno = cs.fregno
                and cd.fexamno = cs.FFRESHEXAM
                and cd.fdegree = cs.fdegree
                and cd.fcollcode = cs.fcollcode
                and cd.fdegree = '{$degree}'
                and cd.fexamno = '{$semester}'
                and cd.fregno between '{$regfrom}' AND '{$regto}'
                and cd.fyear = '{$year}'
                and cd.fexamtype = '{$examtype}'";
                $result = $aobj_context->mobj_db->Execute($query);

            break;  
        default:
          //code block
    }

    $query="UPDATE student
            SET FEXAMNO='{$semester}'
            WHERE fregno BETWEEN '{$regfrom}' AND '{$regto}' 
            {$cond}";  
    $result = $aobj_context->mobj_db->Execute($query);
     
    if($result)
    {

        $query= "insert into regcandsum(FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFRESHEXAM,FLOGDATE)
        select FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FEXAMNO,now() from student st
        where st.fregno between '{$regfrom}' AND '{$regto}' $cond 
        on duplicate key update FEXAMNO = st.FEXAMNO, FFRESHEXAM = st.fexamno,
        FLOGDATE = now()";
        $res = $aobj_context->mobj_db->Execute($query);

        $data['data'] = $result;
        echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0,"success");
        return;

    }else
    {
        $data['data'] = "something went wrong";
        echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail"); 
        return;
    }
}
  ?>