<?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">Maintainance </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="#">Maintainance Invoice</a>
                  </li>
                  <li class="breadcrumb-item active">Maintainance Invoice 
                  </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 ">
		  <?php
					foreach($mnt_grn as $mnt)
				?>
						<h4 class="heading_a uk-margin-bottom print_receipt" >Maintainance Product GRN<span class="pull-right"><?php echo $mnt->user_name; ?></span></h4>
						<thead>
							<tr>
								<th colspan="2" >GRN No : <?php echo $mnt->m_grn_no; ?></th>
								<th colspan="2" >GRN Date : <?php echo $mnt->grn_date; ?></th>
								<th colspan="2">Supplier Name : <?php echo $mnt->vendor_name; ?></th>
								<th colspan="2" >Invoice : <?php echo $mnt->invoice_no; ?></th>
							</tr>
							<tr>
								<th><strong>Product Name</strong></th>
								<!--<th><strong>UOM</strong></th>-->
								<th><strong>Qty</strong></th>
								<th><strong>Price</strong></th>
								<th><strong>Tax (%)</strong></th>
								<th><strong>Tax Amount</strong></th>
								<th><strong>Total Amount</strong></th>
								<th><strong>Remarks</strong></th>													
							</tr>
						</thead>
						<tbody>
						 <?php
						 $count=0;
							foreach($mnt_grn_item as $mitem){
						?>
									<tr>
										<td><?php echo $mitem->m_item_name; ?></td>
										<!--<td><?php //echo $row1['unit_measurement']; ?></td>-->
										<td><?php echo $mitem->m_item_qty; ?></td>
										<td><?php echo $mitem->m_item_price; ?></td>
										<td><?php echo $mitem->m_tax; ?></td>
										<td><?php echo $mitem->m_tax_amount; ?></td>
										<td><?php echo $mitem->m_total_amount; ?></td>
										<td><?php echo $mitem->m_remarks; ?></td>												
									</tr>
									<?php
									}
								?>  
							<?php $count++; ?>	
							<?php
								foreach($mnt_grn_total_sum as $mgitem){
									
							?>
								<tr>
									<td colspan="4" >Total Amount</td>
									<td ><?php echo $mgitem->m_tax_amount; ?></td>
									<td ><?php echo $mgitem->m_total_amount; ?></td>
									<td></td>
								</tr>
								<?php
								}
							?>
						</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 print_receipt  btn-sm my-1"><i class="fa ft-printer"></i></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('Maintainance/mnt_grn_list');?>';
	} 
</script>
	