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


Current Path : /var/www/oasis/Report_details_old/
Upload File :
Current File : /var/www/oasis/Report_details_old/report_answer_book_issued.php

<?php
function Generatetopsheet($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode'];
	$FUNIVCODE = $_SESSION['FUNIVCODE'];
	$degree_code = $aobj_context->mobj_data["degree_code"]; 
	$exam_code = $aobj_context->mobj_data["examno"]; 
	$batch_from = $aobj_context->mobj_data["batch_from"]; 
	$batch_to = $aobj_context->mobj_data["batch_to"]; 
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";	
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_general_list.pdf";
	$getnumword=$aobj_context->main_src."/src/getnumword.php";
	include($getnumword);
	// global varibales
	$p_count =1;
	// end global varibales
	//echo getnumber_to_word("001"); die();
	include($pdf_writer_class);		
	$pdf= new FPDF();
	
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(28.35,15);		
	$pdf->AliasNbPages();	

	// query for the page header	
	$page_header_university = "select FUNIVNAME,FTOWN, date_format(now(),'%d/%m/%Y') as date from control";
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);
	
	$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_total_absent= " select  m.FSUBCODE,count(distinct m.FREGNO) as total_absent  
	from marks m inner join student stu on m.fdegree = stu.fdegree and m.FREGNO = stu.FREGNO
	inner join subject s on m.fdegree = s.fdegree and m.fexamno = s.fexamno and m.FSUBCODE = s.FCSUBCODE
	where m.FDEGREE = '{$degree_code}' and m.FEXAMNO = '{$exam_code}'
	and m.FSUBCODE between '{$sublist_start}' and '{$sublist_end}'
	and m.FCOLLCODE = '{$college_code}' and IFNULL(stu.FDELETED,'F') <> 'T' 
	and m.FMARKS = -2 
	group by m.FSUBCODE order by m.FSUBCODE"; 	
	$$lobj_get_total_absent = $aobj_context->mobj_db->GetAll($get_total_absent);		
	//var_dump($lobj_get_total_absent); die();
	//echo $get_total_absent; die();
	for($m=0;$m<count($lobj_get_total_absent);$m++)
	{
		$sub_wise_total_absent[$lobj_get_total_absent[$m]['FSUBCODE']]=$lobj_get_total_absent[$m]['total_absent'];
		//var_dump($sub_wise_total_absent[$lobj_get_total_absent[$m]['FSUBCODE']]); 
	}	 */

/* 	$get_subject_data= " select distinct  mk.FCOLLCODE, mk.FDEGREE, mk.FEXAMNO, mk.FREGNO, mk.FSUBCODE, mk.FBATCH, if(ifnull(mk.fmarks11,-1) = -2,'ABSENT','') as MARKS 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 = 'msczl' and mk.FEXAMNO = 'a' 
						and mk.fbatch between '01' and '02' and mk.fcollcode = 'pg23'  
						order by FCSUBCODE, mk.FREGNO";  */


/* $get_subject_data = "select distinct  mk.fcollcode, mk.fdegree, mk.fexamno, group_concat( distinct mk.FREGNO order by mk.FREGNO) 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 FCSUBCODE, mk.FREGNO";	 */	
					
					
	$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";
	//var_dump($get_subject_data);
	$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);
	
	$get_date_time="SELECT DATE_FORMAT(now(),'%d-%b-%Y %H:%m %r') as dt";
	$ob_dt = $aobj_context->mobj_db->GetRow($get_date_time); 
	$date_timef=$ob_dt['dt'];
	
	$first=true;
	$sl_no=1;
	$k=0;
	$n=0;
	$pdf->SetFont('Times','',10);
	$oldsub="";
	$newsub="";
	$fbatchold  = "";
		
	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,17);	
			$pdf->Rect(5,09,200,280);
			//$pdf->Cell(0,4,'College :  '.$pdf->college_name,0,1,'C'); 
			$pdf->Cell(0,4,'Degree :  '.$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,' Subject :  '.$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++;
		$ip=$_SERVER["REMOTE_ADDR"];	
		$pdf->SetFont('Arial','',8);  
		$pdf->setY(-25);
		$pdf->Cell(140,6,'Printed   : IP Address : '.$ip." Date ".$date_timef,'0',0,'L');	
	}
	$pdf->Ln(5);

	$pdf->Output("report_top_sheet.pdf","D");
	
}
?>