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.129.23.110


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/viewexamcentrenew.php

<?php

function loaddeggrpexamcentre($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $univcode = $aobj_context->mobj_data['univcode'];
  $fcollcode = $aobj_context->mobj_data['fcollcode'];
  
  if($fcollcode == "" || $fcollcode == null){
    $cond = "";
  }else{
    $cond = "and s.fcollcode = '{$fcollcode}'";
  }

  if($univcode == '051')
  {
    $query="select ifnull(fdeggrp,'') as fdeggrp,ifnull(fdescpn,'') as fdescpn,
    ifnull(fyear,'') as fyear,ifnull(fexamtype,'') as fexamtype
    from notif_deggrp
    where ifnull(fdeleted,'') <> 'T'";
  }elseif ($univcode == '021'){
    $query = "select distinct ifnull(d.fdeggrp,'') as fdeggrp,ifnull(d.fdescpn,'') as fdescpn,
    ifnull(d.fyear,'') as fyear,ifnull(d.fexamtype,'') as fexamtype
    from deggrp d left join degree dg on d.fdeggrp = dg.fdeggrp
    left join student s on dg.fdegree = s.fdegree 
    where ifnull(d.fdeleted,'') <> 'T' $cond";
  }
  else
  {
    $query="select ifnull(fdeggrp,'') as fdeggrp,ifnull(fdescpn,'') as fdescpn,
    ifnull(fyear,'') as fyear,ifnull(fexamtype,'') as fexamtype
    from deggrp
    where ifnull(fdeleted,'') <> 'T'";
  }
  $result = $aobj_context->pobj_db->GetAll($query);

  if($result){
      
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
  }
  else{
    $arr['msg']="Failed to Load";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
}


function loaddeggrpnotif($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $univcode = $aobj_context->mobj_data['univcode'];

  if($univcode == '051')
  {
    $query="select ifnull(fdeggrp,'') as fdeggrp,
    concat(ifnull(fdescpn,''),' - ',fexamdate) as fdescpn,
    ifnull(fyear,'') as fyear,ifnull(fexamtype,'') as fexamtype
    from notif_deggrp
    where ifnull(fdeleted,'') <> 'T'";
  }else{
    $query="select ifnull(fdeggrp,'') as fdeggrp,
    concat(ifnull(fdescpn,''),' - ',fexamdate) as fdescpn,
    ifnull(fyear,'') as fyear,ifnull(fexamtype,'') as fexamtype
    from tdvs_deggrp
    where ifnull(fdeleted,'') <> 'T'";
  }
  $result = $aobj_context->pobj_db->GetAll($query);

  if($result){
      
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
  }
  else{
    $arr['msg']="Failed to Load";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
}



function loadmastersdeg($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $univcode = $aobj_context->mobj_data['univcode'];
  $deggrp = $aobj_context->mobj_data['deggrp'];

  if($deggrp === "All"){
    $deggrpCond = "ifnull(fdeggrp, '') <> ''";
  }else{
    $deggrpCond = "fdeggrp = '{$deggrp}'";
  }

   $query="select ifnull(fdegree,'') as fdegree,ifnull(fdescpn,'') as fdescpn
   from degree 
   where {$deggrpCond}
   group by fdegree";

  
     $result = $aobj_context->pobj_db->GetAll($query);
  if($result){
      
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
  }
  else{
    $arr['msg']="Failed to Load";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
}


function loadsubrptsem($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $univcode = $aobj_context->mobj_data['univcode'];
  $degree = $aobj_context->mobj_data['degree'];

  foreach($degree as $key => $val){
      $deg .= "'".$val."',";
  }
  $degarr = substr_replace($deg ,"",-1);

  if($degarr == "'All'" || $degarr == ""){
      $cnd = "";
    }else{
      $cnd = "and fdegree in ($degarr)";
    }

   $query="select ifnull(fexamno,'') as fexamno,ifnull(fexamname,'') as fexamname
   from degree
   where ifnull(FDELETED,'') <> 'T' and  ifnull(fexamname,'') <> '' $cnd
   group by fexamno";


     $result = $aobj_context->pobj_db->GetAll($query);
  if($result){
      
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
  }
  else{
    $arr['msg']="Failed to Load";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
}




function loadallexamcentre($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];
    $req = $aobj_context->req_body;

    $data = $req['data'];
    $date = $data['date'];
    $subject = $data['subject'];
    $degree = $data['degree'];
    $centre = $data['centre'];
    $session = $data['session'];

    if($deggrp == "All"){
      $deggcond = "dg.fdeggrp <> ''";
    }else{
      $deggcond = "dg.fdeggrp = '{$deggrp}'";
    }

    foreach($date as $key => $val){
        $dat .= "date_format(STR_TO_DATE("."'".$val."'".", '%d/%m/%Y'),'%Y-%m-%d')".",";
    }
    $datearr = substr_replace($dat ,"",-1);

    foreach($subject as $key => $val){
        $sub .= "'".$val."',";
    }
    $subarr = substr_replace($sub ,"",-1);

    foreach($degree as $key => $val){
        $deg .= "'".$val."',";
    }
    $degarr = substr_replace($deg ,"",-1);

    foreach($centre as $key => $val){
        $cen .= "'".$val."',";
    }
    $centrearr = substr_replace($cen ,"",-1);

    foreach($session as $key => $val){
        $sess .= "'".$val."',";
    }
    $sessionarr = substr_replace($sess ,"",-1);

    

  if(strpos($datearr,"All") != "" || $datearr == ""){
      $cnd1 = "";
  }else{
    $cnd1 = "and s.fdoe in ($datearr)";
  }

  if($subarr == "'All'" || $subarr == ""){
    $cnd2 = "";
  }else{
    $cnd2 = "and s.fsubcode in ($subarr)";
  }

  if($degarr == "'All'" || $degarr == ""){
    $cnd3 = "";
  }else{
    $cnd3 = "and d.fdegree in ($degarr)";
  }

  if($centrearr == "'All'" || $centrearr == ""){
    $cnd4 = "";
  }else{
    $cnd4 = "and cs.FCNTRCODE in ($centrearr)";
  }

  if($sessionarr == "'All'" || $sessionarr == ""){
    $cnd5 = "";
  }else{
    $cnd5 = "and s.fsession in ($sessionarr)";
  }

    $querydate = "select distinct ifnull(date_format(s.FDOE,'%d/%m/%Y'),'') as fdoe 
    from subject s
    inner join degree d on s.FDEGREE = d.fdegree and s.fexamno = d.fexamno
    inner join deggrp dg on d.fdeggrp = dg.fdeggrp
    inner join candsum cs on s.fdegree = cs.fdegree
    where $deggcond 
    and ifnull(s.fdoe,'0000-00-00') <> '0000-00-00' $cnd2 $cnd3 $cnd4 $cnd5";


    $resdate = $aobj_context->pobj_db->GetAll($querydate);


    $querysub = "select distinct ifnull(s.FSUBCODE,'') as fsubcode,ifnull(s.FSUBNAME,'') as fsubname
    from subject s 
    inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
    inner join deggrp dg on d.fdeggrp = dg.fdeggrp
    inner join candsum cs on s.fdegree = cs.fdegree
    where $deggcond $cnd1 $cnd3 $cnd4 $cnd5";

    $ressub = $aobj_context->pobj_db->GetAll($querysub);


    $querydegree = "select distinct ifnull(d.FDEGREE,'') as fdegree,ifnull(d.FDESCPN,'') as fdescpn 
    from degree d 
    inner join deggrp dg on d.fdeggrp = dg.fdeggrp
    inner join subject s on s.FDEGREE = d.fdegree and s.fexamno = d.fexamno
    inner join candsum cs on s.fdegree = cs.fdegree
    where $deggcond $cnd1 $cnd2 $cnd4 $cnd5";
// var_dump($querydegree);
// die();

   $resdegree = $aobj_context->pobj_db->GetAll($querydegree);


   $querycentre = "select distinct ifnull(cs.FCNTRCODE,'') as fcntrcode, 
   concat(cs.fcntrcode,' - ',cl.fcollname,', ',cl.ftown) as collanme
   from candsum cs inner join degree d on cs.fdegree = d.fdegree and d.fexamno = 'A'
      inner join deggrp dg on d.fdeggrp = dg.fdeggrp
      inner join subject s on cs.fdegree = s.fdegree
      inner join college cl on cs.fcntrcode = cl.fcollcode
   where $deggcond 
   and cs.FCNTRCODE <> '' and cs.FCNTRCODE <> '0' $cnd1 $cnd2 $cnd3 $cnd5";

   $rescentre = $aobj_context->pobj_db->GetAll($querycentre);


   $querysession = "select distinct ifnull(s.fsession,'') as fsession 
   from subject s 
   inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
   inner join deggrp dg on d.fdeggrp = dg.fdeggrp
   inner join candsum cs on s.fdegree = cs.fdegree
   where $deggcond and fsession <> '' $cnd1 $cnd2 $cnd3 $cnd4ß";

   $ressession = $aobj_context->pobj_db->GetAll($querysession);
   
     $arr['date'] = $resdate;
     $arr['sub'] = $ressub;
     $arr['degree'] = $resdegree;
     $arr['centre'] = $rescentre;
     $arr['session'] = $ressession;


    if($querydate){
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
    }
    else{
      $arr['msg']="Failed to Save";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
    }
  }



  function loadtableexamcentre($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $req = $aobj_context->req_body;
    $deggrp = $aobj_context->mobj_data['deggrp'];
    $reportorder = $aobj_context->mobj_data['reportorder'];
    $data = $req['data'];
    $date = $data['date'];
    $subject = $data['subject'];
    $degree = $data['degree'];
    $centre = $data['centre'];
    $session = $data['session'];
    $frmdates = $data['frmdate'];
    $todates = $data['todate'];
    $qpfrm = $data['qpfrm'];
    $qpto = $data['qpto'];

    if($frmdates !== "" && $todate !== ""){
      $frm = date_create($frmdates);
      $to = date_create($todates);
      $frmdate = date_format($frm,"Y-m-d");
      $todate = date_format($to,"Y-m-d");
    }
    
    if($deggrp == "All"){
      $deggcond = "dg.fdeggrp <> ''";
    }else{
      $deggcond = "dg.fdeggrp = '{$deggrp}'";
    }

  foreach($date as $key => $val){
    if($val != 'All'){
      $dat .= "date_format(STR_TO_DATE("."'".$val."'".", '%d/%m/%Y'),'%Y-%m-%d')".",";
    }else{
      $all .= "All";
    }
  }
  if($all != 'All'){
    $datearr = substr_replace($dat ,"",-1);
  }else{
    $datearr = "";
  }

  foreach($subject as $key => $val){
      $sub .= "'".$val."',";
  }
  $subarr = substr_replace($sub ,"",-1);

  foreach($degree as $key => $val){
      $deg .= "'".$val."',";
  }
  $degarr = substr_replace($deg ,"",-1);

  foreach($centre as $key => $val){
      $cen .= "'".$val."',";
  }
  $centrearr = substr_replace($cen ,"",-1);

  foreach($session as $key => $val){
      $sess .= "'".$val."',";
  }
  $sessionarr = substr_replace($sess ,"",-1);
  
  if(strpos($datearr,"All") != "" || $datearr == ""){
    if($frmdate != "" && $todate != ""){
      $cnd1 = "and s.fdoe between '{$frmdate}' and '{$todate}'";
    }else{
      $cond1 = "";
    }
  }else{
    $cnd1 = "and s.fdoe in ($datearr)";
  }

  if($subarr == "'All'" || $subarr == ""){
    $cnd2 = "";
  }else{
    $cnd2 = "and s.fsubcode in ($subarr)";
  }

  if($degarr == "'All'" || $degarr == ""){
    $cnd3 = "";
  }else{
    $cnd3 = "and d.fdegree in ($degarr)";
  }

  if($centrearr == "'All'" || $centrearr == ""){
    $cnd4 = "";
  }else{
    $cnd4 = "and cs.FCNTRCODE in ($centrearr)";
  }

  if($sessionarr == "'All'" || $sessionarr == ""){
    $cnd5 = "";
  }else{
    $cnd5 = "and s.fsession in ($sessionarr)";
  }

  
  if($reportorder == "qpwisedatewisecentrewise"){
    $query="select distinct ifnull(s.fqpcode,'') as fqpcode,ifnull(s.fsubname,'') as fsubname,
    ifnull(cs.FCNTRCODE,'') as fcntrcode,ifnull(s.fsession,'') as fsession,
    r.FDESCPN,
    date_format(ifnull(s.fdoe,''),'%d/%m/%Y') as fdoe,
    concat(ifnull(cl.FCOLLNAME,''),', ',cl.ftown) as fcollname,
    count(cd.fregno) as cnt
    from canddet cd
    inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
    and cd.fsubcode = s.fsubcode
    inner join candsum cs on cs.fdegree = cd.fdegree 
    and cd.fcollcode = cs.fcollcode
    and cd.fregno = cs.fregno
    inner join college cl on cl.FCOLLCODE = cs.FCNTRCODE
    inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
    inner join deggrp dg on d.fdeggrp = dg.fdeggrp
    inner join reason r on s.fsession = r.FREASONCD
    where $deggcond $cnd1 $cnd2 $cnd3 $cnd4 $cnd5
    and cd.fpresent = 'P'
    and ifnull(cs.frecptdate,'') <> ''
    and s.fqpcode between '{$qpfrm}' and '{$qpto}' 
    group by s.fqpcode,cs.fcntrcode,s.fdoe,s.fsession
    order by s.fdoe,s.fsession,cs.FCNTRCODE";

  }else{
    $query = "select distinct ifnull(cs.FCNTRCODE,'') as fcntrcode,
    concat(ifnull(cl.FCOLLNAME,''),', ',cl.ftown) as fcollname,
    date_format(ifnull(s.fdoe,''),'%d/%m/%Y') as fdoe,
    sum(if(INSTR(s.fsession, 'M') >0,1,0)) as m_cnt,
    count(distinct if(INSTR(s.fsession, 'M') >0,ifnull(cd.fhallno,''),NULL)) as m_hall,
    sum(if(INSTR(s.fsession, 'N') >0,1,0)) as a_cnt,
    count(distinct if(INSTR(s.fsession, 'N') >0,ifnull(cd.fhallno,''),NULL)) as a_hall
    from canddet cd
    inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
    and cd.fsubcode = s.fsubcode
    inner join candsum cs on cs.fdegree = cd.fdegree 
    and cd.fcollcode = cs.fcollcode
    and cd.fregno = cs.fregno
    inner join college cl on cl.FCOLLCODE = cs.FCNTRCODE
    inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
    inner join deggrp dg on d.fdeggrp = dg.fdeggrp
    inner join reason r on s.fsession = r.FREASONCD
    where $deggcond $cnd1 $cnd2 $cnd3 $cnd4 $cnd5
    and cd.fpresent = 'P'
    and ifnull(cs.frecptdate,'') <> ''
    and s.fqpcode between '{$qpfrm}' and '{$qpto}' 
    group by cs.fcntrcode,s.fdoe
    order by s.fdoe,s.fsession,cs.FCNTRCODE";

  }

  $result = $aobj_context->pobj_db->GetAll($query);   
    
  if($result){
      
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
  }
  else{
    $arr['msg']="No Data Found";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
  }

  function getVerfyData($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggp = $aobj_context->mobj_data['deggp'];
    $fstatus = $aobj_context->mobj_data['fstatus'];
  
    if($deggp !== 'ALL'){
      $cond = " and fdeggrp = '{$deggp}'";
    }else{
      $cond = " and ifnull(fdeggrp,'') <> ''";
    }

    if($fstatus == 'ALL'){
      $cond2 = "";
    }elseif($fstatus == 'Pending'){
      $cond2 = "and ifnull(fstatus,'') <> 'T'";
    }elseif($fstatus == 'Verified'){
      $cond2 = "and ifnull(fstatus,'') = 'T'";
    }

    $query="select fnotifname,fnotifdate,ifnull(fstatus,'F') as action,ifnull(fdeleted,'F') as fdeleted,
    if(ifnull(fstatus,'') = 'T','Approved','Draft') as statu,fnotifid,ifnull(fdeggrp,'') as fdeggrp
    from notifsum where ifnull(fdeleted,'F') <> 'T' $cond $cond2
    order by fnotifdate desc";
    // var_dump($query);die();
    // "select fnotifname,fnotifdate,ifnull(fstatus,'F') as action,
    // if(ifnull(fstatus,'') = 'T','Verification','Pending') as statu,fnotifid
    // from notifsum where $cond $cond2";
    
    $result = $aobj_context->pobj_db->GetAll($query);
    if($result){
      echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
    }
    else{
      $arr['msg']="Failed to Load";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
    }
  }

  function saveVerifyNotifi($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $userid = $aobj_context->mobj_data['userid'];
    $usertype = $aobj_context->mobj_data['usertype'];
    $findata = json_decode($aobj_context->mobj_data['findata'],true);
    $date = date("Y-m-d h:i:sa");
    $datatru = true;
    foreach($findata as $val){
      
      if($val['statu'] == 'Approved')
      {
        $query = "select count(distinct cs.fregno) as cnt 
        from notifdet n 
        inner join candsum cs on n.fdegree = cs.fdegree
        and n.fyear = cs.fyear and n.fexamtype = cs.fexamtype
        inner join canddet cd on cs.fregno = cd.fregno 
        and cd.fyear = cs.fyear and cd.fexamtype = cs.fexamtype
        and cd.fexamno = n.fexamno
        where fnotifid = '{$val['fnotifid']}'";
        $res = $aobj_context->pobj_db->GetRow($query);
        
        if($res['cnt'] <=0)
        {
          $datatru = false;

          $query="update notifsum set fdataready = 'N'
          where fnotifid = '{$val['fnotifid']}'";
    
          $result = $aobj_context->pobj_db->Execute($query);
          
        }  

      }

    }

    // if($usertype == '100' || $usertype == '200')
    // {
    //   $datatru = true;
    // }

    if($datatru)
    {

    }else
    {

     

      // $arr['msg']="Examination data is not available for approval.";
      // echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
      // return;

    }
      

    foreach($findata as $val){
      


      $query="update notifsum set fstatus = '{$val['action']}',fverifdate='{$date}',
      fverifuser = '{$userid}',fdeleted = '{$val['fdeleted']}'
      where fnotifid = '{$val['fnotifid']}'";

      $result = $aobj_context->pobj_db->Execute($query);
      
      $query="select distinct fdeggrp,fyear,fexamtype 
      from notifdet where fnotifid = '{$val['fnotifid']}'";
      $res = $aobj_context->pobj_db->GetRow($query);
      
      $dgp = $res['fdeggrp'];
      $year = $res['fyear'];
      $examtype = $res['fexamtype'];
      $notifid = $val['fnotifid'];

      

      if($val['statu'] == 'Approved')
      {

        $query= "select max(fenddate) as fenddate, min(fstartdate) as fstartdate 
        from notifdet where fnotifid = '{$val['fnotifid']}'
        and fheadid in('5','6','7')";
        $res9 = $aobj_context->pobj_db->GetRow($query);
        $fenddate = $res9['fenddate'];
        $fstartdate = $res9['fstartdate'];

        $query = "UPDATE timetable SET 
        ffreeze = 'T', ffreezeuser = '{$user}', ffreezedate=NOW(),
        frelease = 'T'
        WHERE fdeggrp = '{$dgp}' AND fyear = '{$year}' 
        AND fexamtype = '{$examtype}' AND fqpcode in(
          select distinct fqpcode from subject where ifnull(fqpcode,'') <> '' and concat(fdegree,fexamno)in(select distinct concat(fdegree,fexamno) 
          from notifdet where fnotifid = '{$notifid}')
        )";
        $res=$aobj_context->pobj_db->Execute($query);

        $query = "update subject s, timetable t, masdate m,
        (select distinct fqpcode from subject where ifnull(fqpcode,'') <> '' and concat(fdegree,fexamno)in(select distinct concat(fdegree,fexamno) 
          from notifdet where fnotifid = '{$notifid}')) r
        set s.fdoe = m.fdate,
        s.fsession = t.fsessiont
        where t.fdatecodet = m.fdatecode
        and t.fdeggrp  = m.fdeggrp and t.fyear = m.fyear 
        and t.fexamtype = m.fexamtype
        and t.fqpcode = s.fqpcode
        and s.fdegree in (select distinct fdegree from degree where fdeggrp = '{$dgp}')
        and m.fdeggrp = '{$dgp}' and m.fyear = '{$year}' 
        and ifnull(t.frelease,'') = 'T'
        and s.fqpcode =r.fqpcode  
        and m.fexamtype = '{$examtype}'";

        $res1=$aobj_context->pobj_db->Execute($query);

        $upd = "update collexam cs, notifdet d set cs.fappfrom = '{$fstartdate}', cs.fappto = '{$fenddate}'
        where cs.fdegree = d.fdegree and cs.fexamno = d.fexamno
        and d.fnotifid = '{$val['fnotifid']}'";
        $res10=$aobj_context->pobj_db->Execute($upd);

        $upd = "update collexam cs, notifdet d set cs.fiafrom = d.fstartdate  , cs.fiato = d.fenddate
        where cs.fdegree = d.fdegree and cs.fexamno = d.fexamno
        and d.fnotifid = '{$val['fnotifid']}'
        and d.fheadid = '9'";
        $res10=$aobj_context->pobj_db->Execute($upd);

        $upd = "update collexam cs, notifdet d set cs.fattfrom = d.fstartdate, cs.fattto = d.fenddate
        where cs.fdegree = d.fdegree and cs.fexamno = d.fexamno
        and d.fnotifid = '{$val['fnotifid']}'
        and d.fheadid = '10'";
        $res11=$aobj_context->pobj_db->Execute($upd);

        $upd = "update collexam cs, notifdet d set cs.fhtfrom = d.fstartdate, cs.fhtto = d.fenddate
        where cs.fdegree = d.fdegree and cs.fexamno = d.fexamno
        and d.fnotifid = '{$val['fnotifid']}'
        and d.fheadid = '11'";
        $res12=$aobj_context->pobj_db->Execute($upd);

        $upd = "update collexam cs, notifdet d set cs.fprfrom = d.fstartdate, cs.fprto = d.fenddate
        where cs.fdegree = d.fdegree and cs.fexamno = d.fexamno
        and d.fnotifid = '{$val['fnotifid']}'
        and d.fheadid = '12'";
        $res13=$aobj_context->pobj_db->Execute($upd);

      }else if($val['statu'] == 'Draft')
      {
        $query = "UPDATE timetable SET 
        ffreeze = 'F', ffreezeuser = '{$user}', ffreezedate=NOW(),
        frelease = 'F'
        WHERE fdeggrp = '{$dgp}' AND fyear = '{$year}' 
        AND fexamtype = '{$examtype}' AND fqpcode in(
          select distinct fqpcode from subject where ifnull(fqpcode,'') <> '' and concat(fdegree,fexamno)in(select distinct concat(fdegree,fexamno) 
          from notifdet where fnotifid = '{$notifid}')
        )";
        $res=$aobj_context->pobj_db->Execute($query);
      }
    }
    
    if($result){
      $arr['msg']="SuccessFully Updated";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
    }
    else{
      $arr['msg']="Failed to Update";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
    }
  }

?>