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


Current Path : /proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/htdwonload.php

<?php

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

  $fdeggrp = $aobj_context->mobj_data["fdeggrp"];
  $frtype = $aobj_context->mobj_data["frtype"];

  if ($frtype == 'Summary') {
    $query = "SELECT COUNT(fregno) as `Students Fee Paid`,SUM(IF(ifnull(fhtstatus,'')= 'S',1,0)) AS `Student Downloads`,
    SUM(IF(ifnull(fhtstatus,'') = 'C',1,0)) AS `College Downloads`, 
	  sum(IF(ifnull(fhtstatus,'') = 'C',1,0)+IF(ifnull(fhtstatus,'')= 'S',1,0)) as `Total Downloads`,
	  (COUNT(fregno) -(sum(IF(ifnull(fhtstatus,'') = 'C',1,0)+IF(ifnull(fhtstatus,'')= 'S',1,0)))) as `Pending Downloads`
    FROM (select distinct cd.fdegree, cd.fexamno, cd.fregno,d.fdeggrp,fexamdate,
    cs.fhtstatus from canddet cd inner join candsum cs on cd.fregno = cs.fregno
    and cd.fdegree = cs.fdegree and cd.fcollcode = cs.fcollcode
	  inner join degree d on cs.fdegree = d.fdegree and cd.fexamno = d.fexamno
    where ifnull(fpresent,'') = 'P' and ifnull(fpassmth,'') = '' and ifnull(d.fdeggrp,'') = '{$fdeggrp}') s, 
    control c";
    // var_dump($query);
    $result = $aobj_context->pobj_db->GetRow($query);

    $arr['header'] = ['Sl. No.', 'Title', 'Count'];
    $arr['width']  = ['.2', '3', '1'];
    $arr['align']  = ['center', 'left', 'right'];
    $body = array();
    $i = 1;
    // var_dump($result);
    foreach ($result as $k => $v) {

      $temp = array();
      $temp['fslno'] = $i;
      $temp['ftitle'] = $k;
      $temp['fcount'] = $v;

      array_push($body, $temp);
      $i++;
    }
    $arr['body'] = $body;
  } else if ($frtype == 'Collegewise') {
    $query = "select c.fcollcode, CONCAT(d.fcollname,', ',d.ftown) as fcollname,
    CONCAT(fmobile,' / ',FALTMOBILE) as contactno,
    c.fstcount, a.ftotfeepaid, fcollcount,
    (c.fcollcount + c.fstcount) AS fhtdwtotcnt, 
    (a.ftotfeepaid-c.fcollcount-c.fstcount) AS fpendhtcnt  FROM 
    (SELECT fcollcode, fexamno, SUM(IF(fhtstatus = 'C',1,0)) AS fcollcount, 
    SUM(IF(fhtstatus = 'S',1,0)) AS fstcount 
    FROM candsum where fdegree in(select distinct fdegree from degree where fdeggrp = '{$fdeggrp}')
    GROUP BY fcollcode) c
    INNER JOIN 
    (SELECT fcollcode,fdegree, fexamno, COUNT(*) AS ftotfeepaid 
    FROM candsum WHERE IFNULL(frecptdate,'') <> '' and fdegree in(select distinct fdegree from degree where fdeggrp = '{$fdeggrp}')
    GROUP BY fcollcode) a ON a.fcollcode = c.fcollcode 
    INNER JOIN college d ON c.fcollcode = d.fcollcode 
    order by a.ftotfeepaid desc,d.fcollcode";

    //var_dump($query);  

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

    $arr['header'] = ['Sl. No.', 'Coll. Code', 'College Name', 'Contact No.', 'Stud. Fee Paid', 'Coll. Down.', 'Stud. Down.', 'Total Down.', 'Pending Down.'];
    $arr['width']  = ['0.5', '.5', '5', '1', '1', '0.5', '0.5', '0.5', '0.5'];
    $arr['align']  = ['center', 'center', 'left', 'center', 'center', 'center', 'center', 'center', 'center'];
    $arr['body'] = $result;
    $body = array();
    $i = 1;
    // var_dump($result);
    foreach ($result as $k => $v) {

      $temp = array();
      $temp['fslno'] = $i;
      $temp['degcode'] = $v['fcollcode'];
      $temp['degname'] = $v['fcollname'];
      $temp['contactno'] = $v['contactno'];
      $temp['feepaid'] = $v['ftotfeepaid'];
      $temp['collcnt'] = $v['fcollcount'];
      $temp['studcnt'] = $v['fstcount'];
      $temp['totcnt'] = $v['fhtdwtotcnt'];
      $temp['penhtcnt'] = $v['fpendhtcnt'];

      array_push($body, $temp);
      $i++;
    }
    $arr['body'] = $body;
  } else if ($frtype == 'Degreewise') {

    $query = "select c.fdegree,d.fdescpn, c.fexamno, c.fcollcount, c.fstcount, a.ftotfeepaid, (c.fcollcount + c.fstcount) AS fhtdwtotcnt, 
    (a.ftotfeepaid-c.fcollcount-c.fstcount) AS fpendhtcnt  FROM 
    (SELECT fdegree, fexamno, SUM(IF(ifnull(fhtstatus,'') = 'C',1,0)) AS fcollcount, 
    SUM(IF(ifnull(fhtstatus,'') = 'S',1,0)) AS fstcount FROM (select distinct cd.fdegree, cd.fexamno, cd.fregno, 
    cs.fhtstatus from canddet cd inner join candsum cs 
    on cd.fdegree = cs.fdegree and cd.fcollcode = cs.fcollcode 
    and  cd.fregno = cs.fregno inner join degree d on d.fdegree = cd.fdegree and d.fexamno = cd.fexamno
    where ifnull(fpresent,'') = 'P' and ifnull(fpassmth,'') = ''
    and d.fdeggrp = '{$fdeggrp}') s
    GROUP BY fdegree, fexamno) c
    INNER JOIN 
    (SELECT fdegree, fexamno, COUNT(distinct fregno, fexamno) AS ftotfeepaid 
    FROM canddet WHERE ifnull(fpresent,'') = 'P' and ifnull(fpassmth,'') = '' 
    and fdegree in(select distinct fdegree from degree where fdeggrp = '{$fdeggrp}')
    GROUP BY fdegree, fexamno) a ON a.fdegree = c.fdegree 
    AND a.fexamno = c.fexamno
    INNER JOIN degree d ON c.fdegree = d.fdegree AND c.fexamno = d.fexamno
    order by fdegree, fexamno";
    $result = $aobj_context->pobj_db->GetAll($query);

    //var_dump($query);

    $arr['header'] = ['Sl. No.', 'Deg. Code', 'Degree Name', 'Sem', 'Stud. Fee Paid', 'Coll. Down.', 'Stud. Down.', 'Total Down.', 'Pending Down.'];
    $arr['width']  = ['0.5', '.5', '5', '1', '1', '0.5', '0.5', '0.5', '0.5'];
    $arr['align']  = ['center', 'center', 'left', 'center', 'center', 'center', 'center', 'center', 'center'];
    $arr['body'] = $result;
    $body = array();
    $i = 1;
    // var_dump($result);
    foreach ($result as $k => $v) {

      $temp = array();
      $temp['fslno'] = $i;
      $temp['degcode'] = $v['fdegree'];
      $temp['degname'] = $v['fdescpn'];
      $temp['sem'] = $v['fexamno'];
      $temp['feepaid'] = $v['ftotfeepaid'];
      $temp['collcnt'] = $v['fcollcount'];
      $temp['studcnt'] = $v['fstcount'];
      $temp['totcnt'] = $v['fhtdwtotcnt'];
      $temp['penhtcnt'] = $v['fpendhtcnt'];

      array_push($body, $temp);
      $i++;
    }
    $arr['body'] = $body;
  }



  if (!$result && gettype($result) == 'boolean') {
    $arr['msg'] = "Error while fetching HT Download status Details";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
    return;
  }

  if (count($result) > 0) {
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
    return;
  } else {
    $arr['msg'] = "fetching HT Download status Details Not found";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
    return;
  }
}