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


Current Path : /var/www/results/ssc/src/
Upload File :
Current File : /var/www/results/ssc/src/applicationFormReport.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 applicationFormReport  extends FPDF
{
	function DefaultConstructor($aobj_context)
	{
		$this->aobj_context=$aobj_context;
		$this->pdf=  new FPDF();
		$this->pdf=$this;
		$this->app_no=trim($this->aobj_context->mobj_data["app_no"]);
		$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->call_type="Regular";

	}
	
	function DefaultConstructorOther($aobj_context)
	{
		$this->aobj_context=$aobj_context;
		$this->app_no=trim($this->aobj_context->mobj_data["app_no"]);
		$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->call_type="Other";
	} 
	function Header()
	{
		
		
	}	
	
	function Footer()
	{ 
		$this->SetY(-15);
		$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().' of {nb}',0,1,'R');
	}
	
	function FooterManual()
	{
		$this->pdf->SetY(-30);
		$this->pdf->SetFont('Times','B',8);
		$this->pdf->Cell(140,6,'Printed   : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
		$this->pdf->Cell(50,6,'Page 1 of 1',0,1,'R');
	}
	
	function formcolldata()
	{
		$get_coll_name="select FUNIVNAME as 'college_name',
				        FUNIVADD1 as 'state', pdf_logo_path From control";
		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
		$this->college_name=$lobj_get_coll_name['college_name'];
		$this->s_state=$lobj_get_coll_name['state'];
		$this->f_year=$lobj_get_coll_name['f_year'];
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
		$get_app_no=" select FREGNO,FEXAMNO,FPAYMENTYPE
						from res_stud
						where APPNO='{$this->app_no}'";
		$obj_get_app_no=$this->aobj_context->mobj_db->GetRow($get_app_no); 	
		$this->reg_no=$obj_get_app_no['FREGNO'];	
		$this->exam=$obj_get_app_no['FEXAMNO'];	
		
		$this->FPAYMENTYPE=$obj_get_app_no['FPAYMENTYPE'];	
		$get_data="SELECT s.FDEGREE,d.FDESCPN, s.FEXAMNO,d.FEXAMNAME,s.FCOLLCODE,
		concat(c.FCOLLCODE, ' - ', c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME,d.FRESEXAMDATE,
		s.FREGNO,s.FNAME,s.FAYEAR,d.FELIGREM01,d.FELIGREM02
		FROM student s
		INNER JOIN college c
		ON c.FCOLLCODE=s.FCOLLCODE
		INNER JOIN degree d ON d.FDEGREE=s.FDEGREE
		where s.FREGNO='{$this->reg_no}'  and d.fexamno = '{$this->exam}' ";
		$obj_student=$this->aobj_context->mobj_db->GetRow($get_data); 
		
		$FEXAMNAME=$obj_student[FEXAMNAME];
		$FDESCPN=$obj_student[FDESCPN];
		$FEXAMDATE=$obj_student[FRESEXAMDATE];
		$this->FDEGREE=$obj_student[FDEGREE];
		$this->FCOLLNAME=$obj_student[FCOLLNAME];
		$this->FNAME=$obj_student[FNAME];
		$this->degree_details=" {$FEXAMNAME} {$FDESCPN} {$FEXAMDATE} Examinations";		
		
	 } 
	function formData()
	{
		
		
		$this->pdf->SetMargins(10,12,10);		
		$this->pdf->AddPage("P");
		$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;
		 //echo $img_logo_path; die();
		$this->pdf->Image($img_logo_path,10,10,20);
		}
	 
		if($this->call_type=="Other")
		$this->pdf->setY(15);
		$this->pdf->SetFont('Times','B',15);
		$this->pdf->cell(180,3,$this->college_name,"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',13);
		$this->pdf->cell(180,7, $this->degree_details,"0",1,"C");
		$this->pdf->SetFont('Times','B',11);
		$this->pdf->Cell(180,7,"Application for RV / RT / Photocopy of Answer Scripts","0",1,"C");
		$this->pdf->SetFont('Times','B',15);
		$this->pdf->Cell(180,7,"Application Number : {$this->app_no}","0",1,"C");
		$this->pdf->Ln(2);
		$this->pdf->SetFont('Times','',13);
		 
			//$this->SetDrawColor(109,187,195);
		$this->pdf->SetFillColor(63,55,55);
		$this->pdf->Cell(0,0.34,"","T",1,'C',true);
		$this->pdf->cell(30,7, "Register No : ","0",0,"L");
		$this->pdf->cell(124,7,strtoupper($this->reg_no),"0",0,"L");
		
		$this->pdf->cell(50,7,"Date : {$this->app_date}","0",1,"L");

		$this->pdf->cell(30,7, "Name : ","0",0,"L");
		$this->pdf->cell(130,7,$this->FNAME,"0",1,"L");
		
		$this->pdf->cell(30,7, "College : ","0",0,"L");
		$this->pdf->cell(130,7,$this->FCOLLNAME,"0",1,"L");
		$this->pdf->Cell(0,0.34,"","T",1,'C',true);
	}
	function GetFullQry()
	{
		$get_already_applied="SELECT FEXAMNAME,mr.FREGNO,
					APPNO,DATE_FORMAT(FAPPDATE,'%d/%m/%Y') AS app_date,CONCAT(s.FSUBCODE,s.FSSUBCODE) as  FSUBCODE,
					FTOTAL, concat( s.FSUBNAME ,' ',s.FSSUBNAME ) as FSUBNAME,
					FCORRTYPE,FAMOUNT,mr.internal_code FROM
					res_stud 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=CONCAT(s.FSUBCODE,s.FSSUBCODE) 	
					AND s.FDEGREE=d.FDEGREE AND s.FEXAMNO=mr.FEXAMNO						
					WHERE mr.FDEGREE='{$this->FDEGREE}' AND mr.FREGNO='{$this->reg_no}'
					and mr.FEXAMNO ='{$this->exam}' AND  s.FDEGREE=mr.FDEGREE AND s.FEXAMNO=mr.FEXAMNO  
					and APPNO='{$this->app_no}' group by APPNO,mr.FREGNO,mr.FSUBCODE,FCORRTYPE order by mr.FREGNO,APPNO,mr.FSUBCODE ";
			$this->lobj_get_already_applied= $this->aobj_context->mobj_db->GetAll($get_already_applied);
			$this->app_date=$this->lobj_get_already_applied[0][app_date];
			
			$this->distinct_types=array();
			$this->txt_arr["RV"]="RV";
			$this->txt_arr["RT"]="RT";
			$this->txt_arr["XR"]="PC";
			$this->txt_arr["CV"]="CV";
	}
	function GetQry()
	{
		$i=0;
		$allready_applied_html_arr=array();
		foreach($this->lobj_get_already_applied as $ak=>$av)
		{
			$this->app_date=$av['app_date'];

			$allready_applied_html_arr[$av['FSUBCODE']]['sub_name']=$av['FSUBNAME'] ;
			$allready_applied_html_arr[$av['FSUBCODE']]['row_tot']+=$av['FAMOUNT'];
			$allready_applied_html_arr[$av['FSUBCODE']]['details'][$av['FCORRTYPE']]=$av['FAMOUNT'];
			$i++;
			if(!in_array($av['FCORRTYPE'],$this->distinct_types))
			array_push($this->distinct_types,$av['FCORRTYPE']);
		}
		$this->pdf->ln(6);
		$empty_cell_width=1;
		
		if(count($this->distinct_types)==1)
		{
		 $empty_cell_width=20;
		}
		if(count($this->distinct_types)==2)
		{
		 $empty_cell_width=15;
		}
		if(count($this->distinct_types)==3)
		{
		 $empty_cell_width=10;
		}
		if(count($this->distinct_types)==4)
		{
		 $empty_cell_width=5;
		}
		$this->pdf->SetFillColor(109,187,195);
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
		$this->pdf->cell(15,7, "Sl. No.","1",0,"C",true);
		$this->pdf->cell(20,7, "Sub. Code","1",0,"C",true);
		$this->pdf->cell(80,7, "Subject Title","1",0,"C",true);
		foreach($this->distinct_types as $dk)
		{
			$this->pdf->cell(15,7, $this->txt_arr[$dk],"1",0,"C",true);
		}
		$this->pdf->cell(15,7, "Total Fee","1",1,"C",true);
		$sl_no=1;
		$grand_tot=0;$this->SetFillColor(0,0,0);
		foreach($allready_applied_html_arr as $ak=>$av)
		{
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$sub_code=$ak;
			$row_tot=$av['row_tot'];
			$grand_tot+=$row_tot;
			$sub_name=$av['sub_name'];
			$details=$av['details'];
			$get_sx1=$this->pdf->GetX();
			$get_sy1=$this->pdf->GetY();
			$this->pdf->SetXY($get_sx1+15+20,$get_sy1);
			$this->pdf->MultiCell(80,7, $sub_name,'1','L');
			$get_sy2=$this->pdf->GetY();
			$height=$get_sy2-$get_sy1;
			$this->pdf->SetXY($get_sx1,$get_sy1);
			$this->pdf->cell(15,$height,$sl_no,"1",0,"C");
			$this->pdf->cell(20,$height,$sub_code,"1",0,"C");
			$this->pdf->SetXY($get_sx1+15+20+80,$get_sy1);
			$cell_width=0;
			foreach($this->distinct_types as $dk)
			{
				$cell_val=" - ";
				if($details[$dk]>0)
					$cell_val=$details[$dk];
				$this->pdf->cell(15,$height, $cell_val,"1",0,"C");
				$cell_width+=15;
			}
			$this->pdf->cell(15,$height, $row_tot,"1",1,"C");
			$sl_no++;
		}
		 $fi_w=115+$cell_width-15+$empty_cell_width;
		 $this->pdf->cell($fi_w,7,"","0",0,"C");
		 $this->pdf->cell(15,7,"Total ","1",0,"C");
		 $this->pdf->cell(15,7,"{$grand_tot} ","1",1,"C");
		$this->pdf->ln(3);
		if($this->FPAYMENTYPE=="POSTOFFICE")
			$this->pdf->cell(35,7,"Payment Mode : Through Post Office","0",0,"L");
		else 
			$this->pdf->cell(35,7,"Payment Mode : {$this->FPAYMENTYPE}","0",0,"L");
		$this->pdf->ln(19);
		$this->pdf->cell(35,7,"Date : ","0",0,"L");	
		$this->pdf->ln(15);

		$this->pdf->cell(180,7,"Note : Under any circumstance the amount paid towards RV / RT / PC / CV / RI will not be refunded.","0",1,"L");	
		$this->pdf->ln(15);
		$this->pdf->cell(85,7,"Signature of the candidate","0",0,"L");
		$this->pdf->cell(35,7,"","0",0,"L");
		$this->pdf->cell(85,7,"Signature of the Principal with Seal","0",0,"L");
	}
	function SendOutput()
	{
		$this->pdf->Output("application_letter_{$this->app_no}.pdf","D");
	}	 
}

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

?>