<?php
	$filename = 'Return Dispenser List'. date('Y_m_d_h_i_s') .".xls";
	header("Content-type: application/octet-stream");
	header("Content-Disposition: attachment; filename=\"$filename\"");
	header("Content-Type: application/xls");
?>
   <div class="">
    <div><b>Searched Results</b></div>
                                    <!-- PAGE CONTENT BEGINS -->
                                    <?php if($customer_name!=""){?>
                                    <div class="form-group">  
                                        <label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'Customer Name';?> :</label>  <?php echo $customer_name;?>
                                        
                                        
                                    </div>
                                     <?php }?>
                                    
                                     
    </div>
    <table id="example" cellspacing="0" width="100%" class="table table-bordered table-condensed">
                          <thead>
                            <tr>
                              <th class="text-center">Sr no</th>
                              <th class="text-center">Customer Name</th>
                              <th class="text-center">Dispenser Name</th>
                              <th class="text-center">Sale Type</th>
                              <th class="text-center">Branch Name</th>
                              <th class="text-center">Sale Person Name</th>
                              <th class="text-center">Refill Date</th>
                              <th class="text-center">Next Refill Date</th>
                              <!--<th class="text-center">Comments</th>-->
                              <th class="text-center">Tracking Number</th>
                              <th class="text-center">Returned</th>
                            </tr>   
                          </thead>
                          <tbody>
                            <?php 
                            $srno=1;
                            if (!empty($return)) {
                            foreach ($return as $value) {?>        
                             <tr>
                               <td class="text-center" ><?php echo $srno; ?></td>
                               <td class="text-center" style="text-align: center;"><?php echo $value['customer_name'];?></td>
                               
                               <td class="text-center" style="text-align: center;"><?php echo $value['dispenser'];?></td>
                               <td class="text-center" style="text-align: center;"><?php echo $value['sales_type'];?></td>
                               <td class="text-center" style="text-align: center;"><?php echo $value['company_branch_name'];?></td>
                               <td class="text-center" style="text-align: center;"><?php echo $value['first_name']." ".$value['last_name'];?></td>
                                <td>
                                   <?php 
                                if ($value['refill_date']=='0000-00-00') {?>
                                <label><?php echo $value['refill_date']; ?></label><?php }else{?>
                                <label><?php echo get_date_dmy_format_wo_time($value['refill_date']); ?></label>
                                <?php } ?>
                              </td>
                              <td style="text-align: center;">
                                  <?php 
                                 if ($value['next_refill_date']=='0000-00-00') {?>
                                 <label><?php echo $value['next_refill_date']; ?></label><?php }else{?>
                                 <label><?php echo get_date_dmy_format_wo_time($value['next_refill_date']); ?></label>
                                <?php } ?>
                              </td>
                             <!-- <td class="text-center" style="text-align: center;"><?php echo $value['comments'];?></td>-->
                              <td class="text-center" style="text-align: center;"><?php echo $value['tracking_number'];?></td>
                              <td class="text-center" style="text-align: center;"><?php echo $value['is_returned'];?></td>
                             </tr> 
                              <?php 
                               $srno=$srno+1;
                            }
                             }
                              ?>
                          </tbody>
                        </table>