<?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 new_cc where cc_number='".$_GET["id"]."'");
//echo $ss="select * from newtc where adminno='".$_GET["id"]."' and nameofpupil='".$_GET["name"]."'";
//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>
.tc{
	font-size:14px;
	font-family:"Courier New", Courier, monospace;
	color:#333;
	padding: 1px 20px;
}
.tc .txt{
	border:0px;
	border-bottom:1px solid #333;
	width:180px;
	font-family:"Courier New", Courier, monospace;
	color:#009;
	margin:2px 5px;
	display:inline-block;
}
.span{
	border-bottom:2px dotted #000; 
	display:inline-block;
	font-family:"Courier New", Courier, monospace;
}
.header{
	/*border-bottom:2px solid gray;*/
	margin:-8px 0px;
	padding:0px;
}
.name{
	font-family:serif;
	color: #040FD7;
	}
.content{
	color: #E20A0A;
font-weight: 800;
		}
		table {
 
  margin-top: 190px;
  
}
@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"){
?>



<?php }else{


	?>

<table border="0" width="100%" class="tc">
<div style="width:700px; height:1000px; padding:40px;border:6px dotted green">
<span style="font-size:13px;font-weight:800;  color: green; "> </span></br>
	<div style="text-align:center">
		<h1 style="margin:0; padding:0; color:green;"><?php echo $LinksDetails["site_name"] ?></h1>
        <img src="<?php echo $LinksDetails["logo"] ?>" style="height:130px; margin-left:-460px;" "weight:140px;" />
        <p style="color:green; font-size: 20; margin-top:-120px; margin-left:25px;"><?php echo nl2br($LinksDetails["contact_content"]) ?></p>
		<span style="font-size:14px;font-weight:800;  color: green; "> </span><br>
			    <span style="font-size:13px;font-weight:800;  color: green; "></span></br>
        <div style="display: inline-block;border-top: 5px solid green;border-bottom: 5px solid green;border-right: 15px solid green;border-left: 15px solid green;border-radius: 15px;font-size: 40px;font-weight: bold;padding: 5px 15px;margin-top: 50px;">CHARACTER CERTIFICATE</div>
    </div>
    <div style="font-family:  Script MT;font-size: 25px; color:green; margin-top:45px">
    This is to certify that Mr./Mrs./Miss. <span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["pupil_name"] ?></span></span>
Son/Wife/Daughter of shri <span style="font-family: serif;font-size: 19px; display: inline-block; border-bottom: dashed 1px;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["father_name"] ?></span></span>&nbsp;&nbsp;Was admitted to Class <span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["admissionclass"] ?></span></span>
&nbsp;&nbsp;&nbsp;of the institute during session

<span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["passingyear"] ?></span></span>&nbsp;&nbsp;He/She has  appeared in passed/failed the<span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["passingpased"] ?></span></span>
examination<span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["examresult"] ?></span></span>&nbsp;&nbsp;&nbsp;of the Dr.R.M.L.Awadh University,Faizabad Securing a division.<span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["schoocharacter"] ?>.</span></span><br>
His/her date of birth as per the records of the institute is<span style="font-family: serif;font-size: 14px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $res["dob"] ?></span></span>&nbsp;&nbsp;&nbsp;to the best<br><br> of my knowledge and belief his/her cunduct and character during the period of his/her<br> stay in institute has been good/ satisfactory/unsatisfactory.
<br /><br />
I wish him all success in his/her life.<br /><br />
   </div><br /><br /><br /><br />
    <div>
    <div style="display:inline-block; width:30% color:black;" >Date ............................ </div>
    <div style="display:inline-block; width:30%; text-align:center">  </div>
	  <div style="display:inline-block; width:16%; text-align:center">  </div>
    <div style="display:inline-block; width:30%; text-align:right color:black;" > Principal</div>
    </div>
</div>
</table>
<?php } ?>
</form>
<script>window.print() </script>