From 28541f366c74e745fa3f368e1747cf54eeee4cd8 Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Wed, 2 Apr 2025 11:29:25 +0100 Subject: [PATCH] feat: add fullname column to transaction reports and update related templates --- system/controllers/export.php | 33 ++++++++++++++++++++++----------- ui/ui/admin/print/by-period.tpl | 2 ++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/system/controllers/export.php b/system/controllers/export.php index c814fda5..a43a4d70 100644 --- a/system/controllers/export.php +++ b/system/controllers/export.php @@ -71,8 +71,8 @@ switch ($action) { if (count($plns) > 0) { $query->where_in('plan_name', $plns); } - $x = $query->find_array(); - $xy = $query->sum('price'); + $x = $query->find_array(); + $xy = $query->sum('price'); $ui->assign('sd', $sd); $ui->assign('ed', $ed); @@ -134,13 +134,13 @@ switch ($action) { if (count($plns) > 0) { $query->where_in('plan_name', $plns); } - $x = $query->find_array(); - $xy = $query->sum('price'); + $x = $query->find_array(); + $xy = $query->sum('price'); $title = ' Reports [' . $mdate . ']'; $title = str_replace('-', ' ', $title); - $UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH); + $UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH); if (file_exists($UPLOAD_PATH . '/logo.png')) { $logo = $UPLOAD_URL_PATH . '/logo.png'; } else { @@ -157,7 +157,7 @@ switch ($action) { - + @@ -251,7 +251,7 @@ $style $html EOF; $mpdf->WriteHTML($nhtml); - $mpdf->Output('phpnuxbill_reports_'.date('Ymd_His') . '.pdf', 'D'); + $mpdf->Output('phpnuxbill_reports_' . date('Ymd_His') . '.pdf', 'D'); } else { echo 'No Data'; } @@ -264,13 +264,17 @@ EOF; $stype = _post('stype'); $d = ORM::for_table('tbl_transactions'); + $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'); 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(); + $x = $d->find_many(); $dr = ORM::for_table('tbl_transactions'); if ($stype != '') { @@ -296,6 +300,10 @@ EOF; $tdate = _post('tdate'); $stype = _post('stype'); $d = ORM::for_table('tbl_transactions'); + $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'); if ($stype != '') { $d->where('type', $stype); } @@ -303,7 +311,7 @@ EOF; $d->where_gte('recharged_on', $fdate); $d->where_lte('recharged_on', $tdate); $d->order_by_desc('id'); - $x = $d->find_many(); + $x = $d->find_many(); $dr = ORM::for_table('tbl_transactions'); if ($stype != '') { @@ -317,7 +325,7 @@ EOF; $title = ' Reports [' . $mdate . ']'; $title = str_replace('-', ' ', $title); - $UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH); + $UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH); if (file_exists($UPLOAD_PATH . '/logo.png')) { $logo = $UPLOAD_URL_PATH . '/logo.png'; } else { @@ -338,6 +346,7 @@ EOF;
' . Lang::T('Username') . '
+ @@ -350,6 +359,7 @@ EOF; foreach ($x as $value) { $username = $value['username']; + $fullname = $value['fullname']; $plan_name = $value['plan_name']; $type = $value['type']; $price = $config['currency_code'] . ' ' . number_format($value['price'], 0, $config['dec_point'], $config['thousands_sep']); @@ -361,7 +371,8 @@ EOF; $html .= "" . " - + + diff --git a/ui/ui/admin/print/by-period.tpl b/ui/ui/admin/print/by-period.tpl index 78f20828..01f7821f 100644 --- a/ui/ui/admin/print/by-period.tpl +++ b/ui/ui/admin/print/by-period.tpl @@ -26,6 +26,7 @@
' . Lang::T('Username') . '' . Lang::T('Fullname') . ' ' . Lang::T('Plan Name') . ' ' . Lang::T('Type') . ' ' . Lang::T('Plan Price') . '$username$plan_name$fullname$plan_name $type $price $recharged_on
+ @@ -36,6 +37,7 @@ {foreach $d as $ds} +
{Lang::T('Username')}{Lang::T('Fullname')} {Lang::T('Plan Name')} {Lang::T('Type')} {Lang::T('Plan Price')}
{$ds['username']}{$ds['fullname']} {$ds['plan_name']} {$ds['type']} {Lang::moneyFormat($ds['price'])}