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


Current Path : /proc/thread-self/root/var/www/oasis/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/Report_details/generatePrintIaMarks.php

<?php

function generatePrintIaMarks($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'];
	

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

    $qry_insert = "insert ignore into progreport(fdegree, fcollcode, fregno, fexamno, fsubcode, fsubname, fheld, fattend)
    select distinct m.fdegree,m.fcollcode,m.fregno,m.fexamno,s.fsubcode,s.fsubname,
    sum(fnoclass)as conducted, sum(if(a.fpresent = 'P',fnoclass,0))as attended from 
    marks m inner join subject s on m.fdegree = s.fdegree
    and m.fexamno = s.fexamno and m.fsubcode = s.fcsubcode
    inner join attend_det a on a.fdegree = s.fdegree and a.fexamno = s.fexamno and a.fregno = m.fregno 
    and left(a.fsubcode,4) = s.fsubcode and m.fregno = a.fregno 
    and m.fexamno = a.fexamno and left(m.fsubcode,4) = left(a.fsubcode,4) and m.fdegree = a.fdegree
    where m.fcollcode = '{$college}'
    and m.fdegree = '{$degree}' and m.fregno between '{$fromregno}' and '{$toregno}' group by fregno,s.fcsubcode";
        
    
    $res_qry_insert = $aobj_context->mobj_db->Execute($qry_insert);

    $query = "select distinct fsubcode,fdegree,fexamno 
              from progreport where fdegree ='{$degree}' and fexamno = '{$sem}'
              and fcollcode = '{$college}'";
    $res = $aobj_context->mobj_db->getAll($query);

    foreach($res as $sub)
    {
        $fsubcode = $sub['fsubcode'];
        $fdegree = $sub['fdegree'];
        $fexamno = $sub['fexamno'];

        $query = "select distinct fssubname,m.fsubcode from subject s inner join marks m 
        on s.fdegree = m.fdegree and s.fexamno = m.fexamno 
        and s.fcsubcode = m.fsubcode where s.fsubcode = '{$fsubcode}' and  
        m.fdegree = '{$fdegree}' and m.fexamno = '{$fexamno}'";
        
        $res1 = $aobj_context->mobj_db->getAll($query);
       
        foreach($res1 as $subdet)
        {
            $fssubname = $subdet['fssubname'];
            $fsubcode = $subdet['fsubcode'];
            if($fssubname == 'MSE-1' || $fssubname == 'MSE')
            {
                $upd = "update progreport p, marks m  set p.fmse1 = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'MSE-2')
            {
                $upd = "update progreport p, marks m  set p.fmse2 = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'TASK T1' || $fssubname == 'TASKS T1')
            {
                $upd = "update progreport p, marks m  set p.ftask1 = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'TASK T2' || $fssubname == 'TASKS T2')
            {
                $upd = "update progreport p, marks m  set p.ftask2 = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'TASK T3' || $fssubname == 'TASKS T3')
            {
                $upd = "update progreport p, marks m  set p.ftask3 = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'Record')
            {
                $upd = "update progreport p, marks m  set p.frecord = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'Conduction')
            {
                $upd = "update progreport p, marks m  set p.fconduction = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'MSE (IPCC)')
            {
                $upd = "update progreport p, marks m  set p.fmseipcc = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

            if($fssubname == 'MSE (PCC)')
            {
                $upd = "update progreport p, marks m  set p.fmsepcc = m.fmarks
                    where p.fdegree = m.fdegree and p.fexamno = m.fexamno
                    and p.fsubcode = left(m.fsubcode,4)
                    and p.fregno = m.fregno
                    and m.fsubcode = '{$fsubcode}'
                    and p.fdegree = '{$fdegree}'
                    and m.fdegree = '{$fdegree}'";
                $res10 = $aobj_context->mobj_db->Execute($upd);

            }

        }  
    }
    
	$get_student_data = " select distinct fregno, fexamno, fdegree from progreport 
                          where fregno between '{$fromregno}' and '{$toregno}' and fcollcode = '{$college}' 
                          and fdegree = '{$degree}' and fexamno = '{$sem}'"; 
	$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); 
        
        $query="select ifnull(fsubname,'')as fsubname,
                if(ifnull(fmse1, '') = '-1','',fmse1)as fmse1,
                if(ifnull(fmse2, '') = '-1','',fmse2)as fmse2,
                if(ifnull(ftask1, '') = '-1','',ftask1)as ftask1,
                if(ifnull(ftask2, '') = '-1','',ftask2)as ftask2,
                if(ifnull(ftask3, '') = '-1','',ftask3)as ftask3,
                if(ifnull(fmsepcc,'') = '-1','',fmsepcc)as fmsepcc,
                if(ifnull(frecord,'') = '-1','',frecord)as frecord,
                if(ifnull(fconduction,'') = '-1','',fconduction)as fconduction,
                if(ifnull(fmseipcc,'') = '-1','',fmseipcc)as fmseipcc,
                ifnull(fheld, '')as fheld,
                ifnull(fattend, '')as fattend from progreport 
                where fregno = '{$value['fregno']}' and fdegree = '{$degree}'
                and fexamno = '{$sem}' and fcollcode='{$college}';";
                            // var_dump($query);
                            // die();
        $res = $aobj_context->mobj_db->GetAll($query);
        $pdf->AddPage('P');
        

        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', 8);	

        $table = '<style>
			td {
			    border: 0.5px solid black;
			}
			.lable {
				font-weight: bold;
			}
		 </style>';
        $table .= '<div><table>';
        $table.='<tr><td style = "text-align:center" class="lable" width="14px" height="30px">Sl <br/>No</td>';
        $table.='<td style = "text-align:center" class="lable" width="142px">Subject</td>';
        foreach($res_qry_sub_det as $sub_det){
           $table.='<td style = "text-align:center" class="lable" width="35px">'.$sub_det['fssubname'].'</td>';
        }
        $table.='<td style = "text-align:center" class="lable">Class<br/>Held</td>';
        $table.='<td style = "text-align:center" class="lable">Class<br/>Attend</td>';
        $table.='</tr>';
        $pdf->SetFont('Times','',8.5);	
        $count=1;	
        
        foreach($res as $key => $value)
        {	
            $table .='<tr>';
            $table .='<td style = "text-align:center" height="20px">'.$count.'</td>';
            $table .='<td height="20px">'.$value['fsubname'].'</td>';
            $table .='<td style = "text-align:center"  height="20px">'.$value['fmse1'].'</td>';
            if($college == '1001'){
                $table .='<td style = "text-align:center" height="20px">'.$value['fmse2'].'</td>';
                if($degree!="BTCS1"){
                    $table .='<td style = "text-align:center" height="20px">'.$value['fmsepcc'].'</td>';
                }
            }
            $table .='<td style = "text-align:center" height="20px">'.$value['ftask1'].'</td>';
            $table .='<td style = "text-align:center" height="20px">'.$value['ftask2'].'</td>';
            $table .='<td style = "text-align:center" height="20px">'.$value['ftask3'].'</td>';
            if($college == '1001'){
                $table .='<td style = "text-align:center" height="20px">'.$value['frecord'].'</td>';
                $table .='<td style = "text-align:center" height="20px">'.$value['fconduction'].'</td>';
                $table .='<td style = "text-align:center" height="20px">'.$value['fmseipcc'].'</td>';
            }
            $table .='<td style = "text-align:center" height="20px">'.$value['fheld'].'</td>';
            $table .='<td style = "text-align:center" height="20px">'.$value['fattend'].'</td>';
            $table.='</tr>';
            $count++;
        }
        $table.='</table>';
        $pdf->writeHTML($table, false, true, false, false, 'L');
        
        $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(10);
        $pdf->Cell(0,4,'Signature of HOD','',0,'L');
        $pdf->Cell(0,4,'Signature of Principal','',1,'R');

    }

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