From 43a92c5d3bb27b889da11aab6c43c7fade216946 Mon Sep 17 00:00:00 2001
From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com>
Date: Sat, 22 Mar 2025 18:34:51 +0100
Subject: [PATCH] feat: add fullname field to transaction reports, pdf export
and update language file
---
system/controllers/export.php | 8 +++++++-
system/controllers/reports.php | 5 ++++-
ui/ui/admin/reports/list.tpl | 7 ++++---
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/system/controllers/export.php b/system/controllers/export.php
index 154d188f..c814fda5 100644
--- a/system/controllers/export.php
+++ b/system/controllers/export.php
@@ -114,7 +114,10 @@ switch ($action) {
$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');
+ ->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 (count($tps) > 0) {
$query->where_in('type', $tps);
}
@@ -158,6 +161,7 @@ switch ($action) {
' . Lang::T('Username') . ' |
+ ' . Lang::T('Fullname') . ' |
' . Lang::T('Plan Name') . ' |
' . Lang::T('Type') . ' |
' . Lang::T('Plan Price') . ' |
@@ -170,6 +174,7 @@ switch ($action) {
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']);
@@ -181,6 +186,7 @@ switch ($action) {
$html .= "
" . "
$username |
+ $fullname |
$plan_name |
$type |
$price |
diff --git a/system/controllers/reports.php b/system/controllers/reports.php
index 4272a22c..4562ab6e 100644
--- a/system/controllers/reports.php
+++ b/system/controllers/reports.php
@@ -359,7 +359,10 @@ switch ($action) {
$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');
+ ->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 (count($tps) > 0) {
$query->where_in('type', $tps);
}
diff --git a/ui/ui/admin/reports/list.tpl b/ui/ui/admin/reports/list.tpl
index deb249b6..356ebec0 100644
--- a/ui/ui/admin/reports/list.tpl
+++ b/ui/ui/admin/reports/list.tpl
@@ -94,10 +94,11 @@
- |
+ |
{Lang::T('Username')} |
+ {Lang::T('Fullname')} |
{Lang::T('Type')} |
{Lang::T('Plan Name')} |
{Lang::T('Plan Price')} |
@@ -111,6 +112,7 @@
{foreach $d as $ds}
{$ds['username']} |
+ {$ds['fullname']} |
{$ds['type']} |
{$ds['plan_name']} |
{Lang::moneyFormat($ds['price'])} |
@@ -122,9 +124,8 @@
{/foreach}
{Lang::T('Total')} |
- |
{Lang::moneyFormat($dr)} |
- |
+ |