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


Current Path : /var/www/html/pgadm2020/pgetadm/
Upload File :
Current File : /var/www/html/pgadm2020/pgetadm/bnuapplicationFormPGReport.php

<?php
ob_start();
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
//$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
$pdf_writer_class =$main_src."/tcpdf/tcpdf.php";
require_once($pdf_writer_class);
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);

class MYPDF extends TCPDF {
    public $aobj_context;
     
    public function setData($aobj_context){
    	$this->aobj_context = $aobj_context;
    }
    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);
        // set bacground image

        $this->SetMargins(10,34,20,true);	
		$this->SetFillColor(248, 248 ,255);		
		$img_path = $this->aobj_context->main_src."/img/".$this->aobj_context->FUNIVCODE."_logo.jpg";
		// var_dump($img_path);
		if(file_exists($img_path)) 
			$this->Image($img_path,10,6,20,20);

		$img_path1 = $this->aobj_context->main_src . "img/".$this->aobj_context->FUNIVCODE."_logo_2.jpeg";
        //var_dump($img_path);
        if (file_exists($img_path1)) {
            $this->Image($img_path1, 178, 3, 20, 20);
        }
		
		$this->SetFont('Times','B',13);
		$this->SetY(5);
		$this->Cell(0,4,$this->aobj_context->FUNIVNAME,0,1,'C');
		//state
		$this->SetFont('Times','',11);
		$this->Cell(0,4,$this->aobj_context->s_state,0,1,'C');
				 
		$this->SetFont('Times','B',12);
		$this->Ln(1);
		
		$cur_year = date("Y");
		$next_year = $cur_year + 1;
		$this->Cell(180,5,'PG Programme Admission Application Form -'.$cur_year. '-'.substr($next_year,2),'0',1,'C');
		$this->Cell(0,4,$this->degree,0,1,'C'); 
		// var_dump($this->degree);
		// var_dump($this->degree);
		$style = array(
			'position' => 'right',
			'align' => 'C',
			'stretch' => false,
			'fitwidth' => true,
			'cellfitalign' => '',
			'border' => false,
			'hpadding' => 'auto',
			'vpadding' => 'auto',
			'fgcolor' => array(0,0,0),
			'bgcolor' => false, //array(255,255,255),
			'text' => true,
			'font' => 'helvetica',
			'fontsize' => 8,
			'stretchtext' => 4
		);
		// var_dump($this->aobj_context->FAPPNO);
		$this->write1DBarcode($this->aobj_context->appno, 'C39', '140', '20','130', 16, 0.3, $style, 'R');
        // restore auto-page-break status
        $this->SetAutoPageBreak($auto_page_break, $bMargin);
        // set the starting point for the page content    
    }

    public function Footer() 
    {
        $this->SetY(-15);
        $this->SetFont('helvetica', 'I', 8);
        $this->Cell(50, 10,'IP : '.$_SERVER["REMOTE_ADDR"], 0, 0, 'L');
        $this->Cell(100, 10,'Date : ' .$this->aobj_context->current_date, 0, 0, 'C');

        $this->Cell(50, 10,'Page ' .$this->getPageNumGroupAlias().'/'.$this->getPageGroupAlias(), 0, 1, 'R');
    }
}

class AddmissionApplication
{	
	function DefaultConstructor($aobj_context)
	{
		$this->aobj_context=$aobj_context;
		//$this->pdf=  new FPDF();
		$this->collcode=$_SESSION['collcode'];
		$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);

		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', concat(FUNIVCODE,'_',pdf_logo_path) as pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";

		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
		//var_dump($this->degree);
		$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->FEXAMAPPREQ=$lobj_get_coll_name['FEXAMAPPREQ'];
		$aobj_context->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE']; 

		
		$app_no = trim($aobj_context->mobj_data["appno"]);

		$aobj_context->appno = $app_no;
		$aobj_context->current_date = $obj['now_date'];
		$this->current_date = $obj['now_date'];

		$this->pdf= new MYPDF('P');
		$this->pdf->setData($aobj_context);
		
	}
 
	function formcolldata()
	{
		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', concat(FUNIVCODE,'_',pdf_logo_path) as pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";

		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
		
		$this->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
		$this->s_state=$lobj_get_coll_name['state'];
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
		$this->FEXAMAPPREQ=$lobj_get_coll_name['FEXAMAPPREQ'];
		$this->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE']; 
	}
	
		
	function writeApplication($db,$fprefix,$fdescpn,$fdegree,$per_details, $fee_det,$res_optopns,$degree, $res_prevmarks,$res_lanmarks,$res_totmarks,$fdob)
	{

		//var_dump($degdet[$per_details['FDEGREE1']]);
	// var_dump($db,$per_details, $fee_det,$res_optopns,$per_details['FDEGREE1'], $res_prevmarks,$res_lanmarks);


		$pdf=$this->pdf;


		$pdf->SetMargins(10,35,25,false);
		$pdf->startPageGroup();
		$pdf->AddPage("P");

		$pdf->SetFont('Times','UB',10);

		$this->degree = $degdet[$degree];
		//$pdf->cell(0,7,"Courses Preference : ".$degree." - ".$degdet[$degree],0,1,'C');

		

		$i = 1;
        $head = '<style>
			td {
			    border: 0.5px solid black;
			}
		 </style>
		 <table cellpadding="3" cellspacing="0" border="0" width="100%">';

        //====================Subject Details====================================
        $table2 = '<style>
			td, th {
			    border: 0.5px solid black;
			}
		 </style>
		<table cellpadding="2" cellspacing="0" border="0" width="100%">';
        $i = 1;
        
        $fprefix = $fprefix;
		
            $table2 .= '<tr nobr="true">
			<td align="center">' . 'Application for ' . $fdescpn. ' ['  . $fdegree . ']' . '</td>			
			</tr>';
        $table2 .= '</table>';
		$x = $pdf->GetX();
        $y = $pdf->GetY();
        $pdf->SetX(11);
        $pdf->writeHTMLcell(185, 0, $x, $y, $table2, false, true, false, false, 'C');
        //var_dump($fprefix);
        $pdf->ln(2);

		//====================Personal Details====================================
		$pdf->SetFont('Times','',10);
		$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);">I. Personal Details</h3>';
		$x = $pdf->GetX();
		$y = $pdf->GetY();		
		$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);

		$path = realpath(__DIR__ .'/..');
		//var_dump($path.'/pget_photos'.'/'.$per_details['fphotopath']);
		//var_dump($path.'/'.$per_details['fphotopath']);
		$photo_url = "https://admission-certificates.s3.ap-south-1.amazonaws.com";
		$i= 1;
		// var_dump($photo_url);
		// var_dump($per_details);
		


		
		
		$table1 = '<style>
			td {
			    border: 0.5px solid black;
			}
			.lable {
				font-weight: bold;
			}
		 </style>
		<table cellpadding="3" cellspacing="0">
			<tr nobr="true">
				<td width="150" class="lable">Application No.</td>
				<td width="270" colspan="3" style = "font-size:15px;">'.$fprefix.$per_details['FAPPNO'].'</td>
				<td width="100" rowspan="5"><img width="100" height="120" src="'.$photo_url.'/'.$per_details['FPHOTOPATH'].'" /></td>
		</tr>';


		$table1 .='<tr nobr="true">
				<td width="150" class="lable">1. Name of the Applicant</td>
				<td width="270" colspan="3">'.$per_details['FNAME'].'</td></tr>';

		$table1 .='<tr nobr="true">
				<td width="80" class="lable">2. Gender </td>
				<td width="70">'.$per_details['fgender'].'</td>
				<td width="150" class="lable">3. Date of Birth (DD/MM/YYYY)</td>
				<td width="120">'.$per_details['fdob'].'</td>
				</tr>';



		$table1 .='<tr nobr="true">								
				<td width="80" class="lable">4. Nationality </td>
				<td width="70">'.$per_details['FNATIONAL'].'</td>
				<td width="150" class="lable">5. Religion</td>
				<td width="120">'.$per_details['freligion'].'</td>
				</tr>';

		$table1 .='<tr nobr="true">								
				<td width="80" class="lable">6. Mother Tongue</td>
				<td width="70">'.$per_details['fmotherton'].'</td>
				<td width="150" class="lable">7. Aadhar Number</td>
				<td width="120">'.$per_details['FAADHARNO'].'</td>
				</tr>';

		$table1 .='<tr nobr="true">				
				<td width="80" class="lable">8. Blood Group</td>
				<td width="70" colspan="3">'.str_replace('N','-',str_replace('P','+', $per_details['fbloodgrp'])).'</td>				
				<td width="70" class="lable">9. Category</td>
				<td width="80">'.$per_details['FCATEGORY'].'</td>
				<td width="120" class="lable">10. Online Scholarship (Post metric) Reg. No</td>
				<td width="100">'.$per_details['FPMREGNO'].'</td>
				
				</tr>';

		
	

		$table1 .='<tr nobr="true">
				<td width="150" class="lable">11. Father Name</td>
				<td width="150">'.$per_details['FFATNAME'].'</td>
				<td width="120" class="lable">Father Occupation</td>
				<td width="100">'.$per_details['FFATOCC'].'</td>
				</tr>';
		$table1 .='<tr nobr="true">
				<td width="150" class="lable">12. Mother Name</td>
				<td width="150">'.$per_details['FMOTNAME'].'</td>
				<td width="120" class="lable">Mother Occupation</td>
				<td width="100">'.$per_details['FMOTOCC'].'</td>
                </tr>';
                        
		
			
		
				
		$table1 .= '</table>';
		// echo $table1;

		$pdf->SetX(11);
		// $pdf->SetY(42);
		
		$pdf->writeHTML($table1, false, true, false, false, 'L');
		$pdf->ln(2);
		$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);">II. Communication Details</h3>';
		$x = $pdf->GetX();
		$y = $pdf->GetY();
		$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);
		

		$per_details['fperadd'] = $per_details['FPERMADD1'].' '.$per_details['FPERMADD2'].' '.$per_details['FPERMADD3'].' '.$per_details['FPERMDIST'].' '.$per_details['FPERMSTATE'].' - '.$per_details['FPERMPIN'];
		$per_details['fcuradd'] = $per_details['FCURRADD1'].' '.$per_details['FCURRADD2'].' '.$per_details['FCURRADD3'].' '.$per_details['FCURRDIST'].' '.$per_details['FCURRSTATE'].' - '.$per_details['FCURRPIN'];
		$table2 = '<style>
			td {
			    border: 0.5px solid black;
			}
			.lable {
				font-weight: bold;
			}
		 </style>
		<table cellpadding="3" cellspacing="0">
			<tr nobr="true">
				<td width="150" class="lable">13. Permanent Address</td>
				<td width="370">'.$per_details['fperadd'].'</td>
		</tr>';

		$table2 .= '<tr nobr="true">
				<td width="150" class="lable">14. Communication Address</td>
				<td width="370">'.$per_details['fcuradd'].'</td>
		</tr>'; 

		

		$table2 .= '<tr nobr="true">
				<td width="150" class="lable">15. Mobile No.</td>
				<td width="370">'.$per_details['FMOBILENO'].'</td>
		</tr>'; 
		$table2 .= '<tr nobr="true">
				<td width="150" class="lable">16. Email Address</td>
				<td width="370">'.$per_details['FEMAIL'].'</td>
		</tr>'; 

		$table2 .= '</table>';
		$pdf->SetX(11);
		$pdf->writeHTML($table2, false, true, false, false, 'L');
		$pdf->ln(2);
		
		
			$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);">III. Reservation Details </h3>';
			$x = $pdf->GetX();
			$y = $pdf->GetY();
			$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);

			$pdf->SetX(11);
			
			// $query = "SELECT fboardname FROM masboard WHERE fboardcode = '{$per_details['FUNIVNAME']}'";
			// $obj_univ =  $this->aobj_context->mobj_db->GetRow($query); 
			// $per_details['FUNIVNAME'] = $obj_univ['fboardname'];
			$cnd = $per_details['FBCUETYPE'];
			if($per_details['FBCUE'] == 'No')
				$cnd = "";
			
			if($per_details['FHK'] == 'Yes'){
				$fhkrdno = '('.$per_details['fhkrdno'].')';
			}else{
				$fhkrdno = "";
			}
			// var_dump($fhkrdno);
			$table4 = '<style>
				td, th {
					border: 0.5px solid black;
				}
			</style>
			<table cellpadding="3" cellspacing="0">
			<tr nobr="true">
				<th width="420" align="center"><b>Reservation Details</b></th>
				<th width="100" align="center" ><b>Yes / No</b></th>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>17. Are you single Girl child of your parents?                    </b></td>
					<td width="100" align="center" >'.$per_details['fgirlchild']. '</td>
			</tr>
            <tr nobr="true">
					<td width="420" ><b>18. Have you studied 7 years in Karnataka?</b></td>
					<td width="100" align="center" >'.$per_details['fsevenkar']. '</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>19. Do you belong to Hyderabad-Karnataka quota (371j)?</b></td>
					<td width="100" align="center" >'.$per_details['FHK'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>20. Are you Kashmiri migrant?</b></td>
					<td width="100" align="center" >'.$per_details['fkashmig'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>21. Are you a student of Jammu & Kashmir State?</b></td>
					<td width="100" align="center" >'.$per_details['fjkstud'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>22. Have you studied in Rural Area upto 10th Std?</b></td>
					<td width="100" align="center" >'.$per_details['fruralten'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>23. Have you studied in Kannada Medium upto 10th std?</b></td>
					<td width="100" align="center" >'.$per_details['fkantem'].'</td>
			</tr>';
			if($db == 'bcu')
			{
            	$table4 .='<tr nobr="true">
					<td width="420" ><b>24. Are you a son/dughter of Bengaluru City University Employee?</b></td>
					<td width="100" align="center" >'.$per_details['fsonbcu'].'</td>
				</tr>';
			}else if($db == 'bnu')
			{
				$table4 .='<tr nobr="true">
				<td width="420" ><b>24. Are you a son/dughter of Bengaluru North University Employee?</b></td>
				<td width="100" align="center" >'.$per_details['fsonbcu'].'</td>
				</tr>';
			}	
			$hostel = $per_details['fhostelfac'];

			if($hostel == 'Yes')
				$hostel = $per_details['fhostelfac']." (".$per_details['fdistklr'].")";

            $table4 .='<tr nobr="true">
					<td width="420" ><b>25. Do you claim under Differently abled quota?</b></td>
					<td width="100" align="center" >'.$per_details['FHANDICAP'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>26. Do you claim under Sports quota?</b></td>
					<td width="100" align="center" >'.$per_details['FSPORTS'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>27. Do you Claim NCC?</b></td>
					<td width="100"  align="center">'.$per_details['FNCC'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>28. Do you Claim NSS ?</b></td>
					<td width="100"  align="center">'.$per_details['FNSS'].'</td>
            </tr>
            <tr nobr="true">
					<td width="420" ><b>29. Are you a child of Defence Personnel ?</b></td>
					<td width="100" align="center" >'.$per_details['FDEFENCE'].'</td>
			</tr>
			<tr nobr="true">
					<td width="420" ><b>30. Do you belong to below poverty line family(BPL)?</b></td>
					<td width="100" align="center" >'.$per_details['FBPL'].'</td>
			</tr>
			<tr nobr="true">
				<td width="420"><b>31. Other University within Karnataka?</b></td>
				<td width="100" align="center" >'.$per_details['finkar'].'</td>
			</tr>
			<tr nobr="true">
				<td width="420"><b>32. Other University Outside Karnataka?</b></td>
				<td width="100" align="center">'.$per_details['fkarout'].'</td>
			</tr>
			<tr nobr="true">
				<td width="420"><b>33. Banglore North University Autonomous Colleges?</b></td>
				<td width="100" align="center">'.$per_details['fbuautclg'].'</td>
			</tr>
			<tr nobr="true">
				<td width="420" ><b>34. Do you Need Hostel Facility if u are selected for University Departments.?</b></td>
				<td width="100" align="center" >'.$hostel.'</td>
			</tr><tr nobr="true">
				<td width="420" ><b>34. Do you Need Hostel Facility if u are selected for University Departments.?</b></td>
				<td width="100" align="center" >'.$hostel.'</td>
			</tr>
			<tr nobr="true">
				<td width="420" ><b>35. Are you a student of Banglore North University?</b></td>
				<td width="100" align="center" >'.$per_details['fstudbu'].'</td>
			</tr>';

			$table4 .= '</table>';
			$pdf->SetX(11);
			$pdf->writeHTML($table4, true, true, false, false, 'L');
			
		


		//====================Degree Details====================================

		$pdf->SetFont('Times','',10);
		// $pdf->AddPage("P");

		$pdf->ln(0);
		

		$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);">IV. Previous Academic Details</h3>';
		$x = $pdf->GetX();
		$y = $pdf->GetY();
		$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);
		$pdf->ln(2);

		$pdf->SetX(11);

		// var_dump($per_details['funivstud']);

		$table5 = '<style>
			td, th {
			    border: 0.5px solid black;
			}
		 </style>
		 <table cellpadding="3" cellspacing="0">';//Percentage

	
		
		$univ = $per_details['FQUNIV'];
		if($per_details['FQUNIV'] == '' || $per_details['FQUNIV'] == NULL)
			$univ = "NA";

			$table5 = '<style>
			td, th {
				border: 0.5px solid black;
			}
		</style>
		<table cellpadding="3" cellspacing="0">	';
		
		// $table5 .= '</table>';	
		// $pdf->SetX(11);
		// $pdf->writeHTML($table4, true, true, false, false, 'L');		

		$table5 .= '<tr nobr="true">
		<td width="240"><b>36. Degree Exam Registration Number</b></td>
		<td width="280">'.$per_details['FQREGNO'].'</td>
		</tr>';

		$table5 .= '<tr nobr="true">
		<td width="240"><b>37. Qualifying Degree</b></td>
		<td width="280">'.$per_details['FQDEGREE'].'</td>
		</tr>';

		$table5 .= '<tr nobr="true">
		<td width="240"><b>38. Qualifying Degree Combination</b></td>
		<td width="280">'.$per_details['fdescpn'].'</td>
		</tr>';
			
		

		$table5 .= '<tr nobr="true">
		<td width="240"><b>39. Class / Division</b></td>
		<td width="280">'.$per_details['FQCLASS'].'</td>
		</tr>';

		$table5 .= '<tr nobr="true">
		<td width="240"><b>40. Passing year</b></td>
		<td width="280">'.$per_details['FQYEAR'].'</td>
		</tr>';
				
		$table5 .='</table>';
		//$pdf->SetX(12);

		$pdf->SetX(11);
		$pdf->writeHTML($table5, false, false, true, false, 'L');

		// $table5 = '<style>
		// 	td, th {
		// 	    border: 0.5px solid black;
		// 	}
		//  </style>
		//  <table cellpadding="3" cellspacing="0">';

		//  $table5 .= '<tr nobr="true"> <td width="520"><b> Language Details </b> </td> </tr>
		//  <tr nobr="true">
		//  <td width="200"><b>Kannada</b></td>
		//  <td width="80">Sec. Marks</td>
		//  <td width="80">'.$per_details['FLANG1MS'].'</td>
		//  <td width="80">Max. Marks</td>
		//  <td width="80"><b>'.$per_details['FLANG1MM'].'</b></td>
		//  </tr>';

		//  if($per_details['FLANG2'] != '' || $per_details['FLANG2'] != NULL)
		//  {
		// 	$table5 .= '<tr nobr="true">
		// 	<td width="200"><b>English</b></td>
		// 	<td width="80">Sec. Marks</td>
		// 	<td width="80">'.$per_details['FLANG2MS'].'</td>
		// 	<td width="80">Max. Marks</td>
		// 	<td width="80"><b>'.$per_details['FLANG2MM'].'</b></td>
		// 	</tr>';
		//  }

		//  $table5 .='</table>';
		//  $pdf->SetX(11);
		// $pdf->writeHTML($table5, false, false, true, false, 'L');

		// var_dump($res_prevmarks);
		$pdf->ln(5);
		if(count($res_totmarks) > 0 || count($res_lanmarks) >0 || count($res_prevmarks) >0 )
		{
			$table6 = '<style>
				td, th {
					border: 0.5px solid black;
				}
			</style>
			<table cellpadding="2" cellspacing="0">				
				<thead>
				<tr nobr="true">
					<th width="520" colspan="7" align="left"><b>41. Semester Total marks</b></th>
				</tr>
				<tr nobr="true">
				<th width="20" rowspan="2" align="center"><b>Sl. No</b></th>
				<th width="115" align="center" rowspan="2"><b>Subject</b></th>
				<th width="50" colspan="2" align="center"><b>Sem I / Year</b></th>
				<th width="50" colspan="2" align="center"><b>Sem II / Year</b></th>
				<th width="50" colspan="2" align="center"><b>Sem III / Year</b></th>
				<th width="50" colspan="2" align="center"><b>Sem IV / Year</b></th>
				<th width="50" colspan="2" align="center"><b>Sem V / Year</b></th>
				<th width="50" colspan="2" align="center"><b>Sem VI / Year</b></th>
				<th width="50" colspan="2" align="center"><b>Total Marks</b></th>
				<th width="35" align="center" rowspan="2"><b>%</b></th>
			</tr>
			<tr nobr="true">
				<th width="25" align="center"><b>Max</b></th>
				<th width="25" align="center"><b>Obt</b></th>
				<th width="25" align="center"><b>Max</b></th>
				<th width="25" align="center"><b>Obt</b></th>
				<th width="25" align="center"><b>Max</b></th>
				<th width="25" align="center"><b>Obt</b></th>
				<th width="25" align="center"><b>Max</b></th>
				<th width="25" align="center"><b>Obt</b></th>
				<th width="25" align="center"><b>Max</b></th>
				<th width="25" align="center"><b>Obt</b></th>
				<th width="25" align="center"><b>Max</b></th>
				<th width="25" align="center"><b>Obt</b></th>
				<th width="25" align="center"><b>Max</b></th>
				<th width="25" align="center"><b>Obt</b></th>
			</tr>
				</thead>';//Percentage
				$i = 1;
			foreach($res_totmarks as $value) 
			{	
				$table6 .= '<tr nobr="true">
						<td width="20" align="center">'.$i.'</td>
						<td width="115" align="left">'.$value['fsubname'].'</td>
						<td width="25" align="center">'.$value['famm'].'</td>
						<td width="25" align="center">'.$value['famo'].'</td>
						<td width="25" align="center">'.$value['fbmm'].'</td>
						<td width="25" align="center">'.$value['fbmo'].'</td>
						<td width="25" align="center">'.$value['fcmm'].'</td>
						<td width="25" align="center">'.$value['fcmo'].'</td>
						<td width="25" align="center">'.$value['fdmm'].'</td>
						<td width="25" align="center">'.$value['fdmo'].'</td>
						<td width="25" align="center">'.$value['femm'].'</td>
						<td width="25" align="center">'.$value['femo'].'</td>
						<td width="25" align="center">'.$value['ffmm'].'</td>
						<td width="25" align="center">'.$value['ffmo'].'</td>
						<td width="25" align="center">'.$value['fmaxmarks'].'</td>
						<td width="25" align="center">'.$value['fsecmarks'].'</td>
						<td width="35" align="center">'.$value['fpercent'].'</td>
					</tr>
					<tr nobr="true">
					<th width="520" colspan="7" align="left"><b>42. Language Details</b></th>
				</tr>';
					$i++;
			}	
			foreach($res_lanmarks as $value) 
			{	
				$table6 .= '<tr nobr="true">
						<td width="20" align="center">'.$i.'</td>
						<td width="115" align="left">'.$value['fsubname'].'</td>
						<td width="25" align="center">'.$value['famm'].'</td>
						<td width="25" align="center">'.$value['famo'].'</td>
						<td width="25" align="center">'.$value['fbmm'].'</td>
						<td width="25" align="center">'.$value['fbmo'].'</td>
						<td width="25" align="center">'.$value['fcmm'].'</td>
						<td width="25" align="center">'.$value['fcmo'].'</td>
						<td width="25" align="center">'.$value['fdmm'].'</td>
						<td width="25" align="center">'.$value['fdmo'].'</td>
						<td width="25" align="center">'.$value['femm'].'</td>
						<td width="25" align="center">'.$value['femo'].'</td>
						<td width="25" align="center">'.$value['ffmm'].'</td>
						<td width="25" align="center">'.$value['ffmo'].'</td>
						<td width="25" align="center">'.$value['fmaxmarks'].'</td>
						<td width="25" align="center">'.$value['fsecmarks'].'</td>
						<td width="35" align="center">'.$value['fpercent'].'</td>
					</tr>';
					$i++;
			}
			$table6 .='<tr nobr="true">
					<th width="520" colspan="7" align="left"><b>43. Details of the marks obtained in all the optional subjects in qualifying Degree Examination</b></th>
				</tr>';
			foreach($res_prevmarks as $value) 
			{	
				$table6 .= '<tr nobr="true">
						<td width="20" align="center">'.$i.'</td>
						<td width="115" align="left">'.$value['fsubname'].'</td>
						<td width="25" align="center">'.$value['famm'].'</td>
						<td width="25" align="center">'.$value['famo'].'</td>
						<td width="25" align="center">'.$value['fbmm'].'</td>
						<td width="25" align="center">'.$value['fbmo'].'</td>
						<td width="25" align="center">'.$value['fcmm'].'</td>
						<td width="25" align="center">'.$value['fcmo'].'</td>
						<td width="25" align="center">'.$value['fdmm'].'</td>
						<td width="25" align="center">'.$value['fdmo'].'</td>
						<td width="25" align="center">'.$value['femm'].'</td>
						<td width="25" align="center">'.$value['femo'].'</td>
						<td width="25" align="center">'.$value['ffmm'].'</td>
						<td width="25" align="center">'.$value['ffmo'].'</td>
						<td width="25" align="center">'.$value['fmaxmarks'].'</td>
						<td width="25" align="center">'.$value['fsecmarks'].'</td>
						<td width="35" align="center">'.$value['fpercent'].'</td>
					</tr>';
					$i++;
			}
			$table6 .='</table>';
			$pdf->SetX(11);
			$pdf->writeHTML($table6, true, false, true, false, 'L');
		}	

		//====================Preferred location====================================
		$pdf->ln(-4);
		


		$pdf->SetFont('Times','',10);
		$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);"> V. Programme for which you wish to take admission</h3>';
		$x = $pdf->GetX();
		$y = $pdf->GetY();
		$pdf->SetMargins(10,35);
		$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);
		
		$i = 1;
		$head = '<style>
			td {
			    border: 0.5px solid black;
			}
		 </style>
		 <table cellpadding="3" cellspacing="0">';
		
		//====================Subject Details====================================
		$table2 = '<style>
			td, th {
			    border: 0.5px solid black;
			}
		 </style>
		<table cellpadding="2" cellspacing="0">
			<tr nobr="true">
				<th width="50" align="center"><b>Sl. No.</b></th>
				<th width="70" align="center"><b>Programme Code</b></th>
				<th width="400" align="center"><b>Programme Name</b></th>
			</tr>';
		$i = 1;
		$fprefix = "";
		$fprefix = $res_optopns[0]['fprefix'];
		foreach($res_optopns as $value)
		{
			
			$table2 .= '<tr nobr="true">
			<td width="50" align="center">'.$i.'</td>
			<td width="70" align="center">'.$value['fdegree'].'</td>
			<td width="400" align="left">'.str_replace('(CBCS)','',$value['fdescpn']).'</td>			
			</tr>';
			
			$i++;
		}

		
		$table2 .='</table>';
		
		$pdf->SetX(11);
		
		$pdf->writeHTML($table2, false, true, false, false, 'L');
		//var_dump($fprefix);
		$pdf->ln(2);

		



		if(strtoupper($per_details['FPGDEGREE']) == 'YES')
		{

			$pdf->cell(0,7,"Postgraduate Degree Details",0,1,'L');

			$table5 = '<style>
			td, th {
			    border: 0.5px solid black;
			}
			</style>
			<table cellpadding="3" cellspacing="0">';//Percentage

			$table5 .= '<tr nobr="true">
			<td width="100"><b>University Studied</b></td>
			<td width="420">'.$per_details['FPGUNIVTYPE'].'</td>
				</tr>';
			
			$table5 .= '<tr nobr="true">
			<td width="100"><b>Reg. No.</b></td>
			<td width="420">'.$per_details['FPGREGNO'].'</td>
			</tr>';

			$table5 .= '<tr nobr="true">
			<td width="100"><b>Class- I/ II / III</b></td>
			<td width="420">'.$per_details['FPGQCLASS'].'</td>
			</tr>';

			$table5 .= '<tr nobr="true">
			<td width="100"><b>Passing month / year</b></td>
			<td width="420">'.$per_details['FPGMONTH'].' / '.$per_details['FPGYEAR'].'</td>
			</tr>';

			$table5 .= '<tr nobr="true">
			<td width="130"><b>Sec. Marks</b></td>
			<td width="130">'.$per_details['FPGSECMARKS'].'</td>
			<td width="130"><b>Max. Marks</b></td>
			<td width="130">'.$per_details['FPGMAXMARKS'].'</td>
			</tr>';

			$table5 .='</table>';
			//$pdf->SetX(12);
			
			$pdf->SetX(11);
			$pdf->writeHTML($table5, true, false, true, false, 'L');
			$pdf->ln(2);

		}
		$pdf->AddPage("P");

		$html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);">VI. Fee Details</h3>';
		$x = $pdf->GetX();
		$y = $pdf->GetY();
		// $pdf->SetMargins(10,30);
		$pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);
		$pdf->ln(1);
		
		$i = 1;
		$head = '<style>
			td {
			    border: 0.5px solid black;
			}
		 </style>
		 <table cellpadding="3" cellspacing="0">';
		
		//====================Subject Details====================================
		$table2 = '<style>
			td, th {
			    border: 0.5px solid black;
			}
		 </style>
		<table cellpadding="2" cellspacing="0">
			<tr nobr="true"><th width="40" align="center"><b>Sl. No.</b></th>
				<th width="360" align="center"><b>Fee Head</b></th>
				<th width="120" align="center"><b>Amount</b></th>
			</tr>';
		$i=1;
		$total = 0;
		foreach ($fee_det as $key => $value) 
		{
			$table2 .= '<tr nobr="true">
				<td width="40" align="center">'.$i.'</td>
				<td width="360" align="left">'.substr($value['FHEADCODE'],3).'</td>
				<td width="120">'.$value['FAMOUNT'].'</td></tr>';
				$total = $total+$value['FAMOUNT'];
			$i++;
		}

		$table2 .= '<tr nobr="true">
				<td width="400" collspan = "2" align="right"><b>Total</b></td>
				<td width="120"><b>'.$total.'</b></td></tr>';

		$table2 .='</table>';
		$pdf->SetX(11);
		
		$pdf->writeHTML($table2, true, true, false, false, 'L');

		$pdf->ln(10);

		if($pdf->GetY() > 210)
		{
			$pdf->AddPage();
		}

		$pdf->SetFont('Times','BU',10);

		$pdf->Cell(180,7,'Declaration by the Candidate',0,1,'C');

		$str = "I hereby declare that the above information furnished by me is true. I have not suppressed any information. BNU can initiate action against me, if I have furnished any false information";
        
		$pdf->SetFont('Times','',11);
		$pdf->MultiCell(180,4,$str,0,'J');
		$pdf->ln(20);
		$pdf->SetFont('Times','B',10);
		$pdf->Cell(160,4,'Date',0,0,'L');
		$pdf->Cell(30,4,'Signature of the Student ',0,1,'R');
		$pdf->ln(20);

		if($pdf->GetY() > 210)
		{
			$pdf->AddPage();
		}
		
		$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => "black"));
		$pdf->Cell(0,7,'',"T",1,'C');

		$pdf->SetFont('Times','BU',13);

		$pdf->Cell(0,7,' Student Acknowledgement ',0,1,'C');
		$pdf->SetFont('Times','',11);
		
		$pdf->Cell(45,7,'Application No.',0,0,'L');
		$pdf->Cell(80,7,": ".$per_details['FAPPNO'],0,1,'L');

		$pdf->Cell(45,7,'Student Name',0,0,'L');
		$pdf->Cell(80,7,": ".$per_details['FNAME'],0,1,'L');
		
		$pdf->Cell(45,7,'Amount Paid',0,0,'L');
		$pdf->Cell(80,7,": ".$per_details['FTOTFEE'],0,1,'L');

		$pdf->Cell(45,7,'Payment Type ',0,0,'L');
		$pdf->Cell(80,7,": ".$per_details['FPAYTYPE'],0,1,'L');

		$pdf->Cell(45,7,'Payment Status ',0,0,'L');
		$pdf->Cell(80,7,": ".$per_details['FPAYSTATUS'],0,1,'L');

		$pdf->Cell(45,7,'Payment Date',0,0,'L');
		$pdf->Cell(80,7,": ".$per_details['FPAYDATE'],0,1,'L');

		$pdf->Cell(45,7,'Tranction ID',0,0,'L');
		$pdf->Cell(80,7,": ".$per_details['FPAYID'],0,1,'L');
		// $pdf->Cell(45,7,'Payment Transcation ID ',0,0,'L');
		// $pdf->Cell(80,7,": ".$per_details['FPAYID'],0,1,'L');

		// $html = '<h3 style="background-color: #918988; color: rgb(255, 255, 255);">Course for which you are appearing</h3>';
		// $x = $pdf->GetX();
		// $y = $pdf->GetY();
		// $pdf->SetMargins(10,30);
		// $pdf->writeHTMLCell(188,0,$x,$y,$html, false,1, false, true, '', false);
		// $pdf->ln(1);
		
		// $i = 1;
		// $head = '<style>
		// 	td {
		// 	    border: 0.5px solid black;
		// 	}
		//  </style>
		//  <table cellpadding="3" cellspacing="0">';
		
		// //====================Subject Details====================================
		// $table2 = '<style>
		// 	td, th {
		// 	    border: 0.5px solid black;
		// 	}
		//  </style>
		// <table cellpadding="2" cellspacing="0">
		// 	<tr nobr="true">
		// 		<th width="50" align="center"><b>Courses Code</b></th>
		// 		<th width="200" align="center"><b>Courses Name</b>
		// 		<th width="200" align="center"><b>College Name</b>
		// 		<th width="50" align="center"><b>Priority</b>
		// 		</th>
		// 	</tr>';
		
		// 	foreach($res_optopns as $value)
		// 	{
				
		// 		$table2 .= '<tr nobr="true">
		// 		<td width="50" align="left">'.$value['fdegree'].'</td>
		// 		<td width="200" align="left">'.$value['fdescpn'].'</td>
		// 		<td width="200" align="left">'.$value['fcollname'].'</td>
		// 		<td width="50" align="left">'.$value['fpriority'].'</td>
		// 		</tr>';
		// 	}
			
		// $table2 .='</table>';
		// $pdf->SetX(11);
		
		// $pdf->writeHTML($table2, true, true, false, false, 'L');
		$pdf->ln(20);
		$pdf->SetFont('Times','B',10);
		$pdf->Cell(160,4,'Date',0,0,'L');
		$pdf->Cell(30,4,'Signature of the Document Receiver ',0,1,'R');


	}
		
	function SendOutput()
	{
		// ob_end_clean();
		// ob_end_flush();
		// ob_end_clean();
		$this->pdf->Output("Application_letter.pdf","D");
	}	 
}

function applicationFormPGReport($aobj_context)
{
	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$query = "select distinct fdegree,fdescpn from degree where fdegree like 'm%'";
	$result = $aobj_context->mobj_db->GetAll($query);
	// var_dump($result);
	$degdet = [];
	foreach($result as $value)
	{
		$degdet[$value['fdegree']] = $value['fdescpn'];
	}

	$get_coll_name="select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', concat(FUNIVCODE,'_',pdf_logo_path) as pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";

	$lobj_get_coll_name=$aobj_context->mobj_db->GetRow($get_coll_name);
	// var_dump( $aobj_context->mobj_db);
	$appno = trim($aobj_context->mobj_data["appno"]);
	$db = trim($aobj_context->mobj_data["db"]);

	$per_details_query = "SELECT DISTINCT IF(IFNULL(fgender,'') = 'F', 'Female', IF(IFNULL(fgender,'') = 'M', 'Male', '')) AS fgender, 
    DATE_FORMAT(IFNULL(a.fdob,''), '%d/%m/%Y') AS fdob,b.fdescpn, a.* 
    FROM entstudadm a,entprevcomb b WHERE a.fqcombcode = b.fcombcode 
	and a.fqdegree = b.fdegree
	AND fappno =  '{$appno}' ";
	// var_dump($per_details_query);
	$per_details = $aobj_context->mobj_db->GetRow($per_details_query);
	$cnt = 0;

	$class_obj = new AddmissionApplication();
	
	$class_obj->DefaultConstructor($aobj_context);

	$query = "select * from entfeedetl where fappno = '{$appno}'";
	$fee_det = $aobj_context->mobj_db->GetAll($query);

	
	$query = "select o.fdegree,d.fdescpn,d.fprefix from entoptdeg o 
	inner join entdeg d on d.fdegree = o.fdegree
	where fappno = '{$appno}'
	order by o.fdegree";
	$res_optopns = $aobj_context->mobj_db->GetAll($query);
	$res = $res_optopns;
	$query = "select * from entprevmarks a inner join entprevcomb b 
	on a.fdegree = b.fdegree and a.fcombcode = b.fcombcode 
	and a.fsubcode= b.fsubcode where fappno ='{$appno}' AND IFNULL(b.fcombcode,'') <> 'TOT'";
	$res_prevmarks = $aobj_context->mobj_db->GetAll($query);

	$query = "select * from entprevmarks a inner join entprevcomb b 
	on a.fcombcode = b.fcombcode 
	and a.fsubcode= b.fsubcode where fappno ='{$appno}'
	and a.fcombcode = 'lan'";
	$res_lanmarks = $aobj_context->mobj_db->GetAll($query);

	$query = "select * from entprevmarks a inner join entprevcomb b 
	on a.fcombcode = b.fcombcode 
	and a.fsubcode= b.fsubcode where fappno ='{$appno}'
	and a.fcombcode = 'TOT'";
	$res_totmarks = $aobj_context->mobj_db->GetAll($query);

	
	$fdob = "";
	foreach($res as $value)
	{
		$fdegree = $value['fdegree'];
		$fdescpn = $value['fdescpn'];
		$fprefix = $value['fprefix'];

		$class_obj->writeApplication($db,$fprefix,$fdescpn,$fdegree,$per_details, $fee_det,$res_optopns,$per_details['FDEGREE1'], $res_prevmarks,$res_lanmarks,$res_totmarks,$fdob);
	}	
	

	$class_obj->SendOutput();
}