<?php
    include('common/header.php');
?>
<div class="row">
  <section class="panel panel-default">
     <header class="panel-heading bg-info lt font-bold">
         Refill Transaction Details
     </header>

    <div class="panel-body bs-example form-horizontal">
        <div class="col-sm-3" >  </div>
     <div class="col-sm-6" >  
                 
        <div class="table-responsive">
            <table cellspacing="0"class="table table-bordered table-condensed">
                <tr>
                   <td>Customer Name</td>
                   <td><?php echo $customer_name; ?></td>
                </tr>  
                 <tr>
                   <td>Dispenser Name</td>
                   <td><?php echo $dispenser_product_name; ?></td>
                </tr> 
                <!--  <tr>
                   <td>Total Quantity</td>
                   <td><?php echo $dispenser_quantity; ?></td>
                </tr>  -->
            </table>
        </div>
    </div>
       
        
      

    </div>
  </section>
</div>

<div class="row">
    <div class="col-xs-12">
        <section class="panel panel-default">
             <div class="panel-body bs-example form-horizontal">
        <div class="table-header">
            
        </div>
       
                
        <div class="table-responsive">
        <table  id="example" cellspacing="0" width="100%" class="table table-bordered table-condensed">
            <thead>
                <tr>
                    <th class="text-center" style="color: black;">Sr no</th>
                <!--        <?php foreach($fields as $field_name => $field_display): ?>
            <th <?php if ($sort_by == $field_name) echo "class=\"sorting_$sort_order\"" ?>>
            <?php echo anchor("gc/master_sale_data_report/refill_sale_data_report/$id/$customer_id/$query_id/$field_name/" .
            (($sort_order == 'asc' && $sort_by == $field_name) ? 'desc' : 'asc') ,
            $field_display); ?>     </th>
          <?php endforeach; ?> -->

                    <th class="text-center" style="color: black;">Refill Name</th>
                    <th class="text-center" style="color: black;">Quantity</th>
                    <th class="text-center" style="color: black;">Programming Duration Days</th>
                    <th class="text-center" style="color: black; width: 110px;">Refill Date</th>
                    <th class="text-center" style="color: black; width: 110px;">Next Due Date</th>
                    <th class="text-center" style="color: black; width: 110px;">Is Returned</th>
                    <th class="text-center" style="color: black; width: 110px;">Is Stop</th>
                    <th class="text-center" style="color: black;">Comments</th>
                   
                </tr>   
            </thead>
            <tbody>
                <?php 
                 //$icnt=0;
                $count=count($refill_transaction);
        
              // if ($count>0) {
                  $sr=1;
                foreach ($refill_transaction as $value) {
                    $product_name=$value['product_name'];
                    $quantity=$value['quantity'];
                    $duration_days=$value['duration_days'];
                    $refill_date=$value['refill_date'];
                    $next_refill_date=$value['next_refill_date'];
                    $comments=$value['comments'];
                    $stop_refill=$value['stop_refill'];
                    $is_returned=$value['is_returned'];
                    $dispenser_return_comments=$value['dispenser_return_comments'];
                    // $icnt++;
                    // $sr=$offset+$icnt;
                    // $sr=$offset+$icnt;

                    ?>        
                <tr>
                    <td class="text-center"><?php echo $sr; ?></td>
                    <td class="text-center"><?php echo $product_name;?></td>
                    <td class="text-center"><?php echo $quantity;?></td>
                    <td class="text-center"><?php echo $duration_days;?></td>
                    <td class="text-center"><?php echo $refill_date;?></td>
                    <td class="text-center"><?php echo $next_refill_date;?></td>
                    <td class="text-center"><?php echo $is_returned;?></td>
                    <td class="text-center"><?php echo $stop_refill;?></td>
                    <td>
                          <?php if ($is_returned=='yes' &&  $stop_refill=='no'){
                            echo $dispenser_return_comments;
                          }else if($is_returned=='no' &&  $stop_refill=='yes'){
                            echo $comments;
                          }else if($is_returned=='yes' &&  $stop_refill=='yes'){
                            echo $comments;
                          }else{
                            echo $comments;
                          }?>
                        </td>

                </tr> 
               <?php 
               $sr=$sr+1;
               }
           
          
             
             ?>
        </tbody>
        </table>
     
        </div>
    <!--                <?php
     if($num_results > 0) { ?>
      <div class="block"> </div>
        <div class="clearfix">
        <div class="row">
          <?php 
            if (strlen($pagination)): 
              $label_disp="List Of Refill Transaction";
              $data['label_disp']=$label_disp;
              $data['count']=$count;
              $this->load->view('pagination_view.php',$data);
            endif; ?>
            </div>
        </div>
          <div class="block"> </div>
      <?php } ?> -->
</div>
   
    
</section>
          
        <div class="clearfix form-actions">
          <div class="col-md-offset-5 col-md-5">
            <button class="btn btn-info" type="button" onclick="javascript:window.history.back();" >
                Back
            </button>           
          </div>
    </div>
    </form>
    </div>
</div>
<div>
    <!-- /.page-row -->
    <!-- /.page-content --> 
</div>
<!-- /.main-content --> 
</div>
<!-- /#ace-settings-container --> 
</div>
<!-- /.main-container-inner --> 
<?php
    include('common/footer.php');
?>
<script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable( {
    destroy: true,
    searching: true,
    ordering: false,
    "lengthMenu": [20, 40, 60, 80, 100],
    "pageLength": 20,
    "order": [],
    "columnDefs": [
      { "orderable": false, "targets":  [] }
      ]
  } );
});
</script> 
