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


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

<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
require_once($pdf_writer_class);
	
class practicalmarksmisc_report  extends FPDF
{
		 
	function DefaultConstructor($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$this->pdf=  new FPDF();
		$this->pdf=$this;
		$this->Degcode = trim($this->aobj_context->mobj_data["Degcode"]);
		$this->Degree_name = trim($this->aobj_context->mobj_data["Degree_name"]);
		//var_dump($this->Degree_name);
		$this->Subcode = trim($this->aobj_context->mobj_data["Subcode"]);
		$this->Examno = trim($this->aobj_context->mobj_data["Examno"]);
		$this->VivaSubcode = trim($this->aobj_context->mobj_data["VivaSubcode"]);
		$getnumword=$this->aobj_context->main_src."/src/getnumword.php";
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$get_date="select date_add(date_add(now(),INTERVAL 13 hour),interval 30 minute) as now_date";
		$obj=$this->aobj_context->mobj_db->GetRow($get_date);
		$this->current_date=$obj[now_date];	
		$this->collcode=$_SESSION['collcode'];	
	}
	 
	function Header()
	{
		$img_path=$this->aobj_context->main_src.$this->photo_path;
		if(!empty($this->photo_path) && file_exists($img_path)) 
		{			
			$this->pdf->Image($img_path,166,50,50);
		}	
		if(!empty($this->pdf_logo_path))
		{
			$img_logo_path=$this->aobj_context->main_src.$this->pdf_logo_path;
			$this->pdf->Image($img_logo_path,10,7,17);
		}
		
		$img_path2 = $this->aobj_context->main_src."/img/logo2.jpg";
		if(file_exists($img_path2))
		{
			$this->pdf->Image($img_path2,170,6,23,23);
		}
		
		$get_exam_date="select FEXAMDATE as exam_date,FEXAMNAME from degree 
						where FDEGREE='{$this->Degcode}'
						and FEXAMNO='{$this->Examno}'";
		$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'];
		
		$this->pdf->SetFont('Times','B',15);
		$this->pdf->cell(180,3,$this->FUNIVNAME."","0",1,"C");
		$this->pdf->SetFont('Times','B',8);
		$this->pdf->cell(180,7, $this->s_state,"0",1,"C");
		$this->pdf->SetFont('Times','B',11);
		$this->pdf->cell(180,7, $this->college_details,"0",1,"C");
		$this->pdf->Cell(180,6,"Practical Marks (Miscellaneous)","0",1,"C");
		$this->pdf->SetFont('Times','',11);
		$this->pdf->cell(180,6, "Degree : "." ".$this->Degcode." - ".$this->Degree_name ,"0",1,"C");
		$this->pdf->cell(180,6,"Exam : ".$this->FEXAMNAME,"0",1,"C");
		$this->pdf->cell(180,6,"Subject : "." ".$this->sub_name,"0",1,"C");
		
		
		$this->pdf->Ln(2);
		
	}
	
	function Footer()
	{
		 
		$this->SetY(-17);
		$this->pdf->SetFont('Times','B',8);
		$this->Cell(140,6,'Printed   : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
		//$this->Cell(50,6,'Page '.($this->PageNo()-1).' of {nb}',0,1,'R');
	}
	
	function formcolldata()
	{
		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',
						FUNIVADD1 as 'state', pdf_logo_path From control";
		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
		
		$this->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
		$this->s_state=$lobj_get_coll_name['state'];
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];

		$query="select concat(fdegree, ' - ', fdescpn) as fdegree from degree where fdegree='{$this->degree_code}'";
		 
		$result=$this->aobj_context->mobj_db->GetRow($query); 

		$get_data = "select c.fcollcode,
			concat(c.fcollcode, ' - ', c.fcollname,', ',c.ftown) as fcollname from college c
			where c.fcollcode='{$this->collcode}'";
		$obj_student=$this->aobj_context->mobj_db->GetRow($get_data); 
		$this->college_details = $obj_student['fcollname'];
		
		$this->college_details =" College : {$this->college_details}";		
		$this->degree_details = " Degree : {$result['fdegree']}";		
		$this->exam_details = " Exam : ".$this->examno." Semister";
	}

	function GetFullQry()
	{	
		if($this->VivaSubcode != '')
		{
			$vivasub = $this->VivaSubcode;
		}else
		{
			$vivasub = "1=1";
		}
		
		$query = "select pr.FDEGREE, pr.FEXAMNO, pr.FCOLLCODE, pr.FOCOLLCODE, pr.FSUBCODE, pr.FREGNO, pr.FMARKS11, concat(s.FCSUBCODE,'-',s.FSUBNAME,' ',s.fssubname) as fsubname from marks_pr_misc pr, subject s
			where  s.fdegree = pr.FDEGREE and s.fexamno = pr.fexamno and pr.fsubcode = s.fcsubcode
			and pr.fdegree = '{$this->Degcode}' and pr.fexamno = '{$this->Examno}' and pr.fsubcode = '{$this->Subcode}' group by pr.fregno";
		$this->result = $this->aobj_context->mobj_db->GetAll($query);
		$this->sub_name = $this->result[0]['fsubname'];

		$query2 = "select pr.FDEGREE, pr.FEXAMNO, pr.FCOLLCODE, pr.FOCOLLCODE, pr.FSUBCODE, pr.FREGNO, pr.FMARKS11, concat(pr.fsubcode,'-',FSUBNAME,' ',fsubshort) as fsubname from marks_pr_misc pr, subject s
		where  s.fdegree = pr.FDEGREE and s.fexamno = pr.fexamno and pr.fsubcode = s.fcsubcode
		and pr.fdegree = '{$this->Degcode}' and pr.fexamno = '{$this->Examno}' and pr.fsubcode = '{$this->VivaSubcode}' group by pr.fregno";			
		$this->result2 = $this->aobj_context->mobj_db->GetAll($query2);
		
		foreach($this->result2 as $vk=>$vv)
		{
			$this->viva_marks_arr[$vv['FREGNO']]=$vv['FMARKS11'];
			
		}
	}
	
	function formData()
	{

		$this->pdf->SetMargins(8,12,10);		
		$this->pdf->AddPage();
		$this->pdf->Rect(2,05,200,280,'D');
		$empty_cell_width=2;
		$sl_no=1;
		$k2 = 1;
		$first = true;
		$this->pdf->SetFont('Times','B',11);
		foreach($this->result as $dk => $dv)
		{
			if($k2 > 30)
			{
				$this->pdf->AddPage();
				$this->pdf->Rect(2,05,200,280,'D');
				$k2 = 1;
			}
			
			if($first == true || $k2 == 1)
			{
				//$this->pdf->Rect(4,03,200,280);
				$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->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+114,$this->get_y_pos-5);
					
					if($FUNIVCODE == '029' || $FUNIVCODE == '003D')
					{
						$this->pdf->Cell(50,5,'Viva',"LRT",1,'C');
					}else
					{
						$this->pdf->Cell(50,5,'Record',"LRT",1,'C');
					}
					
					$this->pdf->SetXY($this->get_x_pos+114,$this->get_y_pos);
					$this->pdf->Cell(15,5,'Mark',"1",0,'C');
					$this->pdf->Cell(35,5,'Remarks',"1",1,'C');	
				}
				$first = false;
			}
			$this->pdf->SetFont('Times','',11);
				$this->pdf->SetX($this->_intital_x_pos+22);
				$this->pdf->Cell(15,5,$sl_no,"1",0,'C');
				$this->pdf->Cell(30,5,$dv['FREGNO'],"1",0,'C');
				$this->pdf->Cell(15,5,$dv['FMARKS11'],"1",0,'C');
				
				//$cell_val=GetNumToSeperateWord(floatval($dv['FMARKS11']));
				$this->pdf->Cell(35,5,GetNumToSeperateWord(floatval($dv['FMARKS11'])),"1",1,'L');
				$get_x_pos1=$this->pdf->GetX();
				$get_y_pos1=$this->pdf->GetY();
				
				if(!empty($this->viva_marks_arr))
				{
					$viva_marks=$this->viva_marks_arr[$dv['FREGNO']];
					$this->pdf->SetXY($get_x_pos1+114,$get_y_pos1-5);
					$this->pdf->Cell(15,5,$viva_marks,"1",0,'C');
					$this->pdf->Cell(35,5,GetNumToSeperateWord(floatval($viva_marks)),"1",1,'L');

				}
			$sl_no++;
			$k2++;

		}
	}
			 
	function SendOutput()
	{
		$this->pdf->Output("Practical_marks_misc.pdf","D");
	}
}

function ReoprtPracticalEntryMarksmisc($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new practicalmarksmisc_report();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);
	$class_obj->GetFullQry();
	$class_obj->formcolldata();
	$class_obj->formData();
	$class_obj->SendOutput();
}

function GetNumToSeperateWord($num)
{
		     		$ones =	array(
					 "0"=>"Zero",
					 "1"=>"One",
					 "2"=>"Two",
					 "3"=>"Three",
					 "4"=>"Four",
					 "5"=>"Five",
					 "6"=> "Six",
					 "7"=>"Seven",
					 "8"=>"Eight",
					 "9"=>"Nine");
				$final_val="";						 
		for($i=0;$i<strlen($num);$i++)
			{
			$split_num=substr($num,$i,1);
			
			$final_val.=$ones[$split_num]." ";
			}	
			return $final_val;	
}

?>