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


Current Path : /var/www/oasis/Report_details_old/
Upload File :
Current File : /var/www/oasis/Report_details_old/bundle_ack_wait.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);
include_once("stringspliter.php");
	
class report_ra_qp_wise_student_count  extends TCPDF
{
		 
	function DefaultConstructor($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$this->pdf=  new TCPDF();
		$this->pdf=$this;
		$this->exdate=trim($this->aobj_context->mobj_data["exdate"]);
		$this->session=trim($this->aobj_context->mobj_data["session"]);
		
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$get_date="select date_format(now(),'%d/%m/%Y %h:%i %p') as now_date";
		// $get_date="select current_timestamp 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'];
		$this->pdf->Ln(5);
		$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',14);
		$this->pdf->cell(190,5,$this->FUNIVNAME."","0",1,"C");
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->cell(190,8, $this->s_state,"0",1,"C");
		$this->pdf->SetFont('Times','B',13);
		$this->pdf->cell(190,8, $this->college_details,"0",'1',"C");
		$this->pdf->SetFont('Times','B',13);
		$this->pdf->Cell(190,8,"Bundle Dispach Acknowledgement - ".$this->FEXAMDATE." Examination","0",1,"C");
		$this->pdf->Cell(95,8,"Exam Date : ".$this->exdate,"0",0,"L");
		if($this->session == 'M')
		{
			$session = "Morning";
		}
		else
		{
			$session = "After Noon";
		}
		$this->pdf->Cell(95,7,"Session : ".$session,"0",1,"R");
		$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->session == 'M')
        {
            $sess = 'AM';
        }
        else
        {
            $sess = 'PM'; 
        }

        
        $get_data = "select  d.FEXAMDATE, c.FQPCODE, concat(s.fsubname, ' [', s.FSSUBNAME,']') as FSSUBNAME, 
        group_concat(distinct concat(c.fbuno, ' (', c.ftotscript, ')') order by c.fbuno separator ', ') as fbundle,
         count( distinct fbuno) as fbundlecnt, 
        sum(ftotscript) as fpresentcnt 
        from colldesp c inner join subject s on c.fqpcode = s.fqpcode inner join degree d on 
        d.fdegree = s.fdegree and d.fexamno = s.fexamno
        where c.fdoe = date_format(str_to_date('{$this->exdate}', '%d/%m/%Y'), '%Y-%m-%d') 
        and fcollcode = '{$this->collcode}' and c.fsession = '{$sess}'
        group by c.fqpcode";

        // var_dump($get_data);
		$this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
		$this->FEXAMDATE = $this->lobj_get_data[0]['FEXAMDATE'];
	}
	
	function formData($copy)
	{

		$this->pdf->SetMargins(7,12,10);		
        $this->pdf->AddPage();
      $this->pdf->SetMargins(7,20,10);		
      //$this->pdf->SetMargins(5,12,10);	
        $this->pdf->Ln(25);
        $this->pdf->SetFont('Times','B',14);
        $this->pdf->Cell(190,8,$copy,"0",1,"C");
		$empty_cell_width=2;
		$sl_no=1;
		$k2 = 1;
		$first = true;
		foreach($this->lobj_get_data as $dk => $dv)
		{
			if($this->pdf->GetY() > 240)
			{
				$this->pdf->AddPage();
				$k2 = 1;
				$this->pdf->Ln(20);
				$this->pdf->SetMargins(7,20,10);
				$this->pdf->SetFont('Times','B',14);	
				$this->pdf->Cell(190,7,$copy,"0",1,"C");
			}
			
			if($first == true || $k2 == 1)
			{
				$this->pdf->SetFont('Times','B',12);
				$this->pdf->cell($empty_cell_width,5, ""," ",0,"C");
				$this->pdf->cell(12,5, "Sl.","LTR",0,"C");
				$this->pdf->cell(18,5, "QP ","LTR",0,"C");
                $this->pdf->cell(80,5, "Paper Title","LTR",0,"C");
                $this->pdf->cell(60,5, "Bundle Nos. (Script Count)","LTR",0,"C");
                $this->pdf->cell(20,5, "Received","LTR",1,"C");
                // $this->pdf->cell(14,5, "No. of","LTR",0,"C");
                // $this->pdf->cell(16,5, "Ans Book","LTR",1,"C");
                $this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
				$this->pdf->cell(12,5, "No.","LBR",0,"C");
				$this->pdf->cell(18,5, "Code","LBR",0,"C");
                $this->pdf->cell(80,5, "","LBR",0,"C");
                $this->pdf->cell(60,5, "","LBR",0,"C");
                $this->pdf->cell(20,5, "","LBR",1,"C");
                // $this->pdf->cell(14,5, "Bundles","LBR",0,"C");
                //$this->pdf->cell(16,5, "Count","LBR",1,"C");
				$this->pdf->SetFont('Times','',12);
				$first = false;
			}
			
			$subname = trim($dv['FSSUBNAME']);
			$subnamearr = str_splitf($subname,40);
            $nb = 0;
            $nb=max($nb,NbLines(60,$dv['fbundle'],''));
           //var_dump($nb);die();
            $yH =10*$nb;
            //var_dump($yH);
            $this->pdf->cell($empty_cell_width,$yH, ""," ",0,"C");
			$this->pdf->cell(12,$yH, $sl_no,"1",0,"C");
			$this->pdf->cell(18,$yH, $dv['FQPCODE'],"1",0,"C");
			$this->pdf->SetFont('Times','',12);
            $this->pdf->cell(80,$yH, $subnamearr[0],"1",0,"L");
       
            $this->pdf->Multicell(60,$yH, $dv['fbundle'],'1','L', 0, 0, '', '', true, 0, false, true, $yH, 'M');
       		$this->pdf->cell(20,$yH,"","1",1,"L");
			$sl_no++;
			$k2++;
		}
		
		$this->pdf->SetFont('Times','B',12);
		if(count($this->lobj_get_data) > 0)
		{
            $this->pdf->Ln(10);
            $this->pdf->cell(95,8, "Signature Chief Superintendent",0,0,"L");
            
			$this->pdf->cell(95,8, "Signature of Bundle Recieving Official",0,1,"R");
		}
	}
			 
	function SendOutput()
	{
		$this->pdf->Output("QPBundleAcknowledgement.pdf","D");
	}
	
}

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

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


	$class_obj->GetFullQry();
	 $class_obj->formcolldata();
	$class_obj->formData("University Copy");
    
    $class_obj->formcolldata();
	$class_obj->formData("College Copy");
	
    
	$class_obj->SendOutput();
}

function NbLines($w,$txt,$pdf)
{
    //Computes the number of lines a MultiCell of width w will take
    $cw=&$pdf->CurrentFont['cw'];
    if($w==0)
        $w=$pdf->w-$pdf->rMargin-$pdf->x;
    $wmax=($w-2*$pdf->cMargin)*1000/$pdf->FontSize;
    $s=str_replace("\r",'',$txt);
    $nb=strlen($s);
    if($nb>0 and $s[$nb-1]=="\n")
        $nb--;
    $sep=-1;
    $i=0;
    $j=0;
    $l=0;
    $nl=1;
    while($i<$nb){
        $c=$s[$i];
        if($c=="\n"){
            $i++;
            $sep=-1;
            $j=$i;
            $l=0;
            $nl++;
            continue;
        }
        if($c==' ')
            $sep=$i;
        $l+=$cw[$c];
        if($l>$wmax)
		{
            if($sep==-1){
                if($i==$j)
                    $i++;
            } else
                $i=$sep+1;
            $sep=-1;
            $j=$i;
            $l=0;
            $nl++;
        } 
		else
            $i++;
    }
    return $nl;
 }

?>