<?php
if($_POST){
	$data=json_encode($_POST);
	$flgIn=$db->insertAry("newtc",$value);
	echo $db->getErMsg();
}
?>
<form method="post" action="">
<?php 
$detail=$db->getVal("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);
?>
<input type="button" id="print"  value="print" onclick="window.print()" />
<?php
}else{
	?>

	<?php
}
$res=$db->getRow("select * from newtc where tc_number='".$_GET["id"]."'");
//print_r($res);
?>
<script src="<?php echo URL_ROOT ?>js/jquery.min.js"></script>
<!--<script>
$('#print').click(function(){
	this.hide();
	});
</script>-->
<script>
var th = ['', 'thousand', 'million', 'billion', 'trillion'];
var dg = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
var tn = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'];
var tw = ['twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
function toWords(s) {
    s = s.toString();
    s = s.replace(/[\, ]/g, '');
    if (s != parseFloat(s)) return 'not a number';
    var x = s.indexOf('.');
    if (x == -1) x = s.length;
    if (x > 15) return 'too big';
    var n = s.split('');
    var str = '';
    var sk = 0;
    for (var i = 0; i < x; i++) {
        if ((x - i) % 3 == 2) {
            if (n[i] == '1') {
                str += tn[Number(n[i + 1])] + ' ';
                i++;
                sk = 1;
            } else if (n[i] != 0) {
                str += tw[n[i] - 2] + ' ';
                sk = 1;
            }
        } else if (n[i] != 0) {
            str += dg[n[i]] + ' ';
            if ((x - i) % 3 == 0) str += 'hundred ';
            sk = 1;
        }
        if ((x - i) % 3 == 1) {
            if (sk) str += th[(x - i - 1) / 3] + ' ';
            sk = 0;
        }
    }
    if (x != s.length) {
        var y = s.length;
        str += 'point ';
        for (var i = x + 1; i < y; i++) str += dg[n[i]] + ' ';
    }
    return str.replace(/\s+/g, ' ');

}
$(document).ready(function(e) {
	$('#date').html(" "+toWords('<?php echo date('d', strtotime($res["dob"])); ?>')+" ");
	$('#year').html(" "+toWords('<?php echo date('Y', strtotime($res["dob"])); ?>')+" ");    
});
function printme(){
	window.print();
  $('#print').hide();
	window.onfocus=function(){ window.close();}
}
</script>

<style>


.rect{
  display: inline-block;
  height: 62px; /*sets height of element*/
  background: cornflowerblue; /*sets the background of this element (here a solid colour)*/
  transition: all 0.6s; /*sets a transition (for hover effect)*/
  padding-left: 8px; /*sets 'padding'*/
  padding-right: 0px; /*sets 'padding'*/
  line-height: 21px; /*for this, it sets vertical alignment*/
}

.tc{
	font-size:20px;
	font-family: "Times New Roman", Times, serif;
	color:black;
	padding: 1px 20px;
	 font-weight: bold;
}
.tc .txt{
	border:0px;
	border-bottom:1px solid #333;
	width:220px;
	font-family: "Times New Roman", Times, serif;
	color:black;
	margin:2px 5px;
	display:inline-block;
	 font-weight: bold;
	 	color: black;
		font-size:22px;
	
}

.header{
	/*border-bottom:2px solid gray;*/
	margin:-8px 0px;
	padding:0px;
}
.name{
	font-size:18px;
	font-family: "Times New Roman", Times, serif;
	color: black;
	 font-weight: bold;
	}
.content{
	color: #E20A0A;
font-weight: 800;
		}
		table {
 
  margin-top: 20px;
  
}
.span{
	border-bottom:2px  blue; 
	display:inline-block;
	font-family: "Times New Roman", Times, serif;
	font-size:22px;
}
@media print {
body {-webkit-print-color-adjust: exact;}
}


</style>

<?php  $il=$db->getVal("select id from extra where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET["id"]."' and type='tc'"); 
if(isset($_GET["action"]) && $_GET["action"]=="cc"){
?>

<div style="width:700px;padding:20px;border:1px solid" >
	<div style="text-align:center ">
	<img src="<?php echo $LinksDetails["logo"] ?>" style="height:65px" />
		<h1 style="margin:0; padding:0"><?php echo $LinksDetails["site_name"] ?></h1>
        
        <div>Affi. No. 330483 School No. 50395</div>
        <div><?php echo nl2br($LinksDetails["contact_content"]) ?></div>
        <div style="display: inline-block;border-top: 5px solid #000;border-bottom: 5px solid #000;border-right: 15px solid #000;border-left: 15px solid #000;border-radius: 15px;font-size: 24px;font-weight: bold;padding: 5px 15px;margin: 45px 0;">CHARACTER CERTIFICATE</div>
    </div>
    <div style="font-family: Brush Script MT;font-size: 22px;">
    This is to certify that Master/Miss <span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;width: 380px;display: inline-block;"><h3><?php echo $res["name"] ?></h3></span><br />
Son/Daughter of shri <span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;width: 280px;display: inline-block;"><h3><?php echo $res["fname"] ?></h3></span> Roll No <span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;width: 120px;display: inline-block;"><h3><?php echo $res["admissionno"] ?></h3></span><br />
has been a bonafide student of this school. He/She has passed All India Secondary <br />
/ Senior Secondary School Examination held in the month of <span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;width: 200px;display: inline-block;"></span><br />
<span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;width: 340px;display: inline-block;"></span> to the best of my knowledge, he/she bears a<br />
good moral character, during the session.<br />
<br />
We wish him/her every success in life.    <br /><br />
    </div>
    <div>
    <div style="display:inline-block; width:30%">Date ............................ </div>
    <div style="display:inline-block; width:30%; text-align:center"> Class Teacher </div>
    <div style="display:inline-block; width:30%; text-align:right"> Principal</div>
    </div>
</div>

<?php }else{ ?>

<div style="margin-top:210px; font-weight: bold;"><hr  style="font-weight: bold;"></div>
 <table border="0" width="100%" class="tc"  >
     
    <td colspan="3">
	 <div style="margin:3px; padding:5px; color: black; font-size:23px; margin-top:-30px; width:200px;  font-weight: bold;" ><b> T.C-No. </b>
      <b><?php echo $res["tc_number"] ?></b></div>
    <div style="margin:3px; color: blue; padding:5px; width:235px; float:right" >
   
	

</div>

<div style="color: black;  ">
	   <div style="font-weight: bold; margin-left:660px;font-size:22px; margin-top:-30px; "><b>Admission No.&nbsp;<?php echo $res["adminno"];  ?> </b></div> </div>

    <div style="margin-left:660px; padding:5px; font-size:22px;  width:200px"><b>  Date.&nbsp;<span class="span" style="color: black;  font-weight: bold;"><?php
  $originalDate = $res["date"];
echo $newDate = date("d-m-Y", strtotime($originalDate));
?></span> </b></div>
 <div style="font-size:30px; margin-left:300px; margin-top:-30px; "><b>Transfer Certificate</b></div>

    </td>
  
  
  <tr >
  
    <td colspan="3"> 
	</br>
    <span class="name" >1- Name Of Pupil :</span> <span class="txt" style="font-size:20px; width:350px;"><?php echo $res["nameofpupil"] ?></span><br /> 
    <span class="name" > 2- Mother's Name : </span> <span class="txt" style="font-size:20px; width:350px;"><?php echo $res["nameofmother"] ?></span><br />
    <span class="name" >3- Father's/Guardian's Name : </span><span class="txt" style="font-size:20px;  width:350px; 	border-bottom:1px solid #333;"><?php echo $res["nameofGuardien"] ?></span><br/> 
   
   <span class="name" > 4- Nationality : </span> <span class="txt" style="font-size:20px;">INDIAN</span><br /> 
   <span class="name" > 5- Whether the candidate belongs to Scheduled Caste or Scheduled Tribe : </span> <span class="txt" style="font-size:20px;"><?php echo $res["cast"] ?></span><br />
   <span class="name" > 6-Date of  first  admission in the School with class : </span><input type="text"  style="font-size:20px;" class="txt" name="admission_class" value="<?php echo $res["admission_class"] ?>" />  <br />
   <span class="name" > 7- Date of birth(in Christian Era) according to the admission Register(in figure) : </span> <span class="txt" style="font-size:20px;"><?php echo date("d-M-Y",strtotime($res["DOB"]));  ?></span><br />
    <span class="name" >(In words): <span  style="font-size:20px; 	width:350px; 	border-bottom:1px solid #333; "><?php echo $res["dobininwords"] ?></span><br />
   <span class="name" > 8- Class in which pupil last studied(in figure) : </span><input type="text" style="font-size:20px;" class="txt" name="last_class" value="<?php echo $res["last_class"] ?>" />   <br />
    <span class="name" > 9- School/Board annual examination last taken with result: </span><input type="text"  style="font-size:20px;" class="txt" name="result" value="<?php echo $res["result"] ?>" /><br />
    <span class="name"> 10- Whether failed,if so once/twice,in the same class  : </span><input type="text" style="font-size:20px;" class="txt" name="failds" value="<?php echo $res["failds"] ?>" /><br />
   <span class="name" > 11- Subjects Studied : </span><u><?php echo $res["subject"] ?></u>  <br />
    <span class="name" > 12- Whether qualified for promotion to the higher class, if so to which class : </span><input type="text"style="font-size:20px;"   class="txt" name="qualified" value="<?php echo $res["qualified"] ?>" /> <br />
    <span class="name" > 13- Month upto which the (pupil has paid)  school dues paid  : </span><input type="text" style="font-size:20px;" class="txt" name="dues" value="<?php echo $res["dues"] ?>" /> <br />
	    <span class="name" > 14- Any fee concession availed of , if so the nature of such concession : </span><input type="text" style="font-size:20px;" class="txt" name="concession" value="<?php echo $res["concession"] ?>" /> <br />

	<span class="name"  > 15- Total no. of  working days: </span><input type="text" style="font-size:20px;" class="txt" name="totalworking" value="<?php echo $res["totalworking"] ?>" />  <br />
    <span class="name"  > 16-Total no. of  working days Presents: </span> <input type="text" style="font-size:20px;" class="txt"  name="totalpresent" value="<?php echo $res["totalpresent"] ?>" /></br>	
	<span class="name" > 17- Whether NCC cadet/boy scout/girl Guide(details may be given) : </span><input type="text" style="font-size:20px;" class="txt" name="qualified" value="<?php echo $res["ncc"] ?>" /> <br />
    <span class="name" > 18- Games played or extra curricular activities in which the pupil usually took part (Mentioned achivement level therein) : </span><input type="text" style="font-size:20px;  width:90px; 	border-bottom:1px solid #333;" class="txt" name="activities" value="<?php echo $res["activities"] ?>" /> <br />
     <span class="name"  > 19- General conduct : </span> <input type="text" style="font-size:20px;" class="txt"  name="Conduct" value="<?php echo $res["Conduct"] ?>" /></br>	
    <span class="name"  >20- Date of application for certificate : </span> <input type="text" style="font-size:20px;" class="txt"  name="date_of_application" value="<?php echo $res["date_of_application"] ?>" /></br>	

	<span class="name"  > 21- Date of  issue of certicate :  </span> <input type="text" style="font-size:20px;" class="txt"  name="issue_date" value="<?php echo $res["issue_date"] ?>" /></br>	
    
    <span class="name"  > 22- Reason for leaving the school : </span> <input type="text" style="font-size:20px;width:500px;" class="txt"  name="reason" value="<?php echo $res["reason"] ?>" /></br>	
  
     <span class="name"  > 23- Any other Remark : </span> <input type="text" style="font-size:20px;" class="txt"  name="remark" value="<?php echo $res["remark"] ?>" /></br>	

   
     
    

</td>

    </tr>
	<br>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
  </tr>
  
  <tr>
    <td class="name"> <span class="txt"  style="  width:95px; 	color: black;" >&nbsp;</span> <br /><br />Signature of class Teacher</td>
    <td class="name"><span class="txt" style="width:95px" 	color: black; >&nbsp;</span> <br /><br />Checked by Office Incharge</td>
    <td class="name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="txt" style="width:95px; 	color: black; " ></span> <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Principal
    </td>
  </tr>
  <tr>
    <td > <span  >&nbsp;</span> </td>
    <td ><span >&nbsp;</span> </td>
    <td ><span  >&nbsp;M.P Education Academy<br>Jalpura Ater Bhind(m.p)</span> 
   
    </td>
  </tr>
</table>
<?php } ?>
</form>
<script>window.print() </script>