<?php
include("includes/site_info.php");
include('session_handler.inc');

$WUserID = $_SESSION['Sess_UserId'];
$WUsername = $_SESSION['Sess_UserName'];

$now = getdate();
$initial_date = date ("Y-m-d H:i:s", mktime (0,0,0,$now['mon'],1,$now['year'])); //current month
$final_date = date ("Y-m-d H:i:s", mktime (23,59,59,$now['mon']+1,0,$now['year']));

	$date_str="and ((date_submitted >= '$initial_date' and date_submitted <= '$final_date')";
	$date_str.=" or (date_submitted <= '$initial_date' and date_submitted >= '$final_date'))";	

$sql2="select *,DATE_FORMAT(date_submitted, '%b %d, %Y') as t from transactions where mem_userid=$WUserID $date_str order by date_submitted";
//echo $sql2;
$query=mysql_query($sql2);
$bank_TOTAL=mysql_num_rows($query);
?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
});
</script>

<div class="p5 width_700">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="white_back_t_xb">
		<tr class="p0">
			<td><table border="0" align="right" cellpadding="0" cellspacing="0" class="p5">
					<tr>
						<td><a href="javascript:;" title="Point Available"><img src="images/iconPA_o.gif" border="0" align="absmiddle" />0</a></td>
						<td><a href="javascript:;" title="Point Reward"><img src="images/iconPR_o.gif" border="0" align="absmiddle" />0</a></td>
						<td><a href="javascript:;" title="Point Deal"><img src="images/iconPD_o.gif" border="0" align="absmiddle" />0</a></td>
						<td><a href="<?=$CONST_LINK_ROOT?>/hahaperParks.php#upgrade" id="UPVIP" class="a_button">UPGRADE</a></td>
						<td><a href="javascript:;" id="CashOut" class="a_button">CASH OUT</a></td>
					</tr>
				</table></td>
		</tr>
		<tr class="grey_12 orange_row_back solid_line_separator">
			<td><div style="background-color:#0000FF; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"><img src="images/spacer.gif" width="10" height="10" /></div> Transaction History: <?=date ("d-m-Y", mktime (0,0,0,$now['mon'],1,$now['year']));?> - <?=date ("d-m-Y", mktime (0,0,0,$now['mon'],$now['mday'],$now['year']));?></td>
		</tr>
		<tr>
			<td><table width="100%" border="0" cellpadding="5" cellspacing="1" id="structureTable">
					<tr>
						<th width="15%" align="left">Date</th>
						<th width="55%" align="left">Description</th>
						<th width="10%" align="left">Status</th>
						<th width="10%" align="left">Amount</th>
					</tr>
					<?php if ($bank_TOTAL > 0) { 
							while($rs_query=mysql_fetch_object($query)) { ?>
					<tr id="<?=$rs_query->id?>">
						<td valign="baseline" nowrap="nowrap"><?=$rs_query->t?></td>
						<td valign="baseline"><?=$rs_query->description?></td>
						<td valign="baseline" nowrap="nowrap"><?=$rs_query->pstatus?></td>
						<td valign="baseline" nowrap="nowrap"><?=$rs_query->ptype?> <?=$rs_query->amount?></td>
					</tr>
					<?php } } else {?>
					<tr>
						<td colspan="4">No transactions that meet your criteria.</td>
					</tr>
					<?php } ?>
				</table></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
	</table>
</div>
