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


Current Path : /var/www/html/college/Report_details_old/
Upload File :
Current File : /var/www/html/college/Report_details_old/answer_book_statistics.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);
include_once("stringspliter.php");
	
class report_Generatetatkalreport  extends FPDF
{
		 
	function DefaultConstructor($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$this->pdf=  new FPDF();
		$this->pdf=$this;
		$this->reportype=trim($this->aobj_context->mobj_data["reportype"]);
		$this->date_from = trim($this->aobj_context->mobj_data["date_from"]);
		$this->date_to = trim($this->aobj_context->mobj_data["date_to"]); 
		
		$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()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		
		$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);
		}	
		$img_logo_path=$this->aobj_context->main_src."/".$this->aobj_context->mobj_data["db"]."/".$this->pdf_logo_path;
		if(!empty($this->pdf_logo_path) && file_exists($img_logo_path))
		{	
			$this->pdf->Image($img_logo_path,10,10,23,22);
		}
		$img_path2 = $this->aobj_context->main_src."/img/logo2.jpg";
		if(file_exists($img_path2))
		{
			$this->pdf->Image($img_path2,170,6,23,23);
		}
		
		$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',13);
		$this->pdf->cell(180,7, $this->college_details,"0",1,"C");
		$this->pdf->SetFont('Times','B',11);
		$this->pdf->Cell(180,7,"Answer Book Statistics","0",1,"C");
		$this->pdf->SetFont('Times','',11);
		$this->pdf->Cell(180,7,"Exam Date Range : ".$this->date_from." - ".$this->date_to,"0",1,"C");
		$this->pdf->Ln(2);
		$this->pdf->SetFont('Times','',13);
		
	}
	
	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 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->f_year=$lobj_get_coll_name['f_year'];
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];

		$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->degree_details=" College : {$this->FCOLLNAME}";		

	}

	function GetFullQry()
	{
		$reporttype = "";
		if($this->reportype == 'detailed')
		{
			$reporttype = " and m.FCNTRCODE =  '{$this->collcode}' "; 
		}else
		{
			$query = "select distinct sum(substr(ad.ftoans,3,8)-substr(ad.ffromans,3,8)+1) as totrec
			from ansdist ad
			where ad.fcollcode = '{$this->collcode}'";
			$result = $this->aobj_context->mobj_db->GetRow($query);
			$totrec = $result['totrec'];
			$get_data = "select '{$totrec}' as totrec,
			sum(case when ifnull(al.FCANCEL,'') = '' then 1 else 0 end) as used,
			sum(case when ifnull(al.FCANCEL,'') = 'T' and ifnull(al.fremarks,'') <> 'ABSENT' and ifnull(al.fremarks,'') <> 'MAL PRACTICE' then 1 else 0 end) as cancelled,
			sum(case when ifnull(al.FCANCEL,'') = 'T' and ifnull(al.fremarks,'') = 'ABSENT' then 1 else 0 end) as ab,
			sum(case when ifnull(al.FCANCEL,'') = 'T' and ifnull(al.fremarks,'') = 'MAL PRACTICE' then 1 else 0 end) as mp
			from ansallot al
			where FCNTRCODE = '{$this->collcode}'";
			$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
		}	
		
		$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
	}
	
	function formData()
	{

		$this->pdf->SetMargins(8,12,10);		
		$this->pdf->AddPage();
		
		$empty_cell_width=30;
		$sl_no=1;
		$k2 = 1;
		$first = true;
		foreach($this->lobj_get_data as $dk => $dv)
		{
			if($k2 > 29)
			{
				$this->pdf->SetMargins(50,12,10);
				$this->pdf->AddPage();
				$k2 = 1;
			}
			
			if($first == true || $k2 == 1)
			{
				$this->pdf->SetFont('Times','B',10);
				$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
				$this->pdf->cell(12,7, "Sl. No.","1",0,"C");
				$this->pdf->cell(80,7, "Description","1",0,"C");
				$this->pdf->cell(20,7, "Total","1",1,"C");
				$this->pdf->SetFont('Times','',9);
				$first = false;
			}
			
			$subname = $dv['FSSUBNAME'];
			$subnamearr = str_splitf($subname,55);
			
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(12,7, "","LT",0,"C");
			$this->pdf->SetFont('Times','B',9);
			$this->pdf->cell(80,7, "Total Answer Books Received","RTB",0,"L");
			$this->pdf->SetFont('Times','',9);
			$this->pdf->cell(20,7, $dv['totrec'],"1",1,"R");
			
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(12,7, "1","1",0,"C");
			$this->pdf->cell(80,7, "Total Answer Books Used","1",0,"L");
			$this->pdf->cell(20,7, $dv['used'],"1",1,"R");
			
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(12,7, "2","1",0,"C");
			$this->pdf->cell(80,7, "Total Answer Books Mal Practice","1",0,"L");
			$this->pdf->cell(20,7, $dv['mp'],"1",1,"R");
			
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(12,7, "3","1",0,"C");
			$this->pdf->cell(80,7, "Total Answer Books Cancelled","1",0,"L");
			$this->pdf->cell(20,7, $dv['cancelled'],"1",1,"R");
			
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(12,7, "4","1",0,"C");
			$this->pdf->SetFont('Times','B',9);
			$this->pdf->cell(80,7, "Total Answer Books Absent","1",0,"L");
			$this->pdf->cell(20,7, $dv['ab'],"1",1,"R");
			
			
			
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(12,7, "","LB",0,"C");
			$this->pdf->cell(80,7, "Total Answer Books To Be Returned","RTB",0,"L");
			$this->pdf->cell(20,7, $dv['totrec']-$dv['used']-$dv['cancelled']-$dv['ab'],"1",1,"R");
			
			
			$sl_no++;
			$k2++;
		}
		
	}
			 
	function SendOutput()
	{
		$this->pdf->Output("QPwise Students count.pdf","D");
	}
	
}

function Generateansbookstatistics($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

	$class_obj=new report_Generatetatkalreport();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);

	$class_obj->GetFullQry();
	 $class_obj->formcolldata();
	$class_obj->formData();
	 
	$class_obj->SendOutput();
}

?>