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


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

<?php
ob_start();
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
//$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
$pdf_writer_class =$main_src."/tcpdf/tcpdf.php";
require_once($pdf_writer_class);
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);

class MYPDF extends TCPDF {
    public $aobj_context;
     
    public function setData($aobj_context){
    	$this->aobj_context = $aobj_context;
		
    }
    public function Header() {

		$collcode=$_SESSION['collcode'];
		$degree = $this->aobj_context->mobj_data["degree"];
		$exam = $this->aobj_context->mobj_data["examno"];
		$subcode = $this->aobj_context->mobj_data["subject"];
		$section = $this->aobj_context->mobj_data["section"];

		$query = "select s.fdegree, s.fsubname, d.fexamname from subject s inner join 
			  degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno  
			  where s.fdegree = '{$degree}'  
			  and s.fexamno = '{$exam}'
			  and fsubcode = '{$subcode}'
			  and fintass='T'";

			  
    	$res3=$this->aobj_context->mobj_db->GetRow($query);
		
        // get the current page break margin
        $bMargin = $this->getBreakMargin();
        // get current auto-page-break mode
        $auto_page_break = $this->AutoPageBreak;
        // disable auto-page-break
        $this->SetAutoPageBreak(false, 0);
        // set bacground image

        $this->SetMargins(10,38,20,true);	
		$this->SetFillColor(248, 248 ,255);		
		$img_path = $this->aobj_context->main_src.$this->aobj_context->mobj_data["db"]."/img/".$this->aobj_context->FUNIVCODE."_logo.jpg";
		// var_dump($img_path);
		if(file_exists($img_path)) 
			$this->Image($img_path,10,6,20,20);

		$img_path1 = $this->aobj_context->main_src . "img/".$this->aobj_context->FUNIVCODE."_logo_2.jpeg";
        //var_dump($img_path);
        if (file_exists($img_path1)) {
            $this->Image($img_path1, 178, 3, 20, 20);
        }
		
		$this->SetFont('Times','B',13);
		$this->SetY(5);
		$this->Cell(0,4,$this->aobj_context->FUNIVNAME,0,1,'C');
		//state
		$this->SetFont('Times','',11);
		$this->Cell(0,4,$this->aobj_context->s_state,0,1,'C');
				 
		$this->SetFont('Times','B',12);
		$this->Ln(1);
		
		$cur_year = date("Y");

		$this->SetFont('Times','B',12);
		$this->Cell(0,4,"Subjectwise IA Report",0,1,'C');
		$this->Cell(0,4,"Subject Name: ".ucwords(strtolower($res3['fsubname'])),0,1,'C');
		$this->Cell(0,4,"Degree / Sem: ".$res3['fdegree'].' / '.ucwords(strtolower($res3['fexamname'])),0,1,'C');

		
		
		// var_dump($this->degree);
		$style = array(
			'position' => 'right',
			'align' => 'C',
			'stretch' => false,
			'fitwidth' => true,
			'cellfitalign' => '',
			'border' => false,
			'hpadding' => 'auto',
			'vpadding' => 'auto',
			'fgcolor' => array(0,0,0),
			'bgcolor' => false, //array(255,255,255),
			'text' => true,
			'font' => 'helvetica',
			'fontsize' => 8,
			'stretchtext' => 4
		);
		// var_dump($this->aobj_context->FAPPNO);
		// $this->write1DBarcode($this->aobj_context->fprefix.$this->aobj_context->appno, 'C39', '130', '20','130', 16, 0.3, $style, 'R');
        // restore auto-page-break status
        $this->SetAutoPageBreak($auto_page_break, $bMargin);
        // set the starting point for the page content    
    }

    public function Footer() 
    {
		$this->SetY(-25);
		$this->SetFont('Times','B',10);
		$this->Cell(0, 10,'Teacher Entered' .$this->aobj_context->current_date, 0, 0, 'L');
		$this->Cell(0, 10,'HOD Signature' .$this->aobj_context->current_date, 0, 1, 'R');
        $this->SetFont('helvetica', 'I', 8);
        $this->Cell(50, 10,'IP : '.$_SERVER["REMOTE_ADDR"], 0, 0, 'L');
        $this->Cell(100, 10,'Date : ' .$this->aobj_context->current_date, 0, 0, 'C');
        $this->Cell(50, 10,'Page ' .$this->getPageNumGroupAlias().'/'.$this->getPageGroupAlias(), 0, 1, 'R');

		
    }
}

class AddmissionApplication
{	
	function DefaultConstructor($aobj_context)
	{
		$this->aobj_context=$aobj_context;
		$appno=$_SESSION["APPNO"];
		$apptype = trim($aobj_context->mobj_data["fapptype"]);
		$fdegree = trim($aobj_context->mobj_data["fdegree"]);
		$combcode = trim($aobj_context->mobj_data["fcombcode"]);
		//$this->pdf=  new FPDF();
		$this->collcode=$_SESSION['collcode'];
		$degree = trim($aobj_context->mobj_data["degree"]);
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$get_date="select DATE_FORMAT(now(), '%d/%m/%Y') as now_date,fprefix from entdeg where fdegree = '{$degree}'";
		$obj=$this->aobj_context->mobj_db->GetRow($get_date);
		$fprefix = $obj['fprefix'];

		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', concat(FUNIVCODE,'_',pdf_logo_path) as pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";

		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);

		$app_type = "select papp.*, pcourse.*  from phdappfor papp 
					inner join phdcoursedet pcourse on pcourse.fdegree = papp.fdegree 
					and pcourse.fcombcode = papp.fcombcode where 
					papp.fapptype = '{$apptype}' and papp.fappno='{$appno}' 
					and papp.fdegree = '{$fdegree}' and papp.fcombcode='{$combcode}'";
		$lobj_get_app_type=$this->aobj_context->mobj_db->GetRow($app_type);

		$aobj_context->FAPPTYPE=$lobj_get_app_type['fapptype'];
		$aobj_context->FDEGREE=$lobj_get_app_type['fdegree'];
		$aobj_context->FDESC=$lobj_get_app_type['fdeggname'];
		$aobj_context->FCOMBCODE=$lobj_get_app_type['fcombcode'];
		$aobj_context->FCOMBNAME=$lobj_get_app_type['fcombname'];

		//var_dump($this->degree);
		$aobj_context->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
		$aobj_context->s_state=$lobj_get_coll_name['state'];
		$aobj_context->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
		$aobj_context->FEXAMAPPREQ=$lobj_get_coll_name['FEXAMAPPREQ'];
		$aobj_context->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE']; 

		
		$app_no = trim($aobj_context->mobj_data["appno"]);

		$aobj_context->appno = $app_no;
		$aobj_context->fprefix = $fprefix;
		$aobj_context->current_date = $obj['now_date'];
		$this->current_date = $obj['now_date'];

		$this->pdf= new MYPDF('P');
		$this->pdf->setData($aobj_context);
		
	}
 
	function formcolldata()
	{
		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', concat(FUNIVCODE,'_',pdf_logo_path) as pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ 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'];
		$this->FEXAMAPPREQ=$lobj_get_coll_name['FEXAMAPPREQ'];
		$this->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE']; 
	}
	
		
	function writeApplication($results1, $res){
		$pdf=$this->pdf;
		
		$pdf->SetMargins(10,10,25,false);
		$pdf->startPageGroup();
		$pdf->AddPage("P");
		$pdf->SetFont('Times','B',10);

		$this->pdf->cell(14,7, "Sl. No.","LTR",0,"C");
		$this->pdf->cell(32,7, "Reg. No.","LTR",0,"C");
		$this->pdf->cell(85,7, "Student Name","LTR",0,"C");

		$count = count($res);

		$i = 0;
		foreach($res as $val){
			if($i  === $count - 1 ){
				$break = 1;
			}else{
				$break = 0;
			}
			$this->pdf->cell(30,7, $val["fssubname"],"LTR",$break,"C");
			$i++;
		}

		$this->pdf->cell(14,7, "","LBR",0,"C");
		$this->pdf->cell(32,7, "","LBR",0,"C");
		$this->pdf->cell(85,7, "","LBR",0,"C");

		$i = 0;
		foreach($res as $val){
			if($i  === $count - 1 ){
				$break = 1;
			}else{
				$break = 0;
			}
			$this->pdf->cell(30,7, 'Max. M.: '.$val["FVALMAX"],"LBR",$break,"C");
			$i++;
		}


		
		$xy = 1;
		$z=0;
		foreach($results1 as $value){
			$pdf->SetFont('Times','',10);
			if($z == 25){
				$pdf->AddPage("P");
				$pdf->SetFont('Times','B',10);

				$this->pdf->cell(14,7, "Sl. No.","LTR",0,"C");
				$this->pdf->cell(32,7, "Reg. No.","LTR",0,"C");
				$this->pdf->cell(85,7, "Student Name","LTR",0,"C");

				$cnt = count($res);

				$a = 0;
				foreach($res as $val){
					if($a  === $cnt - 1 ){
						$break = 1;
					}else{
						$break = 0;
					}
					$this->pdf->cell(30,7, $val["fssubname"],"LTR",$break,"C");
					$a++;
				}

				$this->pdf->cell(14,7, "","LBR",0,"C");
				$this->pdf->cell(32,7, "","LBR",0,"C");
				$this->pdf->cell(85,7, "","LBR",0,"C");

				$b = 0;
				foreach($res as $val){
					if($b  === $cnt - 1 ){
						$break = 1;
					}else{
						$break = 0;
					}
					$this->pdf->cell(30,7, 'Max. M.: '.$val["FVALMAX"],"LBR",$break,"C");
					$b++;
				}
				$z=0;
				$pdf->SetFont('Times','',10);
			}

			
			$subSplit = explode(",",$value['sublist']);
			$marks = [];
			foreach($subSplit as $v){
				$markSplit = explode("_", $v);
				array_push($marks, $markSplit[1]);
			}

			$this->pdf->cell(14,7, $xy,"LBR",0,"C");
			$this->pdf->cell(32,7,$value['FREGNO'],"LBR",0,"C");
			$this->pdf->cell(85,7, $value['FNAME'],"LBR",0,"L");

			$count = count($marks);
			$j=0;
			foreach($marks as $m){
				if($j === $count - 1){
				$break = 1;
				}else{
					$break = 0;
				}
				$this->pdf->cell(30,7, $m, "LBR",$break,"C");
				$j++;
			}
			$z++;
			$xy++;
		}
		
		$table.='</table>';
		$pdf->writeHTML($table, false, true, false, false, 'L');		
	}
		
	function SendOutput()
	{
		$this->pdf->Output("PHD_Application.pdf","I");
	}	 
}

function getIaSubjectWiseReport($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode=$_SESSION['collcode'];
    $degree = $aobj_context->mobj_data["degree"];
    $exam = $aobj_context->mobj_data["examno"];
    $subcode = $aobj_context->mobj_data["subject"];
    $section = $aobj_context->mobj_data["section"];
    
    $cnd = "and stu.fsection = '{$section}'";
    if($section == 'All')
    {
        $cnd = "";
    }

    $query1="select stu.FREGNO, stu.FNAME,
    group_concat(
    concat(mak.FSUBCODE,'_',IFNULL(mak.FMARKS, '-1'),'_',IFNULL(mak.FPRESENT, ''),'_',sub.FVALMAX)
    order by mak.FSUBCODE) as sublist
    FROM student stu inner join marks mak ON stu.fdegree = mak.fdegree 
    and stu.FREGNO=mak.FREGNO and mak.Fdegree='{$degree}' 
    and mak.Fexamno='{$exam}' and mak.FCOLLCODE='{$collcode}'
    inner join subject sub on sub.FcSUBCODE = mak.FSUBCODE
    inner join degree d on d.FDEGREE =mak.FDEGREE 
    and  d.Fexamno=mak.Fexamno and d.FMEYEAR=mak.FYEAR 
    and d.FMEEXAMTYP=mak.FEXAMTYPE
    WHERE stu.FREGNO != ''  
    and fintass = 'T'
    and sub.FSUBCODE='{$subcode}' and sub.FDEGREE='{$degree}'
    and sub.FEXAMNO='{$exam}'
    {$cnd}
    group by stu.FREGNO
    order by stu.FREGNO";

    $results1=$aobj_context->mobj_db->GetAll($query1);

    $query = "select distinct fcsubcode, fssubname, FVALMAX from subject 
    where fdegree = '{$degree}' and fexamno = '{$exam}' 
    and fsubcode='{$subcode}'
    and fintass = 'T'
    order by fcsubcode";	
    $res=$aobj_context->mobj_db->GetAll($query);

	
	
	$class_obj = new AddmissionApplication();
	$class_obj->DefaultConstructor($aobj_context);
	$class_obj->writeApplication($results1, $res);
	$class_obj->SendOutput();
}