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


Current Path : /proc/thread-self/root/var/www/html/admission/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/admission/src/qp_dashboard.php

<?php
function qp_dashboard($aobj_context){

  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

  $univcode = $aobj_context->mobj_data['univcode'];
  $usertype = $aobj_context->mobj_data['usertype'];
  $date = $aobj_context->mobj_data['date'];
  

  $query = "select distinct s.fsession, r.fdescpn from 
            subject s inner join reason r on s.fsession=r.FREASONCD
             where s.fsession<>'' and s.fdoe = date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d') group by s.fsession;";

  $getDegGrp = "select distinct d.fdeggrp from candsum cs inner join canddet cd on cs.fregno = cd.fregno
  and cd.fcollcode = cs.fcollcode
  inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno and
  cd.fsubcode = s.fsubcode inner join degree d on cs.fdegree = d.fdegree and d.fexamno = cd.fexamno
  where fdoe =date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d') and d.fdeggrp<>'' ";

  
  $deggrpResult = $aobj_context->pobj_db->GetAll($getDegGrp);

  $result = $aobj_context->pobj_db->GetAll($query);
  if($deggrpResult||$result){
    $arr['deggrp']=$deggrpResult;
    $arr['session']=$result;
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
  } else {
    $arr['msg'] = 'Error while fetching session';
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
  
}

function getCenterCount($aobj_context){

  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

  $univcode = $aobj_context->mobj_data['univcode'];
  $usertype = $aobj_context->mobj_data['usertype'];
  $date = $aobj_context->mobj_data['date'];
  $session = $aobj_context->mobj_data['session'];
  $deggrp = $aobj_context->mobj_data['deggrp'];

  if($deggrp == 'all'){
    $cnd1 = "";
  }else{
    $cnd1 = "and d.fdeggrp = '{$deggrp}'";
  }
  
  $query = "select distinct count(distinct fcntrcode) as cnt 
            from candsum cs inner join canddet cd on cs.fregno = cd.fregno
            and cd.fcollcode = cs.fcollcode
            inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno and
            cd.fsubcode = s.fsubcode inner join degree d on 
            cs.fdegree = d.fdegree and d.fexamno = cd.fexamno
            where fdoe =date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
            and fsession = '{$session}' and cd.fpresent = 'P'
            and ifnull(frecptdate,'') <> ''
            and ifnull(s.fqpcode,'') <> '' $cnd1 ";

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

  $query2 = "select distinct fdoe, count(distinct fcntrcode) as cnt,
            sum(if(ifnull(l.fcollcode,'') = '',0,1)) as logedin
            from (select distinct fdoe, fcntrcode from candsum cs 
            inner join canddet cd on cs.fregno = cd.fregno
            and cd.fcollcode = cs.fcollcode 
            and cd.fdegree = cs.fdegree
            inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
            and cd.fsubcode = s.fsubcode 
            inner join degree d on cd.fdegree = d.fdegree and cd.fexamno = s.fexamno
            where fdoe = date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
            and fsession = '{$session}'
            and cd.fpresent = 'P'
            and ifnull(frecptdate,'') <> ''
            and ifnull(s.fqpcode,'') <> ''
            $cnd1
            group by fcntrcode) a 
            left join qpdaylog l on a.fcntrcode = l.fcollcode
            and fenttype = 'log' and date_format(fdate,'%d/%m/%Y') = '{$date}'";

  $result2 = $aobj_context->pobj_db->GetRow($query2);

  $query3 = "select distinct fdoe, count(distinct fcntrcode) as cnt,
            sum(if(ifnull(l.fcollcode,'') = '',0,1)) as qp
            from (select distinct fdoe, fcntrcode from candsum cs 
            inner join canddet cd on cs.fregno = cd.fregno
            and cd.fcollcode = cs.fcollcode 
            and cd.fdegree = cs.fdegree
            inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
            and cd.fsubcode = s.fsubcode 
            inner join degree d on cd.fdegree = d.fdegree and cd.fexamno = s.fexamno
            where fdoe = date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
            and fsession = '{$session}'
            and cd.fpresent = 'P'
            and ifnull(frecptdate,'') <> ''
            and ifnull(s.fqpcode,'') <> ''
            $cnd1
            group by fcntrcode) a 
            left join qpdaylog l on a.fcntrcode = l.fcollcode
            and fenttype = 'qp' and date_format(fdate,'%d/%m/%Y') = '{$date}'";

  $result3 = $aobj_context->pobj_db->GetRow($query3);

  $query4 = "select distinct fdoe, count(distinct fcntrcode) as cnt,
            sum(if(ifnull(l.fcollcode,'') = '',0,1)) as copy
            from (select distinct fdoe, fcntrcode from candsum cs 
            inner join canddet cd on cs.fregno = cd.fregno
            and cd.fcollcode = cs.fcollcode 
            and cd.fdegree = cs.fdegree
            inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
            and cd.fsubcode = s.fsubcode 
            inner join degree d on cd.fdegree = d.fdegree and cd.fexamno = s.fexamno
            where fdoe = date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
            and fsession = '{$session}'
            and cd.fpresent = 'P'
            and ifnull(frecptdate,'') <> ''
            and ifnull(s.fqpcode,'') <> ''
            $cnd1
            group by fcntrcode) a 
            left join qpdaylog l on a.fcntrcode = l.fcollcode
            and fenttype = 'copy' and date_format(fdate,'%d/%m/%Y') = '{$date}'";

  $result4 = $aobj_context->pobj_db->GetRow($query4);
  
  if($result){
    $arr['centercount'] = $result;
    $arr['logcount'] = $result2;
    $arr['qpcount'] = $result3;
    $arr['copycount'] = $result4;
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
  } else {
    $arr['msg'] = 'Error while fetching Center Count';
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
  
}

function getCenterDetails($aobj_context){

  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

  $univcode = $aobj_context->mobj_data['univcode'];
  $usertype = $aobj_context->mobj_data['usertype'];
  $date = $aobj_context->mobj_data['date'];
  $session = $aobj_context->mobj_data['session'];
  $deggrp = $aobj_context->mobj_data['deggrp'];
  $type = $aobj_context->mobj_data['type'];
  

  

  if($deggrp == 'all'){
    $cnd1 = "";
  }else{
    $cnd1 = "and d.fdeggrp = '{$deggrp}'";
  }

  if($type == "center"){
  $query = "select distinct fcntrcode , c.fcollname, c.ftown from candsum cs inner join canddet cd on cs.fregno = cd.fregno
            and cd.fcollcode = cs.fcollcode
            and cs.fregno = cd.fregno
            inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno and
            cd.fsubcode = s.fsubcode inner join degree d on cs.fdegree = d.fdegree 
            inner join college c on c.fcollcode = cs.fcntrcode 
            where fdoe =date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
            and fsession = '{$session}' $cnd1 and cd.fpresent = 'P'
            and ifnull(frecptdate,'') <> ''
            and ifnull(s.fqpcode,'') <> ''";

  }else if($type == "log"){
    $query = "select distinct date_format(str_to_date(fdoe,'%Y-%m-%d'),'%d/%m/%Y') as fdoe, fcntrcode, count(distinct fcntrcode) as cnt,
              concat(fcollname,' - ',ftown)as fcollname, fip, if(ifnull(fenttype,'')='','NOTLOG',fenttype)as fenttype,
              sum(if(ifnull(l.fcollcode,'') = '',0,1)) as logedin
              from (select distinct fdoe, fcntrcode from candsum cs 
              inner join canddet cd on cs.fregno = cd.fregno
              and cd.fcollcode = cs.fcollcode 
              and cd.fdegree = cs.fdegree
              inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
              and cd.fsubcode = s.fsubcode 
              inner join degree d on cd.fdegree = d.fdegree and cd.fexamno = s.fexamno
              where fdoe = date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
              and fsession = '{$session}'
              $cnd1
              and cd.fpresent = 'P'
              and ifnull(frecptdate,'') <> ''
              and ifnull(s.fqpcode,'') <> ''
              group by fcntrcode) a  
              left join qpdaylog l on a.fcntrcode = l.fcollcode 
              and fenttype = 'log' and date_format(fdate,'%d/%m/%Y') = '{$date}'
              inner join college c on c.fcollcode = a.fcntrcode group by fcntrcode ORDER BY fenttype";     

  }else if($type == "qp"){
    $query = "select distinct date_format(str_to_date(fdoe,'%Y-%m-%d'),'%d/%m/%Y') as fdoe, fcntrcode, count(distinct fcntrcode) as cnt,
              concat(fcollname,' - ',ftown)as fcollname, fip, if(ifnull(fenttype,'')='','QPNOTDOWNLOAD',fenttype)as fenttype,
              sum(if(ifnull(l.fcollcode,'') = '',0,1)) as fqp
              from (select distinct fdoe, fcntrcode from candsum cs 
              inner join canddet cd on cs.fregno = cd.fregno
              and cd.fcollcode = cs.fcollcode 
              and cd.fdegree = cs.fdegree
              inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
              and cd.fsubcode = s.fsubcode 
              inner join degree d on cd.fdegree = d.fdegree and cd.fexamno = s.fexamno
              where fdoe = date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
              and fsession = '{$session}'
              $cnd1
              and cd.fpresent = 'P'
              and ifnull(frecptdate,'') <> ''
              and ifnull(s.fqpcode,'') <> ''
              group by fcntrcode) a  
              left join qpdaylog l on a.fcntrcode = l.fcollcode 
              and fenttype = 'qp' and date_format(fdate,'%d/%m/%Y') = '{$date}' 
              inner join college c on c.fcollcode = a.fcntrcode group by fcntrcode ORDER BY fenttype";

  } else if($type == 'cpy'){
    $query = "select distinct date_format(str_to_date(fdoe,'%Y-%m-%d'),'%d/%m/%Y') as fdoe, fcntrcode, count(distinct fcntrcode) as cnt,
              concat(fcollname,' - ',ftown)as fcollname, fip, if(ifnull(fenttype,'')='','NOTCOPY',fenttype)as fenttype,
              sum(if(ifnull(l.fcollcode,'') = '',0,1)) as fcopy
              from (select distinct fdoe, fcntrcode from candsum cs 
              inner join canddet cd on cs.fregno = cd.fregno
              and cd.fcollcode = cs.fcollcode 
              and cd.fdegree = cs.fdegree
              inner join subject s on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
              and cd.fsubcode = s.fsubcode 
              inner join degree d on cd.fdegree = d.fdegree and cd.fexamno = s.fexamno
              where fdoe = date_format(str_to_date('{$date}','%d/%m/%Y'),'%Y-%m-%d')
              and fsession = '{$session}'
              $cnd1
              and cd.fpresent = 'P'
              and ifnull(frecptdate,'') <> ''
              and ifnull(s.fqpcode,'') <> ''
              group by fcntrcode) a  
              left join qpdaylog l on a.fcntrcode = l.fcollcode 
              and fenttype = 'copy' and date_format(fdate,'%d/%m/%Y') = '{$date}'
              inner join college c on c.fcollcode = a.fcntrcode group by fcntrcode ORDER BY fenttype";
  }
  
  $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");
  }

}

?>