<?php 
include("../db.php");

$res=$db->getRow("select * from student where school_id='".$_SESSION["admin"]["school_id"]."' and idno=".$_GET["id"]);
//	$res=$db->getRow("select * from newtc where tc_number='".$_GET["id"]."'");

if($_POST){
	$data=json_encode($_POST);
	
	 $tcnumber=$db->getVal("SELECT max(tc_number) FROM extra");
  $ptcnumber=$tcnumber+1;
//	$db->insertAry("extra",array("data"=>$data,"school_id"=>$_SESSION["admin"]["school_id"],"tc_number"=>$ptcnumber, "added_by"=>$_SESSION["admin"]["uid"],
//"idno"=>$_GET["id"],"type"=>"tc"));
$value=array(
   "data"=>$data 
     );


 $flgIn=$db->updateAry("extra",$value,"where idno='".$_GET["id"]."'");

	echo $db->getErMsg();
}

	
	
	$detail=$db->getVal("select data from extra where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET["id"]."' and type='tc'");
//echo 	$ss="select data from extra where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET["id"]."' and type='tc'";
if($detail!=""){
	$idata=json_decode($detail,true);
}
//print_r($idata);
//print_r($detail);
?>
<form  method="post">
<table border="0" width="100%" class="tc">
  <tr>
    <td colspan="3" align="center" style="color:blue;"><h1>TRANSFER CERTIFICATE </h1></td>
    </tr>
  <tr>
    <td colspan="3">
    <div style="margin:3px; padding:5px 5px; width:235px; float:right">
   

</div>
   <!-- <div style="margin:3px; padding:	5px 5px; width:200px"> TC-No. <span class="span" style="width:100px"> !-->
      
    
    </td>
    </tr>
  
  <tr>
  <?php
    
  $detail=$db->getVal("SELECT max(tc_number) FROM newtc");
 // echo $ss="SELECT max(tc_number) FROM newtc";
    ?>
	<td colspan="3"> 
 <span class="name" style="font-size:16px;">1- Name Of Pupil :</span> <span class="txt" style="font-size:16px; width:200px; border-bottom-style: dotted; #333;"><?php echo $res["name"] ?></span><br /> <br /> 
 
    <span class="name" style="font-size:16px;">2- Father's/Guardian's Name : </span><span class="txt"  style="font-size:16px; width:250px; border-bottom-style: dotted; #333;"><?php echo $res["fname"] ?></span><br/><br/>  
   <span class="name" style="font-size:16px;"> 3- Mother's Name : </span> <span class="txt" style="font-size:16px; width:200px; border-bottom-style: dotted; #333;"><?php echo $res["mname"] ?></span><br /><br/>  
      <span class="name" style="font-size:16px;"> 4- Nationality : </span> <span class="txt" style="font-size:16px; border-bottom-style: dotted;">INDIAN</span><br /><br/>   

 <span class="name" style="font-size:16px;"> 5- Whether SC or ST: </span> <input type="text" style="font-size:16px;" class="txt" name="cast" value="<?php echo $idata["cast"] ?>" /><br /><br />
  <span class="name" style="font-size:16px;"> 6- Admission Class : </span><input type="text"  style="font-size:16px;" class="txt" name="admission_class" value="<?php echo $res["admissionclass"] ?>" /> <span class="name" style="font-size:16px;"><b>Admission Year</b> </span>: <input style="font-size:16px;" type="text" class="txt" name="year" value="<?php echo date("d-M-Y",strtotime($res["doa"]));  ?>" />  <br /><br />
   <span class="name" style="font-size:16px;"> 7- Date of Birth according to admission register: </span> <span class="txt" style="font-size:16px;"><?php echo date("d-M-Y",strtotime($res["dob"]));  ?></span><br /><br />
 <span class="name" style="font-size:16px;"> (In words):<input style="font-size:16px;  width:300px; border-bottom:1px doted #333;" type="text" class="txt" name="dobininwords" value="<?php echo $idata["dobininwords"] ?>" /><br><br />
     <span class="name" style="font-size:16px;"> 8- Class in which pupil last studied(in figure): </span><input type="text" class="txt" style="font-size:16px; width:100px; border-bottom:1px doted #333;" name="last_class" value="<?php echo $idata["last_class"] ?>" /><span class="name" style="font-size:16px;"><b>In Words</b> </span>: <input class="txt" style="font-size:16px; width:100px; border-bottom:1px doted #333;" type="text" class="txt" name="last_class_words" value="<?php echo $idata["last_class_words"] ?>" /> <br /><br />

   <span class="name" style="font-size:16px;"> 9- School/Board Annual Examination last taken with result: </span><input type="text"  style="font-size:16px;" class="txt" name="result" value="<?php echo $idata["result"] ?>" /><br /><br />
    <span class="name"> 10- Whether failed,if so once/twice,in  the same class : </span><input type="text" style="font-size:16px;" class="txt" name="failds" value="<?php echo $idata["failds"] ?>" /><br /><br />
   <span class="name" style="font-size:16px;"> 11- Subjects Offered : </span><input type="text" style="font-size:16px; width:350px; 	border-bottom:1px doted #333;" class="txt" name="subject" value="<?php echo $idata["subject"] ?>" /><br /><br />
  <span class="name" style="font-size:16px;"> 12- Whether qualified for promotion to the higher class : </span><input type="text"style="font-size:16px;"   class="txt" name="qualified" value="<?php echo $idata["qualified"] ?>" /> <br /><br />
    <span class="name" style="font-size:16px;"> If so to which class(In Fig) : </span><input type="text" style="font-size:16px;" class="txt" name="infig" value="<?php echo $idata["infig"] ?>" /> (In words): <input type="text" style="font-size:16px;" class="txt" name="inwords" value="<?php echo $idata["inwords"] ?>" /> <br /><br />
    <span class="name" style="font-size:16px;"> 13- Month upto which the (pupil has paid) school dues paid : </span><span  style="font-size:16px; width:200px; border-bottom-style: dotted;   #333; class="txt"">March 2020 </span><br /><br />
  
  	<span class="name" style="font-size:16px;" > 14- Total no. of working days: </span><input type="text" class="txt" style="font-size:16px; width:80px; border-bottom:1px doted #333;" class="txt" name="totalworking" value="<?php echo $idata["totalworking"] ?>" />Total days present: <input type="text" style="font-size:16px;" class="txt"  name="totalpresent" value="<?php echo $idata["totalpresent"] ?>" />  <br /><br />
	<span class="name" style="font-size:16px;"> 15- Whether NCC cadet/Boy Scout/Girl scout(detail may be given) : </span><input type="text" style="font-size:16px;" class="txt" name="ncc" value="<?php echo $idata["ncc"] ?>" /> <br /><br />
    <span class="name" style="font-size:16px;"> 16- Any Fee Concession availed of : if so, the nature of such concession : </span><input type="text" style="font-size:16px; width:120px; border-bottom:1px doted #333;" class="txt" name="concession" value="<?php echo $idata["concession"] ?>" /> <br /><br />
    <span class="name" style="font-size:16px;"> 17- Games played or extra curricular activities in which the pupil has taken part (Details may be given) : </span><span  style="font-size:16px; width:200px; border-bottom-style: dotted;   #333; class="txt"">Please see certificates </span><br /><br />
  <span class="name" style="font-size:16px;"> 18- Date of application for certificate : </span><input type="text" style="font-size:16px;" class="txt" name="date_of_application" value="<?php echo $idata["date_of_application"] ?>" /> <br /><br />
      <span class="name" style="font-size:16px;"> 19- Date of issue of certificate : </span><input type="text" style="font-size:16px;" class="txt" name="issue_date" value="<?php echo $idata["issue_date"] ?>" /> <br /><br />
     <span class="name" style="font-size:16px;"> 20- Reason for leaving the school : </span><input type="text" style="font-size:16px;" class="txt" name="reason" value="<?php echo $idata["reason"] ?>" /> <br /><br />
     <span class="name" style="font-size:16px;"> 21- General Conduct : </span><input type="text" style="font-size:16px;" class="txt" name="Conduct" value="<?php echo $idata["Conduct"] ?>" /> <br /><br />
     <span class="name" style="font-size:16px;"> 22- Any other remark : </span><input type="text" style="font-size:16px;" class="txt" name="remark" value="<?php echo $idata["remark"] ?>" /> <br /><br />
  
  
 <?PHP    


session_start();




if($flgIn>0)
{
?>	
<!--<a class="button" href="print/?page_id=tc&action=print&id=<?PHP  echo $_GET["id"];?> " >PRINT TC</a>'; !-->
echo "<script>alert('your data edited');document.location='print/?page_id=tc&action=print&id=<?PHP  echo $_GET["id"];?>'</script>";


<?php }

else

{
?>
<input type="submit" name="SUBMIT">
<?php
}	
 ?>
</td>
    </tr>
 

</table>
</form>
<style>
.button {
    display: block;
    width: 115px;
    height: 25px;
    background: #4E9CAF;
    padding: 10px;
    text-align: center;
    border-radius: 5px;
    color: white;
    font-weight: bold;
}
</style>
<style>
input[type="text"]
{
    border: 0;
  outline: 0;
  background: transparent;
  border-bottom: 1px solid black;
}

input[type="date"]
{
    border: 0;
  outline: 0;
  background: transparent;
  border-bottom: 1px solid black;
}
textarea name[type="address"]
{
    border: 0;
  outline: 0;
  background: transparent;
  border-bottom: 1px solid black;
}
</style>
<?php

 
//print_r($value);

?>
<SCRIPT>
$(document).ready(function(){
    $("a.submit").click(function(){
        document.getElementById("myForm").submit();
    }); 
});
</SCRIPT>
