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


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

<?php

function teachworksumaryapi($aobj_context)
{
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

  $univcode = $aobj_context->mobj_data["univcode"];  

    $tcodefrom = $aobj_context->mobj_data["tcodefrom"];
    $tcodeto = $aobj_context->mobj_data["tcodeto"];
    $vdatefrom = $aobj_context->mobj_data["vdatefrom"];
    $vdateto = $aobj_context->mobj_data["vdateto"];
    $fcollcode = $aobj_context->mobj_data["fcollcode"];
    
    $cnd = "";

    if($fcollcode != '' && $fcollcode != NULL)
        $cnd = "and t1.fcollcode = '{$fcollcode}'";

    $query = "select count(*) as cnt from mastabu where frevcode = '{$tcodefrom}'";
    $result = $aobj_context->pobj_db->GetRow($query);
        
    if($result['cnt'] <= 0)
    {
      $arr['msg'] = 'Reviewer details not found';
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
      return;
      die();
    }    

    $query1 = "select fqpcode, fsubname, fteachcode, fteachname, cnt from (
      select v.fqpcode,m.fsubname, v.fvalcode as fteachcode, ifnull(t1.fteachname,'') as fteachname, 
      sum(ifnull(v.fvcount,'')) as cnt
      from mastabu v inner join masqp m on v.fqpcode = m.fqpcode
      left join masteach t1 on v.fvalcode = t1.fteachcode 
      where v.fvalcode between '{$tcodefrom}' and '{$tcodeto}'
      and v.fdate between date_format(str_to_date('{$vdatefrom}','%d/%m/%Y'),'%Y-%m-%d')
      and date_format(str_to_date('{$vdateto}','%d/%m/%Y'),'%Y-%m-%d')
      {$cnd}
      and ifnull(fteachname,'')<>''
      union
      select v.fqpcode,m.fsubname, v.fvalcode as frvalcode, ifnull(t1.fteachname,'') as fteachname, 
      sum(v.frcount) as frscriptcnt
      from mastabu v 
      inner join masqp m on v.fqpcode = m.fqpcode
      left join masteach t1 on v.fvalcode = t1.fteachcode 
      where v.frevcode between  '{$tcodefrom}' and '{$tcodeto}'
      and v.fdate between date_format(str_to_date('{$vdatefrom}','%d/%m/%Y'),'%Y-%m-%d')
      and date_format(str_to_date('{$vdateto}','%d/%m/%Y'),'%Y-%m-%d')
      {$cnd}
      group by fqpcode, fteachcode) a where ifnull(fteachcode,'') <> ''
      order by fqpcode, fteachcode";
  
   $result1 = $aobj_context->pobj_db->GetAll($query1);
  
  if ($result1) {
    $res['valdet'] = $result1;
    echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
    return;
  } else {
    $arr['msg'] = 'No Deatils found';
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
    return;
  }
}
?>