<?php
define('NTLCMS', 1);
$module = 'history';
include ('../system/start.php');
include ('../system/function.php');
include ('../system/antidos.php');
$page_title = 'Страница истории выплат - клик клуба ' . strtoupper($_SERVER['HTTP_HOST']);
include ('../system/head.php');
if (!$active){
header('Location: '.URL);
$_SESSION['fail'] = 'Вы не авторизированы!';
exit;
}
echo '<div class="title"><b>'.razd.' История выплат</b></div>';
$usinpay = DB :: run() -> querySingle("select sum(`summa`) from `money_in` where `login` = ?", array($ulogin));
$usoutpay = DB :: run() -> querySingle("select sum(`money`) from `payment` where `login` = ? and `status` = ?", array($ulogin, 'on'));
$uspausepay = DB :: run() -> querySingle("select sum(`money`) from `payment` where `login` = ? and `status` = ?", array($ulogin, 'moder'));
echo '<div class="menu">
<i class="fa fa-dot-circle-o fa-fw"></i> Введено: '.money_p((int)$usinpay).' <br/>
<i class="fa fa-dot-circle-o fa-fw"></i> Выплачено: '.money_m((float)$usoutpay).' <br/>
<i class="fa fa-dot-circle-o fa-fw"></i> Ожидает выплаты: '.money((float)$uspausepay).' </div>';
$k_post = DB :: run() -> querySingle("select count(`id`) from `payment` where `login` = ?", array($ulogin));
$k_page = k_page($k_post, $onpage);
$page = page($k_page);
$start = $onpage * $page - $onpage;
$sql = DB :: run() -> query("select * from `payment` where `login` = ? limit ".$start.", ".$onpage, array($ulogin));
if ($k_post == 0){
echo '<div class="post"><center><i class="fa fa-close fa-fw"></i> Выплат еще не было!</center></div>';
} else {
while ($row = $sql -> fetch(PDO::FETCH_OBJ)){
echo '<div class="menu">
<i class="fa fa-calendar fa-fw"></i> Дата: '.date('d.m.Y H:i', $row -> date).'<br/>
<i class="fa fa-credit-card fa-fw"></i> Куда: '.($row -> oplata ? $row -> oplata : '-').'<br/>
<i class="fa  fa-money fa-fw"></i> Сумма: '.money(round($row -> money, 2)).'<br/>
<i class="fa fa-cogs fa-fw"></i> Статус: '.cost($row -> status).'</div>';
}
if ($k_page > 1) navigation(URL.'/history?', $k_page, $page);
}
echo '<div class="block"><i class="fa fa-home fa-fw"></i> <a href="'.URL.'/cabinet">В кабинет</a> | <a href="'.URL.'/finances">Мои финансы</a></div>';
include ('../system/foot.php');
?>