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


Current Path : /var/www/html/gug/Report_details/
Upload File :
Current File : /var/www/html/gug/Report_details/report_daliy_report_qp_25042018.php

<?php
	$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
	$pdf_writer_class =$main_src."/tarka_pdf_latest/fpdf.php";
	require_once($pdf_writer_class);
	
	class DownloadExamAppFormApplications  extends FPDF
	{		
		function DefaultConstructor($aobj_context)
		{
			include_once($aobj_context->main_src."/src/format.php");
			$this->aobj_context=$aobj_context;
			$this->pdf=  new FPDF();
			$this->pdf=$this;
			session_start();
			$this->ip=$_SERVER["REMOTE_ADDR"];
			$this->collcode=$_SESSION['collcode'];
			$this->college_code=$_SESSION['collcode'];
			$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->qp_code_start =  substr("0000000000".$aobj_context->mobj_data["qp_code_start"],-5); 
			$this->qp_code_end =  substr("ZZZZZZZZZZ".$aobj_context->mobj_data["qp_code_end"],-5); 

			$this->date_start = substr("0000000000".db_date_Format($aobj_context->mobj_data["Date_start"]),-10); 
			$this->date_end   = substr("ZZZZZZZZZZ".db_date_Format($aobj_context->mobj_data["Date_end"]),-10);
	 
			$this->session     = stripslashes($aobj_context->mobj_data["session"]); 
			if($this->session=="PM")
			$this->session="'PM'";
			if($this->session=="AM")
			$this->session="'AM'";
		}		 
			 
		function Header()
		{
			$this->pdf->SetMargins(10,12,10);		
			
			$img_path=$this->aobj_context->main_src.$this->pdf_logo_path;
			 
			if(!empty($this->pdf_logo_path) && file_exists($img_path)) 
			{					 
				$this->pdf->Image($img_path,10,10,20);
			}
			$this->pdf->SetFont('Times','B',15);
			$this->pdf->cell(180,4,"".$this->FUNIVNAME,"0",1,"C");
			$this->pdf->SetFont('Times','',8);
			$this->pdf->cell(180,4, $this->s_state,"0",0,"C");
			$this->pdf->SetFont('Times','',10);	
			$this->pdf->Cell(-20,4,"Page {$this->pdf->PageNo()}/{nb}",0,1,'C'); 
			$this->pdf->SetFont('Times','B',10);
			$this->pdf->cell(180,5, "College : ".$this->FCOLLCODE." - ".$this->FCOLLNAME,"0",1,"C");			 
			$this->pdf->SetFont('Times','B',10);		
		}	
		
		function Footer()
		{	 
			$this->SetY(-15);
			$this->pdf->SetFont('Times','B',8);
			//$this->Cell(140,6,'Entered  : IP Address : '.$this->ip_address." Date ".$this->created_date,'0',0,'L');
			$new_y=$this->pdf->GetY();
			$this->pdf->SetDash(1, .3);
			$this->pdf->Line(5,$new_y, 203,$new_y);
			$this->pdf->Line(5,$new_y+.5, 203,$new_y+.5);
			$this->pdf->Ln(2);
			$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_coll_name="SELECT FCOLLCODE,FCOLLNAME
			FROM college where FCOLLCODE='{$this->collcode}'";
			$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
			$this->FCOLLCODE=$lobj_get_coll_name['FCOLLCODE']; 
			 
			$this->FCOLLNAME=$lobj_get_coll_name['FCOLLNAME']; 
		}
		function GetAllSubjects()
		{
			//print_r($get_fcsubcode_from_both_table);die();	

			$query1 = "SET SESSION group_concat_max_len=100000";
					
			$results1 = $this->aobj_context->mobj_db->Execute($query1);		

			$get_daliy_data= "  select  date_format(cd.FDOE,'%d/%m/%Y') as doe_name,cd.FQPCODE as FQPCODE,cd.FSESSION, 
			concat(sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as subject_desp,
			FNOBUNDLE,FTOTSCRIPT 
			from colldesp cd inner join subject sub on
			sub.FQPCODE=cd.FQPCODE							 
			where  
			cd.FCOLLCODE='{$this->college_code}' and
			cd.FQPCODE>='{$this->qp_code_start}' and cd.FQPCODE<='{$this->qp_code_end}' and 
			cd.FDOE>='{$this->date_start}' and cd.FDOE<='{$this->date_end}'   
			and cd.FSESSION in({$this->session}) and							 
			ifnull(cd.FDELETED,'') <> 'T' group by cd.FDOE,cd.FQPCODE,cd.FSESSION 
			order by date_format(cd.FDOE,'%d/%m/%Y'), cd.FSESSION, cd.fqpcode "; 
									
			$lobj_get_daliy_data = $this->aobj_context->mobj_db->GetAll($get_daliy_data);
	
			//$result=mysql_query("set group_concat_max_len=10000");
			
			$get_daliy_present_data= " select sub.FQPCODE,date_format(sub.FDOE,'%d/%m/%Y') as doe_name, sub.FSESSION, 'QPP' as type,
			concat(sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as subject_desp,
			GROUP_CONCAT(distinct a.FREGNO order by a.fregno SEPARATOR '  ') as FREGNO, COUNT(DISTINCT FREGNO) AS reg_cnt 
			from canddet a inner join subject sub on
			sub.FDEGREE=a.FDEGREE and sub.fexamno = a.fexamno and sub.fsubcode = a.fsubcode 
			and ifnull(sub.ftheory,'') = 'T' and ifnull(sub.fqpcode,'') <> '' 
			where 
			sub.FDOE>='{$this->date_start}' and sub.FDOE<='{$this->date_end}'
			and sub.FQPCODE>='{$this->qp_code_start}' and sub.FQPCODE<='{$this->qp_code_end}'    
			and sub.FSESSION in({$this->session})
			and a.FCOLLCODE='{$this->college_code}'
			and ifnull(a.FDELETED,'') <> 'T' and  a.FCOLLCODE='{$this->college_code}' and a.fpresent = 'P'
			and concat(a.fcollcode, a.fregno, sub.fqpcode) not in(select concat(fcollcode, fregno, fqpcode) from absent 
			where FDOE>='{$this->date_start}' and sub.FDOE<='{$this->date_end}' 
			and FQPCODE>='{$this->qp_code_start}' and sub.FQPCODE<='{$this->qp_code_end}'
			and FCOLLCODE='{$this->college_code}')
			group by sub.FDOE, sub.FQPCODE, sub.FSESSION 
			order by date_format(sub.FDOE,'%d/%m/%Y'), sub.FSESSION, sub.fqpcode" ;	
			
			//var_dump($get_daliy_present_data);
			$lobj_get_daliy_present_data = $this->aobj_context->mobj_db->GetAll($get_daliy_present_data);
			
			$get_daliy_absent_data= " select a.FQPCODE,date_format(a.FDOE,'%d/%m/%Y') as doe_name,a.FSESSION,upper(a.FABSTYPE) as type,
			concat(sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as subject_desp,
			GROUP_CONCAT(distinct a.FREGNO order by a.fregno SEPARATOR '  ') as FREGNO,COUNT(DISTINCT FREGNO) AS reg_cnt 
			from absent a 
			inner join subject sub on
			sub.FQPCODE=a.FQPCODE	 and left(a.FABSTYPE,2)='QP'	
			where 
			a.FDOE>='{$this->date_start}' and a.FDOE<='{$this->date_end}'
			and a.FQPCODE>='{$this->qp_code_start}' and a.FQPCODE<='{$this->qp_code_end}'    
			and a.FSESSION in({$this->session})
			and a.FCOLLCODE='{$this->college_code}'
			and ifnull(a.FDELETED,'') <> 'T' and  a.FCOLLCODE='{$this->college_code}'
			group by a.FDOE,a.FQPCODE,a.FABSTYPE,a.FSESSION 
			order by date_format(a.FDOE,'%d/%m/%Y'), a.FSESSION, a.fqpcode, a.FABSTYPE" ;	
			
			$lobj_get_daliy_absent_data = $this->aobj_context->mobj_db->GetAll($get_daliy_absent_data);
			
			//echo "<pre>".$get_daliy_absent_data;die();
			$this->unique_page_arr=array();
			$this->qp_code_arr=array();
			foreach($lobj_get_daliy_absent_data as $ak=>$av)
			{
				if($av['type']=='QPA')
				{
					$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['det']['QPA']['cnt']=$av['reg_cnt'];
					$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['det']['QPA']['FREGNO']=$av['FREGNO'];	 
				}

				if($av['type']=='QPM')
				{
					$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['det']['QPM']['cnt']=$av['reg_cnt'];
					$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['det']['QPM']['FREGNO']=$av['FREGNO'];			 
				}
				
				$this->qp_code_arr[$av['FQPCODE']]=$av['subject_desp'];
			}
			
			
			foreach($lobj_get_daliy_data as $ak=>$av)
			{
				$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['bund']['FNOBUNDLE']=$av['FNOBUNDLE'];
				$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['bund']['FTOTSCRIPT']=$av['FTOTSCRIPT'];
				$this->qp_code_arr[$av['FQPCODE']]=$av['subject_desp'];	
			}

			foreach($lobj_get_daliy_present_data as $ak=>$av)
			{
				$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['det']['QPP']['cnt']=$av['reg_cnt'];
				$this->unique_page_arr[$av['doe_name']][$av['FQPCODE']][$av['FSESSION']]['det']['QPP']['FREGNO']=$av['FREGNO'];	 				
				$this->qp_code_arr[$av['FQPCODE']]=$av['subject_desp'];
			}
			
			// echo "<pre>";
			// print_r($this->unique_page_arr);die();				 
		}
			 
		function formData()
		{		
			foreach($this->unique_page_arr as $date_k=>$date_v)
			{
				$this->doe=$date_k;
				foreach($date_v as $qp_codek=>$qp_code_v)
				{
					$this->qp_code=$qp_codek;
					$this->qp_name=$this->qp_code_arr[$this->qp_code];

					foreach($qp_code_v as $sessk=>$sessv)
					{
						$this->session_name=$sessk;

						if($this->session_name=="AM")
							$this->session_name="Morning";
						else
							$this->session_name="After Noon";
						$this->FDOE=$sessv['FDOE'];
						$this->pdf->AddPage();
						$this->pdf->SetFont('Times','',10);
						$this->pdf->Cell(180,5,"QP Code : {$this->qp_code} - {$this->qp_name}","0",1,"C");
						$this->pdf->Cell(180,5,"Date of Examination : {$this->doe}","0",1,"C");
						$this->pdf->Cell(180,5,"Session : {$this->session_name}","0",1,"C");
						$this->pdf->ln(1);
						$new_y=$this->pdf->GetY();
						$this->pdf->SetDash(1, .3);
						$this->pdf->Line(5,$new_y, 203,$new_y);
						$this->pdf->Line(5,$new_y+.5, 203,$new_y+.5);
						$this->pdf->ln(4);
						$this->pdf->SetFont('Times','',10);
						$this->pdf->Cell(15,6,'','0',0,'L');
						$this->pdf->Cell(80,6,'Total Number of Bundles','LT',0,'L');
						$this->pdf->Cell(95,6,$sessv['bund']['FNOBUNDLE'],'1',1,'C');	
						$this->pdf->Cell(15,6,'','R',0,'L');
						$this->pdf->Cell(80,6,'Total Number of Scripts','LB',0,'L');		
						$this->pdf->Cell(95,6,$sessv['bund']['FTOTSCRIPT'],'1',1,'C');	

						//total_present
						$this->pdf->ln(2);						
						$cnt=$sessv['det']['QPP']['cnt'];
						$FREGNO=$sessv['det']['QPP']['FREGNO'];
						$explode_arr=explode("  ",$FREGNO);
						$chnk_cnt=count(array_chunk($explode_arr, 8))*1;
						if($chnk_cnt<6)
						$chnk_cnt=6;
						$this->pdf->Cell(15,6,'','0',0,'L');
						$this->pdf->SetFont('Times','B',10);
						$this->pdf->Cell(80,6,'Total Present','1',0,'L');
						$this->pdf->Cell(95,6,$cnt,'1',1,'C');	
						$this->pdf->Cell(15,6,'','R',0,'L');
						$this->pdf->SetFont('Times','',10);
						$this->pdf->MultiCell(175,5,$FREGNO,1,"L");
						
						
						//total_abs
						$this->pdf->ln(2);						
						$cnt=$sessv['det']['QPA']['cnt'];
						$FREGNO=$sessv['det']['QPA']['FREGNO'];
						$explode_arr=explode("  ",$FREGNO);
						$chnk_cnt=count(array_chunk($explode_arr, 8))*1;
						if($chnk_cnt<6)
						$chnk_cnt=6;
						$this->pdf->Cell(15,6,'','0',0,'L');
						$this->pdf->SetFont('Times','B',10);
						$this->pdf->Cell(80,6,'Total Absent','1',0,'L');
						$this->pdf->Cell(95,6,$cnt,'1',1,'C');	
						$this->pdf->Cell(15,6,'','R',0,'L');
						$this->pdf->SetFont('Times','',10);
						$this->pdf->MultiCell(175,$chnk_cnt,$FREGNO,1,"L");
						
							//total_abs
						$this->pdf->ln(2);						
						$cnt=$sessv['det']['QPM']['cnt'];
						$FREGNO=$sessv['det']['QPM']['FREGNO'];
						$explode_arr=explode("  ",$FREGNO);
						$chnk_cnt=count(array_chunk($explode_arr, 8))*1;
						if($chnk_cnt<6)
						$chnk_cnt=6;
						$this->pdf->Cell(15,6,'','0',0,'L');
						$this->pdf->SetFont('Times','B',10);
						$this->pdf->Cell(80,6,'Total Mal-practice','1',0,'L');
						$this->pdf->Cell(95,6,$cnt,'1',1,'C');	
						$this->pdf->Cell(15,6,'','R',0,'L');
						$this->pdf->SetFont('Times','',10);
						$this->pdf->MultiCell(175,$chnk_cnt,$FREGNO,1,"L");
							
						$this->SetY(-65); 
						$new_y=$this->pdf->GetY();
						$this->pdf->SetDash(1, .3);
						$this->pdf->Line(5,$new_y, 203,$new_y);
						$this->pdf->Ln(5);
						$this->pdf->Cell(180,6,'Signature of the Principal','',0,'R');	
					}
				}
				 
			} 		 
		}
			 
			 
		function SendOutput()
		{
			$this->pdf->Output("daily_report.pdf","D");
		}
			 
	}
	function generateDaliyReportQp($aobj_context)
	{
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		$class_obj=new DownloadExamAppFormApplications();
		$class_obj->AliasNbPages();
		$class_obj->DefaultConstructor($aobj_context);
		$class_obj->formcolldata();
		$class_obj->GetAllSubjects(); 
		$class_obj->formData();	 
		$class_obj->SendOutput();
	}
?>