<?php
session_start();
?>


<h3><center>Статистика (Последние 50 операций)</center></h3></br>

<table class="tables">
	<thead><tr>
		<th class="top">№</th>
		<th class="top">Дата</th>
		<th class="top">Сумма</th>
		<th class="top">Описание, действие</th>
		<th class="top">Состояние</th>
	</tr></thead>

<?php

db_connect();

$tabla = db_query("SELECT * FROM knb_history where user='".db_string($_SESSION["login"])."' ORDER BY id DESC limit 50");
while ($row = db_assoc($tabla))
{
	echo "<tr><td align='center'>";
	echo $row["id"];
	echo "</td><td align='center'>";
	echo $row["date"];
	echo "</td><td align='center'>";
	echo $row["amount"];
	echo "</td><td align='center'>";
	echo $row["method"];
	echo "</td><td align='center'>";
	if($row["tipo"]==0 && $row["status_pay"]==0 && $row["status"]==false) {
		echo "Ожидает обработки";
	}elseif($row["status"]!=false){
		echo $row["status"];
	}elseif($row["status_pay"]==1){
		echo "Выплачено";
	}elseif($row["status_pay"]=="2") {
		echo 'Возвращено на баланс';
	}
	echo "</td></tr>";
}
echo "</table>";


db_close();

?>