<?php
    $filename = 'refill_due_'. 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");
    $dis_country_name=$this->input->post('dis_country_name');
    $dis_state_name=$this->input->post('dis_state_name');
    $dis_city_name=$this->input->post('dis_city_name');
    $dis_customer_name=$this->input->post('dis_customer_name');
    $dis_product_name=$this->input->post('dis_product_name');
    $refill_due_for=$this->input->post('refill_due_for');
   
?>

                                <div class="">
                                    <div><b>Searched Results</b></div>
                                    <!-- PAGE CONTENT BEGINS -->
                                    <?php if($dis_country_name!=""){?>
                                    <div class="form-group">  
                                        <label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'Country:';?><?php echo $dis_country_name?> </label>
                                    </div>
                                    <?php }
                                     if($dis_state_name!=""){
                                    ?>
                                    <div class="form-group">  
                                        <label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'State:';?><?php echo $dis_state_name?> </label>
                                    </div>
                                    <?php }
                                     if($dis_city_name!=""){
                                    ?>
                                    <div class="form-group">  
                                        <label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'City:';?><?php echo $dis_city_name?> </label>
                                    </div>  
                                    <?php }
                                     if($dis_customer_name!=""){
                                    ?>
                                    <div class="form-group">  
                                        <label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'Customer Name:';?><?php echo $dis_customer_name;?> </label>
                                    </div>
                                    <?php }
                                     if($dis_product_name!=""){
                                    ?>
                                    <div class="form-group">  
                                        <label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'Dispenser:';?><?php echo $dis_product_name;?> </label>  
                                    </div>
                                     <?php }
                                     if($refill_due_for!=""){
                                    ?>
                                    <div class="form-group">  
                                        <label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'Refill Due For:';?> <?php echo $refill_due_for;?> </label>
                                    </div>
                                     <?php }?>
                                </div>
                                <br>
                                <br>
	<table cellspacing="0" width="100%" class="table table-bordered table-condensed">
            <thead>
                <tr>
					<th class="text-center">Sr No</th>
                    <th class="text-center">Date</th>
                    <th class="text-center">Customer Name</th>
                    <th class="text-center">City</th>
                    <th class="text-center">Dispenser</th>
                    <th class="text-center">Refill</th>
                    <th class="text-center">Last refill date</th>
                   
                </tr>   
            </thead>
            <tbody>
				<?php 
				$srno=1;
                 foreach ($refill_sale as $ve) {
                 $dispenser_sales_id=$ve['dispenser_sales_id'];
                 $dispenser_refill_details_id=$ve['dispenser_refill_details_id'];
               //  $id= $this->encrypt->encode($dispenser_sales_id);
                // $dispenser_refill_details_id= $this->encrypt->encode($dispenser_refill_details_id);
                 $installation_date=get_date_dmy_format_wo_time($ve['installation_date']);
                 $refill_date=get_date_dmy_format_wo_time($ve['refill_date']);
                 $customer_name=$ve['customer_name'];
                 $city_name=$ve['city_name'];
                 $dispenser=$ve['dispenser'];
                 $refill_name=$ve['refill_name'];
                 $refill_date=$ve['refill_date'];

				 ?>
				<tr>
					<td style="text-align: center;"><?php echo $srno; ?></td>
					<?php 
                     if ($installation_date=='0000-00-00') {?>
					<td style="text-align: center;"><?php echo $installation_date; ?></td><?php }else{?>
					<td style="text-align: center;"><?php echo $installation_date; ?></td>
					<?php } ?>
					<td style="text-align: center;"><?php echo $customer_name; ?></td>
					<td style="text-align: center;"><?php echo $city_name; ?></td>
					<td style="text-align: center;"><?php echo $dispenser; ?></td>	
					<td style="text-align: center;"><?php echo $refill_name; ?></td>	
					<?php 
                     if ($refill_date=='0000-00-00') {?>
					<td  style="text-align: center;"><?php echo $refill_date; ?></td><?php }else{?>
					<td style="text-align: center;"><?php echo $refill_date; ?></td>
					<?php } ?>
				</tr>
			<?php 
			$srno=$srno+1;
		     } 
		     ?>
        
            </tbody>
        </table>