<?php
require_once('../classes/body.class.php');
require_once('../classes/db.class.php');
require_once('../classes/system.class.php');
$title= new Body;
$title->SetTitle('Биллинг - Переводы');
$title->GetHeader();
if ($b == false) {
header('location: /');
die();
}
echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> :: <a href="/billing"style="text-decoration:none; color:white;">Биллинг</a> :: Переводы</div></div></div>';
echo'<div class="t-body"><div class="list-group lg-alt">';
$look = DB::$dbs->querySingle("SELECT COUNT(id) FROM billing_perevod WHERE user_id = ?", [$b['id']]);
$num = 10;
$k_page = k_page($look, $num);
$page = page($k_page);
$start = $num*$page-$num;
$sql = DB::$dbs->query("SELECT * FROM billing_perevod WHERE user_id = ? ORDER BY id DESC LIMIT $start,$num", [$b['id']]);
if ($sql -> rowCount() == 0) {
err('Пусто');
} else {
while($a = $sql->fetch()) {
echo'<a href="/users/'.$a['id_user'].'" class="list-group-item media"><div class="pull-left"><img class="img-circle pull-left" src="/'.(user_inf($a['id_user'], 'ava') != NULL ? user_inf($a['id_user'], 'ava') : 'assets/img/4.jpg').'" alt="" width="40" height="40"></div><div class="media-body"><div class="list-group-item-heading"> '.user_inf($a['id_user'], 'name').'  '.user_inf($a['id_user'], 'family').'  '.(($a['id_user'] != $b['id']) ? '<font color="green">+'.$a['suma'].'р</font>':' font color="red">-'.$a['suma'].'р</font>').'</div><small class="list-group-item-text">Примечание: '.$a['prim'].' </small></div></a>';
}
}
echo'</div></div>';
if ($k_page > 1) {
str('?',$k_page,$page);
}
$title->GetMenu();
$title->GetFooter();
?>