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 : 13.59.82.60


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

<?php
function GenerateAttendanceStudentwiseReport($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["exam_code"]; 
	$sublist_start     = $aobj_context->mobj_data["subwise_start"]; 
	$sublist_end       = $aobj_context->mobj_data["subwise_end"]; 
	$from_month_name   = $aobj_context->mobj_data["from_month_name"]; 
	$to_month_name     = $aobj_context->mobj_data["to_month_name"]; 
	
	
	$userid = $_SESSION['user_id'];
	$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;

	include($pdf_writer_class);		
	$pdf= new FPDF();
	
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(12,8);		
	$pdf->AliasNbPages();	

	// query for the page header	
	$page_header_university = "select FUNIVNAME,FTOWN,FUNIVADD1, 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 = 'Student Wise Attendance Report';
	$pdf->FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
	$pdf->FTOWN = $lobj_page_header_university['FTOWN'];
	$pdf->FUNIVADD1 = $lobj_page_header_university['FUNIVADD1'];
	$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'];

	$month_arr = array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");

	$a = array_search($from_month_name, $month_arr);
	$b = array_search($to_month_name, $month_arr);
	$result = array();
	if($a <= $b)
	{
		$b = $b-$a;
		$result = array_slice($month_arr,$a,$b+1);
	}
	else
	{
		$result1 = array_slice($month_arr,0,$b+1);
		$result2 = array_slice($month_arr,$a,12);
		$result = array_merge($result2, $result1);
	}
	
	foreach($result as $value)
	{
		$str .= ",concat(ifnull(F".$value."A,0),'/',ifnull(F".$value."C,0)) as ".'F'.$value;
		$attend .= "ifnull(F".$value."A,0)+";
		$conducted .= "ifnull(F".$value."C,0)+";
	}
	
	$str = substr($str, 0);
	$attend = substr($attend, 0,-1);
	$conducted = substr($conducted, 0,-1);
	
	//$str = substr($str, 100, 1);
	
	$get_subject_data = "select distinct a.fdegree,a.fexamno,a.fregno,st.fname,
				concat(s.fsubname,' ',s.fssubname) as fsubname {$str} ,sum({$attend}) as attend,
				sum({$conducted}) as conducted, FEXAMTYPE
				from attend a,student st,subject s
				where a.fdegree = s.FDEGREE and s.FCSUBCODE = a.FSUBCODE
				and s.fexamno = a.fexamno and a.fregno = st.fregno  
				and a.fdegree = '{$degree_code}' and a.fexamno = '{$exam_code}' 
				and a.fsubcode between '{$sublist_start}' and '{$sublist_end}'
				group by a.fdegree,a.fexamno,a.fsubcode,a.fregno
				order by a.fregno,a.fdegree,a.fexamno,a.fsubcode"; 	  

	$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);	
	
	$first = true;
	$sl_no = 1;
	$k2    = 1;
	$pdf->SetFont('Times','',10);
	$oldreg = "";
	$oldsection = "";
	$newreg = "";
	$newsection = "";
	$pdf->page_absent_count=0;
	
	foreach($lobj_get_subject_data as $key => $value)
	{	
		$newreg = $value['fregno'];
		
		if($oldreg != $newreg)
		{
			$i = 1;
			$oldreg = $newreg;
			$pdf->AddPage();
			//var_dump($value[fsubname]);die();
			$pdf->Ln(4);
			$pdf->SetFont('Times','B',10);
			$pdf->Cell(180,5,'Reg. No. : '.$value['fregno'],'0',1,'C');
			$pdf->Cell(180,5,'Name of the Student : '.$value['fname'],'0',1,'C');
			$pdf->Ln(2);
			$pdf->Cell(10,5,'Sl. No.','LRT',0,'C');
			$pdf->Cell(70,5,'Subject Name','LRT',0,'C');
			
			foreach($result as $value1)
			{
				$pdf->Cell(14,5,$value1,'LRT',0,'C');
			}
			$pdf->Cell(14,5,'Total','LRT',0,'C');		
			$pdf->Cell(14,5,'Perc.','LRT',1,'C');
			$pdf->Cell(10,5,'','LRB',0,'C');
			$pdf->Cell(70,5,'','LRB',0,'C');
			
			$pdf->SetFont('Times','B',8);
			
			foreach($result as $value1)
			{
				$pdf->Cell(14,5,'Att. / Con.','LRB',0,'L');
			}
			
			$pdf->Cell(14,5,'Att. / Con.','LRB',0,'L');		
			$pdf->Cell(14,5,'','LRB',1,'C');		
		}
		$pdf->SetFont('Times','',10);
		
		$get_x1=$pdf->GetX();
		$get_y1=$pdf->GetY();
		$pdf->SetXY($get_x+22,$get_y1);	
		$pdf->MultiCell(70,6,$value['fsubname'],'1','L');
		$get_y2=$pdf->GetY();
		$height=$get_y2-$get_y1;	
		$pdf->SetXY($get_x1,$get_y1);	
		$pdf->Cell(10,$height, $i,'1',1,'C'); 
		$get_x1=$pdf->GetX();
		$pdf->SetXY($get_x1+80,$get_y1);
		$j = 14;
		
		foreach($result as $value1)
		{
			$pdf->Cell(14,$height,$value['F'.$value1],'1',0,'C');		
			$pdf->SetXY($get_x1+80+$j,$get_y1);
			$j = $j+14;
		} 
		
		$pdf->Cell(14,$height,$value['attend'].'/'.$value['conducted'],'1',0,'C');	
		$percent = 	round((($value['attend'])/($value['conducted']))*100,2);
		$pdf->Cell(14,$height,$percent,'1',1,'C');		
		$i++;

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