<?php $this->load->view("common/header"); ?>
<div style="top:5px;" class="panel-tools open">
  <button data-toggle="dropdown" class="btn btn-blue dropdown-toggle" onClick="window.print()"><i class="fa fa-print"></i></button>
</div>
<style type="text/css">
th {
	text-align: left !important;
}
.report_view_th {
	color: #000 !important;
	text-align: center !important;
}
body {
	background-color: #fff !important;
	font-size: 12px;
}
p {
	margin: 0;
}
.modal-body {
	padding: 2px 15px 15px;
	position: relative;
}
body .modal {
	/* new custom width */

	width: 750px;
	/* must be half of the width, minus scrollbar on the left (30px) */

	margin-left: -375px;
}
.print-table td, th {
	padding: 1px;
	vertical-align: top !important;
}
thead {
	display: table-header-group;
}
tfoot {
	display: table-footer-group;
}
.width_cus {
	width: 100px !important;
}
.width_qty {
	width: 100px !important;
}
</style>

<!--https://css-tricks.com/almanac/properties/p/page-break/-->

<!--onLoad="window.print()-->
<!---->
<body onLoad="window.print()">
    <form name="delivery_print_form">
<!--<pre>-->
<?php //print_r($delivary_stns); ?>
<!--</pre>-->
<div class="row">
    
    <div class="row">

<div class="col-xs-12 text-center">

<p>

 </p><h1 style="font-size:25px; ">
 RATHNA TRADERS</h1>
 		
 108/1,MAKOLA SOUTH ,MAKOLA<br>
 TP:0112962726 / WhatsApp/Viber : 0761409403  <br>
	<p></p>
<!-- Email:   -->
   </div><!--col-xs-12-->
</div>
    
  <div class="col-xs-12"> 
    <!-- <h3 class="center" style="font-family:'Times New Roman', Times, serif; margin-bottom:3px; letter-spacing:2px;"></h3>--> 
    
    <!-- <p class="center">

 	 <?php echo $wharehose_details['address'] ?></p>--> 
    
    <!-- <p class="center">

	<?php echo $wharehose_details['phone'];?></p>

    <p class="center">

	<?php echo $wharehose_details['email'];?></p>-->
    
    <h5 class="center" style="font-family:'Times New Roman', Times, serif; margin-bottom:3px; letter-spacing:2px;">Good Receiving Note</h5>
    <div class="col-xs-6">
      <p>Printed Date & Time:
        <?php echo date("Y-m-d H:i:s a");
	  
	 ?>
      </p>
      <p>Vehicle : <?php echo $delivary_stns[0]['vehicle_code']?> </p>
      <p> Driver Name : <?php echo $delivary_stns[0]['driver_name']?></p>
      <br>
    </div>
    <div class="col-xs-6 pull-right" style="padding-left:160px;"> </div>
  </div>
</div>
<div class="print-start">
  <table class="print-table" width="100%" style="border:1px solid #000; text-align:left">
    <thead>
      <tr>
      	<th style="border:1px solid #000;" class="col-md-1">Customer</th>
        <th style="border:1px solid #000;" class="col-md-1">Address</th>
        <th style="border:1px solid #000;" class="col-md-1">Invoice No</th>
        <th style="border:1px solid #000;" class="col-md-1">Product</th>
        <th style="border:1px solid #000;" class="col-md-1">Quantity</th>
        <th style="border:1px solid #000;"class="col-md-3">Remarks</th>
      </tr>
    </thead>
    <tbody>
        
         <?php 
    /*
    
     foreach($delivary_details as $del){
		        $invoice = $this->store_notes_model->get_store_note_info($del['stn_no']);
		        $sale_id = $invoice['sale_id'];
		        $sale_details= $this->Sales_Model->get_sale_info($sale_id);
		        $customer_details = array();
		        if(isset($sale_details['customer_id']))
        		$customer_details= $this->customer_model->get_customer_info($sale_details['customer_id']);
		        if(isset($customer_details['cus_name']))
    		        print_r($customer_details['cus_name']);
		    }
		*/
    
    ?>

      <?php
$totqty=0;

 foreach($delivary_stns as $key=>$del){
     if($del['issue_qty'] < 1)continue;
	$invoice = $this->store_notes_model->get_store_note_info($del['stn_no']);
    $sale_id = $invoice['sale_id'];
    $sale_details= $this->Pos_Model->get_sale_info($del['sale_id']);
    $customer_details = array();
    if($sale_details['customer_id'] == 1) continue;
    if(isset($sale_details['customer_id']))
	$customer_details= $this->customer_model->get_customer_info($sale_details['customer_id']);

?>
      <tr>
      	<td style="border:1px solid #000;"><input type="hidden" name="cus_id[]" value="<?php echo $customer_details['cus_id'];?>"><?php echo $customer_details['cus_name'];?><br><?php echo $customer_details['cus_phone'];?></td>
      	<td style="border:1px solid #000;"><input type="hidden" name="cus_id[]" value="<?php echo $customer_details['cus_id'];?>"><?php echo $customer_details['cus_address'];?></td>
        <td style="border:1px solid #000; text-align:center"><input type="hidden" name="sale_id[]" value="<?php echo $sale_details['sale_reference_no']?>"><?php echo $sale_details['sale_reference_no']?></td>        
        <td style="border:1px solid #000;"><input type="hidden" name="product_id[]" value="<?php echo $del['product_id']?>"><?php echo $del['product_name']?></td>
        <td style="border:1px solid #000; text-align:center"><input type="hidden" name="quantity[]" value="<?php echo $del['issue_qty']?>"><?php echo $del['issue_qty']?></td>
        <td style="border:1px solid #000;"></td>
      </tr>
      <?php }?>
    </tbody>
    <tfoot class="collapse">
      <tr class="tfoot active" id="tfoot">
        <th style="border:1px solid #000;" class="col-md-1">Customer</th>
        <th style="border:1px solid #000;" class="col-md-1">Address</th>
        <th style="border:1px solid #000;" class="col-md-1">Invoice No</th>
        <th style="border:1px solid #000;" class="col-md-1">Product</th>
        <th style="border:1px solid #000;" class="col-md-1">Quantity</th>
        <th style="border:1px solid #000;"class="col-md-3">Remarks</th>
      </tr>
    </tfoot>
  </table>
  <hr>
  
</div>
<div class="row">
</div>
<div class="col-xs-12 pull-right" id="border_print" style="border:0px solid #000;"><br>
  <br>
  Full Total :<br>
  <br>
  <br>
  Signature Issuing By :<br>
  <br>
  <br>
  Signature Check By :<br>
  <br>
  <br>
  Signature Receiving By : </div>
<div class="row text-center">
    භාණ්ඩ හොඳින්   පරීක්ෂා කර භාර ගතිමි
</div>

<!--print-start-->
</form>
</body>
