<?php
session_start();
$app1=$_REQUEST['flag'];
$session=$_REQUEST['flag2'];
$id=$_REQUEST['flag3'];
include("link/databaseconnection.php");
$sel="select * from  registration2 where  session='$session' and id='$id' order by id desc";
$res=mysqli_query($conn,$sel);
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
$app1=$row['mobile'];

$sel124="select * from  payment_fees where billing_tel ='$app1' and session='$session' and form_id='$id' and order_status='Success'";
$res124=mysqli_query($conn,$sel124);
$row124=mysqli_fetch_array($res124,MYSQLI_BOTH);
if($row124['amount']>700)
{
   
$session_year='25';
$class=$row['class'];
		
if($row['class']=='BA II' or $row['class']=='BA III')
{
	$class_add='1';
}

if($row['class']=='B.Sc II' or $row['class']=='B.Sc III')
{
	$class_add='2';
}
if($row['class']=='M.A II')
{
	$class_add='3';
}
if($row['class']=='M.Sc II')
{
	$class_add='4';
}
if($row['class']=='BA II' or $row['class']=='B.Sc II')
{
	$class_year='2';
}
if($row['class']=='BA III' or $row['class']=='B.Sc III')
{
	$class_year='3';
}
if($row['class']=='MA I' or $row['class']=='M.Sc I')
{
	$class_year='1';
}
if($row['class']=='M.A II' or $row['class']=='M.Sc II')
{
	$class_year='2';
}

	$sel1244="select * from  registration2 where class ='$class' and alot_number!=''  and session='$session' ";
$res1244=mysqli_query($conn,$sel1244);
$co=mysqli_num_rows($res1244);
$co1=$co+1;
$str_length = 3;
//$s1=$s+1;
$str = substr("000{$co1}", -$str_length);

  $alot_number=$session_year.$class_add.$class_year.$str;
// echo $alot_number;
 
 $sel1245="select * from  registration2 where mobile ='$app1' and id='$id' and session='$session' ";
$res1245=mysqli_query($conn,$sel1245);
$row1245=mysqli_fetch_array($res1245,MYSQLI_BOTH);

$sel124513="select * from  registration2 where alot_number ='$alot_number' and session='$session'  ";
$res124513=mysqli_query($conn,$sel124513);
$row124513=mysqli_fetch_array($res124513,MYSQLI_BOTH);
if($row1245['alot_number']=='')
{
   // echo 'Yes _';
$up="update registration2 set alot_number='$alot_number',idcard='Yes' where  id='$id'";
if(mysqli_query($conn,$up))
{
    //echo 'update';
}

}
else
{
   // echo 'no _';
}
$sel12451="select * from  registration2 where mobile ='$app1' and id='$id' and session='$session' ";
$res12451=mysqli_query($conn,$sel12451);
$row12451=mysqli_fetch_array($res12451,MYSQLI_BOTH);
?>

<html>
<head>
     <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="https://fonts.googleapis.com/css?family=Mukta&display=swap" 

    rel="stylesheet">
 <script src="js/jquery-3.2.1.min.js"></script>  <!--jquery-->
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 <style>
 #name2{font-weight:bold}
 @media print {
 #name2{font-weight:bold;font-size:12px}
 #name3{font-size:12px
     
     text-transform: uppercase;
 }

  body{
  -webkit-print-color-adjust:exact;
}
  p{font-size:11px}
  td{font-size:12px}
 }
 #gh{transform-origin: 0 0;
  transform: rotate(-45deg);;
    position: absolute;
    top: 580;
  left: 245;
  font-size:50px;
  color:GREEN;
    
    
}
 </style>
<script>
$(document).ready(function(){
	$("#pay").click(function(){
		window.location.href='bil.php';
	});
});
$(document).ready(function(){

	$("#print").click(function(){
		$("#pay").css("visibility","hidden");
		$("#back").css("visibility","hidden");
		$("#print").css("visibility","hidden");
		window.print();
		window.location.href='index.php';
	});
	$("#back").click(function(){
		window.location.href='index.php';
	});
});

</script>
<link href="css/student_print.css" rel="stylesheet" type="text/css">
</head>
<body>
<h3 id='gh'>ADMISSION </h3>
<table frame="border" width="100%" >

<tr>
<td colspan='2' style='background-color:black;color:white'><span><img src="images/name.png" height="95px" width="100%"/></span></td>
</tr>
</table>
<table cellspacing="0" width="100%" border="1px" style='font-size:12px'>

<tr>
<td ><span id="name2">Sr.No.(Form No.)</span></td><td ><span id="name3" style='font-weight:bold'><?php echo $row12451['alot_number'].'&emsp;('.$row['id'].')';?></span></td><td><span id="name2">Course</span></td><td ><span id="name2"><?php echo $row['class'];?></span></td>
</tr>
<tr>
<td width="20%"><span id="name2">Student's Name</span></td><td width=""><span id="name3"><?php echo $row['name'];?></span></td><td width="20%"><span id="name2">Father's Name</span></td><td width=""><span id="name3"><?php echo $row['fname'];?></span></td>
</tr>
<tr>
<td width="20%"><span id="name2"> Mother's Name</span></td><td><span id="name3"><?php echo $row['mname'];?></span></td><td width="20%"><span id="name2"> DOB</span></td><td><span id="name3"><?php echo $row['dob'];?></span></td>
</tr>


<tr>
<td width="30%"><span id="name2">Gender</span></td><td width="30%"><span id="name3"><?php echo $row['gender'];?></span></td><td width="20%"> <span id="name2">Sport</span></td><td width="30%"><span id="name3"><?php echo $row['game'];?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Aadhaar Number</span></td><td width="30%"><span id="name3"><?php echo $row['adhar'];?></span></td><td width="20%"><span id="name2">NCC</span></td><td width="20%"><span id="name3"><?php echo $row['ncc'];?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Category</span></td><td width="20%"><span id="name3"><?php echo $row['category'];?></span>  </td><td width="20%"><span id="name2">Rovers/Ranger</span></td><td width="20%"><span id="name3"><?php echo $row['rovers'];?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Caste</span></td><td width="30%"><span id="name3"><?php echo $row['sub_category'];?></span></td><td width="20%"><span id="name2">NSS</span></td><td width="20%"><span id="name3"><?php echo $row['nss'];?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Religion</span></td><td width="30%"><span id="name3"><?php echo $row['religion'];?></span></td><td width="20%"><span id="name2">Handicapped</span></td><td width="20%"><span id="name3"><?php echo $row['handicapped'];?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Ews</span></td><td width="30%"><span id="name3" style ='color:black'><?php echo $row['ews'];?></span></td><td width="20%"><span id="name2">Staff Quota</span></td><td width="20%"><span id="name3"><?php echo $row['quota'];?></span></td>
</tr>

<tr>
<td width="30%"><span id="name2">Nationality</span></td><td width="30%"><span id="name3"><?php echo $row['nationality'];?></span></td><td width="20%"><span id="name2">Marrital Status</span></td><td width="20%"><span id="name3"><?php echo $row['marrital'];?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Email Id</span></td><td width="30%"><span id="name3"><?php echo $row['email'];?></span></td><td width="20%"><span id="name2"> Date</span></td><td width="20%"><span id="name3"><?php echo $row['datetime']?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Uni. Reg. No.</span></td><td width="30%"><span id="name3"><?php echo $row['uni_form_no'];?></span></td><td width="20%"><span id="name2"> Roll No.</span></td><td width="20%"><span id="name3"><?php echo $row['roll_no']?></span></td>
</tr>
<tr>
<td width="30%"><span id="name2">Enrollment No.</span></td><td width="30%"><span id="name3"><?php echo $row['enrollment_no'];?></span></td><td width="20%"><span id="name2"> </span></td><td width="20%"><span id="name3"><?php  $row['roll_no']?></span></td>
</tr>
</table>




<table cellspacing="0" width="100%" border="1px">
<tr>
<th  ></th>
<th  >Sem - III/V</th>
<th  >Sem - IV/VI </th>

</tr>
<tr>
<td >Major-1</td>
<td><?php echo $row['choose_subject1']?></td>
<td><?php echo $row['choose_subject1']?></td>


</tr>
<tr>
<td >Major-2</td>
<td><?php echo $row['choose_subject2']?></td>
<td><?php echo $row['choose_subject2']?></td>


</tr>
<?php

if($row['class']!='MA I' or $row['class']!='M.Sc I' or $row['class']=='M.A II' or $row['class']=='M.Sc II')
{



?>
<tr>
<td >Minor</td>
<td><?php  $row['minor']?></td>
<td id='name3'></td>


</tr>

<tr>
<td >Co-Curriculor</td>
<td><?php  $row['curricular']?></td>
<td id='name3'><?php echo $row['curricular_2']?></td>


</tr>


<tr>
<td >Skill Development</td>
<td><?php  $row['skill']?></td>
<td id='name3'><?php echo $row['skill_2']?></td>


</tr>
<?php }?>
</table>

<?php
$sel12="select * from  payment_fees where form_id ='$id' and order_status='Success' and session='$session' and amount>700";
$res12=mysqli_query($conn,$sel12);
$row12=mysqli_fetch_array($res12,MYSQLI_BOTH);



?>
<table cellspacing="0" width="100%" border="1px">
	
<tr>
<th colspan='3' > Fee Record</th>

</tr>
<tr>
<td ><span style='font-weight:bold'>Order Id - </span> <?php echo $row12['order_id']?></td>
<td><span style='font-weight:bold'>Bank_Ref_no - </span> <?php echo $row12['bank_ref_no']?></td>
<td><span style='font-weight:bold'>Date - </span> <?php echo $row12['date']?></td>


</tr>
<tr>
<td ><span style='font-weight:bold'>Amount - </span> <?php echo $row12['amount']?> Rs</td>
<td><span style='font-weight:bold'>Time - </span> <?php echo $row12['time']?></td>
<td><span style='font-weight:bold'>Status - </span> <?php echo $row12['order_status']?></td>



</tr>
</table>

<table  cellspacing="0" width="100%" border="1px">
<tr>
<td align="center" style='background-color:black;color:white'><span id="name2">Student Address</span></td><td align="center" style='background-color:black;color:white'><span id="name2"></span></td><td align="center" style='background-color:black;color:white'><span id="name2">Photo & Signature
</span></td>
</tr>
<tr align="left" style='font-size:12px'>
<td><span id="name3"><?php echo $row['village'];?></br><?php echo $row['postoffice'];?> </br><?php echo $row['dist'];?></br><?php echo $row['state'];?></br><?php echo $row['mobile'];?></br><?php echo $row['pincode'];?></span></td>
<td align="center" style='font-weight:bold;font-size:12px'><img src="admin/temp/<?php echo $filename.'.png';?>" style='height:80px;width:80px' id='qr'><br/><?php echo $row['alot_number']?></td>
<td  align="center"><img src="code/img/<?php echo $row['picture'];?>" height="80px" ></br><img src="code/img/<?php echo $row['signature'];?>" height="30px" ></td>
</tr>
</table>
<br/>
<p style='font-size:11px'>मैं महाविद्यालय में  <b> <?php echo $row['class']?>  </b>कक्षा का प्रवेशार्थी हूँ  | आवेदन पत्र में समस्त सूचनायें अपने पूर्ण विश्वास के साथ सही भरी है | कोई भी तथ्य असत्य पाए जाने पर या जान बूझ कर  छिपाने जाने पर मेरा प्रवेश निरस्त कर दिए  जाने पर मुझे कोई  आपत्ति नहीं  होगी  | महाविद्यालय के छात्र  / छात्रा के रूप में सदैव अनुशासनबद्ध रहकर  मैं अपना व्यवहार और आचरण सही रखूँगा / रखूँगी | </p>

<table   style="border:none; border-collapse:collapse; cellspacing:0; cellpadding:0;margin-top:35px" width="100%">
	<tr>
<td > Office</td>
<td style='text-align:center'> Chief Proctor</td>
<td style='text-align:right'> Principal</td>



</tr>
	</table><br/><br/>
<button id="print" style="margin-left:500px;" >Click For Print</button>&emsp;&emsp;&emsp;&emsp;&emsp;

</body>
</html>
<?php
}
else
{
    echo "<script>alert('Please Contact College');window.location.href='adm_process.php;</script>";
}
?>