<? global $vis_language; 
$prodStatus = array('1' => $vis_language['TXTACTIVE'],'2' => $vis_language['TXTPENDING'],'3' => $vis_language['TXTINCOMPLETE'],'4' => $vis_language['TXTCANCELED']);
?>
<div class="m-r-n m-l-n">
  <table class="table table-hover m-b-none" data-ride="datatables">
	<thead class="table_head">
		<th class="txt_nowrap"><? echo $vis_language['TXTTITLE']; ?></th>
		<th class="txt_nowrap"><? echo $vis_language['TXTBILLINGCYCLE']; ?></th>
		<th class="txt_nowrap"><? echo $vis_language['TXTPAIDDATE']; ?></th>
		<th class="txt_nowrap"><? echo $vis_language['TXTEXPIRYDATE']; ?></th>
		<th class="txt_nowrap"><? echo $vis_language['TXTAMOUNT'].' ('.VIS_DOMAIN_CURRENCY.')'; ?></th>
		<th class="txt_nowrap"><? echo $vis_language['TXTSTATUS']; ?></th>
	</thead>
	<tbody>	
		<? if($product!=-1) for($i=0;$i<$client_product_count;$i++) {
			$lableCol = '';
			if($client_product[$i]['product_status'] == 2)
			{
				$lableCol = 'bg-danger';
			}
			else if($client_product[$i]['product_status'] == 1)
			{
				$lableCol = 'label vh-green-bg';
			}
			else
			{
				$lableCol = 'label label-default';
			}	
			if($client_product[$i]['validity']==0) { $expiry=$client_product[$i]['entry_date']; }
			else if($client_product[$i]['validity']==1) {
				$current_date=format_date($client_product[$i]['entry_date']);
				$expiry = strtotime(date("Y-m-d", strtotime($current_date)) . "+1 month"); }
			else if($client_product[$i]['validity']==2) {
				$current_date=format_date($client_product[$i]['entry_date']);
				$expiry = strtotime(date("Y-m-d", strtotime($current_date)) . " +4 month"); }
			else if($client_product[$i]['validity']==3) {
				$current_date=format_date($client_product[$i]['entry_date']);
				$expiry = strtotime(date("Y-m-d", strtotime($current_date)) . " +6 month"); }
			else if($client_product[$i]['validity']==4) {
				$current_date=format_date($client_product[$i]['entry_date']);
				$expiry = strtotime(date("Y-m-d", strtotime($current_date)) . " +12 month"); } ?>
		<tr>
			<td><?= $client_product[$i]['title']; ?></td>
             <? if($client_product[$i]['validity']==0) $validityname='TXTVALIDITYONETIME'; 
              elseif ($client_product[$i]['validity']==1) $validityname='TXTVALIDITYMONTHLY'; 
              elseif ($client_product[$i]['validity']==2) $validityname='TXTVALIDITYQUARTERLY'; 
              elseif ($client_product[$i]['validity']==3) $validityname='TXTVALIDITYSEMIANNUALLY'; 
              else $validityname='TXTVALIDITYANNUALLY'; 
           ?>
			<td><?= $vis_language[$validityname]; ?></td>
			<td><?= format_date($client_product[$i]['entry_date']); ?></td>
			<td><?= format_date($expiry); ?></td>
			<td><?= $client_product[$i]['amount']; ?></td>
			<td><span class="label <? echo $lableCol ?>"><?= $prodStatus[$client_product[$i]['product_status']]; ?></span></td>
		</tr>
		<? } ?>
	</tbody>
  </table>
</div>  
<script> $(document).ready(function() { $(".selectpicker").selectpicker(); });</script>