Transaction list

This commit is contained in:
Ibnu Maksum 2023-10-20 14:31:56 +07:00
parent d037b2bef4
commit 51ab4a35c5
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
6 changed files with 127 additions and 28 deletions

View File

@ -355,13 +355,16 @@ switch ($action) {
$ui->assign('planid', $planid); $ui->assign('planid', $planid);
$voucher = []; $voucher = [];
$n = 1;
foreach ($v as $vs) { foreach ($v as $vs) {
$temp = $template; $temp = $template;
$temp = str_replace('[[qrcode]]', '<img src="qrcode/?data=' . $vs['code'] . '">', $temp); $temp = str_replace('[[qrcode]]', '<img src="qrcode/?data=' . $vs['code'] . '">', $temp);
$temp = str_replace('[[price]]', Lang::moneyFormat($vs['price']), $temp); $temp = str_replace('[[price]]', Lang::moneyFormat($vs['price']), $temp);
$temp = str_replace('[[voucher_code]]', $vs['code'], $temp); $temp = str_replace('[[voucher_code]]', $vs['code'], $temp);
$temp = str_replace('[[plan]]', $vs['name_plan'], $temp); $temp = str_replace('[[plan]]', $vs['name_plan'], $temp);
$temp = str_replace('[[counter]]', $n, $temp);
$voucher[] = $temp; $voucher[] = $temp;
$n++;
} }
$ui->assign('voucher',$voucher); $ui->assign('voucher',$voucher);

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/) * PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux * by https://t.me/ibnux
@ -12,7 +13,7 @@ $action = $routes['1'];
$admin = Admin::_info(); $admin = Admin::_info();
$ui->assign('_admin', $admin); $ui->assign('_admin', $admin);
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){ if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']); r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
} }
@ -26,6 +27,26 @@ $month_n = date('n');
switch ($action) { switch ($action) {
case 'by-date': case 'by-date':
case 'activation':
$q = (_post('q') ? _post('q') : _get('q'));
$keep = _post('keep');
if (!empty($keep)) {
ORM::raw_execute("DELETE FROM tbl_transactions WHERE date < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL $keep DAY))");
r2(U . "logs/list/", 's', "Delete logs older than $keep days");
}
if ($q != '') {
$paginator = Paginator::build(ORM::for_table('tbl_transactions'), ['invoice' => '%' . $q . '%'], $q);
$d = ORM::for_table('tbl_transactions')->where_like('invoice', '%' . $q . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::build(ORM::for_table('tbl_transactions'));
$d = ORM::for_table('tbl_transactions')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('activation', $d);
$ui->assign('q', $q);
$ui->assign('paginator', $paginator);
$ui->display('reports-activation.tpl');
break;
case 'daily-report': case 'daily-report':
$paginator = Paginator::bootstrap('tbl_transactions', 'recharged_on', $mdate); $paginator = Paginator::bootstrap('tbl_transactions', 'recharged_on', $mdate);
$d = ORM::for_table('tbl_transactions')->where('recharged_on', $mdate)->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many(); $d = ORM::for_table('tbl_transactions')->where('recharged_on', $mdate)->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();

View File

@ -124,6 +124,7 @@
{if Lang::arrayCount($activation)} {if Lang::arrayCount($activation)}
<thead> <thead>
<tr> <tr>
<th>{$_L['Invoice']}</th>
<th>{$_L['Username']}</th> <th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th> <th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Price']}</th> <th>{$_L['Plan_Price']}</th>
@ -136,6 +137,7 @@
<tbody> <tbody>
{foreach $activation as $ds} {foreach $activation as $ds}
<tr onclick="window.location.href = '{$_url}prepaid/view/{$ds['id']}'" style="cursor:pointer;"> <tr onclick="window.location.href = '{$_url}prepaid/view/{$ds['id']}'" style="cursor:pointer;">
<td>{$ds['invoice']}</td>
<td>{$ds['username']}</td> <td>{$ds['username']}</td>
<td>{$ds['plan_name']}</td> <td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>

View File

@ -31,6 +31,7 @@
<b>[[price]]</b> Plan Price.<br> <b>[[price]]</b> Plan Price.<br>
<b>[[voucher_code]]</b> Voucher Code.<br> <b>[[voucher_code]]</b> Voucher Code.<br>
<b>[[plan]]</b> Voucher Plan.<br> <b>[[plan]]</b> Voucher Plan.<br>
<b>[[counter]]</b> Counter.<br>
</p> </p>
</div> </div>
{/if} {/if}

View File

@ -0,0 +1,70 @@
{include file="sections/header.tpl"}
<!-- pool -->
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">
Activity Log
</div>
<div class="panel-body">
<div class="text-center" style="padding: 15px">
<div class="col-md-4">
<form id="site-search" method="post" action="{$_url}reports/activation">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="q" class="form-control" value="{$q}"
placeholder="{$_L['Invoice']}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-8">
</div>&nbsp;
</div>
<br>
<div class="table-responsive">
<table id="datatable" class="table table-bordered table-striped">
<thead>
<tr>
<th>{$_L['Invoice']}</th>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
</tr>
</thead>
<tbody>
{foreach $activation as $ds}
<tr>
<td onclick="window.location.href = '{$_url}prepaid/view/{$ds['id']}'"
style="cursor:pointer;">{$ds['invoice']}</td>
<td onclick="window.location.href = '{$_url}customers/viewu/{$ds['username']}'"
style="cursor:pointer;">{$ds['username']}</td>
<td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['type']}</td>
<td class="text-success">
{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}
</td>
<td class="text-danger">{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{$ds['method']}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -183,6 +183,8 @@
href="{$_url}reports/daily-report">{$_L['Daily_Report']}</a></li> href="{$_url}reports/daily-report">{$_L['Daily_Report']}</a></li>
<li {if $_routes[1] eq 'by-period'}class="active" {/if}><a <li {if $_routes[1] eq 'by-period'}class="active" {/if}><a
href="{$_url}reports/by-period">{$_L['Period_Reports']}</a></li> href="{$_url}reports/by-period">{$_L['Period_Reports']}</a></li>
<li {if $_routes[1] eq 'activation'}class="active" {/if}><a
href="{$_url}reports/activation">{Lang::T('Activation History')}</a></li>
{$_MENU_REPORTS} {$_MENU_REPORTS}
</ul> </ul>
</li> </li>