fix date range dashboard
This commit is contained in:
parent
d5d03875f0
commit
5c33806326
@ -9,7 +9,7 @@ _admin();
|
|||||||
$ui->assign('_title', Lang::T('Dashboard'));
|
$ui->assign('_title', Lang::T('Dashboard'));
|
||||||
$ui->assign('_admin', $admin);
|
$ui->assign('_admin', $admin);
|
||||||
|
|
||||||
if(isset($_GET['refresh'])){
|
if (isset($_GET['refresh'])) {
|
||||||
$files = scandir($CACHE_PATH);
|
$files = scandir($CACHE_PATH);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||||
@ -21,20 +21,21 @@ if(isset($_GET['refresh'])){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$reset_day = $config['reset_day'];
|
$reset_day = $config['reset_day'];
|
||||||
if(empty($reset_day)){
|
if (empty($reset_day)) {
|
||||||
$reset_day = 1;
|
$reset_day = 1;
|
||||||
}
|
}
|
||||||
//first day of month
|
//first day of month
|
||||||
if($reset_day >= date("d")){
|
if (date("d") >= $reset_day) {
|
||||||
$first_day_month = date('Y-m-'.$reset_day);
|
$start_date = date('Y-m-' . $reset_day);
|
||||||
}else{
|
} else {
|
||||||
$first_day_month = date('Y-m-'.$reset_day, strtotime("-1 MONTH"));
|
$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');
|
$month_n = date('n');
|
||||||
|
|
||||||
$iday = ORM::for_table('tbl_transactions')
|
$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', 'Customer - Balance')
|
||||||
->where_not_equal('method', 'Recharge Balance - Administrator')
|
->where_not_equal('method', 'Recharge Balance - Administrator')
|
||||||
->sum('price');
|
->sum('price');
|
||||||
@ -44,7 +45,11 @@ if ($iday == '') {
|
|||||||
}
|
}
|
||||||
$ui->assign('iday', $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 == '') {
|
if ($imonth == '') {
|
||||||
$imonth = '0.00';
|
$imonth = '0.00';
|
||||||
}
|
}
|
||||||
@ -72,13 +77,13 @@ $ui->assign('c_all', $c_all);
|
|||||||
if ($config['hide_uet'] != 'yes') {
|
if ($config['hide_uet'] != 'yes') {
|
||||||
//user expire
|
//user expire
|
||||||
$query = ORM::for_table('tbl_user_recharges')
|
$query = ORM::for_table('tbl_user_recharges')
|
||||||
->where_lte('expiration', $mdate)
|
->where_lte('expiration', $current_date)
|
||||||
->order_by_desc('expiration');
|
->order_by_desc('expiration');
|
||||||
$expire = Paginator::findMany($query);
|
$expire = Paginator::findMany($query);
|
||||||
|
|
||||||
// Get the total count of expired records for pagination
|
// Get the total count of expired records for pagination
|
||||||
$totalCount = ORM::for_table('tbl_user_recharges')
|
$totalCount = ORM::for_table('tbl_user_recharges')
|
||||||
->where_lte('expiration', $mdate)
|
->where_lte('expiration', $current_date)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
// Pass the total count and current page to the paginator
|
// 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
|
// 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('monthlySales', $monthlySales);
|
||||||
$ui->assign('xfooter', '');
|
$ui->assign('xfooter', '');
|
||||||
$ui->assign('monthlyRegistered', $monthlyRegistered);
|
$ui->assign('monthlyRegistered', $monthlyRegistered);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{include file="sections/header.tpl"}
|
{include file="sections/header.tpl"}
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-3 col-xs-6">
|
<div class="col-lg-3 col-xs-6">
|
||||||
<div class="small-box bg-aqua">
|
<div class="small-box bg-aqua">
|
||||||
@ -22,7 +21,7 @@
|
|||||||
<h4><sup>{$_c['currency_code']}</sup>
|
<h4><sup>{$_c['currency_code']}</sup>
|
||||||
{number_format($imonth,0,$_c['dec_point'],$_c['thousands_sep'])}</h4>
|
{number_format($imonth,0,$_c['dec_point'],$_c['thousands_sep'])}</h4>
|
||||||
|
|
||||||
<p title="from {$first_day_month}">{Lang::T('Income This Month')}</p>
|
<p>{Lang::T('Income This Month')}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="ion ion-stats-bars"></i>
|
<i class="ion ion-stats-bars"></i>
|
||||||
@ -60,6 +59,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li>{Lang::dateFormat($start_date)}</li>
|
||||||
|
<li>{Lang::dateFormat($current_date)}</li>
|
||||||
|
</ol>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
|
|
||||||
@ -156,7 +159,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="{$_url}customers/viewu/{$expired['username']}">{$expired['username']}</a></td>
|
<td><a href="{$_url}customers/viewu/{$expired['username']}">{$expired['username']}</a></td>
|
||||||
<td><small data-toggle="tooltip" data-placement="top"
|
<td><small data-toggle="tooltip" data-placement="top"
|
||||||
title="{Lang::dateAndTimeFormat($expired['recharged_on'],$expired['recharged_time'])}">{Lang::timeElapsed($rem_started)}</small> /
|
title="{Lang::dateAndTimeFormat($expired['recharged_on'],$expired['recharged_time'])}">{Lang::timeElapsed($rem_started)}</small>
|
||||||
|
/
|
||||||
<span data-toggle="tooltip" data-placement="top"
|
<span data-toggle="tooltip" data-placement="top"
|
||||||
title="{Lang::dateAndTimeFormat($expired['expiration'],$expired['time'])}">{Lang::timeElapsed($rem_exp)}</span>
|
title="{Lang::dateAndTimeFormat($expired['expiration'],$expired['time'])}">{Lang::timeElapsed($rem_exp)}</span>
|
||||||
</td>
|
</td>
|
||||||
@ -176,7 +180,7 @@
|
|||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
{if $_c['hide_pg'] != 'yes'}
|
{if $_c['hide_pg'] != 'yes'}
|
||||||
<div class="panel panel-success panel-hovered mb20 activities">
|
<div class="panel panel-success panel-hovered mb20 activities">
|
||||||
<div class="panel-heading">{Lang::T('Payment Gateway')}: {$_c['payment_gateway']}</div>
|
<div class="panel-heading">{Lang::T('Payment Gateway')}: {str_replace(',',', ',$_c['payment_gateway'])}</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{if $_c['hide_aui'] != 'yes'}
|
{if $_c['hide_aui'] != 'yes'}
|
||||||
@ -373,43 +377,44 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</script>
|
</script>
|
||||||
{if $_c['new_version_notify'] != 'disable'}
|
{if $_c['new_version_notify'] != 'disable'}
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
$.getJSON("./version.json?" + Math.random(), function(data) {
|
$.getJSON("./version.json?" + Math.random(), function(data) {
|
||||||
var localVersion = data.version;
|
var localVersion = data.version;
|
||||||
$('#version').html('Version: ' + localVersion);
|
$('#version').html('Version: ' + localVersion);
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
"https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/version.json?" +
|
"https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/version.json?" +
|
||||||
Math
|
Math
|
||||||
.random(),
|
.random(),
|
||||||
function(data) {
|
function(data) {
|
||||||
var latestVersion = data.version;
|
var latestVersion = data.version;
|
||||||
if (localVersion !== latestVersion) {
|
if (localVersion !== latestVersion) {
|
||||||
$('#version').html('Latest Version: ' + latestVersion);
|
$('#version').html('Latest Version: ' + latestVersion);
|
||||||
if(getCookie(latestVersion) != 'done'){
|
if (getCookie(latestVersion) != 'done') {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'info',
|
icon: 'info',
|
||||||
title: "New Version Available\nVersion: "+latestVersion,
|
title: "New Version Available\nVersion: " + latestVersion,
|
||||||
toast: true,
|
toast: true,
|
||||||
position: 'bottom-right',
|
position: 'bottom-right',
|
||||||
showConfirmButton: true,
|
showConfirmButton: true,
|
||||||
showCloseButton: true,
|
showCloseButton: true,
|
||||||
timer: 30000,
|
timer: 30000,
|
||||||
confirmButtonText: '<a href="{$_url}community#latestVersion" style="color: white;">Update Now</a>',
|
confirmButtonText: '<a href="{$_url}community#latestVersion" style="color: white;">Update Now</a>',
|
||||||
timerProgressBar: true,
|
timerProgressBar: true,
|
||||||
didOpen: (toast) => {
|
didOpen: (toast) => {
|
||||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
toast.addEventListener('mouseenter', Swal.stopTimer)
|
||||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
toast.addEventListener('mouseleave', Swal
|
||||||
}
|
.resumeTimer)
|
||||||
});
|
}
|
||||||
setCookie(latestVersion, 'done', 7);
|
});
|
||||||
|
setCookie(latestVersion, 'done', 7);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{include file="sections/footer.tpl"}
|
{include file="sections/footer.tpl"}
|
Loading…
x
Reference in New Issue
Block a user