<?php
	include('common/header.php');

?>


<div class="row">
<section class="panel panel-default">
		<div class="panel-body bs-example form-horizontal">

	<div class="col-xs-12">
			<?php 
			$his='';
			if(!empty($refill_history)&& is_array($refill_history))
			{
				$his=count($refill_history);
			}
			if ($his=='') {
			    echo "<h5><span style='color: red;'>Tracking History Not Found</span></h5>";
			} ?>
		<div class="table-header">
			Customer Company Details
		</div>
		<div class="table-responsive">
		
		<table cellspacing="0" widtd="100%" class="table table-bordered table-condensed">				 
		<?php 
            /*  foreach ($refill_history as $value) {
             	$tracking_id=$value['tracking_details_id'];
             	$tracking_number=$value['tracking_number'];
             } */
		  ?>		
			<tbody>
				<tr>
					
					<td>Customer Company  Name</td>
					<td><?php 
 							if ($customer_name!='') {
 								echo $customer_name;
 							}else{
 								echo "-";
 							}
					       ?></td>						
				</tr>

				<tr>
					
					<td>Branch Name</td>
					<td><?php 
							if ($customer_company_branch_name!='') {
 								echo $customer_company_branch_name;
 							}else{
 								echo "-";
 							}
					         ?></td>						
				</tr>

				<tr>
					
					<td>Installation Date</td>
					<?php 
                     if ($installation_date=='0000-00-00' || $installation_date=='') 
					 {?>
					<td><?php echo $installation_date; ?></td><?php }else{?>
					<td><?php echo get_date_dmy_format_wo_time($installation_date); ?></td>
					<?php } ?>						
				</tr>
				<tr>
					
					<td>Currently Possessed By</td>
				    <td>
				    	<?php  
					/* 	echo "==possessed_by=".$possessed_by;
						echo "==is_status=".$is_status; */
				    	$result=get_current_possessed($possessed_by,$is_status);
				    	if ($result=='Not Allocated') {
				    		echo "-";
				    	}else{
				    		echo $result;
				    	}	
						?>
				    </td>
                     					
				</tr>
				
			</tbody>
		</table>
		</div>

		<div class="table-header">
			Dispenser Details
		</div>
		<div class="table-responsive">
		<table cellspacing="0" widtd="100%" class="table table-bordered table-condensed">						
			<tbody>
				<tr>
								
					<td>Dispenser Name</td>
					<td><?php 
					     if ($dispenser!='') {
					     	 echo $dispenser;
					     }else{
					     	echo '-';
					     }
					    ?></td>	               
				</tr>

				
			</tbody>
		</table>
		</div>

		<div class="table-header">
			Tracking Number <?php echo " "; ?><?php echo $this->page_data['page_title']; ?>
		</div>
		<div class="table-responsive">
		<table cellspacing="0" widtd="100%" class="table table-bordered table-condensed">						
		   <thead>
				<tr>
					<th>Sr No</th>					
			        <!-- <th>Customer Type</th> -->
					<th>Customer Company Name</th>
					<th>Date of Transaction</th>
					<th>Refill Due Date</th>
					<th>Refill Name</th>
					<th>Returned(yes/no)</th>
					<th>Stop Refill(yes/no)</th>
				</tr>	
			</thead>
			<tbody>
				<?php 
				$srno=1;
				$rh=0;
				if(!empty($refill_history)&& is_array($refill_history))
				{
				$rh=count($refill_history);
				}
				if ($rh>0) {
				foreach ($refill_history as $value1) {
					
					
				 ?>
				<tr>
					<td><?php echo $srno; ?></td>
					<!-- <td>Individual</td> -->
					<td><?php echo $value1['customer_name']; ?></td>
					<?php 
                     if ($value1['refill_date']=='0000-00-00') {?>
					<td><?php echo $value1['refill_date']; ?></td><?php }else{?>
					<td><?php echo get_date_dmy_format_wo_time($value1['refill_date']); ?></td>
					<?php } ?>
					<?php 
                     if ($value1['next_refill_date']=='0000-00-00') {?>
					<td><?php echo $value1['next_refill_date']; ?></td><?php }else{?>
					<td><?php echo get_date_dmy_format_wo_time($value1['next_refill_date']); ?></td>
					<?php } ?>
					<td><?php echo $value1['product_name']; ?></td>
					<td><?php echo $value1['is_returned']; ?></td>
					<td><?php echo check_disp_returned($value1['dispenser_sales_id']); ?></td>
				</tr>
				<?php 
				$srno=$srno+1;
			} 
		}else{
			echo "<td class='text-center' colspan='12'>no data found</td>";
		}
			?>				
			</tbody>
		</table>
		</div>
      		</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.location='<?php echo base_url();?>index.php/gc/refill_track/manage_refill_track'">
					Back
				</button>
			</div>
		</div>
	</div>
</div>
<div>
	<!-- /.page-row -->
    <!-- /.page-content --> 
</div>
<!-- /.main-content --> 
</div>
<!-- /#ace-settings-container --> 
</div>
<!-- /.main-container-inner --> 
<?php
	include('common/footer.php');
?>