<?php session_start();  if(!isset($_SESSION['sales'])){ 

print"<script> window.location='login'  </script>";
    header('location:login.php'); die();}
include 'xyz.php';



   ?>
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="">
<meta name="author" content="">

    <title>My Outlet</title>
    <?php  include 'inc/toplinks.php';  ?>
</head>
<body id="page-top"><div id="wrapper"><?php  include 'inc/menus.php';  ?>

        

<?php include 'inc/top.php';   ?>



                <!-- End of Topbar -->

                <!-- Begin Page Content -->
                <div class="container-fluid">

                    <!-- Page Heading -->
                    <div class="d-sm-flex align-items-center justify-content-between mb-4">
<?php  include 'inc/greet.php';  ?><?php  include 'process.php';  ?>

                       <!--  <a href="#" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i
                                class="fas fa-download fa-sm text-white-50"></i> Generate Report</a> -->
                    </div>

                    <!-- Content Row -->
                    <div class="row">

<?php $query ="SELECT * FROM products ORDER by item_name DESC";$selCrs=$lucas=$range='';?>
<div class="col-md-12">
<div class="card shadow mb-4">  <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between bg-success text-white"><h6 class="m-0 font-weight-bold text-white">#STOCK & PRICE PREVIEW</h6></div><div class="card-body">


<div class="row d-block d-md-none">
<?php $countd=1; 
foreach(QueryDB($query)as $reg_std){ //$stk=lastStock(,'','');
$stk =lastStock_perBranch($reg_std['id'],'','',$my_branch_code);
?>
<div class="col-md-12 float-right mb-2" style="border:1px dotted gray;box-shadow: 2px 3px 4px gray;min-height:100px;">
<div class="row small">
<div class="col-10"><b><?php echo strtoupper($reg_std['item_name']);  ?></b> <br><?php echo $sized_by[$reg_std['size']];  ?>,<?php echo $colored_by[$reg_std['color']];  ?></div>
<div class="col-2"><span class="badge text-white bg-success"><?php echo $countd; ?></span>&nbsp;</div>
<div class="col-12">
    <?php  echo explode(',',$reg_std['item_img'])[0];
  
if(file_exists(explode(',',$reg_std['item_img'])[0])){
    $view_sel_img =explode(',',$reg_std['item_img'])[0];
echo '<img src="'.$view_sel_img.'" class="img img-thumbnail" style="width:150%;height:100px">';}

  ?> 
</div>
<div class="col-12"><?php echo $brand[$reg_std['brand']];  ?>,<?php echo $company[$reg_std['company']];  ?></div>
<div class="col-9"><b>LStk:</b> <?php echo @date('Y-m-d',$stk['item_time']);?>&nbsp;&nbsp; (<b><?php echo @$stk['item_qty'];?></b>)</div> <div class="col-3"><b>TS:</b> <?php echo totalStock_branch($reg_std['id'],'','',$my_branch_code);  ?> </div>
<div class="col-6 stylefont"><b>Total Sold: <?php echo getQuantity_Branch($reg_std['id'],'','',$my_branch_code);  ?></b></div>
<div class="col-6 stylefont"><b>LEFT: <?php echo totalStock_branch($reg_std['id'],'','',$my_branch_code)-getQuantity_Branch($reg_std['id'],'','',$my_branch_code);  ?></b></div>
</div>

    
    
</div>
<?php $countd++; } ?>
</div>


<!-- d-none d-md-block -->
<div class="table-responsive small">

<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead><tr><th>#</th><th>Item Name</th><th><i class="fa fa-camera"></i></th><th>S/C</th><th>B/C</th><th>Cost</th><th>LStk Date</th><th>Lstk Suply No</th><th>TOTAL STOCK</th><th>T-SOLD</th><th>AVAILABLE</th></tr></thead>
<tbody>
<?php
$count=1; 
foreach(QueryDB($query)as $reg_std){ 
$stk =lastStock_perBranch($reg_std['id'],'','',$my_branch_code);


    ?>
<tr><td class=" text-dark"><?php echo $count++; ?></td><td class=" text-dark"><b><?php echo strtoupper($reg_std['item_name']);  ?></b></td>

<td>
  <?php  //echo explode(',',$reg_std['item_img'])[0];

if(file_exists(explode(',',$reg_std['item_img'])[0])){
    $view_sel_img =explode(',',$reg_std['item_img'])[0];
echo '<img src="'.$view_sel_img.'" class="img img-thumbnail" style="width:150%;height:100px">';}

  ?>  
</td>
    <td class=" text-dark"><?php echo $sized_by[$reg_std['size']];  ?>,<?php echo $colored_by[$reg_std['color']];  ?></td><td class=" text-dark">
    <?php echo $brand[$reg_std['brand']];  ?>,<?php echo $company[$reg_std['company']];  ?></td>
<td class=" text-dark"><?php echo number_format($reg_std['item_cost'],2);?></td>
<td class=" text-dark">
<?php echo @date('Y-m-d',$stk['item_time']);?></td>
<td><?php echo @$stk['item_qty'];  ?></td>
<td class=""><?php echo totalStock_branch($reg_std['id'],'','',$my_branch_code);  ?></td>
<td class=""><?php echo getQuantity_Branch($reg_std['id'],'','',$my_branch_code);  ?></td>
<td class=""><?php echo totalStock_branch($reg_std['id'],'','',$my_branch_code)-getQuantity_Branch($reg_std['id'],'','',$my_branch_code);  ?></td>
</tr><?php  } ?></tbody></table></div></div></div></div>


                     
                       
                      
                    </div>


                    <!-- Content Row -->
               

                </div>
                <!-- /.container-fluid -->

            </div>
            <!-- End of Main Content -->

            <!-- Footer -->
        <?php include 'inc/foot.php';  ?>

<?php include 'inc/modals.php'; include 'inc/bottom.php';    include 'js/foot_links.php';?>






</body>

</html>