<div id="content-outer">
<!-- start content -->
<div id="content">
	<!--  start page-heading -->
	<div id="page-heading">
		<h1>Customers list</h1>
	</div>
	<form name="chkf" method="post" id="mainform" action="<?=site_url() . 'inventory/products/formparse'?>">
	<input type="hidden" name="location" value="customers" />
	<div id="page-icons">
		<input name="new" value="neew" type="image" src="<?=site_url()?>/images/icons/new2.png" />
		<input type="image" name="edit" value="eedit" src="<?=site_url()?>/images/icons/edit2.png" />
		<input type="image" name="delete" value="deelete" src="<?=site_url()?>/images/icons/delete2.png" />
	</div>
	<div style="clear:both;"></div>
	<!-- end page-heading -->

	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="<?=site_url()?>images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="<?=site_url()?>images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner">
		
			<!--  start table-content  -->
			<div id="table-content">
				<?php
					if($this->session->flashdata('msgt') == 'E') {
						echo '
				<div id="message-red">
				<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="red-left">'.$this->session->flashdata('msg').'</td>
					<td class="red-right"><a class="close-red"><img src="'.site_url().'images/table/icon_close_red.gif"   alt="" /></a></td>
				</tr>
				</table>
				</div>
						';
					}
				if($this->session->flashdata('msgt') == 'S') {
					echo '
					<div id="message-green">
					<table border="0" width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td class="green-left">'.$this->session->flashdata('msg').'</a></td>
						<td class="green-right"><a class="close-green"><img src="'.site_url().'images/table/icon_close_green.gif"   alt="" /></a></td>
					</tr>
					</table>
					</div>
					';
				}
				?>
		 		<b>Filter:</b>
				<input id="search-buttonnew" value="<?=$this->uri->segment(3)?>" type="text" name="search" />
				<input id="search-button-new" type="submit" name="dosearch" value="Search" />
				<input id="search-button-new" type="reset" name="clear" value="Clear" />
				<br /><br />
				<!--  start product-table ..................................................................................... -->
				<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
				<tr>
					<th class="table-header-check"><a id="toggle-all" ></a></th>
					<th class="table-header-repeat line-left">
						<?php
							echo ($this->uri->segment(4) == 'ASC') ?
							'<a href="'.site_url().'customers/order/NAME/DESC">Customer Name</a>' :
							'<a href="'.site_url().'customers/order/NAME/ASC">Customer Name</a>'
						?>
					</th>
					<th class="table-header-repeat line-left">
						<?php
							echo ($this->uri->segment(4) == 'ASC') ?
							'<a href="'.site_url().'customers/order/CARD/DESC">Card</a>' :
							'<a href="'.site_url().'customers/order/CARD/ASC">Card</a>'
						?>
					</th>
					<th class="table-header-repeat line-left">
						<?php
							echo ($this->uri->segment(4) == 'ASC') ?
							'<a href="'.site_url().'customers/order/MAXDEBT/DESC">Max Debt</a>' :
							'<a href="'.site_url().'customers/order/MAXDEBT/ASC">Max Debt</a>'
						?>
					</th>
					<th class="table-header-repeat line-left">
						<?php
							echo ($this->uri->segment(4) == 'ASC') ?
							'<a href="'.site_url().'customers/order/CURDEBT/DESC">Debt</a>' :
							'<a href="'.site_url().'customers/order/CURDEBT/ASC">Debt</a>'
						?>
					</th>
					<th class="table-header-repeat line-left">
						<?php
							echo ($this->uri->segment(4) == 'ASC') ?
							'<a href="'.site_url().'customers/order/POINTS/DESC">Points</a>' :
							'<a href="'.site_url().'customers/order/POINTS/ASC">Points</a>'
						?>
					</th>
					<th class="table-header-repeat line-left">
						<?php
							echo ($this->uri->segment(4) == 'ASC') ?
							'<a href="'.site_url().'customers/order/TAXCATEGORY/DESC">Tax Category</a>' :
							'<a href="'.site_url().'customers/order/TAXCATEGORY/ASC">Tax Category</a>'
						?>
					</th>
					<th class="table-header-repeat line-left">
						<?php
							echo ($this->uri->segment(4) == 'ASC') ?
							'<a href="'.site_url().'customers/order/ADDRESS/DESC">Address</a>' :
							'<a href="'.site_url().'customers/order/ADDRESS/ASC">Address</a>'
						?>
					</th>
				</tr>
<?php
for($i=0;$i<count($customers);$i++) {
	if($i %2 == 0) echo '<tr>';
	else echo '<tr class="alternate-row">';
	echo '
					<td><input name="chk" value="'.$customers[$i]->ID.'" type="checkbox"/></td>
					<td>'.$customers[$i]->NAME.'</td>
					<td>'.$customers[$i]->CARD.'</td>
					<td>'.$customers[$i]->MAXDEBT.'</td>
					<td>'.$customers[$i]->CURDEBT.'</td>
					<td>'.$customers[$i]->POINTS.'</td>
					<td>'.$customers[$i]->taxcustname.'</td>
					<td>'.$customers[$i]->ADDRESS.'</td>
				</tr>
	';
}
?>
				</table>
				<!--  end product-table................................... --> 
				</form>
			</div>
			<!--  end content-table  -->
			
			<!--  start paging..................................................... -->
			<table border="0" cellpadding="0" cellspacing="0" id="paging-table">
			<tr>
			<td>
				<a href="<?=site_url() .'customers/search/'. $this->uri->segment(3).'/'?>" class="page-far-left"></a>
				<a href="<?=$previous_page?>" class="page-left"></a>
				<div id="page-info">Page <strong><?=$current_page?></strong> / <?=$last_page/20?></div>
				<a href="<?=($next_page == 20) ? 'customers/search/'.$this->uri->segment(3) . '/'.$next_page : $next_page;?>" class="page-right"></a>
				<a href="<?=site_url() . 'customers/search/'.$this->uri->segment(3) .'/' . $last_page?>" class="page-far-right"></a>
			</td>
			<td>
			&nbsp;
			</td>
			</tr>
			</table>
			<!--  end paging................ -->
			
			<div class="clear"></div>
		 
		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	<div class="clear">&nbsp;</div>

</div>
<!--  end content -->
<div class="clear">&nbsp;</div>
</div>
<!--  end content-outer........................................................END -->

<div class="clear">&nbsp;</div>