<?php include("sass/icon_for_datepicker_and_datatable.php");?>
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <?php include("sass/sidebar.php");?>

            <!-- Right side column. Contains the navbar and content of the page -->
               <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                       <?php echo $company_name ; ?>
                        <small>Control panel</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li class="active">Dashboard</li>
                    </ol>
                </section>
                 <section class="content">
                 	 <div class="row">
                        <div class="col-md-12">
                         
                         
                         <div class="box">
                                <div class="box-header">
                                    <h3 class="box-title">Reorder List</h3>
                                </div><!-- /.box-header -->
                                <div class="box-body table-responsive">
                                    <table id="example1" class="table table-bordered table-striped">
                                        <thead>
                                            <tr>
                                                <th>Product Name</th>
                                                <th>Present Stock</th>
                                                <th>Re-Order Limit</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            
												<?php
                                                
                                                $query = "SELECT * FROM product_setup INNER JOIN present_stock
ON product_setup.product_id=present_stock.product_id WHERE present_stock.present_stock < product_setup.stock_limit and present_stock.branch_id  = '$branch_id_for_header_user'";
                                                $result = mysqli_query($connection,$query);
                                                 
                                                $i=0;
                                                while($row=mysqli_fetch_array($result))
                                                {
                                                $i++;
                                                $product_id = $row['product_id'];
                                                $product_name = $row['product_name'];
                                                $result_for_ps = mysqli_query($connection,"SELECT * FROM present_stock WHERE product_id  = '$product_id' AND branch_id  = '$branch_id_for_header_user'");
		$test_for_ps = mysqli_fetch_array($result_for_ps);
				
				$present_stock=$test_for_ps['present_stock'];
												
                                               $unit_type_id = $row['unit_type_id'];
											    $stock_limit = $row['stock_limit'];
												
												$result_for_unit_type = mysqli_query($connection,"SELECT * FROM unit_type WHERE unit_type_id  = '$unit_type_id'");
		$test_for_unit_type = mysqli_fetch_array($result_for_unit_type);
				
				$unit_type_name=$test_for_unit_type['unit_type_name'];
				
				
												
												$present_stock_sum[] = $row['present_stock'];
                                                
                                                echo "<tr>";
                                                echo "<td>$product_name</td>";
                                                echo "<td>$present_stock $unit_type_name";  echo "</td>";
                                                echo "<td>$stock_limit</td>";
                                                echo "</tr>";
                                                }
                                                
                                                ?>
                                         
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <th>Product Name</th>
                                                <th>Present Stock</th>
                                                <th>Re-Order Limit</th>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </div><!-- /.box-body -->
                            </div>
                         
                         </div>
                    </div>
                 
                 
                 </section>
                </aside>
                <!-- /.right-side -->
        </div><!-- ./wrapper -->

        <!-- add new calendar event modal -->


        <!-- jQuery 2.0.2 -->
          <?php include("sass/footer_for_datepicker_and_datatable.php");?>

    </body>
</html>