<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2008 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts EasyCart                      |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<?php 
	echo $javascript->link('jquery.js');		
	echo $javascript->link('ui.datepicker.js'); 
?>
<script>
	//Code for the project	
	$(document).ready(function()	
	{	
	$('#user_fdate').datepick({minDate: '<?php echo $dflt_mindate;?>' , maxDate:'<?php echo $dflt_maxdate;?>', 
	dateFormat: 'yy-mm-dd',closeAtTop: false, showStatus: true,  showOn: 'both', buttonImageOnly: true,
	 buttonImage: '<?php echo $cnfg["sitebasefolder"]."/img/calendar.gif";?>' });	
	 
	 $('#user_tdate').datepick({minDate: '<?php echo $dflt_mindate;?>' , maxDate:'<?php echo $dflt_maxdate;?>', 
	dateFormat: 'yy-mm-dd',closeAtTop: false, showStatus: true,  showOn: 'both', buttonImageOnly: true,
	 buttonImage: '<?php echo $cnfg["sitebasefolder"]."/img/calendar.gif";?>' });	
	 
	});
</script>
<script>
function submitForm(thisform)
{
 // 
  var fromdate=$('#from_date').val();
  var todate=$('#to_date').val();
   $('#fdate').val(fromdate);
   $('#tdate').val(todate);
   thisform.submit();
  }
  </script>

<label align="center"><font color="#FF0000"><?php $session->flash(); ?></font></label>		
<div align="center" class="subheading">
 <div align="left">USER REPORT</div>
</div>
<br />

<div>
<form name="report" action="<?php echo $cnfg["sitebasefolder"];?>/<?php echo $this->params["controller"];?>/<?php echo $this->params["action"];?>/1" method="post">
From <input type="text"  name="user_fdate"  id="user_fdate" size="15" readonly="readonly" value="<?php echo $mindate;?>" onclick="return false;"/>
&nbsp;&nbsp;&nbsp;
To <input type="text"  name="user_tdate"  id="user_tdate" size="15" readonly="readonly" value="<?php echo $maxdate;?>" onclick="return false;"
/>
<input type="button" value="view"  onclick="return submitForm(document.report);"/>
&nbsp;&nbsp;&nbsp;<b>Show</b>
<select name="filter" id="filter" onchange="document.report.submit();">
<option value="5" <?php if($filterval==5) print "selected=selected";?>>5</option>
<option value="10" <?php if($filterval==10) print "selected=selected";?>>10</option>
<option value="15" <?php if($filterval==15) print "selected=selected";?>>15</option>
<option value="<?php echo $totrec;?>" <?php if($filterval==$totrec) print "selected=selected";?>>All</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="Export to CSV" onClick="javascript:window.location='../usercsv/<?php echo $mindate;?>/<?php echo $maxdate;?>'">
<input type="button" value="Export to Excel" onClick="javascript:window.location='../userxls/<?php echo $mindate;?>/<?php echo $maxdate;?>'">
</form>
</div>    <br />


<div align="left" id="item_details_admin">
				<!--items display area start -->
				 <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table">
				  <tr>
					<td align="left" valign="top"><table width="100%"  border="0" cellspacing="1" cellpadding="6">
					  <tr align="left" valign="middle" id="list_admin_top">
						<td width="4%">#</td>
						<td width="10%">Username</td>
						<td width="25%">Name</td>
						<td width="30%">Email</td>
						<td width="9%">Registration</td>
						<td width="8%">Address</td>
						<td width="5%">Zip</td>
						<td width="5%">Phone</td>
						<td width="4%">Fax</td>
						
					  </tr>
					
					
					 <?php 
						$_count=1;
						if(!empty($reportdet))
						{
						  foreach($reportdet as  $data)
						{ ?> 					  
						  <tr align="left" valign="middle" id="list_admin">
							<td><?php echo $_count;?></td>
							<td><?php echo Sanitize::html($data['usr']['uname']);?></td>
							<td><?php echo Sanitize::html($data['uadd']['fname'])." ".Sanitize::html($data['uadd']['lname']); ?></td>
							<td><?php echo Sanitize::html($data['usr']['email']);?></td>
							<td><?php echo Sanitize::html($data[0]['reg_date']);?></td>
							<td><?php
							if($data['uadd']['address']<>'') 
							{						
							 echo $data['uadd']['address'].'<br>'.$data['uadd']['city'].",<br>".$data['uadd']['state'].", ".$data['uadd']['country'];
							 }
							  ?>							 
							 </td>
							<td><?php echo Sanitize::html($data['uadd']['zip']);?></td>
							<td><?php echo Sanitize::html($data['uadd']['phone']);?> 
							<?php if($data['uadd']['mobile']<>'')
							 {  
							   if( $data['uadd']['mobile']<>'')
								 {  
									 echo "/";
								 }
							   echo Sanitize::html($data['uadd']['mobile']); 
							 }?></td>
							<td><?php echo $data['uadd']['fax'];?></td>
							
						  </tr>  
					   <?php  $_count++; }  ?>					  
					</table>
					 
					  <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
						<tr>
						  <td align="center"><?php echo $pagination; ?></td>
						</tr>
					  </table>
					  <?php }  else { ?>					     
						<tr id="list_admin">
						  <td align="center" colspan="10">No Records Found.</td>
						</tr>					  
					  <?php } ?>
					  </td>
				  </tr>
				</table>
				</div>
				 <div align="left" class="float_clear1"></div>
				</div>