<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_file);
	$sidenav_file=APPPATH.'views/include/sidenav.php';
	require($sidenav_file);	?>
<!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row">
          <div class="content-header-left col-md-6 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">BOM</h3>
            <div class="row breadcrumbs-top d-inline-block">
              <div class="breadcrumb-wrapper col-12">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="#">Home</a>
                  </li>
                  <li class="breadcrumb-item"><a href="#">BOM</a>
                  </li>
                  <li class="breadcrumb-item active">BOM View
                  </li>
                </ol>
              </div>
            </div>
          </div>
         
        </div>
        <div class="content-body"><section class="card">
  <div id="invoice-template" class="card-body p-4">
    <!-- Invoice Items Details -->
    <div id="invoice-items-details" class="pt-2">
      <div class="row">
        <div class="table-responsive col-12">
          <table class="table table-bordered zero-configuration">
            <thead>
                <?php
					foreach($bomview as $bm)
				?>
				<tr>
					<th>BOM No : <?php echo $bm->bill_id; ?></th>
					<th>Yeild : <?php echo $bm->actual_yeild; ?></th>					
					<th>Batch : <?php echo $bm->actual_batch; ?></th>
					<th>Date : <?php echo $bm->orderdate; ?></th>
				</tr>
                <tr>
                    <th colspan="2">Product Name : <?php echo $bm->pname; ?></th>
					<th colspan="2">Chef : <?php echo $bm->chef; ?></th>	
                </tr>
			
				<tr>
					<th class="non-printable fs">Product Id</th>
					<th class="fs">Item Name</th>
					<th class="non-printable fs">UOM</th>
					<th class="fs">Quantity</th>
				</tr>
			</thead>
        <tbody>
             <?php
			$count=1;
				foreach($bomview as $bitem){
				    $tqty = $bitem->quantity;
					$ttqty = number_format($tqty, 3, '.', '.');
					$tprice = $bitem->price;
					$ttprice = number_format($tprice, 3, '.', '.');
			?>
				<tr class="data_list">
					<td class="non-printable fs"><?php echo $count;?></td>
					<td class="fs">
					<?php echo $bitem->iname;?></td>
					<td class="non-printable fs"> 
					<?php echo $bitem->iuom;?></td>
					<td class="fs"> <?php echo $ttqty;?></td>
				</tr>
			<?php 
				$count++; 
				} 
			?>
			</tbody>
          </table>
        </div>
      </div>
  
    </div>

    <!-- Invoice Footer -->
    <div id="invoice-footer">
      <div class="row">
        <div class="col-sm-7 col-12 text-center text-sm-left">
          <!--<h6>Terms & Condition</h6>
          <p>Test pilot isn't always the healthiest business.</p>-->
        </div>
        <div class="col-sm-5 col-12 text-right">
          <button type="button" id="print_receipt" class="btn btn-info btn-lg my-1"><i class="fa ft-printer"></i></i>
            Print
            Invoice</button>
        </div>
      </div>
    </div>
    <!-- Invoice Footer -->

  </div>
</section>
</section>
<!-- // Basic form layout section end -->
        </div>
      </div>
    </div>
    <?php //require('include/theme_customizer.php');?>

   <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>
<script>
	$("#print_receipt").click(function() {
		window.print();
		setTimeout("closePrintView()", 50);
	});
	function closePrintView() {
		window.location = '<?php echo site_url('Production/bom');?>';
	} 
</script>
	