Просмотр файла wu-admin/profit.php

Размер файла: 3.29Kb
<?php
require_once('../wu-engine/wu_init.php');
$page_name = 'Прибыль системы';
$page_keys = 'прибыль,профит';
$page_desc = 'Прибыль системы';
$prevurl_1 = '/'.ADMINPATH.'/';
$prevname_1 = 'Панель управления';
$online_title = 'В панели управления';
$online_url = '/';
$page_right = '<div class="header-buttons"><div class="collapse" id="header-buttons"><div class="well"><a href="javascript://" id="stat_open" class="btn btn-primary">Статистика</a></div></div></div>';
include('../wu-engine/wu_header.php');
include('../wu-engine/wu-functions/wu_pagination.php');
include('../wu-engine/wu-functions/wu_functions.php');
if(!USER_LOGGED) { header ("Location: /"); exit; }
?>

<div id="modal_stat" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><i class="icon-stats"></i> Статистика</h4>
</div>
<div class="modal-body with-padding">
<div id="stat_res"></div>
</div>
<div class="modal-footer">
<button class="btn btn-warning" data-dismiss="modal">Закрыть</button>
</div>
</div>
</div>
</div>

<?php
$num = 20; //Сколько выводить на странице
if (isset($_GET['page'])) { $page = intval($_GET['page']); if ($page == 0) { $page = 1; } } else { $page = 1; }
$qu = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `c` FROM `".DB_PREFIX."_adm_profit`"));
$co = $qu['c'];
$total = intval(($co - 1) / $num) + 1;
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$qr = mysqli_query($connect_db, "SELECT * FROM `".DB_PREFIX."_adm_profit` ORDER BY id DESC LIMIT $start, $num");
if ($co > 0) {
?>
<div class="panel panel-default">
<div class="panel-heading"><h6 class="panel-title"><i class="icon-coin"></i> Прибыль системы</h6></div>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr align="center">
<th>Дата</th>
<th>Прибыль</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($qr)) { ?>
<tr>
<td><?php echo date('d.m.Y',$row['dt']); ?></td>
<td><font style="color:<?php if ($row['s'] > 0) { echo 'green'; } if ($row['s'] < 0) { echo 'red'; } ?>"><?php echo $row['s']; ?> руб.</font></td></tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php
$pageNav = new SimPageNav();
$pages = ceil($co/$num);
echo $pageNav->getLinks($pages, 1, $page, 10, 'page');
} else { echo '<div class="alert alert-info fade in"><i class="icon-info"></i> История пуста</div>'; }
?>

<script src="/wu-static/js/wu_graph.js"></script>
<script src="/wu-static/js/wu_graph_export.js"></script>

<script type='text/javascript'>
$('#stat_open').click(function(){
if ($("#stat_res").text().length == 0) { $("#stat_res").html('<center><i class="icon-spinner7 margloadt spin"></i></center>'); }
$('#modal_stat').modal('show');
var data = {'load': 'ok'};
wu_response('/wu-engine/wu-actions/adm_profit_stat_load.php', data, '', '1', function(wu_result) {
if (wu_result == 'wu-err-3') {
wu_err();
} else {
$("#stat_res").html(wu_result);
}
});
});
</script>

<?php include('../wu-engine/wu_footer.php'); ?>