<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>
<?php 


  $branch=getBranch($m);

  $m->where("bill_id", $_REQUEST['id']);
  $m->where("branch_id", $_SESSION['branch']);
  $billConfig=$m->get(" eduportal_canteen_salebills_config");

  $m->where("student_id", $billConfig[0]['student_id']);
  $m->where("branch_id", $_SESSION['branch']);
  $Customer=$m->get(" edu_student_details");


?>
 <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<title>Print Sale Bill</title>
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />

<script type="text/javascript">
 //window.print();
</script>
<style> 

.section{width:95%; height:auto;float:left;padding-right:2.5%;margin-left:2%;}
.box{
  width:55%;float:left;height:14.5cm;padding:0.5%;margin-left: 27%;;
}  

body {
  background: rgb(204,204,204);
  /*font-weight:bold;*/ 
}
page {
  background: white;
  display: block;
  margin: 0 auto;
  margin-bottom: 0.5cm;
  border:1px solid black;
  box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
  /*padding:1%;*/
  height: 21cm; 
}
page[size="A4"] {  
  width: 21cm;
  height: 29.7cm; 
}
page[size="A4"][layout="landscape"] {
  width: 29.7cm;
  height: 21cm;  
}
page[size="A3"] {
  width: 29.7cm;
  height: 42cm;
}
page[size="A3"][layout="landscape"] {
  width: 42cm;
  height: 29.7cm;  
}
page[size="A5"] {
  width: 14.8cm;
  height: 21cm;
}
page[size="A5"][layout="landscape"] {
  width: 21cm;
  height: 14.8cm;  
}
@media print {
  body, page {
    margin: 0;
    box-shadow: none;
    border:none;
  }
}
  </style>
</head>
<body>

<page size="A4">

      
<div class="box" >

<div class="section" style="">
   
  <p style="font-size: 30px;text-align: center;font-weight: bold;margin-bottom: -10px;"><?php echo $brid[0]['Branch_Name'];?></p>
  <p style="font-size: 18px;text-align: center;font-weight: bold;"><?php echo $brid[0]['Branch_Location'];?></p>
  <p><b>Contact : </b> <?php echo $brid[0]['branch_contact'];?></p>
  <p><b>Bill No : </b> <?php echo $_REQUEST['id'];?></p>
  <p><b>Customer Name : </b> <?php echo $Customer[0]['first_name'];?></p>
  <p><b>Print Date : </b> <?php echo date("d-M-Y")." / ".date("h:i:s a");?></p>
  <p><b>Bill Date : </b> <?php echo date("d-M-Y",strtotime($billConfig[0]['invoice_date']));?></p>
 
  <table style="width:100%">
    <thead>
  <tr>
    <th style="font-weight: bold;text-align: left;">SR</th>
    <th style="font-weight: bold;text-align: left;width: 55%;">ITEM</th>
    <th style="font-weight: bold;text-align: center;">QTY</th> 
    <th style="font-weight: bold;text-align: center;">RATE</th>
    <th style="font-weight: bold;text-align: center;">Total</th>
  </tr>
   </thead>

  <tbody>
<?php  $count=1;
$date= date("Y-m-d");

  $m->where("bill_id", $_REQUEST['id']);
  $m->where("branch_id", $_SESSION['branch']);
  $Bills=$m->get(" eduportal_canteen_salebills_details");
//print_r($Bills);
foreach($Bills as $data){

  $m->where("product_id", $data['product_id']);
  $m->where("branch_id", $_SESSION['branch']);
  $ProductName=$m->get(" eduportal_product_config");


  $m->where("bill_id", $_REQUEST['id']);
  $m->where("branch_id", $_SESSION['branch']);
  $Sale=$m->get(" eduportal_canteen_salebills_config");
/*
  $db->where("customer_id", $Sale[0]['customer_id']);
  $db->where("store_id", $_SESSION['store_id']);
  $custName=$db->get(" traders_customer_detail");

$totalPlus=$data['pro_rate']*$data['product_qty'];
$subTotal += $totalPlus;*/

?>
  <tr>
    <td><?php echo $count++;?></td> 
    <td><?php echo $ProductName[0]['product_name'];?></td>
    <td style="text-align: center;"><?php echo $data['product_qty'];?></td>
    <td style="text-align: center;"><?php echo $data['pro_rate'];?></td>
    <td style="text-align: center;"><?php echo $data['pro_rate']*$data['product_qty'];?></td>
  </tr>

 
 <?php } ?> 
</tbody>

<div style="width: 100%;">
==============================================
</div>
</table>
<div style="width: 100%;">
-----------------------------------------------------------------------------
</div>
<div>
  <div>
    
  </div>
  
</div>
</div>

<div>
  <div style="width: 65%;text-align: right;float: left;">Total Amount :</div>
  <div style="width: 35%;float: left;text-align: center;"><?php echo $Sale[0]['grossamount'];?></div>
  <div style="width: 65%;text-align: right;float: left;">Total Discount :</div>
  <div style="width: 35%;float: left;text-align: center;"><?php echo $Sale[0]['discount_amount'];?></div>
  <div style="width: 65%;text-align: right;float: left;">Net Amount :</div>
  <div style="width: 35%;float: left;text-align: center;"><?php echo $Sale[0]['total_amount'];?></div>
  <div style="width: 100%;">
==============================================
</div>
</div>
<div style="text-align: center;">
  THANK YOU FOR YOUR KIND VISIT
</div>
<div style="width: 100%;">
==============================================
</div>


</div>
 
<!-- ending section  -->

</div>  <!-- ending box  -->


</page>
<br><br>


</body>
</html>
