2017-03-11 02:51:06 +07:00
|
|
|
<?php
|
2023-06-15 10:17:00 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
/**
|
2023-10-12 15:55:42 +07:00
|
|
|
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
|
|
|
* by https://t.me/ibnux
|
2023-06-15 10:17:00 +07:00
|
|
|
**/
|
2023-10-12 15:55:42 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
_admin();
|
2024-02-13 13:54:01 +07:00
|
|
|
$ui->assign('_title', Lang::T('Reports'));
|
2017-03-11 02:51:06 +07:00
|
|
|
$ui->assign('_sysfrm_menu', 'reports');
|
|
|
|
|
|
|
|
$action = $routes['1'];
|
|
|
|
$ui->assign('_admin', $admin);
|
|
|
|
|
|
|
|
$mdate = date('Y-m-d');
|
|
|
|
$tdate = date('Y-m-d', strtotime('today - 30 days'));
|
|
|
|
|
|
|
|
//first day of month
|
|
|
|
$first_day_month = date('Y-m-01');
|
|
|
|
//
|
2023-06-15 10:17:00 +07:00
|
|
|
$this_week_start = date('Y-m-d', strtotime('previous sunday'));
|
2017-03-11 02:51:06 +07:00
|
|
|
// 30 days before
|
|
|
|
$before_30_days = date('Y-m-d', strtotime('today - 30 days'));
|
|
|
|
//this month
|
|
|
|
$month_n = date('n');
|
|
|
|
|
|
|
|
switch ($action) {
|
|
|
|
|
|
|
|
case 'print-by-date':
|
|
|
|
$mdate = date('Y-m-d');
|
2024-07-24 15:56:02 +07:00
|
|
|
$types = ORM::for_table('tbl_transactions')->getEnum('type');
|
|
|
|
$methods = array_column(ORM::for_table('tbl_transactions')->rawQuery("SELECT DISTINCT SUBSTRING_INDEX(`method`, ' - ', 1) as method FROM tbl_transactions;")->findArray(), 'method');
|
|
|
|
$routers = array_column(ORM::for_table('tbl_transactions')->select('routers')->distinct('routers')->find_array(), 'routers');
|
|
|
|
$plans = array_column(ORM::for_table('tbl_transactions')->select('plan_name')->distinct('plan_name')->find_array(), 'plan_name');
|
|
|
|
$reset_day = $config['reset_day'];
|
|
|
|
if (empty($reset_day)) {
|
|
|
|
$reset_day = 1;
|
|
|
|
}
|
|
|
|
//first day of month
|
|
|
|
if (date("d") >= $reset_day) {
|
|
|
|
$start_date = date('Y-m-' . $reset_day);
|
|
|
|
} else {
|
|
|
|
$start_date = date('Y-m-' . $reset_day, strtotime("-1 MONTH"));
|
|
|
|
}
|
|
|
|
$tps = ($_GET['tps']) ? $_GET['tps'] : $types;
|
|
|
|
$mts = ($_GET['mts']) ? $_GET['mts'] : $methods;
|
|
|
|
$rts = ($_GET['rts']) ? $_GET['rts'] : $routers;
|
|
|
|
$plns = ($_GET['plns']) ? $_GET['plns'] : $plans;
|
|
|
|
$sd = _req('sd', $start_date);
|
|
|
|
$ed = _req('ed', $mdate);
|
|
|
|
$ts = _req('ts', '00:00:00');
|
|
|
|
$te = _req('te', '23:59:59');
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2024-07-24 15:56:02 +07:00
|
|
|
$query = ORM::for_table('tbl_transactions')
|
|
|
|
->whereRaw("UNIX_TIMESTAMP(CONCAT(`recharged_on`,' ',`recharged_time`)) >= " . strtotime("$sd $ts"))
|
|
|
|
->whereRaw("UNIX_TIMESTAMP(CONCAT(`recharged_on`,' ',`recharged_time`)) <= " . strtotime("$ed $te"))
|
|
|
|
->order_by_desc('id');
|
|
|
|
if (count($tps) > 0) {
|
|
|
|
$query->where_in('type', $tps);
|
|
|
|
}
|
|
|
|
if (count($mts) > 0) {
|
|
|
|
if (count($mts) != count($methods)) {
|
|
|
|
foreach ($mts as $mt) {
|
|
|
|
$query->where_like('method', "$mt - %");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (count($rts) > 0) {
|
|
|
|
$query->where_in('routers', $rts);
|
|
|
|
}
|
|
|
|
if (count($plns) > 0) {
|
|
|
|
$query->where_in('plan_name', $plns);
|
|
|
|
}
|
2025-04-02 11:29:25 +01:00
|
|
|
$x = $query->find_array();
|
|
|
|
$xy = $query->sum('price');
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2024-07-24 15:56:02 +07:00
|
|
|
$ui->assign('sd', $sd);
|
|
|
|
$ui->assign('ed', $ed);
|
|
|
|
$ui->assign('ts', $ts);
|
|
|
|
$ui->assign('te', $te);
|
2023-06-15 10:17:00 +07:00
|
|
|
$ui->assign('d', $x);
|
|
|
|
$ui->assign('dr', $xy);
|
|
|
|
$ui->assign('mdate', $mdate);
|
|
|
|
$ui->assign('recharged_on', $mdate);
|
2022-09-18 00:00:40 +07:00
|
|
|
run_hook('print_by_date'); #HOOK
|
2025-02-04 10:56:02 +07:00
|
|
|
$ui->display('admin/print/by-date.tpl');
|
2017-03-11 02:51:06 +07:00
|
|
|
break;
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
case 'pdf-by-date':
|
2023-06-15 10:17:00 +07:00
|
|
|
$mdate = date('Y-m-d');
|
2024-07-24 15:56:02 +07:00
|
|
|
$types = ORM::for_table('tbl_transactions')->getEnum('type');
|
|
|
|
$methods = array_column(ORM::for_table('tbl_transactions')->rawQuery("SELECT DISTINCT SUBSTRING_INDEX(`method`, ' - ', 1) as method FROM tbl_transactions;")->findArray(), 'method');
|
|
|
|
$routers = array_column(ORM::for_table('tbl_transactions')->select('routers')->distinct('routers')->find_array(), 'routers');
|
|
|
|
$plans = array_column(ORM::for_table('tbl_transactions')->select('plan_name')->distinct('plan_name')->find_array(), 'plan_name');
|
|
|
|
$reset_day = $config['reset_day'];
|
|
|
|
if (empty($reset_day)) {
|
|
|
|
$reset_day = 1;
|
|
|
|
}
|
|
|
|
//first day of month
|
|
|
|
if (date("d") >= $reset_day) {
|
|
|
|
$start_date = date('Y-m-' . $reset_day);
|
|
|
|
} else {
|
|
|
|
$start_date = date('Y-m-' . $reset_day, strtotime("-1 MONTH"));
|
|
|
|
}
|
|
|
|
$tps = ($_GET['tps']) ? $_GET['tps'] : $types;
|
|
|
|
$mts = ($_GET['mts']) ? $_GET['mts'] : $methods;
|
|
|
|
$rts = ($_GET['rts']) ? $_GET['rts'] : $routers;
|
|
|
|
$plns = ($_GET['plns']) ? $_GET['plns'] : $plans;
|
|
|
|
$sd = _req('sd', $start_date);
|
|
|
|
$ed = _req('ed', $mdate);
|
|
|
|
$ts = _req('ts', '00:00:00');
|
|
|
|
$te = _req('te', '23:59:59');
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2024-07-24 15:56:02 +07:00
|
|
|
$query = ORM::for_table('tbl_transactions')
|
|
|
|
->whereRaw("UNIX_TIMESTAMP(CONCAT(`recharged_on`,' ',`recharged_time`)) >= " . strtotime("$sd $ts"))
|
|
|
|
->whereRaw("UNIX_TIMESTAMP(CONCAT(`recharged_on`,' ',`recharged_time`)) <= " . strtotime("$ed $te"))
|
2025-03-22 18:34:51 +01:00
|
|
|
->left_outer_join('tbl_customers', 'tbl_transactions.username = tbl_customers.username')
|
|
|
|
->select('tbl_transactions.*')
|
|
|
|
->select('tbl_customers.fullname', 'fullname')
|
|
|
|
->order_by_desc('tbl_transactions.id');
|
2024-07-24 15:56:02 +07:00
|
|
|
if (count($tps) > 0) {
|
|
|
|
$query->where_in('type', $tps);
|
|
|
|
}
|
|
|
|
if (count($mts) > 0) {
|
|
|
|
if (count($mts) != count($methods)) {
|
|
|
|
foreach ($mts as $mt) {
|
|
|
|
$query->where_like('method', "$mt - %");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (count($rts) > 0) {
|
|
|
|
$query->where_in('routers', $rts);
|
|
|
|
}
|
|
|
|
if (count($plns) > 0) {
|
|
|
|
$query->where_in('plan_name', $plns);
|
|
|
|
}
|
2025-04-02 11:29:25 +01:00
|
|
|
$x = $query->find_array();
|
|
|
|
$xy = $query->sum('price');
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2023-06-15 10:17:00 +07:00
|
|
|
$title = ' Reports [' . $mdate . ']';
|
|
|
|
$title = str_replace('-', ' ', $title);
|
2017-03-11 02:51:06 +07:00
|
|
|
|
2025-04-02 11:29:25 +01:00
|
|
|
$UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH);
|
2024-02-26 14:38:04 +07:00
|
|
|
if (file_exists($UPLOAD_PATH . '/logo.png')) {
|
2024-03-01 09:37:13 +07:00
|
|
|
$logo = $UPLOAD_URL_PATH . '/logo.png';
|
2024-02-26 14:38:04 +07:00
|
|
|
} else {
|
2024-03-01 09:37:13 +07:00
|
|
|
$logo = $UPLOAD_URL_PATH . '/logo.default.png';
|
2023-08-14 09:25:29 +07:00
|
|
|
}
|
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
if ($x) {
|
|
|
|
$html = '
|
|
|
|
<div id="page-wrap">
|
|
|
|
<div id="address">
|
2023-06-15 10:17:00 +07:00
|
|
|
<h3>' . $config['CompanyName'] . '</h3>
|
|
|
|
' . $config['address'] . '<br>
|
2024-02-13 13:54:01 +07:00
|
|
|
' . Lang::T('Phone Number') . ': ' . $config['phone'] . '<br>
|
2017-03-11 02:51:06 +07:00
|
|
|
</div>
|
2024-02-26 14:38:04 +07:00
|
|
|
<div id="logo"><img id="image" src="' . $logo . '" alt="logo" /></div>
|
2017-03-11 02:51:06 +07:00
|
|
|
</div>
|
2025-04-02 11:29:25 +01:00
|
|
|
<div id="header">' . Lang::T('All Transactions at Date') . ': ' . Lang::dateAndTimeFormat($sd, $ts) . ' - ' . Lang::dateAndTimeFormat($ed, $te) . '</div>
|
2017-03-11 02:51:06 +07:00
|
|
|
<table id="customers">
|
|
|
|
<tr>
|
2024-02-13 13:54:01 +07:00
|
|
|
<th>' . Lang::T('Username') . '</th>
|
2025-03-22 18:34:51 +01:00
|
|
|
<th>' . Lang::T('Fullname') . '</th>
|
2024-02-13 13:54:01 +07:00
|
|
|
<th>' . Lang::T('Plan Name') . '</th>
|
|
|
|
<th>' . Lang::T('Type') . '</th>
|
|
|
|
<th>' . Lang::T('Plan Price') . '</th>
|
|
|
|
<th>' . Lang::T('Created On') . '</th>
|
|
|
|
<th>' . Lang::T('Expires On') . '</th>
|
|
|
|
<th>' . Lang::T('Method') . '</th>
|
|
|
|
<th>' . Lang::T('Routers') . '</th>
|
2017-03-11 02:51:06 +07:00
|
|
|
</tr>';
|
|
|
|
$c = true;
|
|
|
|
foreach ($x as $value) {
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
$username = $value['username'];
|
2025-03-22 18:34:51 +01:00
|
|
|
$fullname = $value['fullname'];
|
2017-03-11 02:51:06 +07:00
|
|
|
$plan_name = $value['plan_name'];
|
|
|
|
$type = $value['type'];
|
2023-06-15 10:17:00 +07:00
|
|
|
$price = $config['currency_code'] . ' ' . number_format($value['price'], 0, $config['dec_point'], $config['thousands_sep']);
|
2024-07-24 15:56:02 +07:00
|
|
|
$recharged_on = Lang::dateAndTimeFormat($value['recharged_on'], $value['recharged_time']);
|
|
|
|
$expiration = Lang::dateAndTimeFormat($value['expiration'], $value['time']);
|
2023-06-15 10:17:00 +07:00
|
|
|
$time = $value['time'];
|
|
|
|
$method = $value['method'];
|
|
|
|
$routers = $value['routers'];
|
|
|
|
|
|
|
|
$html .= "<tr" . (($c = !$c) ? ' class="alt"' : ' class=""') . ">" . "
|
2017-03-11 02:51:06 +07:00
|
|
|
<td>$username</td>
|
2025-03-22 18:34:51 +01:00
|
|
|
<td>$fullname</td>
|
2017-03-11 02:51:06 +07:00
|
|
|
<td>$plan_name</td>
|
|
|
|
<td>$type</td>
|
|
|
|
<td align='right'>$price</td>
|
2023-06-20 12:00:03 +07:00
|
|
|
<td>$recharged_on</td>
|
2024-07-24 15:56:02 +07:00
|
|
|
<td>$expiration</td>
|
2017-03-11 02:51:06 +07:00
|
|
|
<td>$method</td>
|
|
|
|
<td>$routers</td>
|
|
|
|
</tr>";
|
|
|
|
}
|
|
|
|
$html .= '</table>
|
2024-02-13 13:54:01 +07:00
|
|
|
<h4 class="text-uppercase text-bold">' . Lang::T('Total Income') . ':</h4>
|
2023-06-15 10:17:00 +07:00
|
|
|
<h3 class="sum">' . $config['currency_code'] . ' ' . number_format($xy, 2, $config['dec_point'], $config['thousands_sep']) . '</h3>';
|
2022-09-18 00:00:40 +07:00
|
|
|
run_hook('print_pdf_by_date'); #HOOK
|
2017-03-11 02:51:06 +07:00
|
|
|
|
2023-06-15 10:17:00 +07:00
|
|
|
$mpdf = new \Mpdf\Mpdf();
|
2017-03-11 02:51:06 +07:00
|
|
|
$mpdf->SetProtection(array('print'));
|
2023-06-15 10:17:00 +07:00
|
|
|
$mpdf->SetTitle($config['CompanyName'] . ' Reports');
|
2017-03-11 02:51:06 +07:00
|
|
|
$mpdf->SetAuthor($config['CompanyName']);
|
|
|
|
$mpdf->SetWatermarkText($d['price']);
|
|
|
|
$mpdf->showWatermarkText = true;
|
|
|
|
$mpdf->watermark_font = 'Helvetica';
|
|
|
|
$mpdf->watermarkTextAlpha = 0.1;
|
|
|
|
$mpdf->SetDisplayMode('fullpage');
|
|
|
|
|
|
|
|
$style = '<style>
|
|
|
|
#page-wrap { width: 100%; margin: 0 auto; }
|
|
|
|
#header { text-align: center; position: relative; color: black; font: bold 15px Helvetica, Sans-Serif; margin-top: 10px; margin-bottom: 10px;}
|
|
|
|
|
|
|
|
#address { width: 300px; float: left; }
|
|
|
|
#logo { text-align: right; float: right; position: relative; margin-top: 15px; border: 5px solid #fff; overflow: hidden; }
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
#customers
|
|
|
|
{
|
|
|
|
font-family: Helvetica, sans-serif;
|
|
|
|
width:100%;
|
|
|
|
border-collapse:collapse;
|
|
|
|
}
|
|
|
|
#customers td, #customers th
|
|
|
|
{
|
|
|
|
font-size:0.8em;
|
|
|
|
border:1px solid #98bf21;
|
|
|
|
padding:3px 5px 2px 5px;
|
|
|
|
}
|
|
|
|
#customers th
|
|
|
|
{
|
|
|
|
font-size:0.8em;
|
|
|
|
text-align:left;
|
|
|
|
padding-top:5px;
|
|
|
|
padding-bottom:4px;
|
|
|
|
background-color:#A7C942;
|
|
|
|
color:#fff;
|
|
|
|
}
|
|
|
|
#customers tr.alt td
|
|
|
|
{
|
|
|
|
color:#000;
|
|
|
|
background-color:#EAF2D3;
|
|
|
|
}
|
|
|
|
</style>';
|
|
|
|
|
|
|
|
$nhtml = <<<EOF
|
|
|
|
$style
|
|
|
|
$html
|
|
|
|
EOF;
|
|
|
|
$mpdf->WriteHTML($nhtml);
|
2025-04-02 11:29:25 +01:00
|
|
|
$mpdf->Output('phpnuxbill_reports_' . date('Ymd_His') . '.pdf', 'D');
|
2023-06-15 10:17:00 +07:00
|
|
|
} else {
|
2017-03-11 02:51:06 +07:00
|
|
|
echo 'No Data';
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
case 'print-by-period':
|
2023-06-15 10:17:00 +07:00
|
|
|
$fdate = _post('fdate');
|
2017-03-11 02:51:06 +07:00
|
|
|
$tdate = _post('tdate');
|
|
|
|
$stype = _post('stype');
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
$d = ORM::for_table('tbl_transactions');
|
2025-04-02 11:29:25 +01:00
|
|
|
$d->left_outer_join('tbl_customers', 'tbl_transactions.username = tbl_customers.username')
|
|
|
|
->select('tbl_transactions.*')
|
|
|
|
->select('tbl_customers.fullname', 'fullname')
|
|
|
|
->order_by_desc('tbl_transactions.id');
|
2023-06-15 10:17:00 +07:00
|
|
|
if ($stype != '') {
|
|
|
|
$d->where('type', $stype);
|
|
|
|
}
|
2017-03-11 02:51:06 +07:00
|
|
|
$d->where_gte('recharged_on', $fdate);
|
|
|
|
$d->where_lte('recharged_on', $tdate);
|
|
|
|
$d->order_by_desc('id');
|
2025-04-02 11:29:25 +01:00
|
|
|
$x = $d->find_many();
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2023-06-15 10:17:00 +07:00
|
|
|
$dr = ORM::for_table('tbl_transactions');
|
|
|
|
if ($stype != '') {
|
|
|
|
$dr->where('type', $stype);
|
|
|
|
}
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
$dr->where_gte('recharged_on', $fdate);
|
|
|
|
$dr->where_lte('recharged_on', $tdate);
|
2023-06-15 10:17:00 +07:00
|
|
|
$xy = $dr->sum('price');
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2023-06-15 10:17:00 +07:00
|
|
|
$ui->assign('d', $x);
|
|
|
|
$ui->assign('dr', $xy);
|
|
|
|
$ui->assign('fdate', $fdate);
|
|
|
|
$ui->assign('tdate', $tdate);
|
|
|
|
$ui->assign('stype', $stype);
|
2022-09-18 00:00:40 +07:00
|
|
|
run_hook('print_by_period'); #HOOK
|
2025-02-04 10:56:02 +07:00
|
|
|
$ui->display('admin/print/by-period.tpl');
|
2017-03-11 02:51:06 +07:00
|
|
|
break;
|
2022-09-01 14:52:32 +07:00
|
|
|
|
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
case 'pdf-by-period':
|
2023-06-15 10:17:00 +07:00
|
|
|
$fdate = _post('fdate');
|
2017-03-11 02:51:06 +07:00
|
|
|
$tdate = _post('tdate');
|
|
|
|
$stype = _post('stype');
|
|
|
|
$d = ORM::for_table('tbl_transactions');
|
2025-04-02 11:29:25 +01:00
|
|
|
$d->left_outer_join('tbl_customers', 'tbl_transactions.username = tbl_customers.username')
|
|
|
|
->select('tbl_transactions.*')
|
|
|
|
->select('tbl_customers.fullname', 'fullname')
|
|
|
|
->order_by_desc('tbl_transactions.id');
|
2023-06-15 10:17:00 +07:00
|
|
|
if ($stype != '') {
|
|
|
|
$d->where('type', $stype);
|
|
|
|
}
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
$d->where_gte('recharged_on', $fdate);
|
|
|
|
$d->where_lte('recharged_on', $tdate);
|
|
|
|
$d->order_by_desc('id');
|
2025-04-02 11:29:25 +01:00
|
|
|
$x = $d->find_many();
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2023-06-15 10:17:00 +07:00
|
|
|
$dr = ORM::for_table('tbl_transactions');
|
|
|
|
if ($stype != '') {
|
|
|
|
$dr->where('type', $stype);
|
|
|
|
}
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
$dr->where_gte('recharged_on', $fdate);
|
|
|
|
$dr->where_lte('recharged_on', $tdate);
|
2023-06-15 10:17:00 +07:00
|
|
|
$xy = $dr->sum('price');
|
2017-03-11 02:51:06 +07:00
|
|
|
|
2023-06-15 10:17:00 +07:00
|
|
|
$title = ' Reports [' . $mdate . ']';
|
|
|
|
$title = str_replace('-', ' ', $title);
|
2024-03-01 09:37:13 +07:00
|
|
|
|
2025-04-02 11:29:25 +01:00
|
|
|
$UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH);
|
2024-02-26 14:38:04 +07:00
|
|
|
if (file_exists($UPLOAD_PATH . '/logo.png')) {
|
2024-03-01 09:37:13 +07:00
|
|
|
$logo = $UPLOAD_URL_PATH . '/logo.png';
|
2024-02-26 14:38:04 +07:00
|
|
|
} else {
|
2024-03-01 09:37:13 +07:00
|
|
|
$logo = $UPLOAD_URL_PATH . '/logo.default.png';
|
2023-08-14 09:25:29 +07:00
|
|
|
}
|
2017-03-11 02:51:06 +07:00
|
|
|
|
|
|
|
if ($x) {
|
|
|
|
$html = '
|
|
|
|
<div id="page-wrap">
|
|
|
|
<div id="address">
|
2023-06-15 10:17:00 +07:00
|
|
|
<h3>' . $config['CompanyName'] . '</h3>
|
|
|
|
' . $config['address'] . '<br>
|
2024-02-13 13:54:01 +07:00
|
|
|
' . Lang::T('Phone Number') . ': ' . $config['phone'] . '<br>
|
2017-03-11 02:51:06 +07:00
|
|
|
</div>
|
2024-02-26 14:38:04 +07:00
|
|
|
<div id="logo"><img id="image" src="' . $logo . '" alt="logo" /></div>
|
2017-03-11 02:51:06 +07:00
|
|
|
</div>
|
2024-02-13 13:54:01 +07:00
|
|
|
<div id="header">' . Lang::T('All Transactions at Date') . ': ' . date($config['date_format'], strtotime($fdate)) . ' - ' . date($config['date_format'], strtotime($tdate)) . '</div>
|
2017-03-11 02:51:06 +07:00
|
|
|
<table id="customers">
|
|
|
|
<tr>
|
2024-02-13 13:54:01 +07:00
|
|
|
<th>' . Lang::T('Username') . '</th>
|
2025-04-02 11:29:25 +01:00
|
|
|
<th>' . Lang::T('Fullname') . '</th>
|
2024-02-13 13:54:01 +07:00
|
|
|
<th>' . Lang::T('Plan Name') . '</th>
|
|
|
|
<th>' . Lang::T('Type') . '</th>
|
|
|
|
<th>' . Lang::T('Plan Price') . '</th>
|
|
|
|
<th>' . Lang::T('Created On') . '</th>
|
|
|
|
<th>' . Lang::T('Expires On') . '</th>
|
|
|
|
<th>' . Lang::T('Method') . '</th>
|
|
|
|
<th>' . Lang::T('Routers') . '</th>
|
2017-03-11 02:51:06 +07:00
|
|
|
</tr>';
|
|
|
|
$c = true;
|
|
|
|
foreach ($x as $value) {
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
$username = $value['username'];
|
2025-04-02 11:29:25 +01:00
|
|
|
$fullname = $value['fullname'];
|
2017-03-11 02:51:06 +07:00
|
|
|
$plan_name = $value['plan_name'];
|
|
|
|
$type = $value['type'];
|
2023-06-15 10:17:00 +07:00
|
|
|
$price = $config['currency_code'] . ' ' . number_format($value['price'], 0, $config['dec_point'], $config['thousands_sep']);
|
|
|
|
$recharged_on = date($config['date_format'], strtotime($value['recharged_on']));
|
|
|
|
$expiration = date($config['date_format'], strtotime($value['expiration']));
|
|
|
|
$time = $value['time'];
|
|
|
|
$method = $value['method'];
|
|
|
|
$routers = $value['routers'];
|
|
|
|
|
|
|
|
$html .= "<tr" . (($c = !$c) ? ' class="alt"' : ' class=""') . ">" . "
|
2017-03-11 02:51:06 +07:00
|
|
|
<td>$username</td>
|
2025-04-02 11:29:25 +01:00
|
|
|
<td>$fullname</td>
|
|
|
|
<td>$plan_name</td>
|
2017-03-11 02:51:06 +07:00
|
|
|
<td>$type</td>
|
|
|
|
<td align='right'>$price</td>
|
2023-06-20 12:00:03 +07:00
|
|
|
<td>$recharged_on </td>
|
2017-03-11 02:51:06 +07:00
|
|
|
<td>$expiration $time </td>
|
|
|
|
<td>$method</td>
|
|
|
|
<td>$routers</td>
|
|
|
|
</tr>";
|
|
|
|
}
|
|
|
|
$html .= '</table>
|
2024-02-13 13:54:01 +07:00
|
|
|
<h4 class="text-uppercase text-bold">' . Lang::T('Total Income') . ':</h4>
|
2023-06-15 10:17:00 +07:00
|
|
|
<h3 class="sum">' . $config['currency_code'] . ' ' . number_format($xy, 2, $config['dec_point'], $config['thousands_sep']) . '</h3>';
|
2017-03-11 02:51:06 +07:00
|
|
|
|
2022-09-18 00:00:40 +07:00
|
|
|
run_hook('pdf_by_period'); #HOOK
|
2023-08-14 09:25:29 +07:00
|
|
|
$mpdf = new \Mpdf\Mpdf();
|
2017-03-11 02:51:06 +07:00
|
|
|
$mpdf->SetProtection(array('print'));
|
2023-06-15 10:17:00 +07:00
|
|
|
$mpdf->SetTitle($config['CompanyName'] . ' Reports');
|
2017-03-11 02:51:06 +07:00
|
|
|
$mpdf->SetAuthor($config['CompanyName']);
|
|
|
|
$mpdf->SetWatermarkText($d['price']);
|
|
|
|
$mpdf->showWatermarkText = true;
|
|
|
|
$mpdf->watermark_font = 'Helvetica';
|
|
|
|
$mpdf->watermarkTextAlpha = 0.1;
|
|
|
|
$mpdf->SetDisplayMode('fullpage');
|
|
|
|
|
|
|
|
$style = '<style>
|
|
|
|
#page-wrap { width: 100%; margin: 0 auto; }
|
|
|
|
#header { text-align: center; position: relative; color: black; font: bold 15px Helvetica, Sans-Serif; margin-top: 10px; margin-bottom: 10px;}
|
|
|
|
|
|
|
|
#address { width: 300px; float: left; }
|
|
|
|
#logo { text-align: right; float: right; position: relative; margin-top: 15px; border: 5px solid #fff; overflow: hidden; }
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
#customers
|
|
|
|
{
|
|
|
|
font-family: Helvetica, sans-serif;
|
|
|
|
width:100%;
|
|
|
|
border-collapse:collapse;
|
|
|
|
}
|
|
|
|
#customers td, #customers th
|
|
|
|
{
|
|
|
|
font-size:0.8em;
|
|
|
|
border:1px solid #98bf21;
|
|
|
|
padding:3px 5px 2px 5px;
|
|
|
|
}
|
|
|
|
#customers th
|
|
|
|
{
|
|
|
|
font-size:0.8em;
|
|
|
|
text-align:left;
|
|
|
|
padding-top:5px;
|
|
|
|
padding-bottom:4px;
|
|
|
|
background-color:#A7C942;
|
|
|
|
color:#fff;
|
|
|
|
}
|
|
|
|
#customers tr.alt td
|
|
|
|
{
|
|
|
|
color:#000;
|
|
|
|
background-color:#EAF2D3;
|
|
|
|
}
|
|
|
|
</style>';
|
|
|
|
|
|
|
|
$nhtml = <<<EOF
|
|
|
|
$style
|
|
|
|
$html
|
|
|
|
EOF;
|
|
|
|
$mpdf->WriteHTML($nhtml);
|
2024-03-12 12:12:36 +07:00
|
|
|
$mpdf->Output(date('Ymd_His') . '.pdf', 'D');
|
2023-06-15 10:17:00 +07:00
|
|
|
} else {
|
2017-03-11 02:51:06 +07:00
|
|
|
echo 'No Data';
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2022-09-01 14:52:32 +07:00
|
|
|
|
2017-03-11 02:51:06 +07:00
|
|
|
default:
|
2025-02-04 09:23:55 +07:00
|
|
|
$ui->display('admin/404.tpl');
|
2023-06-15 10:17:00 +07:00
|
|
|
}
|