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


Current Path : /var/www/html/univadmin/creport_details/
Upload File :
Current File : /var/www/html/univadmin/creport_details/degreeListReportpdf.php

<?php
function degreeListReportpdf($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    // $college_code = $_SESSION['collcode']; 
    $college_code = $aobj_context->mobj_data["collcode"];
    $univcode = $aobj_context->mobj_data["univcode"];
	$degree_types = $aobj_context->mobj_data["type"]; 
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
    
    //   $img_path = $aobj_context->main_src . "/img/logo.jpg";
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";	
  
   
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report".$_SESSION['user_id']."_".$report_id.".pdf";
// global varibales
	$p_count =1;
// end global varibales	
//echo $pdf_writer_class; 
	include($pdf_writer_class);		
	$pdf= new FPDF();	
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(15,8);		
	$pdf->AliasNbPages();
  


// query for the page header	
	 $page_header_university = "select FUNIVNAME,FUNIVADD1,FTOWN, date_format(now(),'%d/%m/%Y') as date from control";
	$lobj_page_header_university = $aobj_context->pobj_db->GetRow($page_header_university);
   
   
	
	$page_header_college ="select concat(FCOLLCODE,'  ',FCOLLNAME,', ',FTOWN) as college_name
							from college where FCOLLCODE='{$college_code}'";
                        
	$lobj_page_header_college = $aobj_context->pobj_db->GetRow($page_header_college); 	
	  
	$page_footer_date = "select DATE_FORMAT(NOW(),'%d/%m/%Y %h:%i %p') as now_date ";
	$lobj_page_footer_date = $aobj_context->pobj_db->GetRow($page_footer_date);
 
	$pdf->date_time = $lobj_page_footer_date['now_date'];
	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'Degree';
	$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
	$pdf->FTOWN = $lobj_page_header_university[FTOWN];
	$pdf->FUNIVADD1 = $lobj_page_header_university[FUNIVADD1];
	$pdf->date_1 = $lobj_page_header_university['date'];
	$pdf->college_name = $lobj_page_header_college['college_name'];
	$pdf->DEGREETYPES=$degree_types;
	$pdf->AddPage();PrintFooter($pdf);
	$pdf->Ln();
	$pdf->SetFont('Times','',10);
	
	if($degree_types =='selectedonly')
	{
		$get_data= " select distinct c.FDEGREE as 'Degree', d.FDESCPN as 'Description' from colldeg c inner join  degree d 
					on c.FDEGREE = d.FDEGREE and c.FCOLLCODE='{$college_code}' 
					and c.FDELETED='F'";
		$fwidth='140';
	}
	else
	{
		$get_data="select distinct d.FDEGREE as 'Degree', d.FDESCPN as 'Description',IF(IFNULL(c.FDEGREE,'F')='F','','Selected') as 'Status' from colldeg c   right join degree d 
					on c.FDEGREE = d.FDEGREE and c.FCOLLCODE='{$college_code}' 
					and c.FDELETED='F'";
		$fwidth='160';
	}
	$lobj_details = $aobj_context->pobj_db->GetAll($get_data);

	
	$header_row=(array_keys($lobj_details[0]));	
	$pdf->SetDash(1, .3); //5mm on, 5mm off
	$pdf->Line(10, 33, 200, 33);
	//$pdf->Line(10, 33.5, 200, 33.5);
	foreach($header_row as $key1 => $value1)
	{	
		if($value1 == 'Description')
			$width='120';	
		else if($value1 == 'Degree')
			$width='20';	
		else 
			$width = '20';
			
		$pdf->SetFont('Times','B',10);
		$pdf->Cell($width,6,$value1,'0','0','L');
	}
	 //5mm on, 5mm off

	$pdf->SetDash(1, .3);
	$pdf->Line(10,38, 200,38);
	//$pdf->Line(10,38.5, 200,38.5);
	$pdf->Ln();	  
	$adm_ln_counter =0;
	foreach($lobj_details as $key => $value)
	{
	
		if($adm_ln_counter > 35)
		{
			$new_y=$pdf->GetY();
			$pdf->SetDash(1, .3);
			$pdf->Line(10,$new_y, 200,$new_y);
			$pdf->AddPage();PrintFooter($pdf);
			$pdf->Ln(4);
			$pdf->SetDash(1, .3); //5mm on, 5mm off
			$pdf->Line(10, 33, 200, 33);
			$pdf->Line(10, 33.5, 200, 33.5);
			foreach($header_row as $key1 => $value1)
			{	
				if($value1 == 'Description')
					$width='120';	
				else if($value1 == 'Degree')
					$width='20';	
				else 
					$width = '20';
					
				$pdf->SetFont('Times','B',10);
				$pdf->Cell($width,6,$value1,'0','0','L');
			}
			$new_y=$pdf->GetY();
			$pdf->SetDash(1, .3); //5mm on, 5mm off
			$pdf->Line(10, 38, 200, 38);
			$pdf->Line(10, 38.5, 200, 38.5);
			
			$pdf->Ln();
			$adm_ln_counter=0;
		}
	   foreach($value as $key2 => $value2)
	    {		  	    
		 if($key2 == 'Description')
		{
			$align = "L";
			$width='120';
		}	
		else if($key2 == 'Degree')
		{
			$align = "L";
			$width='20';
		}	
		else if($key2 == 'Status')
		{
			$width='20';
			$align = "L";
		}	
		$pdf->SetFont('Times','',10);	
		$pdf->Cell($width,6,$value2,'','0',"{$align}");
		}
		
		 $pdf->Ln();
		++$adm_ln_counter;
	}	
		$new_y=$pdf->GetY();
		$pdf->SetDash(1, .3);
		$pdf->Line(10,$new_y, 200,$new_y);

	$pdf->Output("degree_lists.pdf","I");	 
	 
}

function PrintFooter($pdf)
{
		$new_x=$pdf->GetX();
		$new_y=$pdf->GetY();
		$ip=$_SERVER["REMOTE_ADDR"];
		$pdf->SetY(-20);
		$pdf->SetFont('Times','',8);
		$new_yl=$pdf->GetY();
		$pdf->SetDash(1, .3);
		$pdf->Line(10,$new_yl, 200,$new_yl);
		$pdf->Line(10,$new_yl+.5, 200,$new_yl+.5);
		$pdf->Ln(2);
		$pdf->Cell(140,4,'Printed   : IP Address : '.$ip.", Date : ".$pdf->date_time,'0',0,'L');
		$pdf->SetXY($new_x,$new_y); 
}



// $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;
// // require_once("degreeWiseStudentlist_excel.php");
// // ini_set('memory_limit','900M');
// // ini_set('max_execution_time',0);

// class MYPDF extends TCPDF
// {
//     public $aobj_context;
//     // public $degreegrp;

//     public function setDeggrp($degreegrp){
//         $this->degreegrp = $degreegrp[0];
//     }

//     public function setData($aobj_context)
//     {
//         $this->aobj_context = $aobj_context;
//     }

//     public function Header()
//     {

//         $this->collcode = $this->aobj_context->mobj_data["collcode"];
//         $this->univcode = $this->aobj_context->mobj_data["univcode"];
//         $this->type = $this->aobj_context->mobj_data["type"];
 
//         // 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);
//         $this->SetTitle("Degree List");

//         // set bacground image
//         $this->SetFillColor(248, 248, 255);
//         $img_path = $this->aobj_context->main_src . "/img/logo.jpg";

//         if (file_exists($img_path)) {
//             $this->Image($img_path, 6, 6, 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->pdf->SetFont('Times','B',14);
//         $this->pdf->cell(0,7,"". $this->aobj_context->FUNIVNAME,0,1,"C");
//         $this->pdf->SetFont('Times','',8);
//         $this->pdf->cell(0,4, $this->aobj_context->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(0,7,"College: ".$this->college_name,0,1,"C");
//         $this->pdf->cell(0,7,$type,"0",1,"C");

//         $this->SetFont('Times', 'BU', 12);
//         $this->Ln(1);

//         $cur_year = date("Y");
//         $this->Cell(0, 5, 'Degree List', '0', 1, 'C');
//         $this->Ln(10);
//         // restore auto-page-break status
//         $this->SetAutoPageBreak($auto_page_break, $bMargin);
//         // set the starting point for the page content
//     }

//     public function Footer()
//     {
//         $this->SetY(-15);
//         $this->SetFont('helvetica', 'I', 8);
//         if($this->CurOrientation == 'P')
//         {
//             $this->Cell(60, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
//             $this->Cell(60, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
//             $this->Cell(60, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
//         }
//         else {
//             $this->Cell(90, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
//             $this->Cell(90, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
//             $this->Cell(90, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
//         }
//     }
// }

// class ReprtObject
// {

//     public function DefaultConstructor($aobj_context)
//     {
//         $this->aobj_context = $aobj_context;
//         $collcode = $aobj_context->mobj_data["collcode"];        
//         $univcode = $aobj_context->mobj_data["univcode"];
//         $type = $aobj_context->mobj_data["type"];
//         $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);


//         $this->ip = $_SERVER["REMOTE_ADDR"];
//         $get_date = "select DATE_FORMAT(now(), '%d/%m/%Y') as now_date";
//         $obj = $this->aobj_context->mobj_db->GetRow($get_date);
      
//         $this->reportType = $aobj_context->mobj_data["type"];

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

//         $lobj_get_coll_name = $this->aobj_context->mobj_db->GetRow($get_coll_name);
	
	
//         $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->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];

//         $this->current_date = $obj['now_date'];

//         $this->pdf = new MYPDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'ISO-8859-1', false);
//         $this->pdf->setData($aobj_context);

//         $query1 = "select distinct fdeggrp, fdescpn, fexamdate from deggrp
//         where ifnull(fdeggrp,'') BETWEEN '{$fdeggrpfrm}' AND '{$fdeggrpto}'";
//         // $result1 = $aobj_context->pobj_db->GetAll($query1);

//         $this->pdf->setDeggrp($result1);

//     }

//     public function Header($pdf)
//     {
//         $pdf->Ln(10);
//         $pdf->SetFont('Times', 'B', 10);
//         $pdf->Cell(8, 6, "Sl.No", "LRT", 0, "C");
//         $pdf->Cell(13, 6, "Degree", "LRT", 0, "C");
//         $pdf->Cell(10, 6, "Description ", "LRT", 0, "C");
//         $pdf->Cell(49, 6, "Action", "LRT", 1, "C");
     
//     }

//     public function Report($data)
//     {
//         $pdf = $this->pdf;

//         $pdf->SetMargins(15, 30);
//         $pdf->startPageGroup();
//         $pdf->AddPage("L");

//         $pdf->SetFont('Times', '', 10);

//         $oldCode = "";
//         $newCode = "";
//         $oldSub = "";
//         $newSub = "";
//         $sl_no = 1;
//         $first = true;
//         // var_dump($exattendancelist);
//         // var_dump($this->aobj_context->FUNIVCODE);
//         // die();
//         foreach ($data as $key => $value) {

//             $newCode = $value['fdegree'].$value['fexamno'];
//             $newSub = $value['fsubname'];

//             if ($pdf->getY() > 175) {

//                 $oldSub = "A";
//                 $newSub = $value['fsubname'];
//                 $pdf->SetFont('Times', 'B', 12);
//                 $pdf->cell(180, 1, " ", "T", 1, "C");
//                 $pdf->AddPage("L");
//                 $this->Header($pdf);
//                 $pdf->SetFont('Times', '', 10);
//             }

//             if ($newCode != $oldCode) {
//                 $sl_no = 1;
//                 if(!$first){
//                     $pdf->cell(180, 1, " ", "T", 1, "C");
//                 }
//                 if ($pdf->getY() > 155) 
//                     $pdf->AddPage("L");
//                 $pdf->SetFont('Times', 'B', 12);
//                 $this->Header($pdf);
//                 $pdf->SetFont('Times', '', 10);
//                 $first = false;
//             }
//             $x = $pdf->GetX();
//             $y = $pdf->GetY();

//             if($newSub != $oldSub) {
//                 $pdf->SetX($x + 45);
//                 $pdf->MultiCell(49, 6, $value['fsubname'], "LTR", "L");
//             }
//             else{
//                 $pdf->SetX($x + 45);
//                 $pdf->MultiCell(49, 6, ' ', "LR", "L");
//             }        
//             $y1 = $pdf->GetY();
//             $h = $y1 - $y;
//             $pdf->SetXY($x, $y);
            
//             if($newSub != $oldSub) {
//                 $pdf->Cell(8, $h, $sl_no, "LTR", 0, "C");
//                 $pdf->cell(13, $h, $value['fdegree'], "LTR", 0, "C");
//                 $pdf->cell(10, $h, $value['fexamno'], "LTR", 0, "C");
//                 $pdf->cell(14, $h, $value['fsubcode'], "LTR", 0, "C");    
//                 $sl_no++;
//             }
//             else{
//                 $pdf->Cell(8, $h, "", "LR", 0, "C");
//                 $pdf->cell(13, $h, "", "LR", 0, "C");
//                 $pdf->cell(10, $h, "", "LR", 0, "C");
//                 $pdf->cell(14, $h, "", "LR", 0, "C");
//                 // $sl_no++;
//             }
//             $pdf->SetFont('dejavusans', '', 10);

//             $html =  $value['fmandatory'] == 'True'? 
//                 'Yes': 'No';
//             $pdf->SetFont('Times', '', 10);
            
            
//             // $pdf->cell(13, $h, $value['fsubcode'], "LTR", 0, "C");
//             if($newSub != $oldSub) {
            
//                 $pdf->SetXY($x + 94, $y);
//                 $pdf->cell(17, $h, $value['fsubshort'], "LTR", "B", "C");
//                 $pdf->cell(15, $h, $html, "LTR", 0, "C");
            
//             }else{
//                 $pdf->SetXY($x + 94, $y);
//                 $pdf->cell(17, $h, '', "LR", 0, "C");
//                 $pdf->cell(15, $h, "", "LR", 0, "C");
//             }
            
            

            
            
//             $pdf->cell(15, $h, $value['fssubcode'], "1", 0, "C");
//             $pdf->cell(45, $h, $value['fssubname'], "1", 0, "C");
//             $pdf->cell(15, $h, $value['fthpr'], "1", 0, "C");
//             $pdf->cell(15, $h, $value['fintass'], "1", 0, "C");
//             $pdf->cell(15, $h, $value['fretain'], "1", 0, "C");
//             if($this->aobj_context->FUNIVCODE == '051')
//                 $pdf->cell(15, $h, $value['fmaxmarks'], "1", 0, "C");
//             else
//                 $pdf->cell(15, $h, $value['fsmaxmarks'], "1", 0, "C");
//             $pdf->cell(17, $h, $value['fqpcode'], "1", 1, "C");            
                  

//             $oldCode = $newCode;
//             $oldSub = $newSub;            
//         }
//         $pdf->cell(200, $h, "", "T", 0, "C");

//     }

//     public function SendOutput()
//     {
//         // ob_end_clean();
//         $this->pdf->Output("Subject List.pdf", "I");
//     }
// }

// function degreeListReportpdf($aobj_context)
// {

// 	session_start();
//     $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
//     $college_code = $_SESSION['collcode']; 
// 	$degree = $aobj_context->mobj_data["degree"]; 	
// 	$sem = $aobj_context->mobj_data["sem"]; 
// 	$type = $aobj_context->mobj_data["type"]; 
// 	$univcode = $aobj_context->mobj_data["univcode"];
// 	$collcode = $aobj_context->mobj_data["collcode"];
   
  
//     if($deggrp == "All"){
//         $cond="";
//     }else{
//         $cond="and
//         d.fdeggrp = '{$deggrp}'";
//     }
//     $condt = "";
//     if($fcurtype == '500'){
//         $condt = "and st. fcollcode = '{$fcollcode}'";
//     }
    
//     foreach($degree as $key => $val){
//         $deg .= "'".$val."',";
//     }
//     $degarr = substr_replace($deg ,"",-1);

//     if($degarr == "'All'" || $degarr == ""){
//         $cnd = "";
//       }else{
//         $cnd = "and s.fdegree in ($degarr)";
//       }


//       $_sem = $aobj_context->mobj_data['sem'];
//     $sem = json_decode($_sem,true);

//     foreach($sem as $key => $val){
//         $semester .= "'".$val."',";
//     }
//     $semarr = substr_replace($semester ,"",-1);

//     if($semarr == "'All'" || $semarr == ""){
//         $cnd1 = "";
//       }else{
//         $cnd1 = "and d.fexamno in ($semarr)";
//       }
      
//     if($univcode == '051'){
//         $mark = 'fvalmax';
//     }else{
//         $mark ='fmaxmarks';
//     }
//     // $query = "select distinct s.fdegree, d.fdescpn, d.fexamno, d.fexamname, fsubcode, fsubname, fsubshort,
// 	// ifnull($mark,'') as fmaxmarks, ifnull(fminmarks,'') as fminmarks,
//     // if(fmandatory='T','Yes', 'No') as fmandatory,
//     // fssubcode, fssubname,if(ftheory ='T', 'Th.','Pr.') as fthpr, if(fintass = 'T','Yes', 'No') as fintass,
//     // if(fretain = 'T','Yes', 'No') as fretain, fsmaxmarks, ifnull(fsminmarks,'') as fsminmarks,
//     // ifnull(fqpcode,'') as fqpcode
//     // from subject s inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno 
//     // left join student st on d.fdegree = st.fdegree and s.fdegree = st.fdegree
//     // where s.fsubname <> 'DUMMY'
//     // $condt
//     // $cond
//     // $cnd
//     // $cnd1
//     // order by fdegree, fexamno, fcsubcode;";
//     // // var_dump($query);die();
//     // $result = $aobj_context->pobj_db->GetAll($query);

//     // $result = $aobj_context->pobj_db->GetAll($query);
//     // var_dump($result);
//     foreach($degree as $key => $val){
//         $degg .= $val.", ";
//     }
//     $hdegarr = substr_replace($degg ,"",-2);

//     foreach($sem as $key => $val){
//         $semest .= $val.", ";
//     }
//     $hsemarr = substr_replace($semest ,"",-2);

//     $class_obj = new ReprtObject();
//     $class_obj->univcode = $univcode;
//     $aobj_context->DEGREE = $hdegarr;
//     $aobj_context->DEGGRP = $deggrp;
//     $aobj_context->SEM = $hsemarr;
//     $class_obj->DefaultConstructor($aobj_context);

//     // If No data found Generate Blank Report
//     if (count($result) > 0) {
//         $class_obj->Report($result);
//     }

//     $class_obj->SendOutput();
// }


?>