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


Current Path : /proc/thread-self/root/var/www/html/stph/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/html/stph/Report_details/report_revaluation.php

<?php
function GenerateRevalutionReport($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 
	$reval_degree_code = $aobj_context->mobj_data["reval_degree_code"]; 	
	$reval_from_Exam_no = $aobj_context->mobj_data["reval_from_Exam_no"]; 
	$reval_to_Exam_no = $aobj_context->mobj_data["reval_to_Exam_no"]; 
	$reval_from_reg_no = $aobj_context->mobj_data["reval_from_reg_no"]; 
	$reval_to_reg_no = $aobj_context->mobj_data["reval_to_reg_no"]; 
	$revalution_from_date = $aobj_context->mobj_data["revalution_from_date"]; 
	$revalution_to_date = $aobj_context->mobj_data["revalution_to_date"]; 

	if($revalution_from_date=="0000-00-00" && $revalution_to_date="0000-00-00")
	$date_cond="";
	else 
	$date_cond=" and FAPPDATE >='{$revalution_from_date}' and    FAPPDATE <='{$revalution_to_date}'";
	$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";
	$p_count =1;
	include($pdf_writer_class);		
	$pdf= new FPDF();	
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(5,10);		
	$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,'  ) ') as Exam, FADYEAR,FEXAMDATE  
							from degree where FDEGREE = '{$reval_degree_code}' and 
							FEXAMNO>='{$reval_from_Exam_no}' and FEXAMNO<='{$reval_to_Exam_no}'";
	$lobj_page_header_degree = $aobj_context->mobj_db->GetAll($page_header_degree);

	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'Revaluation Report';
	$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'];		
	$pdf->FEXAMDATE = $lobj_page_header_degree[0]['FEXAMDATE'];		
	$pdf->AddPage();	
	$pdf->SetFont('Times','',10);	
	
	 
	$get_already_applied="SELECT FEXAMNAME,mr.FREGNO,
					APPNO,DATE_FORMAT(FAPPDATE,'%d/%m/%Y') AS app_date,
							FTOTAL,concat(s.FSUBCODE,' ',s.fssubcode ,' ',s.FSUBNAME ,' ',s.FSSUBNAME ) as FSUBCODE,FCORRTYPE,FAMOUNT,mr.internal_code FROM
				mresult_detail mr   
				inner JOIN student st ON st.FREGNO=mr.FREGNO
				INNER JOIN degree d ON d.FDEGREE=mr.FDEGREE  AND d.FEXAMNO=mr.FEXAMNO
				INNER join  subject s on mr.FSUBCODE=s.FCSUBCODE AND s.FDEGREE=d.FDEGREE AND s.FEXAMNO=mr.FEXAMNO						
				WHERE mr.FDEGREE='{$reval_degree_code}' AND 
				  mr.FREGNO >='{$reval_from_reg_no}' and  mr.FREGNO<='{$reval_to_reg_no}'
				AND mr.FCOLLCODE='{$college_code}'  
					and mr.FEXAMNO >='{$reval_from_Exam_no}' and  mr.FEXAMNO <='{$reval_to_Exam_no}'
				AND  s.FDEGREE=mr.FDEGREE AND s.FEXAMNO=mr.FEXAMNO  
				 {$date_cond}
				group by APPNO,mr.FREGNO,mr.FSUBCODE,FCORRTYPE order by mr.FREGNO,APPNO,mr.FSUBCODE ";
		$lobj_get_already_applied= $aobj_context->mobj_db->GetAll($get_already_applied);
	 
 
		$allready_applied_html_arr=array();
		$i=0;
		foreach($lobj_get_already_applied as $ak=>$av)
		{
				 
				
				$allready_applied_html_arr[$av['APPNO']]['APPNO']=$av['APPNO'];
				$allready_applied_html_arr[$av['APPNO']]['app_date']=$av['app_date'];
				$allready_applied_html_arr[$av['APPNO']]['semester']=$av['FEXAMNAME'];
				$allready_applied_html_arr[$av['APPNO']]['reg_no']=$av['FREGNO'];
				$allready_applied_html_arr[$av['APPNO']]['total_amt']=$av['FTOTAL'];
				$allready_applied_html_arr[$av['APPNO']]['subjects'][$av['FSUBCODE']]['type']=$allready_applied_html_arr[$av['APPNO']]['subjects'][$av['FSUBCODE']]['type']."+".$av['FCORRTYPE'];
				$allready_applied_html_arr[$av['APPNO']]['subjects'][$av['FSUBCODE']]['amt']+=$av['FAMOUNT'];
				
		}
	 		 //echo "<pre>";print_r($allready_applied_html_arr);die();
		WriteHeaders($pdf);
		$grand_total=0;
		foreach($allready_applied_html_arr as $apk=>$apv)
		{
			$app_no=$apk;
			$app_date=$apv['app_date'];
			$semester=$apv['semester'];
			$reg_no=$apv['reg_no'];
			$total_amt=$apv['total_amt'];
			$grand_total+=$total_amt;
			$subjects=$apv['subjects'];
			$get_x1=$pdf->GetX();
			$get_y1=$pdf->GetY();
			$upto_sub_cell=18+20+22+35;
			$upto_total_cell=18+20+22+35+50+20+18;
			$pdf->SetXY($get_x1+$upto_sub_cell,$get_y1);
			
			foreach($subjects as $sk=>$sv)
			{
				$pdf->SetX($get_x1+$upto_sub_cell);
				$get_sy1=$pdf->GetY();
				$get_sx1=$pdf->GetX();
				$pdf->MultiCell(50,6, $sk,'1','L');
				$get_sy2=$pdf->GetY();	
				$height=$get_sy2-$get_sy1;
				$pdf->SetXY($get_sx1+50,$get_sy1);
				$pdf->SetFont('Times','',9);
				$type=substr($sv['type'],1,strlen($sv['type']));
				
				$pdf->Cell(22,$height, $type,'1',0,'C');
				$pdf->SetFont('Times','',10);	
				$pdf->Cell(16,$height, $sv['amt'],'1',1,'C');
			}
			$last_y=$pdf->GetY();	
			$app_height=$last_y-$get_y1;
			$pdf->SetXY($get_x1,$get_y1);
				$pdf->Cell(18,$app_height,$app_no,'1',0,'C');
				$pdf->Cell(20,$app_height,$app_date,'1',0,'C');
				$pdf->Cell(22,$app_height,$reg_no,'1',0,'C');
				$pdf->Cell(35,$app_height,$semester,'1',0,'C');
				$pdf->SetX($get_x1+$upto_total_cell);
				$pdf->Cell(18,$app_height,$total_amt,'1',1,'C'); 
				 if($get_y1>=250)
				{
					$pdf->AddPage();	
					writeHeaders($pdf);
				}
		
		}
			 
			$pdf->Ln(18);
			$pdf->Cell(35,4,"Grand Total : {$grand_total}",'0',0,'R');
			$pdf->Ln(10);
			$pdf->Cell(22,4,"Date :",'0',0,'C');
			$pdf->Cell(170,4,"Signature of the Principal with Seal",'0',1,'R');
			
			
			
		
	$pdf->Output("report_revaluation.pdf","D");
}
function WriteHeaders($pdf)
{
	$pdf->Cell(18,6,'App. No.','1',0,'C');
	$pdf->Cell(20,6,'App. Date','1',0,'C');
	$pdf->Cell(22,6,'Reg. No.','1',0,'C');
	$pdf->Cell(35,6,'Semester','1',0,'C');
	$pdf->Cell(50,6,'Subject','1',0,'C'); 
	$pdf->Cell(22,6,'Type','1',0,'C'); 
	$pdf->Cell(16,6,'Amount','1',0,'C'); 
	$pdf->Cell(18,6,'Total','1',1,'C'); 
}
?>