<?php
include "../dbconfig.php";

$from=$con->real_escape_string($_POST['from']);
	  $from = str_replace("/","-",$from);
	  $from = date("Y-m-d", strtotime($from));
	
	  $to=$con->real_escape_string($_POST['to']);
	  $to = str_replace("/","-",$to);
	  $to = date("Y-m-d", strtotime($to));
?>
 <select name="company_id" id="company_id" class="form-control">
			       	   	 <option style="padding:10px; background-color:#E7D91E; color:#F9F0F1; cursor:pointer;" value="">Select a Company </option>
                               <?php
							   
							        $customers_sql="SELECT customers.name,customers.id from customers,bookings
where bookings.customer_id=customers.id AND bookings.job_type!='Cash' AND bookings.job_status=2 AND bookings.start_date BETWEEN '$from' AND '$to' GROUP BY customers.id order by name ASC";
echo $customers_sql;
									$t_result=mysqli_query($con,$customers_sql);
									while($customer=mysqli_fetch_assoc($t_result))
									{
									
									?>
	<option style="padding:20px; background-color:#2977C9; color:#F9F0F1; cursor:pointer;" value="<?php echo $customer['id']; ?>">
	   <?php echo $customer['name']; ?>
    </option>
						<?php
						
						}
						?>
			       	  </select>
<script>
$('#company_id').select2({width: '100%'});
</script>					  