show remaining bill

This commit is contained in:
Ibnu Maksum 2024-09-24 10:55:07 +07:00
parent 4ffbac878c
commit a51462ef1a
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
4 changed files with 78 additions and 50 deletions

View File

@ -189,7 +189,9 @@ switch ($action) {
if (count($usings) == 0) {
$usings[] = Lang::T('Cash');
}
$abills = User::getAttributes("Bill");
$ui->assign('usings', $usings);
$ui->assign('abills', $abills);
$ui->assign('bills', $bills);
$ui->assign('add_cost', $add_cost);
$ui->assign('cust', $cust);

View File

@ -101,7 +101,7 @@ $ui->assign('_bills', $_bill);
// Sync plan to router
if (isset($_GET['sync']) && !empty($_GET['sync'])) {
foreach ($_bill as $tur) {
if($tur['status'] == 'on'){
if ($tur['status'] == 'on') {
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
if ($p) {
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
@ -265,7 +265,7 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && $_c['hs_auth_m
}
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSION['nux-hostname']) && $_c['hs_auth_method'] == 'hchap')) {
$apkurl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'onoff')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$apkurl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'onoff') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$ui->assign('nux_mac', $_SESSION['nux-mac']);
$ui->assign('nux_ip', $_SESSION['nux-ip']);
$keys = explode('-', $_SESSION['nux-key']);
@ -276,23 +276,23 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI
$ui->assign('hchap', $_GET['hchap']);
$ui->assign('logged', $_GET['logged']);
if ($_app_stage != 'demo') {
if ($_GET['mikrotik'] == 'login') {
r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully'));
}
$getmsg = $_GET['msg'];
///get auth notification from mikrotik
if($getmsg == 'Connected') {
$msg .= Lang::T($getmsg);
r2(U . 'home&logged=1', 's', $msg);
} else if($getmsg){
$msg .= Lang::T($getmsg);
r2(U . 'home', 's', $msg);
}
if ($_GET['mikrotik'] == 'login') {
r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully'));
}
$getmsg = $_GET['msg'];
///get auth notification from mikrotik
if ($getmsg == 'Connected') {
$msg .= Lang::T($getmsg);
r2(U . 'home&logged=1', 's', $msg);
} else if ($getmsg) {
$msg .= Lang::T($getmsg);
r2(U . 'home', 's', $msg);
}
}
}
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSION['nux-hostname']) && $_c['hs_auth_method'] == 'hchap')) {
$apkurl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'onoff')|| $_SERVER['SERVER_PORT'] == 443)?'https':'http').'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$apkurl = (((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'onoff') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$ui->assign('nux_mac', $_SESSION['nux-mac']);
$ui->assign('nux_ip', $_SESSION['nux-ip']);
$keys = explode('-', $_SESSION['nux-key']);
@ -303,29 +303,29 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI
$ui->assign('hchap', $_GET['hchap']);
$ui->assign('logged', $_GET['logged']);
if ($_app_stage != 'demo') {
if ($_GET['mikrotik'] == 'login') {
r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully'));
}
$getmsg = $_GET['msg'];
///get auth notification from mikrotik
if($getmsg == 'Connected') {
$msg .= Lang::T($getmsg);
r2(U . 'home&logged=1', 's', $msg);
} else if($getmsg){
$msg .= Lang::T($getmsg);
r2(U . 'home', 's', $msg);
}
if ($_GET['mikrotik'] == 'login') {
r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully'));
}
$getmsg = $_GET['msg'];
///get auth notification from mikrotik
if ($getmsg == 'Connected') {
$msg .= Lang::T($getmsg);
r2(U . 'home&logged=1', 's', $msg);
} else if ($getmsg) {
$msg .= Lang::T($getmsg);
r2(U . 'home', 's', $msg);
}
}
}
$tcf = ORM::for_table('tbl_customers_fields')
->where('customer_id', $user['id'])
->find_many();
->where('customer_id', $user['id'])
->find_many();
$vpn = ORM::for_table('tbl_port_pool')
->find_one();
$ui->assign('cf', $tcf);
$ui->assign('vpn', $vpn);
->find_one();
$ui->assign('cf', $tcf);
$ui->assign('vpn', $vpn);
$ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)

View File

@ -52,32 +52,58 @@
</li>
<li class="list-group-item">
<b>{Lang::T('Using')}</b> <span class="pull-right">
<select name="using" style="background-color: white;outline: 1px;border: 1px solid #b7b7b7;">
{foreach $usings as $us}
<option value="{trim($us)}" {if $using eq trim($us)}selected{/if}>{trim(ucWords($us))}</option>
{/foreach}
{if $_c['enable_balance'] eq 'yes'}
<option value="balance" {if $using eq 'balance'}selected{/if}>{Lang::T('Customer Balance')}</option>
{/if}
<option value="zero" {if $using eq 'zero'}selected{/if}>{$_c['currency_code']} 0</option>
</select>
<select name="using"
style="background-color: white;outline: 1px;border: 1px solid #b7b7b7;">
{foreach $usings as $us}
<option value="{trim($us)}" {if $using eq trim($us)}selected{/if}>
{trim(ucWords($us))}</option>
{/foreach}
{if $_c['enable_balance'] eq 'yes'}
<option value="balance" {if $using eq 'balance'}selected{/if}>
{Lang::T('Customer Balance')}</option>
{/if}
<option value="zero" {if $using eq 'zero'}selected{/if}>{$_c['currency_code']} 0
</option>
</select>
</span>
</li>
</ul>
<center><b>{Lang::T('Total')}</b></center>
<ul class="list-group list-group-unbordered">
{if $using neq 'zero' and $add_cost != 0}
{foreach $bills as $k => $v}
<li class="list-group-item">
<b>{$k}</b> <span class="pull-right">{Lang::moneyFormat($v)}</span>
</li>
{foreach $abills as $k => $v}
{if strpos($v, ':') === false}
<li class="list-group-item">
<b>{$k}</b> <span class="pull-right">
{Lang::moneyFormat($v)}
<sup title="recurring">∞</sup>
{assign var="total" value=$v+$total}
</span>
</li>
{else}
{assign var="exp" value=explode(':',$v)}
{if $exp[1]>0}
<li class="list-group-item">
<b>{$k}</b> <span class="pull-right">
<sup title="{$exp[1]} more times">({$exp[1]}x) </sup>
{Lang::moneyFormat($exp[0])}
</span>
</li>
{/if}
{/if}
{/foreach}
<li class="list-group-item">
<b>{Lang::T('Additional Cost')}</b> <span
class="pull-right">{Lang::moneyFormat($add_cost)}</span>
class="pull-right"><b>{Lang::moneyFormat($add_cost)}</b></span>
</li>
<li class="list-group-item">
<b>{Lang::T('Total')}</b> <small>({Lang::T('Plan Price')} +{Lang::T('Additional Cost')})</small><span class="pull-right"
<b>{$plan['name_plan']}</b> <span
class="pull-right">{if $using eq 'zero'}{Lang::moneyFormat(0)}{else}{Lang::moneyFormat($plan['price'])}{/if}</span>
</li>
<li class="list-group-item">
<b>{Lang::T('Total')}</b> <small>({Lang::T('Plan Price')}
+{Lang::T('Additional Cost')})</small><span class="pull-right"
style="font-size: large; font-weight:bolder; font-family: 'Courier New', Courier, monospace; ">{Lang::moneyFormat($plan['price']+$add_cost)}</span>
</li>
{else}

View File

@ -1,3 +1,3 @@
{
"version": "2024.9.23"
"version": "2024.9.24"
}