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


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

<?php

function teachworkapi($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}'";

    $query1 = "select date_format(v.fdate,'%d.%m.%Y') as fdate , v.fqpcode,m.fsubname,
    v.fvalcode, t1.fcollcode, 
      t1.fteachname, 
    count(v.fpacket) as fvpktcnt,
      sum(v.fvcount) as fvscriptcnt, 
    '' as frvpktcnt,
    '' as frscriptcnt,
    group_concat(concat(v.fpacket,'(',v.fvcount,')') SEPARATOR ', ') as fpkts
      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}
      group by v.fdate,v.fvalcode
  union
  select date_format(v.fdate,'%d.%m.%Y') as fdate ,v.fqpcode, m.fsubname,
      v.frevcode as frvalcode, t1.fcollcode, 
      t1.fteachname, 
    '' as fvpktcnt,
    '' as fvscriptcnt,
    count(v.fpacket) as frvpktcnt,
      sum(v.frcount) as frscriptcnt, 
      group_concat(concat(v.fpacket,'(', v.frcount,')') SEPARATOR ', ') as frpkts 
      from mastabu v 
      inner join masqp m on v.fqpcode = m.fqpcode
      left join masteach t1 on v.frevcode = 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 v.fdate,v.frevcode
    order by fdate";
   
   $result1 = $aobj_context->pobj_db->GetAll($query1);
  //  var_dump($query1);
  if (count($result1) > 0) {
    $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;
  }
}
?>