<div class="s-bk-lf">
	<div class="acc-title">Список выплат на Payeer</div>
</div>
<div class="silver-bk"><div class="clr"></div>	
<?


$num_p = (isset($_GET["page"]) AND intval($_GET["page"]) < 1000 AND intval($_GET["page"]) >= 1) ? (intval($_GET["page"]) -1) : 0;
$lim = $num_p * 100;

function colorSum($sum){

	if($sum >= 100) return "red";
	return "#000000";
}

$db->Query("SELECT * FROM db_request_payment WHERE `status`='3' ORDER BY id DESC LIMIT {$lim}, 100");

if($db->NumRows() > 0){

?>
<table cellpadding='3' cellspacing='0' border='0' bordercolor='#336633' align='center' width="99%">
  <tr bgcolor="#efefef">
    <td align="center" width="50" class="m-tb">Пользователь</td>
	<td align="center" width="50" class="m-tb">Сумма</td>
	<td align="center" width="50" class="m-tb">Кошелек</td>
	<td align="center" width="50" class="m-tb">Выплатить</td>
	<td align="center" width="50" class="m-tb">Отменить</td>
	<td align="center" width="100" class="m-tb">Дата</td>
  </tr>


<?PHP

	while($data = $db->FetchArray()){
	
	?>
	<tr class="htt">
	<td align="center"><a href="/?menu=admin4ik&sel=users&edit=<?=$data["user_id"]; ?>"<?php if($data['gardener']==1) {echo ' style="color: red;"';}  ?> class="stn"><?=$data["user"]; ?></a></td>
    <td align="center"><font color="<?=colorSum($data["sum"]); ?>"><?=sprintf("%.2f",$data["sum"]); ?> RUB</font></td>
	<td align="center"><?=$data["purse"]; ?></td>
	<td align="center">
	<?php
		if($data["status"]==0) {
	?>
	<form action="" method="post">
	<input type="hidden" name="pay_here" value="<?=$data["id"]; ?>" />
	<input type="submit" value="Выплатить" />
	</form>
	<?php
	}
	else if($data["status"]==3) {
		echo "<center><font color = 'green'><b>Выплачено!</b></font></center><BR />";
	}
	else if($data["status"]==2) {
		echo "<center><font color = 'red'><b>Отменена!</b></font></center><BR />";
	}
	?>
	</td>
	<td align="center">
	<?php
		if($data["status"]==0) {
	?>
	<form action="" method="post">
	<input type="hidden" name="canc" value="<?=$data["id"]; ?>" />
	<input type="submit" value="Отменить" />
	</form>
	<?php
	}
	else if($data["status"]==3) {
		echo "<center><font color = 'green'><b>Выплачено!</b></font></center><BR />";
	}
	else if($data["status"]==2) {
		echo "<center><font color = 'red'><b>Отменена!</b></font></center><BR />";
	}
	?>
	</td>
	<td align="center"><?=date("d.m H:i:s",$data["date"]); ?></td>
  	</tr>
	<?PHP
	
	}

?>

</table>
<BR />
<?PHP


}else echo "<center><b>На данной странице нет записей</b></center><BR />";

	
$db->Query("SELECT COUNT(*) FROM  db_request_payment WHERE `status`='3' ");
$all_pages = $db->FetchRow();

	if($all_pages > 100){
	
	$sort_b = (isset($_GET["sort"])) ? intval($_GET["sort"]) : 0;
	
	$nav = new navigator;
	$page = (isset($_GET["page"]) AND intval($_GET["page"]) < 1000 AND intval($_GET["page"]) >= 1) ? (intval($_GET["page"])) : 1;
	
	echo "<BR /><center>".$nav->Navigation(10, $page, ceil($all_pages / 100), "/?menu=admin4ik&sel=pay123_list&page="), "</center>";
	
	}
?>
</div><div class='clr'></div>
