fix inactive customer and check enable_balance

This commit is contained in:
Ibnu Maksum 2024-07-29 14:12:26 +07:00
parent a85e9ee95a
commit b3e97ecf6d
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
2 changed files with 8 additions and 4 deletions

View File

@ -55,9 +55,10 @@ if ($imonth == '') {
}
$ui->assign('imonth', $imonth);
$cb = ORM::for_table('tbl_customers')->whereGte('balance', 0)->sum('balance');
$ui->assign('cb', $cb);
if ($config['enable_balance'] == 'yes'){
$cb = ORM::for_table('tbl_customers')->whereGte('balance', 0)->sum('balance');
$ui->assign('cb', $cb);
}
$u_act = ORM::for_table('tbl_user_recharges')->where('status', 'on')->count();
if (empty($u_act)) {

View File

@ -53,7 +53,7 @@
<ol class="breadcrumb">
<li>{Lang::dateFormat($start_date)}</li>
<li>{Lang::dateFormat($current_date)}</li>
{if in_array($_admin['user_type'],['SuperAdmin','Admin', 'Report'])}
{if $_c['enable_balance'] == 'yes' && in_array($_admin['user_type'],['SuperAdmin','Admin', 'Report'])}
<li>
{Lang::T('Customer Balance')} <sup>{$_c['currency_code']}</sup>
<b>{number_format($cb,0,$_c['dec_point'],$_c['thousands_sep'])}</b>
@ -337,6 +337,9 @@
//lets calculate the inactive users as reported
var expired = u_all - u_act;
var inactive = c_all - u_all;
if(inactive < 0){
inactive = 0;
}
// Create the chart data
var data = {
labels: ['Active Users', 'Expired Users', 'Inactive Users'],