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


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

<?php
function GenerateMarksEntryStudentWiseReport($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
   
    $college_code = $_SESSION['collcode'];
	$userid = $_SESSION['user_id']; 
	$FUNIVCODE = $_SESSION['FUNIVCODE'];
	if($FUNIVCODE=='020'){
		if($_SESSION['usrtype'] == '17'){
			echo "please contact admin";
			return;
		}
	}
	$degree_code = $aobj_context->mobj_data["degree_code"]; 
	$exam_code = $aobj_context->mobj_data["exam_code"];	
	$FCODEorSHRTNAME = $aobj_context->mobj_data["search_field"];	
	$Reglist_start = substr("00000000".$aobj_context->mobj_data["subwise_start"],-8); 
	$Reglist_end = substr("ZZZZZZZZ".$aobj_context->mobj_data["subwise_end"],-8); 
	
	$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_me_student_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->selectFont('./fonts/Helvetica.afm');
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(6,13);		
	$pdf->AliasNbPages();	

// query for the page header	
	$page_header_university = "select concat(FUNIVNAME,', ',FTOWN) as FUNIVNAME, '' as FTOWN, date_format(now(),'%d/%m/%Y') as date,
	ifnull(fdegas,'Degree') as fdegas 
	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 from control";
		$lobj_page_header_REGROLL = $aobj_context->mobj_db->GetRow($page_header_REGROLL);
	$pdf->SetFont('Times','B',14);	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'MARKS_STUDENTWISE';
	$pdf->FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
	/*$pdf->FTOWN = $lobj_page_header_university[FTOWN];*/
	$pdf->SetFont('Times','B',13);	
	$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->fdegas = $lobj_page_header_degree['fdegas'];
	$pdf->Exam = $lobj_page_header_degree['Exam'];
	$pdf->AdmissionYear = $lobj_page_header_degree['FADYEAR'];	
	$pdf->RFROM= $Reglist_start;
	$pdf->RTO= $Reglist_end;
	$pdf->REGROLL=$lobj_page_header_REGROLL['FREGROLL'];
//end header		


$sys = "select * from s_sysdb where internal_code = '{$userid}'";
	$res = $aobj_context->mobj_db->GetRow($sys);
	$user_type = $res['user_type'];


	if($user_type =='40' || $user_type == '14')
	{
		$ltable = '';
	}
	else
	{
		$ltable = "inner join usersub us on mk.fdegree = us.fdegree and instr(us.fsubcode,mk.fsubcode) > 0 and mk.fcollcode = us.fcollegecode and us.fuser = '{$userid}'";
	}
	
	if($user_type =='40' || $user_type == '14')
	{
		$ltable = '';
	}
	else
	{
		if($FUNIVCODE == '052')
			$ltablesc = "inner join usrsection sc on mk.fdegree = sc.fdegree and sc.fsection = s.fsection and mk.fcollcode = sc.fcollcode and sc.fuserid = '{$userid}'";
		else
		$ltablesc = "";
	}

	$get_student_data = " select s.FREGNO, SUBSTR(s.FNAME,1,26)as NAME1, 
							SUBSTR(s.FNAME,27)as NAME2,
							group_concat(concat(right(concat(space(5),{$FCODEorSHRTNAME }),5),IF(ci.`ffreezed` = 'T',' ','*'))  order by mk.fsubcode separator ' ' ) as sublist, 
							group_concat(concat(right(concat(space(5),if(mk.FMARKS>0, right(concat('000',mk.FMARKS),3),if(mk.FMARKS=-2 ,'AB',''))),5),' ') 
							order by mk.FSUBCODE separator ' ' ) as markslist
							from student s inner join marks mk on s.FREGNO=mk.FREGNO and s.FDEGREE=mk.FDEGREE
							INNER JOIN collia  ci ON s.FCOLLCODE = ci.FCOLLCODE AND ci.fdegree = mk.fdegree AND ci.fexamno = mk.FEXAMNO  AND ci.fsubcode = mk.fsubcode
							inner join subject sub on
							sub.FDEGREE=mk.FDEGREE and sub.FEXAMNO=mk.FEXAMNO and sub.FCSUBCODE=mk.FSUBCODE
							and s.FCOLLCODE=mk.FCOLLCODE 
							{$ltable}
							{$ltablesc}
							where s.FCOLLCODE = '{$college_code}' and mk.fdegree = '{$degree_code}' and mk.FEXAMNO='{$exam_code}' 
							and ifnull(mk.FMARKS,-1) <> -1 and s.FREGNO between '{$Reglist_start}' and '{$Reglist_end}' 
							group by s.FREGNO
					   "; 
		// var_dump($get_student_data);
	//echo $get_student_data; die(); 		  
	$lobj_get_student_data = $aobj_context->mobj_db->GetAll($get_student_data);	
	$page_header_FEEZEDorNOT = "select if(FCMESTATUS is null,'NOT CONFIRMED',concat('CONFIRMED(',FCMESTATUS,')')) as MESTATUS								
								from colldeg where fcollcode='{$college_code}'
								and fdegree='{$degree_code}' 
								";
	$lobj_page_header_FEEZEDorNOT = $aobj_context->mobj_db->GetRow($page_header_FEEZEDorNOT);
	$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['MESTATUS'];
	
	  /* echo "<pre>";
	var_dump($lobj_get_student_data);die(); */ 
	//number_to_words	
	$pdf->AddPage('L');
	$pdf->SetFont('Courier','',9);	
	//$pdf->AddFont();	
	$Count_subject=1;
	$DUP_FCSUBCODE='';
	//$pdf->page_absent_count=0;
	//$pdf->toatal_absent_count=0;
	$count=0;
	//$DUP_FCSUBCODE=$lobj_get_student_data[0]['FSUBCODE'];			
	foreach($lobj_get_student_data as $key => $value)
	{				
		$pdf->Cell(10,1,'','L',0,'C');
		$pdf->Cell(32,1,'','L',0,'L');								
		$pdf->Cell(50,1,'','L',0,'L');										
		$pdf->Cell(180,1,'','LR',1,'L');	
		$pdf->Cell(10,4,$Count_subject++,'L',0,'C');
		$pdf->Cell(32,4,$value['FREGNO'],'L',0,'L');								
		$pdf->Cell(50,4,$value['NAME1'],'L',0,'L');										
		$pdf->Cell(180,4,$value['sublist'],'LR',1,'L');	
		$pdf->Cell(10,4,' ','LB',0,'C');			
		$pdf->Cell(32,4,'','LB',0,'L');
		$pdf->Cell(50,4,$value['NAME2'],'LB',0,'L');				
		$pdf->Cell(180,4,$value['markslist'],'LRB',1,'L');
		if($value['markslist'] == '   AB   ' || substr_count($value['markslist'] , '   AB   ' ))
		{
			$page_absent_count++; 
		}	
		$count++;
		if($pdf->GetY() >190)
			$pdf->Cell(123,4,"Note : * Indicates freezing pending",'0',1,'L');

		if($pdf->GetY() >190)	
		{	
			$pdf->AddPage('L');
			
		}
	}
	$pdf->Cell(123,4,"Note : * Indicates freezing pending",'0',1,'L');
	$pdf->Output("report_me_student_list.pdf","I");
}
?>