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


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

<?php
function generateSubjecGeneralReport($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 
	$degree_code = $aobj_context->mobj_data["degree_code"]; 	
	$exam_code_start = $aobj_context->mobj_data["exam_code_start"]; 
	$exam_code_end = $aobj_context->mobj_data["exam_code_end"]; 
	$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=$_SERVER["DOCUMENT_ROOT"]."/".$main_src."/Report_details/output/report_general_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(10,10);		
	$pdf->AliasNbPages();	

	$canddettmp = "canddet";
	$candsumttmp = "candsum"; 
	$degreetmp = "degree";
	$subjecttmp = "subject";

// 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,'  ) ') as Exam, FADYEAR  
							from degree where FDEGREE = '{$degree_code}' and 
							FEXAMNO>='{$exam_code_start}' and FEXAMNO<='{$exam_code_end}'";
		*/					
	$page_header_degree = "select distinct concat('[',degree.FDEGREE,'] - ', degree.FDESCPN) as Degree_name, 
							concat(' (  ',degree.FEXAMNAME,'  ) ') as Exam, degree.FADYEAR  
							from degree, subject where degree.fdegree = subject.fdegree and degree.fexamno = subject.fexamno
							and degree.FDEGREE = '{$degree_code}' and 
							degree.FEXAMNO >= '{$exam_code_start}' and degree.FEXAMNO<='{$exam_code_end}'";
							
	$lobj_page_header_degree = $aobj_context->mobj_db->GetAll($page_header_degree);
	/* echo "<PRE>";
	var_dump($lobj_page_header_degree); die(); */
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'SUBJECT_GENERAL';
	$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[0]['Degree_name'];
	$pdf->Exam = $lobj_page_header_degree[0]['Exam'];
	
//end header		
	$pdf->AddPage();	
	//$pdf->Ln();
	$pdf->SetFont('Times','',10);
	// FSSUBCODE='1'  and
	$get_subject_data= " select if(FMANDATORY='T',concat('* ',FCSUBCODE),concat('  ',FCSUBCODE)) as FCSUBCODE , FEXAMNO,FQPCODE,
						 concat(FSUBNAME,'-',concat(space(3),FSSUBNAME,'(',if(FTHEORY='T','TH','PA'),')'),' - ',fsubshort) as SSubName, 						 
						 FSHORTNAME, FSMAXMARKS 
						 from {$subjecttmp}
						 where FDEGREE='{$degree_code}' and 
						 FEXAMNO>='{$exam_code_start}' and FEXAMNO<='{$exam_code_end}'  and
						  IFNULL(FDELETED,'F') ='F' 
						 group by FCSUBCODE;
					   "; 		  
	$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);	
	//echo $get_subject_data; DIE();//
	/* echo "<PRE>"; 		
	var_dump($lobj_get_subject_data); die(); */
	$Count_subject=1;
	$chk_sem = $lobj_get_subject_data[0]['FEXAMNO'];
	$nxt = 0;
	
	foreach($lobj_get_subject_data as $key => $value)
	{	  	  	    
		if($chk_sem == $value['FEXAMNO'])	
		{
		}
		else
		{
			$nxt++;
			$pdf->Exam = $lobj_page_header_degree['Exam'];			
			$chk_sem = $value['FEXAMNO'];
			//$pdf->college_name = $lobj_page_header_college[$nxt]['college_name'];
			$pdf->Degree_name = $lobj_page_header_degree[$nxt]['Degree_name'];
			$pdf->Exam = $lobj_page_header_degree[$nxt]['Exam'];
			$pdf->AddPage();
			
		}
		
		// if($lQPCode != $value['FQPCODE']){
		// 	$Count_subject=1;

			if ($pdf->GetY()> 270)          
					$pdf->AddPage();                         

    //   $lQPCode = $value['FQPCODE'];  
               
		// }

		$x = $pdf->GetX();
		$y = $pdf->GetY();

		$pdf->SetX($x + 47);
		$pdf->MultiCell(100, 6, $value['SSubName'], "1", "L");
		$y1 = $pdf->GetY();
		$h = $y1 - $y;    
		$pdf->SetXY($x, $y);
			
			$pdf->Cell(12,$h,$Count_subject,'1',0,'C');
			$pdf->Cell(15,$h,$value['FQPCODE'],'1',0,'C');
			$pdf->Cell(20,$h,$value['FCSUBCODE'],'1',0,'L');
			// $pdf->Cell(130,6,$value['SSubName'],'1',0,'L');
			$pdf->SetXY($x+147, $y);
			$pdf->Cell(19,$h,$value['FSHORTNAME'],'1',0,'C');
			$pdf->Cell(19,$h,$value['FSMAXMARKS'],'1',1,'C');			
			$Count_subject++;
	}
		
	$pdf->Output("report_general_list.pdf","I");
}
?>