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


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

<?php

function getRvPcReport($aobj_context)
{
    //$valuationType = $aobj_context->mobj_data['valuationType'];
    $univcode = $aobj_context->mobj_data['univcode'];
    $dateFrom = $aobj_context->mobj_data['dateFrom'];
    $dateTo   = $aobj_context->mobj_data['dateTo'];
    $qpcodeFrom   = $aobj_context->mobj_data['qpcodeFrom'];
    $qpcodeTo =  $aobj_context->mobj_data['qpcodeTo'];
    $regnoFrom = $aobj_context->mobj_data['regnoFrom'];
    $regnoTo = $aobj_context->mobj_data['regnoTo'];
    $correctionType = $aobj_context->mobj_data['correctionType'];
    $status = $aobj_context->mobj_data['status'];
    $reportType = $aobj_context->mobj_data['reportType'];
    $deggrp = $aobj_context->mobj_data["fdeggrp"];
    
    $statusType= "";
    
    if($status == 'NotPulled'){
      $statusType = "and ifnull(r.fpullstatus,'')<>'T'";//Not pulled status
    }else if($status == "Pulled"){
      $statusType = "and ifnull(r.fpullstatus,'')='T'";// Pulled status
    }else if($status == "Sent"){
      $statusType = "and ifnull(r.fxrpath,'')<>''";// sent status
    }else if($status =="NotSent"){
      $statusType = "and ifnull(r.fxrpath,'')=''";//not sent status
    }else{
      $statusType ="";
    }          


    if($correctionType == 'ALL'){
        $corrTypeCnd = '';
        $appType = ",r.fcorrtype";
    }else{
        $corrTypeCnd = "and ifnull(r.fcorrtype,'') = '{$correctionType}'";
    }
   if($reportType=="Detail")
   {
    //var_dump("First");
    $query = "select date_format(r.fappdate,'%d/%m/%Y') as fappdate, s.fqpcode, s.fsubname, r.appno, r.fregno, t.fname, r.fsubcode, r.fcorrtype, r.famount 
    from res_stud r inner join subject s on r.fdegree = s.fdegree and 
    r.fexamno = s.fexamno and r.fsubcode = s.fcsubcode
    inner join student t on r.fdegree = t.fdegree and r.fregno = t.fregno
    where ifnull(fpaymentstatus,'') = 'success' and ifnull(fackdate,'') <> '' 
    and ifnull(r.fappdate,'') between date_format(str_to_date('{$dateFrom}','%d/%m/%Y'),'%Y-%m-%d') 
    and date_format(str_to_date('{$dateTo}','%d/%m/%Y'),'%Y-%m-%d')
    and ifnull(s.fqpcode,'') between '{$qpcodeFrom}' and '{$qpcodeTo}'
    and ifnull(r.fregno,'') between '{$regnoFrom}' and '{$regnoTo}'
    {$corrTypeCnd} {$statusType}
    and r.fdegree in (select distinct fdegree from degree where ifnull(fdeggrp,'') = '{$deggrp}')
    order by r.fappdate, s.fqpcode,r.fregno";

   }
   else if($reportType=="Summary")
   {
     //  var_dump("second");
     $query="select date_format(r.fappdate,'%d/%m/%Y') as fappdate, s.fqpcode, s.fsubname, r.fcorrtype, count(appno) as fappcount 
     ,SUM(IF(IFNULL(fpullstatus,'')='T',1,0)) AS fpullcnt,
      SUM(IF(IFNULL(fxrpath,'')='',0,1)) AS fsentcnt
     from res_stud r inner join subject s on r.fdegree = s.fdegree and 
     r.fexamno = s.fexamno and r.fsubcode = s.fcsubcode
     inner join student t on r.fdegree = t.fdegree and r.fregno = t.fregno
     where ifnull(fpaymentstatus,'') = 'success' and ifnull(fackdate,'') <> '' 
     and ifnull(r.fappdate,'') between date_format(str_to_date('{$dateFrom}','%d/%m/%Y'),'%Y-%m-%d') 
     and date_format(str_to_date('{$dateTo}','%d/%m/%Y'),'%Y-%m-%d')
     and ifnull(s.fqpcode,'') between '{$qpcodeFrom}' and '{$qpcodeTo}'
     and ifnull(r.fregno,'') between '{$regnoFrom}' and '{$regnoTo}'
     {$corrTypeCnd} {$statusType}
     and r.fdegree in (select distinct fdegree from degree where ifnull(fdeggrp,'') = '{$deggrp}')
     group by r.fappdate, r.fqpcode {$appType}
     order by r.fappdate, r.fqpcode {$appType}";
   }
   else
   {
     $query = "select date_format(r.fappdate,'%d/%m/%Y') as fappdate, s.fsubname,
     s.fqpcode, ifnull(r.fbundleno,'') as fbundleno, ifnull(r.fpacket,'') as fpacket, 
     ifnull(r.fregcode,'') as fregcode, ifnull(fpullstatus,'F') as fpullstatus
     from res_stud r inner join subject s on r.fdegree = s.fdegree and 
     r.fexamno = s.fexamno and r.fsubcode = s.fcsubcode
     inner join student t on r.fdegree = t.fdegree and r.fregno = t.fregno
     where ifnull(fpaymentstatus,'') = 'success' and ifnull(fackdate,'') <> '' 
     and ifnull(r.fappdate,'') between date_format(str_to_date('{$dateFrom}','%d/%m/%Y'),'%Y-%m-%d') 
     and date_format(str_to_date('$dateTo','%d/%m/%Y'),'%Y-%m-%d')
     and ifnull(s.fqpcode,'') between '{$qpcodeFrom}' and '{$qpcodeTo}'
     and ifnull(r.fregno,'') between '{$regnoFrom}' and '{$regnoTo}'
     {$corrTypeCnd}
     and ifnull(r.fbundleno,'')<>'' and ifnull(r.fpacket,'')<>'' and ifnull(r.fregcode,'')<>'' 
     and r.fdegree in (select distinct fdegree from degree where ifnull(fdeggrp,'') = '{$deggrp}')
     group by r.fregno, r.fqpcode 
     order by r.fappdate, s.fqpcode";
   }


    $result = $aobj_context->pobj_db->GetAll($query);
    // var_dump($query);
    // var_dump($result);
    // die();
    if(sizeof($result)>0)
     {
         echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
         return;
     }  
     else
     {
         $arr['msg'] = "No data found!";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        return;
     }





    
}

?>