<?php
  include('common/header.php'); 
?>
<div id="messages" style="color: green;"><h5><?php echo $this->session->flashdata('message'); ?></h5></div>
<div class="row">
  <section class="panel panel-default">
     <header class="panel-heading bg-info lt font-bold"><?php echo 'Search results'; ?></header>
    <form method="post" action="<?php echo base_url()?>index.php/<?php echo CUSTOMER_TRACKING_REPORTS;?>search_customer_report_tracking">

    <div class="panel-body bs-example form-horizontal">
     <div class="col-sm-12" >  

                      <div class="col-sm-6">
                            <div class="form-group" id="client_code">
                              <label for="client_code" class="col-sm-3 control-label required"><?php echo 'Customer Name'; ?>:</label>
                              <div class="col-sm-7">
                                <input type="text" name="customer_name" onkeypress="return RestrictSpace()" value="<?php echo $customer_name_hidden; ?>" id="customer_name" placeholder="Customer Name" class="form-control" maxlength="75" /> 
                                
                              </div>
                            </div>
                      </div>  

                      <div class="col-sm-6">    
                       <div class="form-group">
                                <label for="client_code" class="col-sm-3 control-label required"><?php echo 'Dispenser Name'; ?>:</label>
                              <div class="col-sm-7">                             
                                <input type="text" name="dispenser_name" onkeypress="return RestrictSpace()" value="<?php echo $dispenser_name_hidden; ?>" id="dispenser_name" placeholder="Dispenser Name" class="form-control" maxlength="20" />                                        
                              </div>
                       </div>                            
                     </div>
                       
                      <div class="col-sm-6">    
                       <div class="form-group">
                                <label for="client_code" class="col-sm-3 control-label required"><?php echo 'Tracking Number'; ?>:</label>
                              <div class="col-sm-7">                             
                                <input type="text" name="tracking_number" onkeypress="return RestrictSpace()" value="<?php echo $tracking_number_hidden; ?>" id="tracking_number" placeholder="Tracking Number" class="form-control" maxlength="20" />                                        
                              </div>
                       </div>                            
                     </div>
                          

        </div>
        

    </div>
    <div class="clearfix form-actions">
      <div class="col-md-offset-5 col-md-5">
        <button class="btn btn-info" type="submit" value="search" name="search">
         Search
        </button>
      </div>
    </div>
</form>
  </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-responsive">
            <table id="example" class="table table-bordered dataTables" cellspacing="0" width="100%">
              <thead>
        <tr>
          <th>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/customer_tracking_reports/show_tracking/$query_id/$field_name/".
            (($sort_order == 'asc' && $sort_by == $field_name) ? 'desc' : 'asc') ,
            $field_display); ?>     </th>
          <?php endforeach; ?>
          <!-- <th>User Type</th> 
          <th>User Name</th>
          <th>Branch Name</th>
          <th>Email id</th>             
          <th>Mobile Number</th>
          <th>Accessible branches</th> -->
        </tr> 
      </thead>
      <tbody>
         <?php 
       $icnt=0;
	    $count=count($customer_report);
      if ($count>0) {
      foreach ($customer_report as  $value) {
		  $tracking_number=$value->tracking_number;
		  $customer_name=$value->customer_name;
		  $product_name=$value->product_name;		 
		  $company_branch_name=$value->company_branch_name;		 
		  /*nityam:geetanjali 21-Feb-2020 added brach column in the list */
      $installation_date=$value->installation_date;   
$enc_tracking_number=encrypt_decrypt_parameters($value->tracking_number,'encrypt');	  
		  $icnt++;
			$sr=$offset+$icnt;
       ?> 
        
        <tr>
          <td><?php echo $sr; ?></td>
          <td><a href="<?php echo base_url().'index.php/gc/refill_track/list_refill_track/'.$enc_tracking_number; ?>" target="_blank" ><u><?php echo $tracking_number;?></u></a></td>
          <td><?php echo $customer_name;?></td>
          <td><?php echo $installation_date;?></td>
          <td><?php echo $product_name;?></td>    
          <td><?php echo $company_branch_name;?></td>    
        </tr> 
        <?php 
         //$srno=$srno+1;
       }
      }else{?>
              <td colspan="8" class="text-center">no data found</td>
         <?php } ?>
        </tbody>
            </table>
          </div>
		   <?php
		 if($num_results > 0)	{ ?>
			<div class="block">  </div>
				<div class="clearfix">
				<div class="row">
					<?php 
						if (strlen($pagination)): 
							$label_disp="Customer Tracking Reports";
							$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>
	<form method="post" action="<?php echo base_url()?>index.php/<?php echo CUSTOMER_TRACKING_REPORTS;?>excel_data">
   <input type="hidden" name="customer_excel_name" id="customer_excel_name" value="<?php echo $customer_name_hidden ?>" >
  <input type="hidden" name="dispenser_excel_name" id="dispenser_excel_name" value="<?php echo $dispenser_name_hidden ?>" > 
    <div class="clearfix form-actions">
      <div class="col-md-offset-5 col-md-5">
        <button class="btn btn-info" type="submit">
         Export to Excel
        </button>
      </div>
    </div>
  </form>
	
  </div>
</div>

<!-- /.main-content --> 
</div>
<!-- /#ace-settings-container --> 
</div>
<!-- /.main-container-inner -->
 
<?php
  include('common/footer.php');
?>
<!-- <script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#example').DataTable();
  } );
</script> -->
<!-- <script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable( {
    destroy: true,
    searching: false,
    paging: false,
    sorting:false,
    bInfo : false,
    "order": [],
	"pageLength": 5,
    "columnDefs": [
      { "orderable": false, "targets":  [] }
      ]
  } );
});
</script>  -->