<?php
$pgMod="fee_record";
$pgAct="view";

$aryForm=$db->getRow("SELECT * FROM student WHERE   school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET['id']."'");
?>
<style>
table{
	border:2px solid #900;
}
.st {
	width: 55px;
	display: inline-block;
	color: #021EF0;
}
input[type="text"] {
	border: 0px none transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
}
a.btn {
display: none !important;
}
td a {
display: none !important;
}
.half {
	width: 49%;
	display: inline-block;
	vertical-align: top;
	border-left: 5px solid #f00;
border-right: 5px solid #f00;
}
.half .input-block-level {
	width: 80px;
	text-align:center;
}
.half .input-block-level1 {
	width: 60px;
	text-align:center;
}
.half .table td {
	padding: 3px 5px;
	text-align:center;
}
.half .table th {
	text-align:center;
}
.half center {
	font-weight: bold;
	border-top: 1px solid #f00;
	padding: 5px;
	background-color: #A7A1A1;
	color: #000;
}
.h3{ text-align:center; margin:0;}
.headPrint{display:none}
</style>
 <div id="printableDiv">
	 <div class="headPrint" style="text-align:center">
       <!-- <img src="<?php echo URL_ROOT ?>media/photo/<?php echo $aryForm["photo"] ?>" style="float:right" height="60px">
        <h1><img src="<?php echo $LinksDetails["logo"] ?>" height="30px">
        <span style="top: -12px; display: inline-block; position: relative;"><?php echo ucfirst(trim($LinksDetails["site_name"])) ?></span></h1>-->
        <div><?php echo ucfirst(trim($LinksDetails["contact_content"])) ?></div>
     </div>
      <div class="row-fluid">
          <div class="span12">
            <div class="top-bar" id="top">
                <!--<h3><i class="icon-cog"></i> Student detail</h3>-->
                <div style="float:right; margin-top:5px;">
                 <button type="button" onclick="printDiv('printableDiv')" class="btn btn-primary">Print</button>
                </div>
            </div>
            <div class="well no-padding only" id="userdetails" style="padding: 0;margin: 0;">
            	<table class="table" width="100%">
                	<tr style="border-right: 5px solid #f00;border-left: 5px solid #f00;">
                    	<td><strong class="st">Name</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["name"] ?></td>
                        <td><strong class="st">Class</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["class"] ?></td>
                        <td><strong class="st">Section</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["section"] ?></td>
                        <td><strong class="st">Address</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["address"] ?></td>
                        <td rowspan="2"><?php if($aryForm["photo"]!=""){
                        ?><img src="media/photo/<?php echo $aryForm["photo"]; ?>" style="height:70px" /><?php
                    }else{
                        echo "No photo uploaded";
                    }?></td>
                    </tr>
                    <tr style="border-right: 5px solid #f00;border-left: 5px solid #f00;">
                    	<td><strong class="st">Adm/No</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["admissionno"] ?></td>
                        <td><strong class="st">Father</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["fname"] ?></td>
                        <td><strong class="st">Mother</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["mname"] ?></td>
                        <td><strong class="st">Contact</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["mobile"] ?></li></td>
                    </tr>
                </table>
            </div>
        </div>
     </div> 
      <div class="row-fluid">
        <div class="span12">
            <div class="top-bar">
                <h3 style="text-align:center; margin:0;"><i class="icon-cog"></i> Payment detail</h3>
            </div>
            <div class="well no-padding">
                 
             	<div class="half">
                  <center>Pocket Money Collection</center>
                  <table class="table" width="100%">
                    <thead>
                        <tr>
                        	<th>Date</th>
                            <th>Detail</th>
                            <th>UserId</th>
                            <th>Amount</th>                     
                            <th></th>
                        </tr>
                    </thead>
                    <tbody id="tbody" style="border-top:2px solid #F00">
                    	<?php 
					if($_GET["id"]!=''){ $allincome=0;$i=1;
					 $all_product=$db->getRows("select * from transaction where school_id='".$_SESSION["admin"]["school_id"]."' and tfor='hostel-income' and rid='".$_GET["id"]."' and session='".$_SESSION["admin"]["session"]."' order by udate");
					 //echo $db->getErMsg();
					 //echo"<pre>";print_r($all_product);echo"</pre>";
					  if(is_array($all_product) && count($all_product))
                      {
                        foreach($all_product as $iPro)
                        {
							$allincome+=$iPro["amount"]
							?>
                      <tr>
                      
                      	 <td><?php echo date("d-M-Y",strtotime($iPro["udate"]));?></td>
                         <td><?php echo $iPro["tid"]?></td>
                         <td><?php echo $db->getVal("Select name from users where id='".$iPro['added_by']."'");?></td>
                          <td><?php echo $iPro["amount"];?></td>
                       </tr>
                     <?php $i++;} 
					   }
					 } ?>
                     <tr><td></td>
                     <td>Total</td><td></td>
                     <td><?php echo $allincome; ?></td></tr>
                  	</tbody>
                 </table>
                 
          </div>
          		<div class="half">
                  <center>Pocket Money Transactions</center>
                  <table class="table" width="100%">
                    <thead>
                        <tr>
                        	<th>Date</th>
                            <th>Detail</th>
                            <th>UserId</th>
                            <th>Amount</th>                     
                            <th></th>
                        </tr>
                    </thead>
                    <tbody id="tbody" style="border-top:2px solid #F00">
                    	<?php 
					if($_GET["id"]!=''){ $allexpance=0;$i=1;
					 $all_product=$db->getRows("select * from transaction where school_id='".$_SESSION["admin"]["school_id"]."' and tfor='hostel-expance' and rid='".$_GET["id"]."' and session='".$_SESSION["admin"]["session"]."' order by udate");
					 //echo $db->getErMsg();
					 //echo"<pre>";print_r($all_product);echo"</pre>";
					  if(is_array($all_product) && count($all_product))
                      {
                        foreach($all_product as $iPro)
                        {
							$allexpance+=$iPro["amount"]
							?>
                      <tr>
                      
                      	 <td><?php echo date("d-M-Y",strtotime($iPro["udate"]));?></td>
                         <td><?php echo $iPro["tid"]?></td>
                         <td><?php echo $db->getVal("Select name from users where id='".$iPro['added_by']."'");?></td>
                          <td><?php echo $iPro["amount"];?></td>
                       </tr>
                     <?php $i++;} 
					   }
					 } ?>
                     <tr><td></td>
                     <td>Total</td><td></td>
                     <td><?php echo $allexpance; ?></td></tr>
                  	</tbody>
                 </table>              
          </div>
          <table class="table" width="100%">
                 	<thead>
                    	<tr>
                        	<th style="text-align:center">Final Balance</th><th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="first"  style="border-top:2px solid #F00">
                          <th>Total Balance</th>  <th><?php  echo $allincome-$allexpance;?></th>
                        </tr>
                    </tbody>  
          </table>            
         </div>
    </div>
</div> 
</div>       
<script type="text/javascript">
$(document).ready(function(e) {
    var oTable = $('#ajaxtable').dataTable( {
		"bProcessing": true,
		'sPaginationType': 'full_numbers',
		"sAjaxSource": 'ajax.php?type='+$('#tabletype').val(),
		'iDisplayLength': 5,
		"oLanguage": {
			"sSearch": "Search by any columns:"
		}
	});
})
//window.print();
//window.onfocus=function(){ window.close();}
</script>