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


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

<?php
function printMarkListDetailsWisenew_sjbitx1($aobj_context){
    session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
   
    $collcode=$_SESSION['collcode'];
    $teachcode = $aobj_context->mobj_data["teachcode"];
    $classid = $aobj_context->mobj_data["classid"];
    $classidarry = explode("- ", $classid);

    $classid = trim($classidarry[0]);
    
	$main_src=$main_src_obj[1];
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_me_student_list.pdf";
	
	include($pdf_writer_class);		
	$pdf= new FPDF();
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(6,13);		
	$pdf->AliasNbPages();	

	$page_header_university = "select concat(FUNIVNAME,', ',FTOWN) as FUNIVNAME, '' as 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) as college_name
							from college where FCOLLCODE='{$collcode}'";
	$lobj_page_header_college = $aobj_context->mobj_db->GetRow($page_header_college); 

	$page_header_degree = "select concat('[ ',FDEGREE,' ] - ', FDESCPN) as Degree_name, 
							concat('( ', FEXAMNAME ,' Examination ',FEXAMDATE,')') as Exam ,FADYEAR
							from degree where FDEGREE = '{$degree_code}' and FEXAMNO='{$exam_code}' ";
                            
	$lobj_page_header_degree = $aobj_context->mobj_db->GetRow($page_header_degree);
	
	$page_header_REGROLL = "select FREGROLL from control";
	$lobj_page_header_REGROLL = $aobj_context->mobj_db->GetRow($page_header_REGROLL);

    $qpurey = "select ifnull(fiateachfreez,'') as fiateachfreez
    from classfreez
    where fclassid='{$classid}'";
	$res9 = $aobj_context->mobj_db->GetRow($qpurey);

     

    $str = "(FREEZE PENDING)";
    if($res9['fiateachfreez'] == 'T')
        $str = "(FINAL MARKS)";


    $headerQry = "select a.fclassname, s.fsubname,s.fsubcode,m.fexamno,
                m.fdegree, sum.fteachcode, m.fdegree,m.fsubcode as fcsubcode
                from marksint m
                inner join subject s on left(s.fcsubcode, 4) = left(m.fsubcode, 4) 
                and m.fdegree = s.fdegree and m.fexamno = s.fexamno
                inner join attendsum sum on sum.fdegree = m.fdegree and 
                left(sum.fsubcode, 4) = left(m.fsubcode, 4)
                inner join attclass a on a.fclassid = sum.fclassid 
                where sum.fclassid='{$classid}'
                and m.fcollcode = '{$collcode}' 
                group by m.fsubcode, a.fclassid";

    // var_dump($headerQry);die();
    $lobj_page_header = $aobj_context->mobj_db->GetRow($headerQry);
    
    
	$pdf->SetFont('Times','B',15);	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'IA QUESTIONWISE REPORT Summary';
	// $pdf->FUNIVNAME = $lobj_page_header_university['FUNIVNAME'];
	$pdf->FTOWN = $lobj_page_header_university['FTOWN'];
    $pdf->college_name = $lobj_page_header_college['college_name'];
    $pdf->orientation ='L';
    $pdf->Subject_name = $subelement. ' - '.$lobj_page_header['fsubname'];
    $pdf->class_name = $classid. ' - '.$lobj_page_header['fclassname'];
    $pdf->str = $str;
    $fteachcode = $lobj_page_header['fteachcode'];
    
    $fsubcode = $lobj_page_header['fsubcode'];
    $degcode = $lobj_page_header['fdegree'];
    $sem = $lobj_page_header['fexamno'];
    $fcsubcode = $lobj_page_header['fcsubcode'];

    $page_header_REGROLL = "select fteachname,
    date_format(now(),'%d/%m/%Y') as fdate
    from masteach where fteachcode = '{$fteachcode}'";
	$res1 = $aobj_context->mobj_db->GetRow($page_header_REGROLL);
    $pdf->fteachname = $res1['fteachname'];
    $pdf->date_1 = $res1['fdate'];

        $query = "delete from bteach_ia1 where fclassid = '{$classid}'";
        $res1 =$aobj_context->mobj_db->Execute($query);

        $query = "select fdegree,fexamno,fcsubcode,concat(fcsubcode,fsubcode) as fsubcode,fformula
        from subdet where fdegree = '{$degcode}' and fexamno = '{$sem}'
        and concat(fcsubcode,fsubcode) like '{$fsubcode}%'";

        $results =$aobj_context->mobj_db->getAll($query);

        foreach($results as $val)
        {
            $fxsubcode = $val['fsubcode'];
            $fcsubcode = $val['fcsubcode'];
            $fformula = $val['fformula'];

            $query = "insert into bteach_ia1 (fdegree,fexamno,fregno,fsubcode,fcsubcode,fmarks,fupddate,fclassid)
                select m.fdegree,m.fexamno,m.fregno,'{$fcsubcode}' as subcodem,m.fsubcode,
                $fformula as fmarks,
                now(),'{$classid}'
                from marksint m inner join subdet sd on m.fdegree = sd.fdegree
                and m.fexamno = sd.fexamno and m.fsubcode = concat(sd.fcsubcode,sd.fsubcode)
                where m.fsubcode = '{$fxsubcode}'
                and m.fdegree = '{$degcode}'
                and m.fexamno = '{$sem}'
                and ifnull(m.FTEST,'') <> ''
                group by m.fdegree,m.fsubcode,m.fregno";

            $results =$aobj_context->mobj_db->Execute($query);

        }    

        $query = "update marks m, (select fdegree,fexamno,fregno,fsubcode,CEILING(sum(fmarks)/2) as fmarks
        from bteach_ia1
        where fdegree like '{$degcode}'
        and fexamno = '{$sem}'
        and fclassid = '{$classid}'
        group by fdegree,fexamno,fregno,fsubcode) i set m.fmarks = i.fmarks,
        m.flogdate = now()
        where m.fregno = i.fregno 
        and m.fexamno = i.fexamno
        and m.fsubcode = i.fsubcode";
        $results =$aobj_context->mobj_db->Execute($query);


    // $query = "delete from bteach_ia1 where fclassid = '{$classid}'";
    // $res1 =$aobj_context->mobj_db->Execute($query);


    // $query = "INSERT ignore INTO bteach_ia1 (fdegree, fexamno, fregno, fcsubcode, fclassid, fmarks,fupddate)
    // select m.fdegree,m.fexamno,m.fregno,su.fcsubcode,
    // '{$classid}' as fclassid,
    // CEILING(sum(if(ifnull(facttotal,'0') = '-2.0','0',ifnull(facttotal,'0')))/fnotest) as fmarks,
    // now()
    // from marksint m inner join (select fdegree,fexamno,fcollcode,fcsubcode,sum(fnotest) as fnotest 
    // from subdet where fmtype = 'A' group by fdegree,fexamno,fcollcode,fcsubcode) su on m.fdegree = su.fdegree
    // and m.fexamno = su.fexamno 
    // and left(m.FSUBCODE,5) = su.fcsubcode
    // and m.fdegree in(select distinct fdegree from attendsum where fclassid = '{$classid}')
    // and m.fsubcode like '$fsubcode%'
    // group by m.fdegree,su.fcsubcode,m.fregno";
    // //var_dump($query);
    // $results =$aobj_context->mobj_db->Execute($query);

    // $query = "update marks m, bteach_ia1 b set m.fmarks = b.fmarks, m.fpresent = 'P',
    // FLOGDATE = now(), FLOGNAME = 'Direct'
    // where m.fdegree = b.fdegree
    // and m.fexamno = b.fexamno and m.fsubcode = b.fcsubcode
    // and m.fregno = b.fregno
    // and m.fdegree in(select distinct fdegree from attendsum where fclassid = '{$classid}')
    // and b.fclassid = '{$classid}'";
    // $results =$aobj_context->mobj_db->Execute($query);

    // $query = "delete from bteach_ia2 where fclassid = '{$classid}'";
    // $res1 =$aobj_context->mobj_db->Execute($query);

    // $query = "INSERT ignore INTO bteach_ia2 (fdegree, fexamno, fregno, fcsubcode, fsubname, fclassid, fmarks,fupddate)
    // select m.fdegree,m.fexamno,m.fregno,su.fcsubcode,su.fsubname,
    // '{$classid}' as fclassid,
    // CEILING(sum(if(su.fsubname = 'CIE-LAB-Test',(if(ifnull(facttotal,'0') = '-2.0','0',ifnull(facttotal,'0'))/4),0))
    // +
    // sum(if(su.fsubname = 'CIE-Lab-Assignment',(if(ifnull(facttotal,'0') = '-2.0','0',ifnull(facttotal,'0'))),0))) as fmarks,
    // now()
    // from marksint m inner join  subdet su on m.fdegree = su.fdegree
    // and m.fexamno = su.fexamno 
    // and left(m.FSUBCODE,6) = concat(su.fcsubcode,su.fsubcode)
    // where su.fmtype = 'F'
    // and m.fdegree in(select distinct fdegree from attendsum where fclassid = '{$classid}')
    // and m.fsubcode like '$fsubcode%'
    // group by m.fdegree,su.fcsubcode,m.fregno";
    // $results =$aobj_context->mobj_db->Execute($query);

    // $query = "update marks m, bteach_ia2 b set m.fmarks = b.fmarks, m.fpresent = 'P',
    // FLOGDATE = now(), FLOGNAME = 'Direct'
    // where m.fdegree = b.fdegree
    // and m.fexamno = b.fexamno and m.fsubcode = b.fcsubcode
    // and b.fclassid = '{$classid}'
    // and m.fregno = b.fregno";
    // $results =$aobj_context->mobj_db->Execute($query);

    // $query = "delete from bteach_ia3 where fclassid = '{$classid}'";
    // $res1 =$aobj_context->mobj_db->Execute($query);
    
    // $query = "INSERT ignore INTO bteach_ia3 (fdegree, fexamno, fregno, fcsubcode, fsubname, fclassid, fthia, factia, fmarks,fupddate)
    // select m.fdegree,m.fexamno,m.fregno,su.fcsubcode,su.fsubname,
    // '{$classid}' as fclassid,
    // ROUND((sum(if(su.fsubname = 'CIE',(if(ifnull(facttotal,'0') = '-2.0','0',ifnull(facttotal,'0'))),0))/3),2) as fthia,
    // ROUND(sum(if(su.fsubname = 'CIE-Activity 1',(if(ifnull(facttotal,'0') = '-2.0','0',ifnull(facttotal,'0'))),0)),2) as factia,
    // CEILING(((sum(if(su.fsubname = 'CIE',(if(ifnull(facttotal,'0') = '-2.0','0',if(ifnull(facttotal,'0') = '-2.0','0',ifnull(facttotal,'0')))),0))/3) + sum(if(su.fsubname = 'CIE-Activity 1',(if(ifnull(facttotal,'0') = '-2.0','0',ifnull(facttotal,'0'))),0)))/2) as fmarks,
    // now()
    // from marksint m inner join subdet su on m.fdegree = su.fdegree
    // and m.fexamno = su.fexamno 
    // and left(m.FSUBCODE,6) = concat(su.fcsubcode,su.fsubcode)
    // where fmtype = 'D'
    // and m.fdegree in(select distinct fdegree from attendsum where fclassid = '{$classid}')
    // and m.fsubcode like '$fsubcode%'
    // group by m.fdegree,su.fcsubcode,m.fregno";
    
    // $results =$aobj_context->mobj_db->Execute($query);

    // $query = "update marks m, bteach_ia3 b set m.fmarks = b.fmarks, m.fpresent = 'P',
    // FLOGDATE = now(), FLOGNAME = 'Direct', m.fthia = b.fthia,
    // m.factia = b.factia
    // where m.fdegree = b.fdegree
    // and m.fexamno = b.fexamno and m.fsubcode = b.fcsubcode
    // and b.fclassid = '{$classid}'
    // and m.fregno = b.fregno";
    // $results =$aobj_context->mobj_db->Execute($query);
        

	$pdf->SetFont('Times','B',13);	
    
	$query1 = "select m.fdegree,m.fregno,st.fname,m.fsubcode,s.fmtype,
    md.fmarks as finalmarks,
    s.fmtype,
    md.fthia,
    md.factia,
    group_concat(distinct if( ifnull(s.fnotest,'')  <> '1',
    concat(s.fsubname,' - ',m.FTEST ), concat(s.fsubname)) order by s.fsubcode,m.ftest) as sublist,
    group_concat(m.FACTTOTAL order by m.fsubcode,m.ftest) as fmarks
    from marksint m
    inner join subdet s on m.fdegree = s.fdegree 
    and m.fexamno = s.fexamno
    and m.fsubcode = concat(s.fcsubcode,s.fsubcode)
    inner join student st on m.fregno = st.fregno
    inner join attendsum a on st.fregno = a.fregno 
    and left(a.fsubcode,4) = left(m.fsubcode,4)
    and a.fdegree = m.fdegree
    and a.fexamno = m.fexamno
    left join marks md on m.fregno = md.fregno
    and md.fcollcode = m.fcollcode and m.fexamno = md.fexamno
    and left(m.fsubcode,5) = md.fsubcode
    where a.fteachcode = '{$fteachcode}' 
    and a.fclassid = '{$classid}'
    and a.fcollcode = '{$collcode}'
    and m.fsubcode like '$fsubcode%'
    and ifnull(m.ftest,'') <> ''
    group by m.fdegree,m.fregno
    order by st.fname,m.fregno";
	$res2 = $aobj_context->mobj_db->GetAll($query1);
    // var_dump($query1);
    $pdf->AddPage('L');
    $pdf->SetFont('Times', 'B', 10);

    $pdf->ln(7);


    $pdf->Cell(10, 8, 'Sl No', "1", 0, 'C');
    $pdf->Cell(25, 8, 'USN', "1", 0, 'C');
    $pdf->Cell(90, 8, 'Student Name', "1", 0, 'C');
    $x = $pdf->getX();
    $y = $pdf->getY();
    $newSub = $res2[0]['sublist'];
    $fmtype = $res2[0]['fmtype'];
    $subList = explode(",", $newSub);
    
    // var_dump('o',$y);
    // var_dump('o',$x);
    $x1 = 0;
    foreach($subList as $ssub)
    {
       
        $pdf->setXY($x+$x1,$y);
        $pdf->Multicell(20,4,$ssub,'1','C');
        $x1 = $x1+20;
    }
    $pdf->setXY($x+$x1,$y);
    if($fmtype == 'D')
    {
        $pdf->Cell(16,8,'IBSC Th.','1',0,'C');    
        $pdf->Cell(16,8,'IBSC Pr.','1',0,'C');    
    }

    $pdf->Cell(16,8,'Final CIE','1',1,'C');
    $z = 1;
    $pdf->SetFont('Times', '', 10);

    foreach($res2 as $value)
    {   
        $fmarksList = explode(",", $value['fmarks']);
        $fname = $value['fname'];
        $fregno = $value['fregno'];
        
        $pdf->Cell(10, 7, $z, "1", 0, 'C');
        $pdf->Cell(25, 7, $fregno, "1", 0, 'C');
        $pdf->Cell(90, 7, $fname, "1", 0, 'L');
        
        foreach($fmarksList as $val)
        {
            $pdf->SetFont('Times', '', 10);
            if($val == '-2.0')
            {   
                $pdf->SetFont('Times', 'B', 10);
                $pdf->Cell(20,7,'AB','1',0,'C');
                $pdf->SetFont('Times', '', 10);
            }
            else
            {
                $pdf->Cell(20,7,$val,'1',0,'C');
            }
        }

        
        if($fmtype == 'D')
        {
            $pdf->Cell(16,7,$value['fthia'],'1',0,'C');
            $pdf->Cell(16,7,$value['factia'],'1',0,'C');
        }
        if($value['finalmarks'] == '-2')
        {
            $pdf->SetFont('Times', 'B', 10);
            $pdf->Cell(16,7,'AB','1',1,'C');
            $pdf->SetFont('Times', '', 10);
        }else
            $pdf->Cell(16,7,$value['finalmarks'],'1',1,'C');

        $z++;
        
        if($pdf->getY() >180)
        {
            $pdf->AddPage('L');
            $pdf->SetFont('Times', 'B', 10);

            $pdf->ln(7);


            $pdf->Cell(10, 7, 'Sl No', "1", 0, 'C');
            $pdf->Cell(25, 7, 'USN', "1", 0, 'C');
            $pdf->Cell(90, 7, 'Student Name', "1", 0, 'C');
            
            $newSub = $res2[0]['sublist'];
            $fmtype = $res2[0]['fmtype'];
            $subList = explode(",", $newSub);
            
            foreach($subList as $ssub)
            {
                $pdf->Cell(35,7,$ssub,'1',0,'C');
            }
            
            if($fmtype == 'D')
            {
                $pdf->Cell(16,7,'IBSC Th.','1',0,'C');    
                $pdf->Cell(16,7,'IBSC Pr.','1',0,'C');    
            }

            $pdf->Cell(16,7,'Final CIE','1',1,'C');
            $pdf->SetFont('Times', '', 10);
        }
    }

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