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


Current Path : /var/www/html/collportal/src/
Upload File :
Current File : //var/www/html/collportal/src/qpWiseStudCount.php

<?php 
function qpwiseStudCountForRoomAllot($aobj_context){
	$collcode = $aobj_context->mobj_data["collcode"];

	$query = "SELECT DISTINCT ifnull(dg.fdeggrp,'')as `key`,ifnull(dg.fdeggrp,'')as `value`,ifnull(concat(dg.fdeggrp,' - ',dg.fdescpn),'')as `label`  FROM deggrp dg 
    INNER JOIN  degree d on dg.fdeggrp = d.fdeggrp and d.fexamno = 'a'
    INNER JOIN candsum c on d.fdegree = c.fdegree
    WHERE c.fcollcode = '{$collcode}' 
    GROUP BY dg.fdeggrp";
    $result = $aobj_context->mobj_db->GetAll($query);

    $query = "SELECT DISTINCT IFNULL(d.fexamdate,'')AS `key`,IFNULL(CONCAT(d.fyear,'-',d.fexamtype),'')AS `value`,
               IFNULL(d.fexamdate,'')AS `label`, d.fyear,d.fexamtype,c.fcollcode 
	           FROM degexam d INNER JOIN candsum c
	           ON d.fdegree = c.fdegree and d.fyear = c.fyear 
	           and d.fexamtype = c.fexamtype 
	           WHERE c.fcollcode = '{$collcode}'
	            GROUP BY d.fyear,d.fexamtype";
	$result1 = $aobj_context->mobj_db->GetAll($query);


    // $query = "SELECT DISTINCT ifnull(fdeggrp,'')as `key`,ifnull(fdeggrp,'')as `value`, 
	// ifnull(concat(fdeggrp,' - ',fdescpn),'')as `label`  FROM deggrp ";
    // $result = $aobj_context->mobj_db->GetAll($query);

    if ($result) {
		$data['deggp'] = $result;
        $data['exmmonth'] = $result1;
        echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0, "success");
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "error");
        return;
    }
 } 

 function apigetDegreeOnDeggrp($aobj_context){
	$collcode = $aobj_context->mobj_data["collcode"];
	$univcode = $aobj_context->mobj_data["univcode"];
	$deggrp=$aobj_context->mobj_data['deggrp'];

	$query="SELECT DISTINCT d.fdegree AS `key`,d.fdegree AS `value`, CONCAT(d.fdegree,' - ',d.fdescpn) AS `label` FROM degree d
				  INNER JOIN colldeg c ON c.fdegree = d.fdegree 
				  WHERE fdeggrp='{$deggrp}' AND c.fcollcode='{$collcode}'";

				  $res = $aobj_context->mobj_db->GetAll($query);
				  if ($res) {
					echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
				} else {
					$arr['msg'] = "Data not found";
					echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "error");
					return;
				}
	
 }

 function getStudsCountQpWise($aobj_context){
	$collcode = $aobj_context->mobj_data["collcode"];
	$deggrp = $aobj_context->mobj_data["deggrp"];
	$edateFrom = $aobj_context->mobj_data["edateFrom"];
	$examdate=$aobj_context->mobj_data['examdate'];
	$edateTo = $aobj_context->mobj_data["edateTo"];
	$exam = explode('-', $examdate);
     $examyear=$exam[0];
	 $exammode=$exam[1];

  if($edateFrom =="" && $edateTo ==""){
	$date="";
  }else if($edateFrom==""){
    $date="t.fdate BETWEEN STR_TO_DATE('00/00/0000', '%d/%m/%Y') 
				AND STR_TO_DATE('{$edateTo}', '%d/%m/%Y') and" ;
	// $fromdate=$edateFrom;
} else if($edateTo !==" " && $edateFrom !==" "){
	$date="t.fdate BETWEEN STR_TO_DATE('{$edateFrom}', '%d/%m/%Y') 
				AND STR_TO_DATE('{$edateTo}', '%d/%m/%Y') and";
}


	
	// if($edateTo==""){
    //   $todate="00/00/0000";
	// }else{
	// 	// $dateT=date_create($edateTo);
	// 	// $todate=date_format($dateT,"d/m/Y");
	// 	$todate=$edateTo;
	// }

	$qpcodeF = $aobj_context->mobj_data["qpcodeF"];
	
	if (stripos($qpcodeF, "All") !== false) {
        $qpstrt = '';
    } else {
        $sublist_array = explode(',', $qpcodeF);
        $qpcodeF = "'" . implode("','", $sublist_array) . "'";
        $qpstrt = "s.fqpcode in($qpcodeF) and";
		// var_dump($qpstrt);die();
    }

	// var_dump(stripos($qpcodeF, "All") !== false);die();

	$qpcodeT = $aobj_context->mobj_data["qpcodeT"];
	$report = $aobj_context->mobj_data["report"];
	$sort = $aobj_context->mobj_data["sort"];
 

	$reporttype = "";
		$FUNIVCODE = $aobj_context->mobj_data['univcode'];
		if($report == 'center')
		{
			$reporttype = " and ifnull(m.FCNTRCODE,'') =  '{$collcode}' "; 
		}else
		{
			$reporttype = " and ifnull( c.FCOLLCODE,'') =  '{$collcode}'";
		}
		
		if($_SESSION['fexamseparate'] == 'T')
		{
			$candsum = "examcandsum"; 
			$canddet = "examcanddet"; 
			$examdate = "d.fexexamdate as FEXAMDATE";

		}else
		{
			$candsum = "candsum"; 
			$canddet = "canddet"; 
			$examdate = "d.FEXAMDATE as FEXAMDATE";
		}

		$user = $_SESSION['user_type'];

	if($deggrp=== 'All'){
		$deggrpcond = "t.fdeggrp BETWEEN '0' and 'Z'";
	}
	else {
		$deggrpcond = "t.fdeggrp='{$deggrp}'";
	}
	$grpcnd = 'fqpcode';
	if($FUNIVCODE == '055')
		$grpcnd = "left(fqpcode,5)";

	// $get_data =" select {$examdate}, s.FQPCODE, date_format(s.FDOE,'%d/%m/%Y') FDOE,
	// if(ifnull(s.FSESSION,'')<>'',if(s.FSESSION = r.FREASONCD,r.FDESCPN,s.FSESSION),s.FSESSION) as FDESCPN, 
	// if('{$FUNIVCODE}' = '055',concat(s.fsubshort,' - ',s.fsubname),concat(s.fsubname,' ', s.fssubname)) as FSSUBNAME,
	// COUNT(c.FSUBCODE) AS FCAPACITY from degree d
	// inner join subject s on d.fdegree = s.fdegree and d.fexamno = s.fexamno
	// inner join {$canddet} c on s.fdegree = c.fdegree and s.fexamno = c.fexamno and s.fsubcode = c.fsubcode
	// inner join {$candsum} m on c.fregno = m.fregno 
	// left join reason r on r.FREASONCD = s.FSESSION
	// left outer join attshort a on  a.fdegree = c.fdegree and c.fexamno = a.fexamno and a.fregno = c.fregno and left(a.fsubcode,4) = c.fsubcode
	// where ifnull(frecptdate,'0000-00-00') <> '0000-00-00'
	// and ifnull(a.fregno,'') = ''
	// and ifnull(c.FTHPR,'') <> 'T'
	// and c.fpresent = 'P' and ifnull(c.fpassmth,'') = '' {$reporttype} 
	// AND {$qpstrt} s.FDOE BETWEEN 
	// STR_TO_DATE('{$fromdate}', '%d/%m/%Y') and 
	// STR_TO_DATE('{$todate}', '%d/%m/%Y')
	// and {$deggrpcond} and INSTR(m.fhtenable,c.fexamno) >0
	// group by $grpcnd {$sort}";


	$get_data="SELECT {$examdate}, t.FQPCODE, DATE_FORMAT(t.fdate,'%d/%m/%Y') FDOE, 
				IFNULL(t.fsession,'') AS FDESCPN, IF('{$FUNIVCODE}' = '055',CONCAT(s.fsubshort,' - ',s.fsubname),CONCAT(s.fsubname,' ', s.fssubname)) AS FSSUBNAME, 
				COUNT(c.FSUBCODE) AS FCAPACITY FROM degree d 
				INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno 
				INNER JOIN {$canddet} c ON s.fdegree = c.fdegree AND s.fexamno = c.fexamno AND s.fsubcode = c.fsubcode 
				INNER JOIN {$candsum} m ON c.fregno = m.fregno 
				INNER JOIN timetable t ON t.fqpcode = s.fqpcode AND t.fyear = c.fyear AND t.fexamtype = c.fexamtype AND m.fyear = c.fyear 
				AND m.fexamtype = c.fexamtype LEFT JOIN reason r ON r.FREASONCD = s.FSESSION 
				LEFT OUTER JOIN attshort a ON a.fdegree = c.fdegree AND c.fexamno = a.fexamno AND a.fregno = c.fregno 
				AND LEFT(a.fsubcode,4) = c.fsubcode AND a.fyear = c.fyear AND a.fexamtype = c.fexamtype 
				WHERE IFNULL(frecptdate,'0000-00-00') <> '0000-00-00' AND IFNULL(a.fregno,'') = '' AND IFNULL(c.FTHPR,'') <> 'T' 
				AND c.fpresent = 'P' AND IFNULL(c.fpassmth,'') = '' {$reporttype} 
				AND {$qpstrt}  
				{$date} ifnull(c.fyear,'') = '{$examyear}' AND ifnull(c.fexamtype,'') = '{$exammode}' 
				AND {$deggrpcond} AND INSTR(m.fhtenable,c.fexamno) >0 GROUP BY $grpcnd {$sort}";
	
		
	$lobj_get_data = $aobj_context->mobj_db->GetAll($get_data);

	if ($lobj_get_data) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data, 0, "success");
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "error");
        return;
    }

 }

 function loadQpcodeForStudCount($aobj_context){
	$collcode = $aobj_context->mobj_data["collcode"];
	$deggrp = $aobj_context->mobj_data["deggrp"];
	$degree = $aobj_context->mobj_data["degree"];
    
	if($deggrp=="All"){
		$con1="";
	}else{
		$con1=" AND d.fdeggrp='{$deggrp}'";
	}
	if($degree==""||$degree=="All"){
		$con2="";
	}else{
       $con2="AND d.fdegree='{$degree}'";
	}
	$query="SELECT DISTINCT fqpcode AS `key`,fqpcode AS `value`,IFNULL(CONCAT(fsubname,' - ',fvalmax),'') AS `label` FROM subject s 
		    INNER JOIN degree d ON s.fdegree=d.fdegree AND s.fexamno=d.`FEXAMNO`
	        WHERE  fqpcode<>'' $con1 $con2";
		
			  $res = $aobj_context->mobj_db->GetAll($query);
			  if ($res) {
				echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
			} else {
				$arr['msg'] = "Data not found";
				echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "error");
				return;
			}
 }
 ?>