Transaction list
This commit is contained in:
parent
d037b2bef4
commit
51ab4a35c5
@ -355,13 +355,16 @@ switch ($action) {
|
||||
$ui->assign('planid', $planid);
|
||||
|
||||
$voucher = [];
|
||||
$n = 1;
|
||||
foreach ($v as $vs) {
|
||||
$temp = $template;
|
||||
$temp = str_replace('[[qrcode]]', '<img src="qrcode/?data=' . $vs['code'] . '">', $temp);
|
||||
$temp = str_replace('[[price]]', Lang::moneyFormat($vs['price']), $temp);
|
||||
$temp = str_replace('[[voucher_code]]', $vs['code'], $temp);
|
||||
$temp = str_replace('[[plan]]', $vs['name_plan'], $temp);
|
||||
$temp = str_replace('[[counter]]', $n, $temp);
|
||||
$voucher[] = $temp;
|
||||
$n++;
|
||||
}
|
||||
|
||||
$ui->assign('voucher',$voucher);
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
* by https://t.me/ibnux
|
||||
@ -12,8 +13,8 @@ $action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
|
||||
r2(U."dashboard",'e',$_L['Do_Not_Access']);
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
$mdate = date('Y-m-d');
|
||||
@ -26,24 +27,44 @@ $month_n = date('n');
|
||||
|
||||
switch ($action) {
|
||||
case 'by-date':
|
||||
case 'daily-report':
|
||||
$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();
|
||||
$dr = ORM::for_table('tbl_transactions')->where('recharged_on',$mdate)->sum('price');
|
||||
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('d',$d);
|
||||
$ui->assign('dr',$dr);
|
||||
$ui->assign('mdate',$mdate);
|
||||
$ui->assign('mtime',$mtime);
|
||||
$ui->assign('paginator',$paginator);
|
||||
$ui->assign('activation', $d);
|
||||
$ui->assign('q', $q);
|
||||
$ui->assign('paginator', $paginator);
|
||||
$ui->display('reports-activation.tpl');
|
||||
break;
|
||||
case 'daily-report':
|
||||
$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();
|
||||
$dr = ORM::for_table('tbl_transactions')->where('recharged_on', $mdate)->sum('price');
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('dr', $dr);
|
||||
$ui->assign('mdate', $mdate);
|
||||
$ui->assign('mtime', $mtime);
|
||||
$ui->assign('paginator', $paginator);
|
||||
run_hook('view_daily_reports'); #HOOK
|
||||
$ui->display('reports-daily.tpl');
|
||||
break;
|
||||
|
||||
case 'by-period':
|
||||
$ui->assign('mdate',$mdate);
|
||||
$ui->assign('mtime',$mtime);
|
||||
$ui->assign('tdate', $tdate);
|
||||
$ui->assign('mdate', $mdate);
|
||||
$ui->assign('mtime', $mtime);
|
||||
$ui->assign('tdate', $tdate);
|
||||
run_hook('view_reports_by_period'); #HOOK
|
||||
$ui->display('reports-period.tpl');
|
||||
break;
|
||||
@ -54,29 +75,29 @@ switch ($action) {
|
||||
$stype = _post('stype');
|
||||
|
||||
$d = ORM::for_table('tbl_transactions');
|
||||
if ($stype != ''){
|
||||
$d->where('type', $stype);
|
||||
}
|
||||
if ($stype != '') {
|
||||
$d->where('type', $stype);
|
||||
}
|
||||
|
||||
$d->where_gte('recharged_on', $fdate);
|
||||
$d->where_lte('recharged_on', $tdate);
|
||||
$d->order_by_desc('id');
|
||||
$x = $d->find_many();
|
||||
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
if ($stype != ''){
|
||||
$dr->where('type', $stype);
|
||||
}
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
if ($stype != '') {
|
||||
$dr->where('type', $stype);
|
||||
}
|
||||
|
||||
$dr->where_gte('recharged_on', $fdate);
|
||||
$dr->where_lte('recharged_on', $tdate);
|
||||
$xy = $dr->sum('price');
|
||||
$xy = $dr->sum('price');
|
||||
|
||||
$ui->assign('d',$x);
|
||||
$ui->assign('dr',$xy);
|
||||
$ui->assign('fdate',$fdate);
|
||||
$ui->assign('tdate',$tdate);
|
||||
$ui->assign('stype',$stype);
|
||||
$ui->assign('d', $x);
|
||||
$ui->assign('dr', $xy);
|
||||
$ui->assign('fdate', $fdate);
|
||||
$ui->assign('tdate', $tdate);
|
||||
$ui->assign('stype', $stype);
|
||||
run_hook('view_reports_period'); #HOOK
|
||||
$ui->display('reports-period-view.tpl');
|
||||
break;
|
||||
|
@ -124,6 +124,7 @@
|
||||
{if Lang::arrayCount($activation)}
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{$_L['Invoice']}</th>
|
||||
<th>{$_L['Username']}</th>
|
||||
<th>{$_L['Plan_Name']}</th>
|
||||
<th>{$_L['Plan_Price']}</th>
|
||||
@ -136,6 +137,7 @@
|
||||
<tbody>
|
||||
{foreach $activation as $ds}
|
||||
<tr onclick="window.location.href = '{$_url}prepaid/view/{$ds['id']}'" style="cursor:pointer;">
|
||||
<td>{$ds['invoice']}</td>
|
||||
<td>{$ds['username']}</td>
|
||||
<td>{$ds['plan_name']}</td>
|
||||
<td>{Lang::moneyFormat($ds['price'])}</td>
|
||||
|
@ -31,6 +31,7 @@
|
||||
<b>[[price]]</b> Plan Price.<br>
|
||||
<b>[[voucher_code]]</b> Voucher Code.<br>
|
||||
<b>[[plan]]</b> Voucher Plan.<br>
|
||||
<b>[[counter]]</b> Counter.<br>
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
70
ui/ui/reports-activation.tpl
Normal file
70
ui/ui/reports-activation.tpl
Normal 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>
|
||||
</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"}
|
@ -183,6 +183,8 @@
|
||||
href="{$_url}reports/daily-report">{$_L['Daily_Report']}</a></li>
|
||||
<li {if $_routes[1] eq 'by-period'}class="active" {/if}><a
|
||||
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}
|
||||
</ul>
|
||||
</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user