<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>


<div id="myID" style="">

     
    <table width="100%" id="mytable" class="responsive">  

    <thead>
    <tr>

 <th class="thStyle" style="padding:6px 5px;width: 30%;"> Product Details</th>
 <th class="thStyle" style="padding:6px 5px;"> Quantity  </th>
 <th class="thStyle" style="padding:6px 5px;"> Cost Price  </th>
 <th class="thStyle" style="padding:6px 5px;"> Sale Price  </th>
 <th class="thStyle" style="padding:6px 5px;"> Balance  </th>


  </tr>
  </thead>

  <tbody>


    <?php 

$branch_id=$_SESSION['branch'];
$comboID=$_REQUEST['combo_type'];

  $sql="SELECT * FROM eduportal_canteen_combo_details WHERE combo_id='$comboID' and branch_id='$branch_id'";
//print_r($sql);
$WorkAssignListings = $m->query($sql);

$counter=0;

foreach($WorkAssignListings as $productDetails)
{  

  $m->where("product_id", $productDetails['product_id']);
  $m->where("branch_id", $_SESSION['branch']);
  $Products = $m->get("eduportal_product_config");

        ?>
      
      <tr>

            
            <td id="pro_row">   
            <select name="product_id[]" id="product_id" class="form-control">

            <option value="">Select Product </option>                

                <?php
                $m->where("branch_id", $_SESSION['branch']);
                $WorkAssignList = $m->get("eduportal_product_config");
                foreach($WorkAssignList as $WorkAssignListVal)
                { ?>

                   <option <?php if($productDetails['product_id']==$WorkAssignListVal['product_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['product_id']; ?>"><?php echo $WorkAssignListVal['product_name']; ?></option>

                <?php } ?>

            </select>                             
              
            </td>
            
            <input type="hidden" name="stock[]" id="stock" value="<?php echo $stock; ?>" />

            <td> <input class="form-control" value="<?php echo $productDetails['product_quantity']; ?>" name="quantity[]" 
            id="quantity" type="text" /></td>


            <td>  
             <input class="form-control" name="cost_price[]"
             id="cost_price" value="<?php echo $Products[0]['unit_cost']; ?>"  type="text" />           

             </td>

             <td>  

             <input class="form-control" name="sale_price[]"
             id="sale_price"  value="<?php echo $Products[0]['sale_price']; ?>"  type="text" />            

             </td>

             
             <td>  

             <input class="form-control" name="balance[]"
             id="balance"  value="<?php echo $productDetails['product_quantity']*$Products[0]['sale_price']; ?>"  type="text" />            

             </td>
            
            
          </tr>

<?php 

 }  ?>

</tbody>
</table>

<!-- <input  type="submit"style="font-size:18px;margin-top: 29px;float: right;"  value="Submit" class="btn btn-success"> -->

</div>
