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


Current Path : /var/www/html/univadmin/Reports/
Upload File :
Current File : /var/www/html/univadmin/Reports/marks_list_subwise.php

<?php

$main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
$pdf_writer_class = $main_src . "tcpdf/tcpdf.php";
$getnumword=$aobj_context->main_src."Reports/getnumword.php";

require_once $pdf_writer_class;
require_once $getnumword;

ini_set('memory_limit', '-1');
ini_set('max_execution_time', '300');

class MYPDF extends TCPDF
{

    public function Header()
    {
        // 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("Mark List Report");

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

        if (file_exists($img_path)) {
            $this->Image($img_path, 10, 8, 20, 20);
        }

        $this->SetFont('Times', 'B', 13);
        $this->SetY(5);
        $this->Cell(0, 8, $this->aobj_context->FUNIVNAME, 10, 8, 'C');
        
        
        //state
        $this->SetFont('Times', 'C', 7);
        $this->Cell(0, 0, $this->aobj_context->s_state, 0, 1, 'C');
        $this->SetFont('Times', 'B', 12);
        $this->Cell(0, 0, "Subjectwise I.A. Marks List", 0, 1, 'C');
   
        $this->SetFont('Times', 'B', 10);
        $exmrange = $this->aobj_context->mobj_data["exam_code"];
        $examnoStr = strtoupper($exmrange);
        $splitexamno = str_split($examnoStr);
        $examno = implode(",", $splitexamno);

        $this->Cell(0, 5, " Degree: " . $this->aobj_context->DEGREENAME, "0", 1, "C");
        $this->Cell(0, 1,  "". $this->aobj_context->Exam, "0", 0, "C");

    }

    public function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('helvetica', 'I', 8);
        // var_dump();
        if($this->CurOrientation == 'P')
        {
            $this->Cell(50, 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(70, 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 Report
{
  public function DefaultConstructor($aobj_context)
  {
    $this->count ="";
    $this->aobj_context = $aobj_context;
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $deggrp = $this->aobj_context->mobj_data["degree_code"];
    $exmrange = $this->aobj_context->mobj_data["exam_code"];
   

    $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);    
    $aobj_context->date_1 = $obj['now_date'];
    
 
    $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->pobj_db->GetRow($get_coll_name);
    // var_dump($lobj_get_coll_name);
    // die();
    $collQry ="select concat(FCOLLCODE,' ',FCOLLNAME,', ',FTOWN) as college_name
    from college where FCOLLCODE='{$this->fcollcode}'";
    $collRes = $this->aobj_context->pobj_db->GetRow($collQry);

    $page_header_degree = "select concat('[ ',FDEGREE,' ] - ', FDESCPN) as Degree_name, 
							concat(' ', FEXAMNAME ,' Examination ',FEXAMDATE,'') as Exam ,FADYEAR
							from degree where FDEGREE = '{$deggrp}' and FEXAMNO='{$exmrange}' ";
	$lobj_page_header_degree = $aobj_context->pobj_db->GetRow($page_header_degree);

    $page_header_subject = "";
	$lobj_page_header_degree = $aobj_context->pobj_db->GetRow($page_header_degree);
//    var_dump($lobj_page_header_degree);
//    die();
    $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'];
    $aobj_context->FCOLLNAME = $collRes['college_name'];
    $aobj_context->DEGREENAME = $lobj_page_header_degree['Degree_name'];
    $aobj_context->Exam = $lobj_page_header_degree['Exam'];   
 
    $this->current_date = $obj['now_date'];
    // $deggrp = $this->aobj_context->mobj_data["degree_code"];
    // var_dump($deggrp);
    // die();
    $page_header_REGROLL = "select FREGROLL, fsnglent,ifnull(FMULTEXAM,'F') as FMULTEXAM from control";
    $lobj_page_header_REGROLL = $aobj_context->pobj_db->GetRow($page_header_REGROLL);
    $aobj_context->FREGROLL = $lobj_page_header_REGROLL['FREGROLL'];
    $aobj_context->fsnglent = $lobj_page_header_REGROLL['fsnglent'];
    $aobj_context->FMULTEXAM = $lobj_page_header_REGROLL['FMULTEXAM']; 


    $getDeggrp = "select concat(fdeggrp, ' - ', fdescpn) as fdeggrp 
    from deggrp where fdeggrp = '{$deggrp}'";
    $lobj_get_degree = $this->aobj_context->pobj_db->GetRow($getDeggrp);
    
    $aobj_context->deggrp = $lobj_get_degree['fdeggrp'];

    $this->pdf = new MYPDF('P');
    $this->pdf->aobj_context = $aobj_context;    
  }
   public function writeReport($get_sub_data){
    $FUNIVCODE=$this->aobj_context->FUNIVCODE;
    $FMULTEXAM=$this->aobj_context->FMULTEXAM;
    $percentage=$this->aobj_context->percentage;
    $percent=$this->aobj_context->percent;
    $fsnglent=$this->aobj_context->fsnglent;
    $date_1=$this->aobj_context->date_1;
    $FREGROLL=$this->aobj_context->FREGROLL;

    $first=true;
	$sl_no=1;
	$k2=1;
	// $this->pdf->SetFont('Times','',10);
	$oldsub = "";
	$oldsection = "";
	$newsub = "";
	$newsection = "";
	$this->pdf->page_absent_count=0;
	foreach($get_sub_data as $key => $value)
	{	
		$newsub = $value['FSUBCODE'];
		$newsection = $value['fsection'];
	// 	var_dump($sub_wise_total_absent);
    // die();
		// $tot_absent = $sub_wise_total_absent[$value['FSUBCODE']];
		if($this->pdf->GetY() > 240)
		{
			$new_y=$this->pdf->GetY();				
			$first=true;
		}
		if($FUNIVCODE == 030)
			$cond = "|| {$newsection} != {$oldsection}";
		else
			$cond = true;

		if(($newsub != $oldsub) && $cond)
		{
			$first = true;
			$sl_no=1;
			if ($oldsub != '' && $oldsection != '')
			{
				$this->pdf->Ln(2);
				if($FUNIVCODE == '018')
				{
					if($this->pdf->FFREEZE=="F")
					{
						$this->pdf->Cell(1500,3,'Marks Enterd By                           									Marks verified by          																								Marks Authorised by','0',1,'L');
						$this->pdf->Ln(2);
						$this->pdf->Cell(1500,3,'Signature                                 						     			Faculty Signature          																							Hod/Principal Signature','0',1,'L');
						$this->pdf->Ln(2);
						$this->pdf->Cell(1500,3,'Name                                      						     			 Faculty Name              		 																					 Hod/Principal Name','0',1,'L');
						$this->pdf->Ln(2);
						$this->pdf->Cell(1500,3,'Date                                      							     		   Date                       				      										 									Date  ','0',1,'L');
					}
					else
					{
						$this->pdf->SetFont('Times','B',20);  
						$this->pdf->Cell(1500,3,'DRAFT COPY','0',1,'L');
						$this->pdf->SetFont('Times','',10);  
					}
					
				}
			
			}
		}
		$oldsub = $newsub;

		$oldsection = $newsection;
		if($FMULTEXAM != 'T')
		{
			if($first)
			{
				if($k2 != 1)
				{	 

					$this->pdf->Ln(4);
					$this->pdf->SetFont('Times','B',10);
					$this->pdf->Cell(50,2,"Note : ** Marks not entered will be treated as Absent for results processing",'0',1,'L');
					$this->pdf->SetFont('Times','',10);
					$this->pdf->Cell(50,3,"Date : {$date_1}",'0',1,'L');
					$this->pdf->Ln(8);
					$this->pdf->Cell(50,8,'Entered by','0',0,'L');
					$this->pdf->Cell(110,8,'Signature of the Teaching Faculty','0',1,'R');
					$this->pdf->Ln(6);
					/* $this->pdf->Cell(50,3,'Signature of the HOD','0',0,'L');
					$this->pdf->Cell(110,3,'Signature of the Principal','0',1,'R'); */

					if($FUNIVCODE == '038')
						$this->pdf->Cell(50,2,'Signature of the Dean','0',0,'L');
					else
						$this->pdf->Cell(50,2,'Signature of the HOD','0',0,'L');
					if($FUNIVCODE == '038')
						$this->pdf->Cell(110,2,'Signature of the Chairman','0',1,'R');
					else
						$this->pdf->Cell(110,2,'Signature of the Principal','0',1,'R');
			
					$this->pdf->SetY(-20); 
					$this->pdf->SetFont('Times','',7);  
					
					// $this->pdf->page_absent_count=0;			
					// $this->pdf->Ln(5);
					// $this->pdf->Cell(0,3,'Absent on this page : '.$this->pdf->page_absent_count.);	
					// $this->pdf->Cell(0,3,'IP Address : '.$_SERVER['REMOTE_ADDR'].",  Date ".$this->pdf->date_1,'0',1,'R');
					
				}
				$this->pdf->SetMargins(28.35,10);
				$this->pdf->AddPage();
				$this->pdf->Rect(5,05,200,288);
				$this->pdf->SetMargins(28.35,10);
			
				$this->pdf->SetFont('Times','B',10);
				if($percentage == 'true')
					$text = "(Percentage less than {$percent})";
				else
					$text = '';
                    
		
				$this->pdf->Ln(1);
				$this->pdf->Cell(0,4,$this->pdf->Exam,0,1,'C'); 	
                $this->pdf->Ln(8);							
				$this->pdf->Cell(0,22,' Subject :  '.$value['FSUBCODE'].' - '.$value['sub_name'].',  Max. Marks: '.$value['FSMAXMARKS'],0,1,'C'); 								
				$this->pdf->SetFont('Times','C',11);
                $this->pdf->Ln(-7);
					
				if($value['ffreezed'] == 'T')
				{
					
					$this->pdf->Cell(0,0,' Status : FREEZED (READY TO SEND TO UNIVERSITY)',0,1,'C'); 
					$this->pdf->FFREEZE = "F";

				}
				else
				{
					if($value['teachfreez'] == 'T')
					{
						$this->pdf->Cell(0,0,' Status : FREEZING PENDING (TO BE SENT TO UNIVERSITY AFTER PRINCIPAL FREEZING)',0,1,'C'); 
						$this->pdf->FFREEZE = "P";				

					}else
					{
						$this->pdf->Cell(0,0,' Status : FREEZING PENDING (TO BE SENT TO UNIVERSITY AFTER TEACHER AND PRINCIPAL FREEZING)',0,1,'C'); 
						$this->pdf->FFREEZE = "P";				
						
					}
					
					
				}
				$this->pdf->SetFont('Times','B',9);
				if($FUNIVCODE == '030')
					$this->pdf->Cell(0,6,' Section : '.$value['fsection'] ,0,1,'L'); 
				$this->pdf->Ln(2);
				$this->pdf->Cell(10,6,'Sl.No.','1',0,'C');
				$this->pdf->Cell(20,6,$FREGROLL,'1',0,'C');
				$this->pdf->Cell(70,6,'Name','1',0,'C');
				if($fsnglent == 'T')
					$this->pdf->Cell(20,6,'Marks','1',0,'C');	
				else
				{	$this->pdf->Cell(20,6,'Marks','1',0,'C');
					// $this->pdf->Cell(20,6,'Marks 2','1',0,'C');
				}
				$this->pdf->Cell(40,6,'Remarks ','1',1,'C');								
				$first=false;
			}
		
			$this->pdf->SetFont('Times','',9);	
			$this->pdf->Cell(10,6,$sl_no,'LBR',0,'C');
			$this->pdf->Cell(20,6,$value['FREGNO'],'LBR',0,'L');
			$this->pdf->Cell(70,6,$value['Name1'],'LBR',0,'L');			
			
			if($value['Marks']=='ABSENT')
			{			
				$this->pdf->page_absent_count++;
				
				$this->pdf->Cell(20,6,'-','LBR',0,'C');				
				$this->pdf->Cell(40,6,$value['Marks'],'LBR',1,'L');				
			}
			else if($value['Marks']=='Marks Not Entered')
			{
				$this->pdf->Cell(20,6,'-','LBR',0,'C');	
				$this->pdf->SetFont('Times','B',9);			
				$this->pdf->Cell(40,6,$value['Marks'].'**','LBR',1,'L');
				$this->pdf->SetFont('Times','',9);
			}
			else
			{
				$marksw = getNumber(floatval($value['Marks']));
				// if($value['FREGNO'] == 'MUC19314')
				// 	var_dump(strtolower($marksw),' - ',"only");
				if(trim(strtolower($marksw)) == 'only')
				{	
					$marksw = "Zero Only";
					//var_dump($marksw);
				}	

				$this->pdf->Cell(20,6,$value['Marks'],'LBR',0,'C');	
				$this->pdf->Cell(40,6,$marksw,'LBR',1,'L');		
			}					

			if($value['Name2'] != '')
			{
				$this->pdf->Cell(10,6,' ','LRB',0,'C');
				$this->pdf->Cell(20,6,' ','LRB',0,'L');
				$this->pdf->Cell(70,6,$value['Name2'],'LBR',0,'L');
				$this->pdf->Cell(20,6,' ','LRB',0,'L');
				$this->pdf->Cell(40,6,' ','LRB',1,'L'); 
			}
	}
	else
	{
		if($first)
		{
			if($k2 != 1)
			{	 

		        $this->pdf->Ln(4);
		        $this->pdf->SetFont('Times','B',10);
		       // $this->pdf->Cell(50,7,"Note : ** Marks not entered will be treated as Absent for results processing",'0',1,'L');
		        $this->pdf->SetFont('Times','',10);
                $this->pdf->Cell(50,3,"Date : {$date_1}",'0',1,'L');
				$this->pdf->Ln(8);
				$this->pdf->Cell(50,3,'Entered by','0',0,'L');
				$this->pdf->Cell(110,3,'Signature of the Teaching Faculty','0',1,'R');
				$this->pdf->Ln(8);
				

				if($FUNIVCODE == '038')
					$this->pdf->Cell(50,6,'Signature of the Dean','0',0,'L');
				else
					$this->pdf->Cell(50,6,'Signature of the HOD','0',0,'L');
				if($FUNIVCODE == '038')
					$this->pdf->Cell(110,6,'Signature of the Chairman','0',1,'R');
				else
					$this->pdf->Cell(110,6,'Signature of the Principal','0',1,'R');
		
				$this->pdf->SetY(-20); 
				$this->pdf->SetFont('Times','',7);  
				
				$this->pdf->page_absent_count=0;			
				// $this->pdf->Ln(5);
				// $this->pdf->Cell(0,3,'Absent on this page : '.$this->pdf->page_absent_count.'       Total Absent : '.$tot_absent,'0',0,'L');	
				// $this->pdf->Cell(0,3,'IP Address : '.$_SERVER['REMOTE_ADDR'].",  Date ".$date_1,'0',1,'R');
				
			}

			$this->pdf->AddPage();
			$this->pdf->Rect(5,05,200,288);
			$this->pdf->SetMargins(28.35,10);
		
			$this->pdf->SetFont('Times','B',10);
			if($percentage == 'true')
				$text = "(Percentage less than {$percent})";
			else
				$text = '';

			$this->pdf->SetFont('Times','B',9);
            
			if($FUNIVCODE == '030')
				$this->pdf->Cell(0,6,' Section : '.$value['fsection'] ,0,1,'L'); 
            $this->pdf->Ln(12);							
			$this->pdf->Cell(0,22,' Subject :  '.$value['FSUBCODE'].' - '.$value['sub_name'].',  Max. Marks: '.$value['FSMAXMARKS'],0,1,'C');
			$this->pdf->Ln(-2);
			$this->pdf->Cell(10,6,'Sl.No.','1',0,'C');
			$this->pdf->Cell(20,6,$FREGROLL,'1',0,'C');
			$this->pdf->Cell(70,6,'Name','1',0,'C');
			$this->pdf->Cell(20,6,'Test 1','1',0,'C');	
			$this->pdf->Cell(20,6,'Test 2','1',0,'C');	
			$this->pdf->Cell(20,6,'Test 3','1',1,'C');	
			$first=false;
		}

		$this->pdf->SetFont('Times','',9);	
		$this->pdf->Cell(10,6,$sl_no,'1',0,'C');
		$this->pdf->Cell(20,6,$value['FREGNO'],'1',0,'L');
		$this->pdf->Cell(70,6,$value['Name1'],'1',0,'L');			
		$this->pdf->Cell(20,6,$value['marks11'],'1',0,'C');					
		$this->pdf->Cell(20,6,$value['marks21'],'1',0,'C');
		$this->pdf->Cell(20,6,$value['marks31'],'1',1,'C');
	}

		$count++;
		$row_cnt++;
		++$sl_no;
		++$k2;
	}
	$this->pdf->Ln(4);
	if($FUNIVCODE == '018')
	{
		if($this->pdf->FFREEZE=="F")
		{
			$this->pdf->Cell(1500,3,'Marks Enterd By                           									Marks verified by          																								Marks Authorised by','0',1,'L');
			$this->pdf->Ln(2);
			$this->pdf->Cell(1500,3,'Signature                                 						     			Faculty Signature          																							Hod/Principal Signature','0',1,'L');
			$this->pdf->Ln(2);
			$this->pdf->Cell(1500,3,'Name                                      						     			 Faculty Name              		 																					 Hod/Principal Name','0',1,'L');
			$this->pdf->Ln(2);
			$this->pdf->Cell(1500,3,'Date                                      							     		   Date                       				      										 									Date  ','0',1,'L');
		}
		else
		{
			$this->pdf->SetFont('Times','B',20);  
			$this->pdf->Cell(1500,3,'DRAFT COPY','0',1,'L');
			$this->pdf->SetFont('Times','',10);  
		}
		
	}
	else
	{
		$this->pdf->SetFont('Times','B',10);
		//$this->pdf->Cell(50,7,"Note : ** Marks not entered will be treated as Absent for results processing",'0',1,'L');
		$this->pdf->SetFont('Times','',10);
		$this->pdf->Cell(50,3,"Date : {$date_1}",'0',1,'L');
		$this->pdf->Ln(4);
		$this->pdf->Cell(50,3,'Entered by','0',0,'L');
		$this->pdf->Cell(110,3,'Signature of the Teaching Faculty','0',1,'R');
		$this->pdf->Ln(10);
		if($FUNIVCODE == '038')
			$this->pdf->Cell(50,3,'Signature of the Dean','0',0,'L');
		else
			$this->pdf->Cell(50,3,'Signature of the HOD','0',0,'L');
		if($FUNIVCODE == '038')
			$this->pdf->Cell(110,3,'Signature of the Chairman','0',1,'R');
		else
			$this->pdf->Cell(110,3,'Signature of the Principal','0',1,'R');
	}
	$this->pdf->SetY(-20);    

	$this->pdf->SetFont('Times','I',8);  
	
	// $this->pdf->page_absent_count=0;			
	// $this->pdf->Ln(5);
	// $this->pdf->Cell(0,3,'Absent on this page : '.$this->pdf->page_absent_count.'       Total Absent : '.$tot_absent,'0',0,'L');	
	// $this->pdf->Cell(0,3,'IP Address : '.$_SERVER['REMOTE_ADDR'].",  Date ".$this->pdf->date_1,'0',1,'R');
   
    }
    function SendOutput()
  {
      // ob_end_clean();
      $this->pdf->Output("ValuationStatisticsReport.pdf", "I");
  }
}

function generateMarksSubReport($aobj_context){
    
    $univcode = $aobj_context->mobj_data["univcode"]; 
    $collcode = $aobj_context->mobj_data["collcode"];
    $Degree = $aobj_context->mobj_data["degree_code"];
    $exam = $aobj_context->mobj_data["exam_code"];
    $reg_start = $aobj_context->mobj_data["reg_start"];
    $reg_end = $aobj_context->mobj_data["reg_end"];
    $subwise_start = $aobj_context->mobj_data["subwise_start"];
    $subwise_end = $aobj_context->mobj_data["subwise_end"];
    $userid = $aobj_context->mobj_data["usr_id"];
    $percentage = $aobj_context->mobj_data["per"];
    $percent = $aobj_context->mobj_data["perc"];
    $aobj_context->percentage =$percentage;
    $aobj_context->percent =$percent;

    $page_header_REGROLL = "select FREGROLL, fsnglent,ifnull(FMULTEXAM,'F') as FMULTEXAM from control";
    $lobj_page_header_REGROLL = $aobj_context->pobj_db->GetRow($page_header_REGROLL);

    $aobj_context->FMULTEXAM = $lobj_page_header_REGROLL['FMULTEXAM']; 
    $FMULTEXAM=$aobj_context->FMULTEXAM;
    
    if($univcode == '030')
	{
		$sectionrage = "and stu.fsection between '{$sectionfrom}' and '{$sectionto}'";
		$order = "stu.fsection,";
		
	}
	else
	{
		$sectionrage = "and 1=1";
		$order = " ";
	}
	
	$ltable = '';

	if(strtoupper($_SESSION['usr']) =='ADMIN' || strtoupper($_SESSION['usr']) =='SUPER')
	{
		$ltable = '';
	}
	else
	{
		$ltable = "inner join usersub us on m.fdegree = us.fdegree and instr(us.fsubcode,m.fsubcode) > 0 and m.fcollcode = us.fcollegecode and us.fuser = '{$userid}'";
	}
	
	if($percentage == 'true')
	{
		$percentvalue = "and (FMARKS/ifnull(s.FVALMAX,s.FSMAXMARKS)*100 < {$percent})";
	}else
	{
		$percentvalue = "";
	}

	if($FMULTEXAM != 'T')
	{
		$get_subject_data = " select m.FREGNO, SUBSTRING(stu.FNAME,1,36) as Name1,
		SUBSTRING(stu.FNAME,37) as Name2,
		concat(s.FSUBNAME,', ', FSSUBNAME) as sub_name, 
		if(ifnull(m.FMARKS,-1) >= 0,right(concat('000',m.FMARKS),3),if(ifnull(m.FMARKS,-1) = -2,'ABSENT','Marks Not Entered')) as Marks, 
		m.FSUBCODE, ifnull(s.FVALMAX,s.FSMAXMARKS) as FSMAXMARKS, ifnull(c.ffreezed, '') as ffreezed,stu.fsection,
		ifnull(c.ffreezed, '') as teachfreez 
		from marks m inner join student stu on m.fdegree = stu.fdegree and m.FREGNO=stu.FREGNO
		inner join subject s on m.fdegree = s.fdegree and m.fexamno = s.fexamno and m.FSUBCODE = s.FCSUBCODE
		inner join collia c on m.fdegree = c.fdegree and c.fexamno = m.fexamno and c.fcollcode = m.FCOLLCODE
		
		and m.fsubcode = c.fsubcode
		where m.FDEGREE = '{$Degree}' and m.FEXAMNO = '{$exam}' {$sectionrage}
		and m.FSUBCODE between '{$subwise_start}' and '{$subwise_end}'
		and m.fregno between '{$reg_start}' and '{$reg_end}'
		and m.FCOLLCODE = '{$collcode}' and c.FCOLLCODE = '{$collcode}' 
		and IFNULL(stu.FDELETED,'F') <> 'T' {$percentvalue} 
		group by {$order}FCSUBCODE, m.FREGNO order by {$order}FCSUBCODE, m.FREGNO"; 	  
		//var_dump($get_subject_data);
	}else
	{
		$get_subject_data = "select m.FREGNO, SUBSTRING(stu.FNAME,1,36) as Name1,
		SUBSTRING(stu.FNAME,37) as Name2,
		concat(s.FSUBNAME,', ', FSSUBNAME) as sub_name, 
		if(ifnull(m.FMARKS11,-1)>=0,m.FMARKS11,if(ifnull(m.FMARKS11,-1) =-2,'ABSENT','-')) as marks11,
		if(ifnull(m.FMARKS21,-1)>=0,m.FMARKS21,if(ifnull(m.FMARKS21,-1) =-2,'ABSENT','-')) as marks21,
		if(ifnull(m.FMARKS31,-1)>=0,m.FMARKS31,if(ifnull(m.FMARKS31,-1) =-2,'ABSENT','-')) as marks31,		
		m.FSUBCODE, ifnull(s.FVALMAX,s.FSMAXMARKS) as FSMAXMARKS, stu.fsection,
		ifnull(c.ffreezed, '') as teachfreez 
		from marks m inner join student stu on m.fdegree = stu.fdegree and m.FREGNO=stu.FREGNO
		inner join subject s on m.fdegree = s.fdegree and m.fexamno = s.fexamno and m.FSUBCODE = s.FCSUBCODE
		inner join collia c on m.fdegree = c.fdegree and c.fexamno = m.fexamno and c.fcollcode = m.FCOLLCODE
		
		and m.fsubcode = c.fsubcode
		where m.FDEGREE = '{$Degree}' and m.FEXAMNO = '{$exam}' {$sectionrage}
		and m.FSUBCODE between '{$subwise_start}' and '{$subwise_end}'
		and m.fregno between '{$reg_start}' and '{$reg_end}'
		and m.FCOLLCODE = '{$collcode}' and c.FCOLLCODE = '{$collcode}' 
		and IFNULL(stu.FDELETED,'F') <> 'T' {$percentvalue} 
		group by {$order}FCSUBCODE, m.FREGNO order by {$order}FCSUBCODE, m.FREGNO";
	}

  $result = $aobj_context->pobj_db->GetAll($get_subject_data);   

  $class_obj = new Report();
  $class_obj->univcode=$univcode;
  $class_obj->fcollcode = $fcollcode;
  $class_obj->DefaultConstructor($aobj_context);
  
  if(count($result)>0)
    $class_obj->writeReport($result);
  
  $class_obj->SendOutput();
}


?>