<?php 
  $header_file=APPPATH.'views/include/header.php';
  require($header_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-12 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">Present Stock</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="#">Product Stock Management</a>
                  </li>
                  <li class="breadcrumb-item active">Present Stock
                  </li>
                </ol>
              </div>
            </div>
          </div>
        
        </div>
        <div class="content-body"><!-- Zero configuration table -->
<section id="configuration">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-content collapse show">
                    <div class="card-body card-dashboard">
                       <form method="post" autocomplete="off" action="<?php echo site_url('PStockManagement/searchCPresentStock/');?>" method="POST">
                            <div class="row justify-content-md-center">
                                <div class="col-md-4">
                                  <div class="form-group">
                                    <select id="branch" name="branch" class="form-control select2" >
                                      <option value="">Branch</option>
                                      <?php  foreach($branch as $row)
                                        {
                                      ?>
                                        <option value="<?php echo $row->branch_name; ?>"><?php echo $row->branch_name; ?></option>
                                      <?php
                                        } 
                                      ?>
                                    </select>
                                  </div>
                                </div>
                                <div class="col-md-2">
                                  <div class="form-group">
                                    <input type="submit" name="submit" class="btn btn-primary" value="Search">
                                  </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="card" >
                <div  class="card-body p-4">
                    <div class="card-content collapse show">
                        <div class="card-dashboard"> 
             
                        <div class="table-responsive">
              <?php 
          if (isset($result_display)) {
            //echo "<p><u>Result</u></p>";
            if ($result_display == 'No record found !') {
              echo $result_display;
              } else {
            ?>

            <?php if($_POST['branch']!=""){ ?>
            
           
                <div class="row">
                    <div class="col-md-3">
                      <div class="form-group">
                          <input class="form-control" type="text" name="branchs"  id="branchs" value="<?php echo $_POST['branch']; ?>" readonly >
                       </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <select id="category_name" name="category_name" class="form-control select2" >
                          <option value="">Select category</option>
                          <?php  foreach($category as $cat)
                            {
                          ?>
                            <option value="<?php echo $cat->pr_cat_name; ?>" ><?php echo $cat->pr_cat_name; ?></option>
                            <?php
                            }
                          ?>
                        </select>
                      </div>
                    </div>
                  </div>
                <table class="table table-striped table-bordered dataex-html5-export">
                  <thead>
                    <tr>
                        <th>Category</th>
                      <th>Product Name</th>
                      <th>UOM</th>
                      <th>Stock</th>
                      <th>Price</th>
                    </tr>
                  </thead>
                  <tbody id="cfilter">
                    <?php
                        $count =1;
                        if(isset($result_display) && is_array($result_display) && count($result_display)): $i=1;
                      foreach ($result_display as $data) { 
                        
                      ?>
                        <tr>
                            <td><?php echo $data->pr_cat_name; ?></td>
                          <td><?php echo $data->rname; ?></td>
                          <td><?php echo $data->uom; ?></td>
                          <td><?php echo $data->production_stock; ?></td>
                          <td><?php echo $data->total_price; ?></td>
                      </tr>
                        <?php
                $count++;
              }
              
              ?>
              <?php else:
                ?>
                <tr>
                  <td colspan="7" align="center" >No Records Found..</td>
                </tr>
                <?php
                  endif;
                ?>
              </tbody>
              </table>
              
                       
            
                    
                
              </div>
              <br/>
              <form method="post" action="<?php echo site_url('PStockManagement/export_PrPresent/');?>">
                <div class="uk-width-medium-1-4">
                  <div class="uk-input-group">
                    <input class="form-control" type="hidden" name="branchname" value="<?php echo $_POST['branch']; ?>">
                    <input type="submit" name="export_stk_ondate" class="btn btn-info" value="Export">
                  </div>
                </div>
              </form>
             <?php  
            }
          } 

        }
        
        ?>
                      </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!--/ Zero configuration table -->



<!--/ Language - Comma decimal place table -->

        </div>
      </div>
    </div>
    <!-- END: Content-->

   <?php //require('include/theme_customizer.php');?>
 <?php 
  $footer_file=APPPATH.'views/include/footer.php';
  require($footer_file);
  ?>
<script>
  $('.param_check').each(function() { $(this).on( {'click contextmenu': function() {
    //contextmenu
    var i = $(this).data('value');
    var anchor = $("a");
    var anchorTarget = $(this).parent().find('.parmetre').val();
    var submodid = $(this).parent().find('.submod_id').val();
    var link = $(this).attr('href');
    $(this).attr("href", link + submodid +'/'+anchorTarget);

    location.reload();
  }
  })
  })
</script> 
<script>
    $(document).ready(function(){
      $("#category_name").on("change", function() {
        var value = $(this).val().toLowerCase();
        //alert(value);
        $("#cfilter tr").filter(function() {
          $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
      });
    });
</script> 
  </body>
  <!-- END: Body-->

<!-- Mirrored from pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-modern-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Apr 2020 09:38:02 GMT -->
</html>