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


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

<?php

$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/tcpdf/tcpdf.php";	
require_once($pdf_writer_class);
class practical_marks_detail_report extends TCPDF
{
	public $aobj_context;
	public $college_name;	
	public $town;	
	public $address;	
	public $Degree_name;	

	function Default_construstor($aobj_context)
	{
		require_once($aobj_context->main_src.'src/format.php');
		$this->aobj_context=$aobj_context;
		$this->collcode=$_SESSION['collcode'];
		include($this->pdf_writer_class);		
		session_start();
		$this->report_id = $aobj_context->mobj_data["report_id"];
		
		$this->degree = $aobj_context->mobj_data['degree']; 
		$this->degree_name = $aobj_context->mobj_data['degree_name']; 
		$this->exam = $aobj_context->mobj_data['exam'];
		$this->subject   = $aobj_context->mobj_data["sub"];  
		$this->sub_name   = $aobj_context->mobj_data["sub_name"];
		$this->from_qp_code =  $aobj_context->mobj_data["from_qp_code"] ; 
		$this->to_qp_code=  $aobj_context->mobj_data["to_qp_code"] ;
		$this->batch_no=  $aobj_context->mobj_data["batch_no"] ;
		$this->date_value =  $aobj_context->mobj_data["date_value"] ;
		$this->time_value =  $aobj_context->mobj_data["time"] ;
		$this->batch_no=str_pad($this->batch_no, 2, "0", STR_PAD_LEFT);
		$this->fs_sub_name=  $aobj_context->mobj_data["fs_sub_name"] ; 
		$this->freeze_status=" (VERIFICATION PENDING)";	
		$this->pdf=  new TCPDF();
		$this->pdf=$this;	
		$this->GetSubjectLoops();
		$getnumword=$aobj_context->main_src."/src/getnumword.php";
		include($getnumword);
		$get_date_time="SELECT DATE_FORMAT(now(),'%d-%b-%Y %H:%m %r') as dt";
		$ob_dt = $this->aobj_context->mobj_db->GetRow($get_date_time); 
		$this->date_time=$ob_dt['dt'];
	}

	function Header()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$page_header_college ="select FUNIVADD1 as address,FUNIVNAME as college_name ,
								pdf_logo_path as pdf_logo_path from control ";
		
		$lobj_page_header_college = $this->aobj_context->mobj_db->GetRow($page_header_college); 
		$this->coll_name = $lobj_page_header_college['college_name']; 
		$this->address = $lobj_page_header_college['address']; 
		$this->pdf_logo_path = $this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/".$lobj_page_header_college['pdf_logo_path']; 
		$get_college_name="select  concat(FCOLLNAME,', ',FTOWN) as col_name from college where FCOLLCODE='{$this->collcode}'";
		$this->lobj_get_college_name = $this->aobj_context->mobj_db->GetRow($get_college_name);
		$this->col_name=$this->lobj_get_college_name['col_name'];
			
		$get_exam_date="select FEXAMDATE as exam_date,FEXAMNAME from degree 
						where FDEGREE='{$this->degree}'
						and FEXAMNO='{$this->exam}'";
		$this->lobj_get_exam_date = $this->aobj_context->mobj_db->GetRow($get_exam_date);
		$this->exam_date=$this->lobj_get_exam_date['exam_date'];
		$this->FEXAMNAME=$this->lobj_get_exam_date['FEXAMNAME'];
		
		$bMargin = $this->getBreakMargin();

		$auto_page_break = $this->AutoPageBreak;

		$this->SetAutoPageBreak(false, 0);

		$this->SetMargins(10,64,20,true);
		$this->pdf->Ln(5);
		$this->pdf->SetFont('Times','B',14);	
		$this->pdf->Cell(180,4,$this->coll_name,0,1,'C'); 
		$this->pdf->SetFont('Times','',8);	
		$this->pdf->Cell(180,4,$this->address,0,0,'C'); 
		$this->pdf->SetFont('Times','B',12);	
		$this->pdf->Cell(-20,4,'Page '.$this->pdf->getPageNumGroupAlias().'/'.$this->pdf->getPageGroupAlias(),0,1,'C'); 
		$this->pdf->Ln(2);
		$this->pdf->SetFont('Times','B',11);
		$this->pdf->Cell(180,4,"College : ".$this->collcode." ".$this->col_name,0,1,'C');
		$this->pdf->Ln(1);	$this->pdf->SetFont('Times','B',12);	
		$this->pdf->Cell(180,6,"Degree : "." ".$this->degree." - ".$this->degree_name .", Exam : {$this->FEXAMNAME} - ".$this->exam_date,0,1,'C');
		$this->pdf->Ln(1);
		$this->pdf->Cell(180,6,"Subject : "." ".$this->subject." - ".$this->sub_name."(".$this->fs_sub_name .")",0,1,'C');
		$this->pdf->Ln(1);
		$this->pdf->SetFont('Times','BU',12);
		if($FUNIVCODE == '029' || $FUNIVCODE == '021')
			$this->pdf->Cell(180,6,'Practical / Viva Marks List'.$this->freeze_status,0,1,'C');
		else
			$this->pdf->Cell(180,6,'Practical / Record Marks List'.$this->freeze_status,0,1,'C');
		

		$this->pdf->SetFont('Times','B',12);
		$this->pdf->Cell(180,6,'Date - '.$this->date_value . '     Time -  '.$this->time_value,0,1,'C');
		$this->pdf->Cell(180,6,'Batch - '.$this->batch_no,0,1,'C');
		if(file_exists($this->pdf_logo_path)) 
		{
			$this->pdf->Image($this->pdf_logo_path,7,7,20);	 
		}			
		$this->pdf->SetFont('Times','B',12);					
		$this->pdf->Ln(06); 	  
	}	

	function GetSubjectLoops()
	{			 
		$get_loops ="select FCSUBCODE,concat(FSUBNAME) as sub_name from subject
		where  FDEGREE='{$this->degree}'
		and FEXAMNO='{$this->exam}'
		and FCSUBCODE>='{$this->from_qp_code}' and FCSUBCODE<='{$this->to_qp_code}'";
		$this->lobj_get_loops = $this->aobj_context->mobj_db->GetAll($get_loops);
	}

	function GetQuery()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];

		$query = "select sysusr, sysusrkey from s_sysdb 
		where college_code = '{$this->collcode}' and sysusr = '{$_SESSION['usr']}'";
		$result = $this->aobj_context->mobj_db->GetRow($query);
		// var_dump($result['sysusrkey']);
		$this->pdf->SetProtection(array('print', 'copy','modify'), "{$result['sysusrkey']}", "sah@124", 0, null);

		foreach($this->lobj_get_loops as $sk=>$sv)
		{
			$pdf->page_present_count=0;
			$pdf->total_absent_count=0;
			$pdf->total_absent_count=0;
			$FCSUBCODE=$sv['FCSUBCODE'];
		
			$get_frezed_data = " select count(*) as f_cnt from practical_entry_freeze
							where FCOLLCODE='{$this->collcode}'
							and FDEGREE='{$this->degree}' and 
							FEXAM='{$this->exam}' and 
							FCSUBCODE='{$FCSUBCODE}'  and 
							lpad(FBATCH,2,'0')='{$this->batch_no}' and FFREEZED='T' ";	
			
			$obj_get_frezed_data = $this->aobj_context->mobj_db->GetRow($get_frezed_data);
	
			$this->freeze_status=" (VERIFICATION PENDING)";	
			if($obj_get_frezed_data[f_cnt]>0)
			{
				$this->freeze_status=" (Verified)";	
			}
			
			$get_p_frezed_data=" select count(*) as fp_cnt from practical_entry_freeze
							where FCOLLCODE='{$this->collcode}'
							and FDEGREE='{$this->degree}' and 
							FEXAM='{$this->exam}' and 
							FCSUBCODE='{$FCSUBCODE}'  and 
							lpad(FBATCH,2,'0')='{$this->batch_no}' and ifnull(PRINTFREEZED,'F')='T' ";	
			$obj_get_frezed_data = $this->aobj_context->mobj_db->GetRow($get_p_frezed_data);
			$fp_cnt=$obj_get_frezed_data['fp_cnt'];
			
			$sub_name=$sv['sub_name'];
			$this->lobj_get_practical_records=array();	
			$this->lobj_get_viva_records=array()	;
			$this->viva_marks_arr=array();
			$this->ii_details_arr=array();
								
			$get_practical_records = "select sub.FCSUBCODE,sub.FSUBNAME,stu.FREGNO, stu.FNAME, 
			if(mak.FMARKS11>0,right(concat('000',mak.FMARKS11),3),if(mak.FMARKS11=-2,'ABSENT',
			if(mak.FMARKS11=0,0,''))) as FMARKS, 
			IFNULL(mak.FBATCH, '') AS FBATCH,FSUBNAME,FSSUBNAME
			FROM student stu inner join marks_pr mak ON stu.FREGNO=mak.FREGNO 
			and mak.Fdegree='{$this->degree}' and mak.Fexamno='{$this->exam}' and mak.FCOLLCODE='{$this->collcode}'
			inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
			and sub.FCSUBCODE='{$FCSUBCODE}' and lpad(mak.FBATCH,2,'0')='{$this->batch_no}'
			and sub.FDEGREE='{$this->degree}' and sub.FEXAMNO='{$this->exam}'					 
			WHERE stu.FREGNO != ''    and mak.FMARKS11<>-1    #and mak.FMARKS11<>''
			group by stu.FREGNO,sub.FCSUBCODE  order by IFNULL(mak.FBATCH, ''),stu.FREGNO";

			$this->lobj_get_practical_records = $this->aobj_context->mobj_db->GetAll($get_practical_records);
			$this->sub_code=$this->lobj_get_practical_records[0]['FCSUBCODE'];
			$this->sub_name=$this->lobj_get_practical_records[0]['FSUBNAME'];
			$this->fs_sub_name=$this->lobj_get_practical_records[0]['FSSUBNAME'];

			$count_practical_records = "select FCSUBCODE,count(distinct(stu.FREGNO)) as cnt
			FROM student stu inner join marks_pr mak ON stu.FREGNO=mak.FREGNO 
			and mak.Fdegree='{$this->degree}' and mak.Fexamno='{$this->exam}' and mak.FCOLLCODE='{$this->collcode}'
			inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
			and sub.FCSUBCODE='{$FCSUBCODE}'  and lpad(mak.FBATCH,2,'0')='{$this->batch_no}'
			and sub.FDEGREE='{$this->degree}' and sub.FEXAMNO='{$this->exam}'					 
			WHERE stu.FREGNO != ''    and mak.FMARKS11=-2   and mak.FMARKS11<>''
			group by sub.FCSUBCODE  order by IFNULL(mak.FBATCH, ''),stu.FREGNO";
						
			$this->lobj_count_practical_records = $this->aobj_context->mobj_db->GetAll($count_practical_records);
			foreach($this->lobj_count_practical_records as $k=>$v)
			{
				$this->ii_details_arr[$v['FCSUBCODE']]=$v['cnt'];
			}
				
			$get_viva_details=" select FVVCODE from  practical_master where 
								FDEGREE = '{$this->degree}'
								and FEXAMNO = '{$this->exam}' and FPRCODE = '{$FCSUBCODE}'";
								
			$lobj_get_viva_details = $this->aobj_context->mobj_db->GetRow($get_viva_details);
			$FVVCODE = $lobj_get_viva_details['FVVCODE'];
			
			if(!empty($FVVCODE))
			{
				$get_viva_records = "select sub.FCSUBCODE,sub.FSUBNAME,stu.FREGNO, stu.FNAME, 
				if(mak.FMARKS11>=0,right(concat('000',mak.FMARKS11),3),if(mak.FMARKS11=-2,'ABSENT','')) as FMARKS, 
				IFNULL(mak.FBATCH, '') AS FBATCH
				FROM student stu inner join marks_pr mak ON stu.FREGNO=mak.FREGNO 
				and mak.Fdegree='{$this->degree}' and mak.Fexamno='{$this->exam}' and mak.FCOLLCODE='{$this->collcode}'
				inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
				and sub.FCSUBCODE='{$FVVCODE}' and lpad(mak.FBATCH,2,'0')='{$this->batch_no}'
				and sub.FDEGREE='{$this->degree}' and sub.FEXAMNO='{$this->exam}'					 
				WHERE stu.FREGNO != '' 
				group by stu.FREGNO,sub.FCSUBCODE  order by IFNULL(mak.FBATCH, ''),stu.FREGNO";
				$this->lobj_get_viva_records = $this->aobj_context->mobj_db->GetAll($get_viva_records);	
			
				foreach($this->lobj_get_viva_records as $vk=>$vv)
				{
					$this->viva_marks_arr[$vv['FREGNO']]=$vv['FMARKS'];
					
				}
			}

			// $pdf->SetMargins(10,30,20,false);

			$this->pdf->startPageGroup();
			
			$this->header_subject=$FCSUBCODE;
			$this->header_sub_name=$sub_name;
			// $this->pdf->SetMargins(13,10);
			$this->pdf->AddPage();
			$this->pdf->Rect(4,03,200,280);
			$this->SetMargins(10,54,20,true);
			// $this->pdf->SetMargins(11,12);
			$this->_intital_x_pos=$this->pdf->GetX();
			$this->pdf->SetX($this->_intital_x_pos+22);
			$this->pdf->Cell(15,5,'',"LRT",0,'C');
			$this->pdf->Cell(30,5,'',"LRT",0,'C');
			$this->pdf->SetFont('Times','B',12);
			$this->pdf->Cell(50,5,'Practical',"LRT",1,'C');
			$this->get_x_pos = $this->pdf->GetX();
			$this->get_y_pos = $this->pdf->GetY();
			
			$this->pdf->SetX($this->_intital_x_pos+22);
			$this->pdf->Cell(15,5,'Sl No.',"LRB",0,'C');
			$this->pdf->Cell(30,5,'Reg No',"LRB",0,'C');
			$this->pdf->Cell(15,5,'Mark',"1",0,'C');
			$this->pdf->Cell(35,5,'Remarks',"1",1,'C');
			
			if(!empty($this->viva_marks_arr))
			{	
		
				$this->pdf->SetXY($this->get_x_pos+117,$this->get_y_pos-5.5);
				
				if($FUNIVCODE == '029' || $FUNIVCODE == '021')
				{
					$this->pdf->Cell(50,6,'Viva',"LRT",1,'C');
				}else
				{
					$this->pdf->Cell(50,5,'Record',"LRT",1,'C');
				}
				
				$this->pdf->SetXY($this->get_x_pos+117,$this->get_y_pos);
				$this->pdf->Cell(15,5,'Mark',"1",0,'C');
				$this->pdf->Cell(35,5,'Remarks',"1",1,'C');	
		
			}
			$sl=1;
			$lin1=1;$this->pdf->SetFont('Times','','9');
			if($fp_cnt>0)
			{
				$this->lobj_get_practical_records=null;
				$this->pdf->Ln(10);
				$this->pdf->SetFont('Times','B',12);
				$this->pdf->Cell(0,6,'This Report Print is Freezed',"",1,'C');
			}
			
			foreach($this->lobj_get_practical_records as $pk=>$pv)
			{
				$this->FCSUBCODE=$pv['FCSUBCODE'];

				$FREGNO=$pv['FREGNO'];
				$FNAME=$pv['FNAME'];
				$pr_marks=$pv['FMARKS'];
				
				if($lin1==35)
				{
					$this->pdf->AddPage();
					$lin1=1;
				}
				
				$this->pdf->SetX($this->_intital_x_pos+22);
				$this->pdf->Cell(15,5,$sl,"1",0,'C');
				$this->pdf->Cell(30,5,$FREGNO,"1",0,'C');
				
				if($pr_marks=='ABSENT')
				{
					$this->page_absent_count++;
					$this->pdf->Cell(15,5,'AB','1 ',0,'C');				
					$this->pdf->Cell(35,5,$pr_marks,'1',1,'L');				
				}
				else
				{
					$this->pdf->Cell(15,5,$pr_marks,"1",0,'C');
					$cell_val=GetNumToSeperateWord(floatval($pr_marks));
					$cell_val=empty($cell_val)?0:$cell_val;
					$this->pdf->Cell(35,5,$cell_val,"1",1,'L');
					$this->page_present_count++;
				}
				
				$get_x_pos1=$this->pdf->GetX();
				$get_y_pos1=$this->pdf->GetY();
				
				if(!empty($this->viva_marks_arr))
				{
					$viva_marks=$this->viva_marks_arr[$FREGNO];
					$this->pdf->SetXY($get_x_pos1+117,$get_y_pos1-5);
					if($viva_marks=='ABSENT')
					{
						$this->pdf->Cell(15,5,'AB','1',0,'C');				
						$this->pdf->Cell(35,5,$viva_marks,'1',1,'L');				
					}
					else
					{
						$this->pdf->Cell(15,5,$viva_marks,"1",0,'C');
						$this->pdf->Cell(35,5,GetNumToSeperateWord(floatval($viva_marks)),"1",1,'L');	
					}

				}
				$sl++;$lin1++;
					
			}
		}
	
		$this->pdf->Ln(10);
		$this->pdf->SetFont('Times','',9);
		$this->pdf->Cell(35,6,'',"",0,'C');
		$this->pdf->Cell(30,6,'Examiner - 01',"",0,'C');
		$this->pdf->Cell(30,6,'Examiner - 02',"",0,'C');
		$this->pdf->Cell(30,6,'Examiner - 03',"",0,'C');
		$this->pdf->Cell(30,6,'Examiner - 04',"",1,'C');
		$this->pdf->Cell(8,6,'',"",0,'C');
		$this->pdf->Cell(25,6,'Name',"",0,'L');
		$this->pdf->Cell(3,6,':',"",1,'C');	

		$this->pdf->Cell(8,6,'',"",0,'C');
		$this->pdf->Cell(25,6,'College / Degn',"",0,'L');
		$this->pdf->Cell(3,6,':',"",1,'C');

		$this->pdf->Cell(8,6,'',"",0,'C');
		$this->pdf->Cell(25,6,'Signature',"",0,'L');
		$this->pdf->Cell(3,6,':',"",1,'C');

		$this->pdf->Cell(8,6,'',"",0,'C');
		$this->pdf->Cell(25,6,'Date & Time',"",0,'L');
		$this->pdf->Cell(3,6,':',"",0,'C');		
		$this->pdf->Cell(50,3,$pdf->date_time,'0',1,'L');	
	}
   	function Footer()
	{
		$this->SetY(-20);    
		$this->SetFont('Times','I',8);  
	}	

	function SendOutput()
	{
		
		$this->pdf->Output("Practical_Mark_List_report{$this->report_id}.pdf","I");
	}
}
		
function GeneratePracticalMarksReports($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new practical_marks_detail_report(); 
	// $class_obj->AliasNbPages();
	$class_obj->Default_construstor($aobj_context); 
	$class_obj->GetQuery();
	$class_obj->SendOutput();
}
?>