<?php include("../db.php");?>
<script>
    var headPrint='<div class="headPrint"><img src="<?php echo $LinksDetails["logo"] ?>" height="60px"><h1><?php echo ucfirst(trim($LinksDetails["site_name"])) ?></h1></div>';
	var root='<?php echo URL_ROOT ?>';
	</script>
<script type="text/javascript" src="<?php echo URL_ROOT ?>js/jquery-1.9.1.js"></script>
<link href='<?php echo URL_ROOT ?>assets/css/print.css' rel='stylesheet'>
<script type="text/javascript" src="<?php echo URL_ROOT ?>js/custom.js"></script>
<?php 


$aryForm=$db->getRow("SELECT * FROM student WHERE  school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET['idno']."'");




?><style>
.recept {
font-weight: bold;
font-size: 20px;
color: #FC0D0D;
}
.headprint .logo{
	margin: -5px 10px 0px 0px !important;
}
</style>

<form method="post" action="" id='printMe'>

<div style="display:flex;">
<div style="width:49%; border: 4px solid black;background: #C1CCD8;">
<div class="headPrint" style="background: #C1CCD8; border-bottom: 4px solid black;"> 
<table width="100%">
        <tr>
          <td width="10%"><img style="top:3px;position:relative;" src="<?php echo $LinksDetails["logo"] ?>" class="logo" height="50px" width="70px"></td>
           <td  style="text-align:center"><h5 style="margin:0; padding:0;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h5>
            <span style="text-align:center;font-size:13px;"><?php echo ucfirst(nl2br($LinksDetails["contact_content"])); ?></span>
			</td>
        </tr>
      </table>
  </div>
<table width="100%" style='background: #C1CBD8;font-size:12px;'>
    <tr>
        <td width="20%"><strong>R.No</strong></td><td><span class="recept"><?php echo $_REQUEST["rno"]; ?></span></td>
        <!--<td width="20%"><strong>Date</strong></td><td><?php echo date("d-m-Y",strtotime($_REQUEST["udate"])); ?></td>-->
		
		<td width="20%"><strong>Date</strong></td><td><?php echo date("d-m-Y"); ?></td>
    </tr>
    <tr>
        <td><strong>Name</strong></td><td><?php echo $aryForm["name"]; ?></td>
        
       <td><strong>Class</strong></td><td><?php echo $aryForm["class"]; ?></td>
    </tr>
    <tr>
        <td><strong>Father's</strong></td><td><?php echo $aryForm["fname"]; ?></td>
        <td><strong>Mother's</strong></td><td><?php echo $aryForm["mname"]; ?></td>
    </tr>
    <!--<tr>-->
        
    <!--    <td><strong>Bank</strong></td><td><?php echo $_REQUEST[bank]?> </td>        <td><strong>Cheque No</strong></td><td><?php echo $_REQUEST[ch_no]?> </td>-->
    <!--</tr>-->
    <tr>
        <td><strong>Adm/No</strong></td><td><?php echo $aryForm["admissionno"]; ?></td>
        <td><strong>Contact</strong></td><td><?php echo $aryForm["mobile"]; ?></td>
    </tr>
	<tr>
    <td colspan="4">
    
<?php
echo "<table width='100%' border='1'>
<tr>
	<th>Sr. No</th>     <th>Fee Head</th>   <th>Paid</th>
</tr>";

$allitems = $db->getRows("select * from inventory_receipt where idno='".$_REQUEST['idno']."' and rid='".$_REQUEST['rno']."' ");
$i=0;$total_amount=0;
        foreach($allitems as $it){$i++;

            $name= $db->getVal("select name from inventory where id='$it[inventory_id]'");
        	echo "<tr><th>$i</th><th>$name</th><th>$it[total_amount]</th></tr>";
    
            $total_amount+=$it['total_amount'];
        }

	echo "<tr><th></th><th>Total Paid Amount</th><th>".$total_amount."</th></tr>";

    echo "</table><hr/><div class='footerPrint'><span>Signature...............................</span></div>";

	echo '<input style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px;" type="button"  onclick="printDivNoHeader(\'printMe\')" value="Print">';

?>
	</td></tr>
</table>
<span style="color:red;text-align:center;font-size:14px;"><?php echo "[" ?>Note : If any correction,Please consult to fee counter.<?php echo "]" ?></span>
</div>
<!--<br/><br/><br/><div style="border-top:3px dotted black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><br/><br/>-->

<!-- 2nd form-->

<div style="width:49%; border: 4px solid black;background: #C1CCD8;">
<div class="headPrint" style="background: #C1CCD8; border-bottom: 4px solid black;"> 
<table width="100%">
        <tr>
          <td width="10%"><img style="top:3px;position:relative;" src="<?php echo $LinksDetails["logo"] ?>" class="logo" height="50px" width="70px"></td>
           <td  style="text-align:center"><h5 style="margin:0; padding:0;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h5>
            <span style="text-align:center;font-size:13px;"><?php echo ucfirst(nl2br($LinksDetails["contact_content"])); ?></span>
			</td>
        </tr>
      </table>
  </div>
<table width="100%" style='background: #C1CBD8;font-size:12px;'>
    <tr>
        <td width="20%"><strong>R.No</strong></td><td><span class="recept"><?php echo $_REQUEST["rno"]; ?></span></td>
        <!--<td width="20%"><strong>Date</strong></td><td><?php echo date("d-m-Y",strtotime($_REQUEST["udate"])); ?></td>-->
		
		<td width="20%"><strong>Date</strong></td><td><?php echo date("d-m-Y"); ?></td>
    </tr>
    <tr>
        <td><strong>Name</strong></td><td><?php echo $aryForm["name"]; ?></td>
        
			<td><strong>Class</strong></td><td><?php echo $aryForm["class"]; ?></td>
               
    </tr>
    <tr>
        <td><strong>Father's</strong></td><td><?php echo $aryForm["fname"]; ?></td>
        <td><strong>Mother's</strong></td><td><?php echo $aryForm["mname"]; ?></td>
    </tr>
    <!--<tr>-->
        
    <!--    <td><strong>Bank</strong></td><td><?php echo $_REQUEST[bank]?> </td>        <td><strong>Cheque No</strong></td><td><?php echo $_REQUEST[ch_no]?> </td>-->
    <!--</tr>-->
    <tr>
        <td><strong>Adm/No</strong></td><td><?php echo $aryForm["admissionno"]; ?></td>
        <td><strong>Contact</strong></td><td><?php echo $aryForm["mobile"]; ?></td>
    </tr>
	<tr>
    <td colspan="4">
    
<?php
echo "<table width='100%' border='1'>
<tr>
	<th>Sr. No</th><th>Inventory Head</th><th>Paid</th>
</tr>";
// $allitems = $db->getRows("select * from inventory_receipt where idno='".$_REQUEST['idno']."' and rid='".$_REQUEST['rno']."' ");
$i=0;$total_amount=0;
        foreach($allitems as $it){$i++;

            $name= $db->getVal("select name from inventory where id='$it[inventory_id]'");
        	echo "<tr><th>$i</th><th>$name</th><th>$it[total_amount]</th></tr>";
    
            $total_amount+=$it['total_amount'];
        }

	echo "<tr><th></th><th>Total Paid Amount</th><th>".$total_amount."</th></tr>";

    echo "</table><hr/><div class='footerPrint'><span>Signature...............................</span></div>";

	echo '<input style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px;" type="button"  onclick="printDivNoHeader(\'printMe\')" value="Print">';

?>
	</td></tr>
</table>
<span style="color:red;text-align:center;font-size:14px;"><?php echo "[" ?>Note : If any correction,Please consult to fee counter.<?php echo "]" ?></span>
</div>
<!--<br/><br/><br/><div style="border-top:3px dotted black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><br/><br/>-->
</div>
</form>

<script>
function checkreceptNo(id){
	$.post( "<?php echo URL_ROOT ?>ajax.php", { 
			type: "checkreceptNo" ,
			paytype: '<?php echo $_REQUEST["type"] ?>',
			id: id
		} , function( data ) {
		data=data.trim();
		if(data==""){
			$("#saveprintme").click();
		}
		else{
			alert("receipt id already exit");
		}
	});
}
</script>