<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr><td class="nav"><a href="index.php?section=home">Home</a>&nbsp;&gt;&nbsp;<a href="index.php?section=sales&action=pending">Pending Sales</a></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td>
			<table cellpadding="2" cellspacing="3" border="0" align="center">
			<form action="index.php" method="post">
			<input type="hidden" name="section" value="sales">
			<input type="hidden" name="action" value="pending">
				<tr>
					<td class="form_cell">
						<table cellspacing="2" cellpadding="0" border="0">
							<tr>
								<td class="body">Search For:</td>
							</tr>							
							<tr>
								<td><?php admin_form_element(array ("type" => "input", "name" => "search_text", "size" => 20, "value" => $data["values"][search_text])); ?></td>
							</tr>
							<tr>
								<td><?php
									$search_for = array (
										"type" => "select",
										"name" => "search_for",
										"options" => array (
											"" => "Please, select...",
											"mem_id" => "Member ID",
											"email" => "Member Email",
											"fname" => "Member First Name",
											"lname" => "Member Last Name"
										),
										"value" => $data["values"][search_for]
										);
									admin_form_element($search_for);?>
								</td>
							</tr>
						</table>
					</td>
					<td class="form_cell">
						<table cellspacing="2" cellpadding="0" border="0">
							<tr>
								<td class="body">Sort By:</td>
							</tr>
							<tr>
								<td><?php
									$sort_by = array (
										"type" => "select",
										"name" => "sort_by",
										"options" => array (
											"" => "Please, select...",
											"mem_id" => "Member ID",
											"email" => "Member Email",
											"fname" => "Member First Name",
											"lname" => "Member Last Name",											
											"amount" => "Amount",
											"date" => "Payment Due Date"
										),
										"value" => $data["values"][sort_by]
										);
									admin_form_element($sort_by); ?>
								</td>
							</tr>
							<tr>
								<td><?php
									$sort_order = array (
										"type" => "select",
										"name" => "sort_order",
										"options" => array (
											"asc" => "ascending",
											"desc" => "descending"
										),
										"value" => $data["values"][sort_order]
									);
								admin_form_element($sort_order);
								?>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="2" class="form_cell">
						<table width="100%" cellpadding="0" cellspacing="2" border="0">
							<tr><td class="body">Additional Settings:</td></tr>
							<tr>
								<td>
									<table width="100%" cellpadding="0" cellspacing="5" border="0">
										<tr>
											<td class="highlight">Amount:</td>
											<td class="highlight"><?php
											admin_form_element(array ("type" => "input", "name" => "amount_from", "size" => 3, "value" => $data["values"][amount_from]));
											?>&nbsp;to&nbsp;<?php
											admin_form_element(array ("type" => "input", "name" => "amount_to", "size" => 3, "value" => $data["values"][amount_to]));
											?>
											</td>
										</tr>
										<tr>
											<td class="highlight">Date From:</td>
											<td class="highlight"><?php
											$field["name"] = "date_from";
											$field["value"] = $data["values"][date_from];
											$field["dets"][0] = "date_from";
											$field["dets"][1] = "0";
											$field["dets"][2] = date("Y");
											$field["dets"][3] = date("Y")-3;											
											echo build_field("date",$field);
											?>
											</td>
										</tr>
										<tr>
											<td class="highlight">Date To:</td>
											<td class="highlight"><?php
											$field["name"] = "date_to";
											$field["value"] = $data["values"][date_to];
											$field["dets"][0] = "date_to";
											$field["dets"][1] = "0";
											$field["dets"][2] = date("Y");
											$field["dets"][3] = date("Y")-3;
											echo build_field("date",$field);
											?>
											</td>
										</tr>
										<tr>
											<td class="highlight">Sale Type:</td>
											<td class="highlight"><?php
											$options = array (
												"" => "Please, select...",
												"membership" => "Membership Fee",
												"blogs" => "Blogs Featured Subscription",
												"classifieds" => "Classifieds Featured Subscription",
												"events" => "Events Featured Subscription",
												"clubs" => "Clubs Featured Subscription"
											);
											admin_form_element( array ("type" => "select", "name" => "order_type", "options" => $options, "value" => $data["values"][order_type]) );
											?>
											</td>
										</tr>
										<tr><td colspan="2"><table cellpadding="0" cellspacing="2" border="0" align="center">
											<tr>
												<td><?php
												admin_form_element( array ("type" => "checkbox", "name" => "future", "value" => $data["values"][future], "ovalue" => "1") );
												?></td><td class="highlight">Include Future Sales</td>
											</tr>
										</table></td></tr>
									</table>		
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><?php admin_form_element( array ("type" => "button", "value" => "Show")); ?></td>
				</tr>
			</form>
			</table>
		</td>
	</tr>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="600" align="center">
		<tr>
			<td class="list_header" align="center">Buyer</td>
			<td class="list_header" align="center">Description</td>
			<td class="list_header" align="center">Amount</td>
			<td class="list_header" align="center">Payment Due Date</td>
			<td class="list_header" align="center">Last Time Paid</td>
			<td class="list_header" align="center">Action</td>
		</tr>
		<?php
		
			foreach($data["sales"] as $sale){
				?><tr>
				<td class="list_cell"><a href="<?php echo $sale["buyer"][link]; ?>" target="_blank"><?php echo $sale["buyer"]["name"]; ?></a><br>(ID: <?php echo $sale["mem_id"]; ?>)</td>
				<td class="list_cell"><?php echo $sale["description"]; ?></td>
				<td class="list_cell"><?php echo $sale["amount"]; ?></td>
				<td class="list_cell"><?php echo $sale["due_date"]; ?></td>
				<td class="list_cell"><?php echo $sale["last_paid"]; ?></td>
				<td class="list_cell" align="center"><?php
				admin_output_image("buttons/but_verify.gif",$sale["complete"],0,"complete");
				admin_output_image("buttons/but_delete_small.gif",$sale["delete"],0,"delete");
				?></td>
				</tr><?php
			}//foreach
		
		?>		
	</table></td></tr>
	<tr><td align="center"><?php
	admin_form_element( array ("type" => "button", "value" => "Delete All Pending Sales", "link" => "index.php?section=sales&action=delete_pending") );
	?></td></tr>
	<tr><td>&nbsp;</td></tr>
	<?php if(is_array($data["pages"][numbers])): ?>
	<tr>
		<td class="pages_line">
			<table cellpadding="0" cellspacing="0" border="0" align="center" height="20">
				<tr>					
					<td align="center" class="pages_body">
					<?php
						if($data["pages"][prev]){
							?><a href="<?php echo $data["pages"][prev]; ?>">&lt;&lt;</a>&nbsp;<?php
						}//if
						while(list($page,$link) = each($data["pages"][numbers])){
							?><a href="<?php echo $link; ?>"><?php echo ($page == $data["pages"][current]) ? "<b>".$page."</b>" : $page ; ?></a>&nbsp;<?php
						}//while
						if($data["pages"][next]){
							?><a href="<?php echo $data["pages"][next]; ?>">&gt;&gt;</a>&nbsp;<?php
						}//if
					?>
					</td>
			</table>			
		</td>
	</tr>
	<?php endif; ?>
</table>