<?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">Rejection Invoice </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="#">Rejection Order</a>
                  </li>
                  <li class="breadcrumb-item active">Rejection Invoice 
                  </li>
                </ol>
              </div>
            </div>
          </div>
         
        </div>
        <div class="content-body"><section class="card">
  <div id="invoice-template" class="card-body p-4">
    <!-- Invoice Company Details 
    <div id="invoice-company-details" class="row">
      <div class="col-sm-6 col-12 text-center text-sm-left">
        <div class="media row">
          <div class="col-12 col-sm-3 col-xl-2">
            <img src="../../../app-assets/images/logo/logo-80x80.png" alt="company logo" class="mb-1 mb-sm-0" />
          </div>
          <div class="col-12 col-sm-9 col-xl-10">
            <div class="media-body">
              <ul class="ml-2 px-0 list-unstyled">
                <li class="text-bold-800">Modern Creative Studio</li>
                <li>4025 Oak Avenue,</li>
                <li>Melbourne,</li>
                <li>Florida 32940,</li>
                <li>USA</li>
              </ul>
            </div>
          </div>
        </div>
      </div>
      <div class="col-sm-6 col-12 text-center text-sm-right">
        <h2>INVOICE</h2>
        <p class="pb-sm-3"># INV-001001</p>
        <ul class="px-0 list-unstyled">
          <li>Balance Due</li>
          <li class="lead text-bold-800">$12,000.00</li>
        </ul>
      </div>
    </div>-->
    <!-- Invoice Company Details -->

    <!-- Invoice Customer Details 
    <div id="invoice-customer-details" class="row pt-2">
      <div class="col-12 text-center text-sm-left">
        <p class="text-muted">Bill To</p>
      </div>
      <div class="col-sm-6 col-12 text-center text-sm-left">
        <ul class="px-0 list-unstyled">
          <li class="text-bold-800">Mr. Bret Lezama</li>
          <li>4879 Westfall Avenue,</li>
          <li>Albuquerque,</li>
          <li>New Mexico-87102.</li>
        </ul>
      </div>
      <div class="col-sm-6 col-12 text-center text-sm-right">
        <p><span class="text-muted">Invoice Date :</span> 06/05/2019</p>
        <p><span class="text-muted">Terms :</span> Due on Receipt</p>
        <p><span class="text-muted">Due Date :</span> 10/05/2019</p>
      </div>
    </div>-->
    <!-- Invoice Customer Details -->

    <!-- Invoice Items Details -->
    <div id="invoice-items-details" class="pt-2">
      <div class="row">
        <div class="table-responsive col-12">
        <?php
          foreach($rejection as $rjn)
        ?>
          <table  class="table table-bordered zero-configuration rejection">
        <thead>
          <tr class="main_heading">
            <th colspan="10">Rejection Order View<span class="pull-right"><?php echo $rjn->user_name; ?></span></th>
          </tr>
          <tr class="data_details">
            
            <th colspan="2">GRN No : <?php echo $rjn->grn_no; ?></th>
            <th colspan="2">GRN Date : <?php echo $rjn->grn_date; ?></th>
            <th>RJN No : <?php echo $rjn->rejection_no; ?></th>
            <th colspan="2">RJN Date : <?php echo $rjn->rejection_date; ?></th>
            <th colspan="3">Supplier Name : <?php echo $rjn->vendor_name; ?></th>
          </tr>
          <tr class="data_heading">
            <th>Product Name</th>
            <th><strong>UOM</strong></th>
            <th>GRN Qty</th>
            <th>GRN Price</th>
            <th>RJN Qty</th>
            <th>Price</th>
            <th>Tax</th>
            <th>Amount</th>
            <th>Remarks</th>
          </tr>
        </thead>
        <tbody>
          <?php
            
            $count = 1;
            foreach($rejection_item as $data){
                
              ?>
              <tr class="data_list">
                <td><?php echo $data->grn_item; ?></td>
                <td><?php echo $data->uom; ?></td>
                
                <td><?php echo $data->grn_item_qty; ?></td>
                <td><?php echo $data->grn_item_price; ?></td>
                <td><?php echo $data->rejection_qty; ?></td>
                <td><?php echo $data->rejection_price; ?></td>
                <td><?php echo $data->rejection_tax; ?></td>                 
                <td><?php echo $data->rejection_total_amount; ?></td>
                <td><?php echo $data->rejection_remarks; ?></td>
              </tr>
              
          <?php $count++; } ?>
          <?php
            
              foreach($rejection_sum_amount as $rdata){
            ?>
            <tr>
              <td colspan="7" >Total Amount</td>
              <td ><?php echo $rdata->sum_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>
    
      <div id="image_preview"></div>
      <div class="doc_viewer">
        <!--<iframe id="viewer" frameborder="0" scrolling="yes" width="950" height="500"></iframe>-->
        <img id="viewer" />
      </div>
  </div>
</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/rejection_list/'.$sub_mod_id);?>';
  } 
</script>