<?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">
h3 {
	margin-top: 10px;
}
th {
	text-align: center !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()">
    <div class="col-xs-12">
<div class="row">
<div class="col-xs-12 text-center">
<p>
    <h3> BOM </h3>
<!--<h5> <?php echo  $master_details['warehouse_name']; ?> </h5>-->
<!--<h6> <?php echo  $master_details['address']; ?> </h6>-->
<!--<h6> <?php echo  $master_details['phone']; ?> </h6>-->

</P>
</div><!--col-xs-12-->
</div><!--row-->
<div class="row">
  <div class="col-xs-12">
    <div class="col-xs-6" style="border:solid 1px;">       
        <table class="print-table" width="100%" style="border:none">
        <tr>
          <td > BOM NO  </td>
          <td > : <?php echo $master_details['psnm_ref_no']; ?></td>
        </tr>
        <tr>
          <td > Document NO </td>
          <td > : <?php echo $master_details['psnm_manual_ref_no']; ?></td>
        </tr>
       
        <tr>
          <td > Date Time</td>
          <td > : <?php echo $master_details['psnm_date_time']; ?></td>
        </tr>
       
        <tr>
          <td > Prepare By </td>
          <td > : <?php echo $master_details['user_first_name']; ?></td>
        </tr>
      </table>
        
        

    </div>
    <div class="col-xs-6 pull-right">
      <table class="print-table" width="100%" style="border:none">
        <tr>
          <td style="border:1px solid #000"> Location </td>
          <td style="border:1px solid #000"> <?php echo  $master_details['warehouse_name']; ?></td>
        </tr>
        <tr>
          <td style="border:1px solid #000"> Time </td>
          <td style="border:1px solid #000"> ( DAY / NIGHT )</td>
        </tr>
        <tr>
          <td style="border:1px solid #000"> Pick-up On </td>
          <td style="border:1px solid #000"><?php if($master_details['psnm_pickup_status']==1){echo $master_details['psnm_pickup_on'];}else{ echo "";}  ?></td>
        </tr>
         <tr>
          <td style="border:1px solid #000"> Pick-up By </td>
          <td style="border:1px solid #000"><?php if($master_details['psnm_pickup_status']==1){echo $master_details['pickup_by'];} ?></td>
        </tr>
      </table>
    </div>
  </div>
</div>
<!--lorry rep; due date;--> 
<br>
<div class="print-start" style="border:solid 1px; " ><!-- min-height:560px;-->
    <h5 class="text-center">Ingredientscc Items</h5>
  <table class="print-table" width="100%" style="border:none">
    <thead>
      <tr class="report_view_th text-center"  style="border:1px solid #000">
        <th style="border:1px solid #000; width:40px;" class='width_cus'>
          No</th>
        <th class="col-xs-5" style="border:1px solid #000">
          Description</th>
          
        <!--  <th style="border:1px solid #000";>
          Type</th>
          
          <th style="border:1px solid #000";>
          Unit</th> -->
        <th  style="border:1px solid #000";>
          Qty</th>
      </tr>
    </thead>
    <tbody>
      <?php 
 $tmpcount=0;
  foreach ($items_details as $row)
 {
	 $tmpcount++; ?>
      <tr style="line-height:18px">
        <td style="text-align:center; vertical-align:middle; border:none"><?php echo $tmpcount ?>)</td>
        <td  ><?php echo $row['product_mat_name']; ?>
          <?php echo $row['product_mat_code']; ?></td>
          <!--<td  ><?php echo $row['mpt_name']; ?></td>
          <td  ><?php echo $row['unit_name']; ?></td>-->
        <td style="text-align:right; vertical-align:middle; border:none"><strong><?php echo number_format($row['pbis_qty'], 3, '.', ','); ?></strong></td>
      </tr>
      <?php }?>
    </tbody>
  </table>
</div>
<br>
    <div class="print-start" style="border:solid 1px; " ><!-- min-height:560px;-->
    <h5 class="text-center">Production Items</h5>
  <table class="print-table" width="100%" style="border:none">
    <thead>
      <tr class="report_view_th text-center"  style="border:1px solid #000">
        <th style="border:1px solid #000; width:40px;" class='width_cus'>
          No</th>
        <th class="col-xs-3" style="border:1px solid #000">
          Description</th>
          
        <!--  <th style="border:1px solid #000";>
          Type</th>
          <th style="border:1px solid #000";>
          Unit</th>-->
        <th  style="border:1px solid #000";>
          Required  Qty</th>
          <th  style="border:1px solid #000";>
          Output Qty</th>
          <th  style="border:1px solid #000";>
          Wastage Qty</th>
      </tr>
    </thead>
    <tbody>
      <?php 
 $tmpcount=0;
  foreach ($production_items_details as $row)
 {
     $p_item_all_quntity=0;//$this->Production_Material_In_Out_Model->runGetSumAllSTNProductionActualCount($row['product_id'],$master_id);
	 $tmpcount++; ?>
      <tr style="line-height:18px">
        <td style="text-align:center; vertical-align:middle;border: 1px solid black;"><?php echo $tmpcount ?>)</td>
        <td style="border: 1px solid black;" ><?php echo $row['product_name']; ?>
          <?php echo $row['product_code']; ?>  : <?php echo $row['pbi_ref_no']; ?> : <?php echo $row['bri_note']; ?> </td>
         <!-- <td style="border: 1px solid black;" ><?php echo $row['mpt_name']; ?></td>
          <td  style="border: 1px solid black;"><?php echo $row['unit_name']; ?></td>-->
        <td style="text-align:center; vertical-align:middle;border: 1px solid black;"><strong><?php echo number_format($row['pbi_qty'], 3, '.', ','); ?></strong></td>
        <td style="text-align:center; vertical-align:middle;border: 1px solid black;"><strong></strong></td>
        <td style="text-align:center; vertical-align:middle;border: 1px solid black;"><strong></strong></td>
      </tr>
      <?php }?>
    </tbody>
  </table>
</div>
    

    
   </div>
  
</div>
 <!--col-xs-12-->
 <div class="col-xs-12">
     <br>
     <div class="col-xs-12" id="border_print" style="border:1px solid #000;">
     <p class="text-center"><strong>Note</strong> <br><?php echo $master_details['psnm_note'];  ?></p>
   </div>
  
  <div class="col-xs-2" style="border-top:dashed 1px; margin:50px 5px 0px 25px">
     <center>
      Printed By (<?php echo $this->session->userdata('ss_user_first_name')." ". $this->session->userdata('ss_user_last_name') ?>)
    </center>
   </div>
  <div class="col-xs-2" style="border-top:dashed 1px; margin:50px 5px 0px 25px">
     <center>
      Checked By
    </center>
   </div>
  <div class="col-xs-2" style="border-top:dashed 1px; margin:50px 5px 0px 25px">
     <center>
      Issued By 
    </center>
   </div>
  <div class="col-xs-2" style="border-top:dashed 1px; margin:50px 5px 0px 25px">
     <center>
      Recived By
    </center>
   </div>
</div>
 <div class="col-xs-12">
  <!--<p class="text-center" style="font-size:17px;">
     <strong>Thank You! </strong></p>-->
</div>

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