<?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:0px solid black">
<span style="font-size:13px;font-weight:800;  color: green; "> </span></br>

    <div style="font-family:  Agency FB;font-size: 25px; color:green; margin-top:140px; color:black;">
        <div style="display:inline-block; width:30% color:black;" ><b>S.r. No.</b> <span style="color:black; font-size: 24px; width: 100px;">&nbsp;&nbsp;<?php echo $res["cc_number"] ?></div>
        <br> <br>
    This is to certify that  <span style="font-family: serif;font-size: 13px;border-bottom: dashed 1px;display: inline-block;"><span style="color:black; font-size: 22px; border-bottom: dotted 1px; width: 200px;">&nbsp;&nbsp;<?php echo $res["pupil_name"] ?></span></span>
Son/Daughter of <span style="font-family: serif;font-size: 15px; display: inline-block; border-bottom: dashed 1px;"><span style="color:black; font-size: 20px; border-bottom: dotted 1px;" ><?php echo $res["father_name"] ?>&nbsp;&nbsp;</span></span>is/Was a bonafide student of  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;<?php echo $res["class"] ?></span></span>
&nbsp;&nbsp;&nbsp;of this school in/of the session&nbsp;&nbsp;<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;<?php echo $res["passingpased"] ?></span></span>
He/She bears a good moral character.<br /><br />
   </div><br /><br /><br />
    <div>
    <div style="display:inline-block; width:30% color:black;" ><b>Date ............................</b> </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;" ><b> &nbsp;&nbsp;&nbsp;&nbsp;Principal</b></div>
    </div>
</div>
</table>
<?php } ?>
</form>
<script>window.print() </script>