diff --git a/system/controllers/dashboard.php b/system/controllers/dashboard.php index ab7411c5..aee57c36 100644 --- a/system/controllers/dashboard.php +++ b/system/controllers/dashboard.php @@ -9,7 +9,7 @@ _admin(); $ui->assign('_title', Lang::T('Dashboard')); $ui->assign('_admin', $admin); -if(isset($_GET['refresh'])){ +if (isset($_GET['refresh'])) { $files = scandir($CACHE_PATH); foreach ($files as $file) { $ext = pathinfo($file, PATHINFO_EXTENSION); @@ -21,20 +21,21 @@ if(isset($_GET['refresh'])){ } $reset_day = $config['reset_day']; -if(empty($reset_day)){ +if (empty($reset_day)) { $reset_day = 1; } //first day of month -if($reset_day >= date("d")){ - $first_day_month = date('Y-m-'.$reset_day); -}else{ - $first_day_month = date('Y-m-'.$reset_day, strtotime("-1 MONTH")); +if (date("d") >= $reset_day) { + $start_date = date('Y-m-' . $reset_day); +} else { + $start_date = date('Y-m-' . $reset_day, strtotime("-1 MONTH")); } -$mdate = date('Y-m-d'); + +$current_date = date('Y-m-d'); $month_n = date('n'); $iday = ORM::for_table('tbl_transactions') - ->where('recharged_on', $mdate) + ->where('recharged_on', $current_date) ->where_not_equal('method', 'Customer - Balance') ->where_not_equal('method', 'Recharge Balance - Administrator') ->sum('price'); @@ -44,7 +45,11 @@ if ($iday == '') { } $ui->assign('iday', $iday); -$imonth = ORM::for_table('tbl_transactions')->where_not_equal('method', 'Customer - Balance')->where_not_equal('method', 'Recharge Balance - Administrator')->where_gte('recharged_on', $first_day_month)->where_lte('recharged_on', $mdate)->sum('price'); +$imonth = ORM::for_table('tbl_transactions') + ->where_not_equal('method', 'Customer - Balance') + ->where_not_equal('method', 'Recharge Balance - Administrator') + ->where_gte('recharged_on', $start_date) + ->where_lte('recharged_on', $current_date)->sum('price'); if ($imonth == '') { $imonth = '0.00'; } @@ -72,13 +77,13 @@ $ui->assign('c_all', $c_all); if ($config['hide_uet'] != 'yes') { //user expire $query = ORM::for_table('tbl_user_recharges') - ->where_lte('expiration', $mdate) + ->where_lte('expiration', $current_date) ->order_by_desc('expiration'); $expire = Paginator::findMany($query); // Get the total count of expired records for pagination $totalCount = ORM::for_table('tbl_user_recharges') - ->where_lte('expiration', $mdate) + ->where_lte('expiration', $current_date) ->count(); // Pass the total count and current page to the paginator @@ -200,7 +205,8 @@ if (file_exists($cacheMSfile) && time() - filemtime($cacheMSfile) < 43200) { } // Assign the monthly sales data to Smarty -$ui->assign('first_day_month',$first_day_month); +$ui->assign('start_date', $start_date); +$ui->assign('current_date', $current_date); $ui->assign('monthlySales', $monthlySales); $ui->assign('xfooter', ''); $ui->assign('monthlyRegistered', $monthlyRegistered); diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl index 6025622f..45b409eb 100644 --- a/ui/ui/dashboard.tpl +++ b/ui/ui/dashboard.tpl @@ -1,6 +1,5 @@ {include file="sections/header.tpl"} -
@@ -22,7 +21,7 @@

{$_c['currency_code']} {number_format($imonth,0,$_c['dec_point'],$_c['thousands_sep'])}

-

{Lang::T('Income This Month')}

+

{Lang::T('Income This Month')}

@@ -60,6 +59,10 @@
+
@@ -156,7 +159,8 @@ {$expired['username']} {Lang::timeElapsed($rem_started)} / + title="{Lang::dateAndTimeFormat($expired['recharged_on'],$expired['recharged_time'])}">{Lang::timeElapsed($rem_started)} + / {Lang::timeElapsed($rem_exp)} @@ -176,7 +180,7 @@
{if $_c['hide_pg'] != 'yes'}
-
{Lang::T('Payment Gateway')}: {$_c['payment_gateway']}
+
{Lang::T('Payment Gateway')}: {str_replace(',',', ',$_c['payment_gateway'])}
{/if} {if $_c['hide_aui'] != 'yes'} @@ -373,43 +377,44 @@ {/if} {if $_c['new_version_notify'] != 'disable'} - + }); + {/if} {include file="sections/footer.tpl"} \ No newline at end of file