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


Current Path : /var/www/html/collportal/Reports/
Upload File :
Current File : /var/www/html/collportal/Reports/topsheet.php

<?php
function Generatetopsheet($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $aobj_context->mobj_data["fcollcode"];
	$FUNIVCODE = $aobj_context->mobj_data["univcode"];
	
	$degree_code = $aobj_context->mobj_data["fdegree"]; 
	$exam_code = $aobj_context->mobj_data["exmval"]; 
	$batch_from = $aobj_context->mobj_data["batchFrm"]; 
	$batch_to = $aobj_context->mobj_data["batchTo"]; 
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	// $main_src=$main_src_obj[1];
	// $pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";	
	$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
	$pdf_writer_class =$main_src."/tarka_pdf_latest/fpdf.php";	
	$getnumword=$aobj_context->main_src."/src/getnumword.php";
	include($getnumword);
	// global varibales
	$p_count =1;
	// end global varibales
	//echo getnumber_to_word("001"); die();
	require_once($pdf_writer_class);		
	$pdf= new FPDF();
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(28.35,10);		
	$pdf->AliasNbPages();	

	// query for the page header	
	$page_header_university = "select FUNIVNAME,FTOWN, date_format(now(),'%d/%m/%Y') as date,
	ifnull(fdegas,'Degree') as fdegas,
	ifnull(fcollas,'College') as fcollas,
	ifnull(fsubas,'Subject') as fsubas,
	ifnull(FREGROLL,'Reg. No.') as FREGROLL 
	from control";
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);
	
	$fdegas = $lobj_page_header_university['fdegas'];
	$fcollas = $lobj_page_header_university['fcollas'];
	$fsubas = $lobj_page_header_university['fsubas'];
	$FREGROLL = $lobj_page_header_university['FREGROLL'];
	
	$page_header_college ="select concat('[ ',FCOLLCODE,' ]  ',FCOLLNAME,', ',FTOWN) as college_name
							from college where FCOLLCODE='{$college_code}'";
	$lobj_page_header_college = $aobj_context->mobj_db->GetRow($page_header_college); 
	
	$page_header_degree = "select concat('[ ',FDEGREE,' ] - ', FDESCPN) as Degree_name, 
							concat('( ', FEXAMNAME ,' Examination ',FEXAMDATE,')') as Exam ,FADYEAR
							from degree where FDEGREE = '{$degree_code}' and FEXAMNO='{$exam_code}' ";

	$lobj_page_header_degree = $aobj_context->mobj_db->GetRow($page_header_degree);
	
	$page_header_REGROLL = "select FREGROLL, fsnglent from control";
		$lobj_page_header_REGROLL = $aobj_context->mobj_db->GetRow($page_header_REGROLL);
		
	 
	$pdf->aobj_context =$aobj_context ;
	//$pdf->WhichReport = 'MARKS_SUBJECTWISE';
	$pdf->FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
	$pdf->FTOWN = $lobj_page_header_university['FTOWN'];
	$pdf->date_1 = $lobj_page_header_university['date'];
	$pdf->college_name = $lobj_page_header_college['college_name'];
	$pdf->Degree_name = $lobj_page_header_degree['Degree_name'];
	$pdf->Exam = $lobj_page_header_degree['Exam'];
	$pdf->AdmissionYear = $lobj_page_header_degree['FADYEAR'];
	$pdf->REGROLL=$lobj_page_header_REGROLL['FREGROLL'];
	$fsnglent=$lobj_page_header_REGROLL['fsnglent'];
	$pdf->RFROM=strtoupper(substr($sublist_start,-4));
	$pdf->RTO=strtoupper(substr($sublist_end,-4));
	
	$get_subject_data = "select distinct mk.fcollcode, mk.fdegree, mk.fexamno, 
	group_concat( distinct mk.FREGNO,'->',if(ifnull(mk.fmarks11,-1) = -2,'ABSENT','')  order by mk.FREGNO separator '~') AS FREGNO, 
	concat(mk.fsubcode,':',s.FSUBNAME) as fsubcode, mk.fbatch, 
	group_concat(if(ifnull(mk.fmarks11,-1) = -2,'ABSENT','')) as Marks, 
	count(if(ifnull(mk.fmarks11,-1) = -2,'ABSENT','')) as cnt 
	from marks_pr mk inner join student stu on mk.fdegree = stu.fdegree and mk.FREGNO=stu.FREGNO 
	inner join subject s on mk.fdegree = s.fdegree and mk.fexamno = s.fexamno and mk.FSUBCODE = s.FCSUBCODE 
	inner join colldeg c on mk.fdegree = c.fdegree where mk.FDEGREE = '{$degree_code}' and mk.FEXAMNO = '{$exam_code}' 
	and mk.fbatch between '{$batch_from}' and '{$batch_to}' and mk.fcollcode = '{$college_code }' group by mk.FBATCH,mk.fsubcode
	order by mk.fdegree,mk.fexamno,FCSUBCODE, mk.fbatch,mk.FREGNO";

	$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);

	$first=true;
	$sl_no=1;
	$k=0;
	$n=0;
	$pdf->SetFont('Times','',10);
	$oldsub="";
	$newsub="";
	$fbatchold  = "";
		

	$deg = "Degree : ";				
	if($FUNIVCODE == '049')
		$deg = "Program : ";


	$sub = "Subject : ";				
	if($FUNIVCODE == '049')
		$sub = "Course : ";
		
	foreach($lobj_get_subject_data as $key => $value)
	{	
		$j = 1;
		$newsub = $value['fsubcode'];
		$fbatchnew = $value['fbatch'];
		if($pdf->GetY() > 250)
		{
			$new_y=$pdf->GetY();				
			$first=true;
		}
		
		if($newsub != $oldsub || $fbatchnew!=$fbatchold)
		{	 
			$first=true;
			$sl_no=1;
			$k=0;
			$n=0;
		}
		
		$oldsub = $newsub;
		$fbatchold = $fbatchnew;
		
		if($first)
		{
			$pdf->AddPage();
			$pdf->SetMargins(28.35,10);	
			$img_path = $pdf->aobj_context->main_src . "img/".$FUNIVCODE."_logo.jpg";
    
			if (file_exists($img_path)) {
				if($FUNIVCODE == '030')
					$pdf->Image($img_path, 5,5,50,20);
				else
					$pdf->Image($img_path, 10,8,25,25);
			}
			$pdf->SetFont('Times','B',12);
			$pdf->Cell(0,4,$pdf->FUNIVNAME,0,1,'C'); 
			$pdf->Ln(2);
			$pdf->SetFont('Times','',10);
			$pdf->Rect('5','05','200','280');
			$pdf->Cell(0,4,'College :  '.$pdf->college_name,0,1,'C');
			$pdf->Ln(1); 
			$pdf->Cell(0,4,$fdegas.' : '.$pdf->Degree_name,0,1,'C');	
			$pdf->Cell(0,4,$pdf->Exam,0,1,'C'); 								
			//$pdf->Cell(0,6,' Subjectwise I.A. Marks List',0,1,'C'); 
			$pdf->Cell(0,6,$fsubas.' : '.$newsub,0,1,'C'); 									
			$pdf->SetFont('Times','B',10);
			$pdf->Ln(2);
		
			$first=false;
		}

		$pdf->Ln(3);
		$pdf->Cell(0,8,"Batch ".$value['fbatch'],0,1,'L'); 
		$k=0;
		$n=0;
		$FREGNO = explode('~',$value['FREGNO']);
		$sl_no == 0;
		$presentList = '';
		$absentList = '';
		$a = 0;
		$p = 0;
		foreach($FREGNO as $key => $regeno)
		{	
			$present = explode('->',$regeno );
			
			if($present[1] != 'ABSENT') 
			{
				$presentList .= $present[0].' , ';	 //substr("Hello world",0,-1)
				$p++;
			}
			else
			{
				$absentList .= $present[0].' , ';
				$a++;
			}
		}
		$pdf->Cell(90,5,'Total Number Of Present Students  ','1',0,'L');
		$pdf->Cell(60,5,$p,'1',1,'C');
		$pdf->Cell(150,5,'Number Of Present Student','1',1,'L');
		$pdf->SetFont('Times','',10);
		$presentList = substr($presentList,0,-2);
		$presentList = strtoupper($presentList);
		$pdf->MultiCell(150,5,$presentList,1,'L');
		$pdf->Ln(4);
		$pdf->SetFont('Times','B',10);
		$pdf->Cell(90,5,' Total Number Of Absent Students ','1',0,'L');
		$pdf->Cell(60,5,$a,'1',1,'C');
		$pdf->Cell(150,5,' Number Of Absent Student ','1',1,'L');
		$pdf->SetFont('Times','',10);
		$absentList = substr($absentList,0,-2);
		$absentList = strtoupper($absentList);
		$pdf->MultiCell(150,5,$absentList,1,'L');

		$j++;
	}
	$pdf->Ln(5);
	
	$pdf->Output("report_top_sheet.pdf","I");
	
}
?>