Просмотр файла account/cashout.php

Размер файла: 6.6Kb
<?php
$page_name = 'Вывод средств';
$page_keys = 'вывод,выплата';
$page_desc = 'Страница вывода средств';
$online_title = 'На странице вывода средств';
$online_url = '/account/cashout';
include('../wu-engine/wu_header.php');
include('../wu-engine/wu_account_menu.php');
include('../wu-engine/wu-functions/wu_pagination.php');
include('../wu-engine/wu-functions/wu_functions.php');
if(!USER_LOGGED) { header ("Location: /"); exit; }
$label = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `cnt` FROM `".DB_PREFIX."_operations` WHERE usr = '$u_id'"));
?>

<div class="tabbable">
<ul class="nav nav-tabs">
<li><a href="/account/cashadd">Пополнение баланса</a></li>
<li class="active"><a href="/account/cashout">Вывод средств</a></li>
<li><a href="/account/operations">История операций<?php if ($label['cnt'] > 0) { echo ' <span class="label label-info">'.$label['cnt'].'</span>'; } ?></a></li>
</ul>
<div class="tab-content with-padding">
<br />
<center>
<div class="form-group">
<select data-placeholder="Выберите платёжную систему" class="select" tabindex="2" id="paysystems">
<option value=""></option>
<?php
$wu_q = mysqli_query($connect_db, "SELECT id,ti FROM `".DB_PREFIX."_pay_systems` WHERE active_out = '1' ORDER BY pos ASC");
while($row = mysqli_fetch_assoc($wu_q)) {
?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['ti']; ?></option>
<?php } ?>
</select>
<a href="javascript://" class="btn btn-default" id="cashout" data-loading-text="<i class='icon-spinner7 spin'></i> Загружаем" />Вывести</a>
</div>
</center>

<?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 `cnt` FROM `".DB_PREFIX."_adm_cash_out` WHERE usr='$u_id'"));
$co = $qu['cnt'];
$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 ".DB_PREFIX."_adm_cash_out.id,n,s,dt,ti FROM `".DB_PREFIX."_adm_cash_out` INNER JOIN ".DB_PREFIX."_pay_systems ON ".DB_PREFIX."_adm_cash_out.ps = ".DB_PREFIX."_pay_systems.id WHERE usr='$u_id' ORDER BY id DESC LIMIT $start, $num");
if ($co > 0) {
?>
<div class="panel panel-default img40">
<div class="panel-heading"><h6 class="panel-title"><i class="icon-credit"></i> Заявки на ручной вывод средств</h6></div>
<div class="table-responsive">
<table class="table table-hover text-center">
<thead>
<tr>
<th class="text-center">#</th>
<th class="text-center">Платёжная система</th>
<th class="text-center">Номер кошелька</th>
<th class="text-center">Сумма</th>
<th class="text-center">Дата</th>
<th class="text-center">Действия</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($qr)) { ?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['ti']; ?></td>
<td><?php echo $row['n']; ?></td>
<td><?php echo number_format($row['s'],2,'.',','); ?> руб.</td>
<td><?php echo wudate($row['dt']); ?></td>
<td><a href="javascript://" onclick="out_cancel('<?php echo $row['id']; ?>');" class="btn btn-default btn-small">Отменить</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php
$pageNav = new SimPageNav();
$pages = ceil($co/$num);
echo $pageNav->getLinks($pages, 1, $page, 10, 'page');
} ?>

</div>
</div>

<div id="modal_out" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<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-credit"></i> Вывод средств через <font id="topay"></font></h4>
</div>
<div class="modal-body with-padding" id="paysys_result">
</div>
<div class="modal-footer">
<a class="btn btn-success" href="javascript://" id="btn_send" data-loading-text="<i class='icon-spinner7 spin'></i> Выводим">Вывести</a>
<button class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>

<div id="modal_cancel" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<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-remove"></i> Удаление заявки #<font id="todel"></font></h4>
</div>
<div class="modal-body with-padding">
<div class="alert alert-info"><center>Заявка на вывод средств будет удалена, сумма вернётся на баланс аккаунта.</center></div>
</div>
<div class="modal-footer">
<button type="button" id="icancel" class="btn btn-danger" data-loading-text="<i class='icon-spinner7 spin'></i> Удаляем">Удалить</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>

<script type="text/javascript" src="/wu-static/js/select2.min.js"></script>

<script type="text/javascript">
//Оформление селекта
$(document).ready(function() {
$(".select").select2({
minimumResultsForSearch: "-1",
width: 200
});
});

//Загрузка платёжной системы
$('#cashout').click(function(){
$('#btn_send').unbind();
if ($('#paysystems').val() > 0) {
var paysys = $('#paysystems').val();
var data = {'id': paysys};
wu_response('/wu-engine/wu-pay-systems/wu_outload.php', data, 'cashout', '1', function(wu_result) {
if (wu_result == 'wu-error') {
wu_err();
} else if (wu_result == 'wu-error-n') {
notif_e('Данный кошелёк не указан в профиле');
} else {
$('#paysys_result').html(wu_result);
$('#topay').text($('#paysystems option:selected').text());
$('#modal_out').modal('show');
}
});
} else { notif_e('Выберите платёжную систему'); }
});

//Предудаление заявки
var out_to_del;
function out_cancel(id){
out_to_del = id;
$('#todel').text(id);
$('#modal_cancel').modal('show');
};

//Удаление заявки
$('#icancel').click(function(){
var data = {'id': out_to_del};
wu_response('/wu-engine/wu-actions/acc_cashout_del.php', data, 'icancel', '1', function(wu_result) {
if (wu_result == '1') {
$(location).attr('href','/account/cashout');
}
if (wu_result == 'wu-error') {
wu_err();
}
});
});
</script>

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