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) { if (count($usings) == 0) {
$usings[] = Lang::T('Cash'); $usings[] = Lang::T('Cash');
} }
$abills = User::getAttributes("Bill");
$ui->assign('usings', $usings); $ui->assign('usings', $usings);
$ui->assign('abills', $abills);
$ui->assign('bills', $bills); $ui->assign('bills', $bills);
$ui->assign('add_cost', $add_cost); $ui->assign('add_cost', $add_cost);
$ui->assign('cust', $cust); $ui->assign('cust', $cust);

View File

@ -101,7 +101,7 @@ $ui->assign('_bills', $_bill);
// Sync plan to router // Sync plan to router
if (isset($_GET['sync']) && !empty($_GET['sync'])) { if (isset($_GET['sync']) && !empty($_GET['sync'])) {
foreach ($_bill as $tur) { foreach ($_bill as $tur) {
if($tur['status'] == 'on'){ if ($tur['status'] == 'on') {
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']); $p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
if ($p) { if ($p) {
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']); $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')) { 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_mac', $_SESSION['nux-mac']);
$ui->assign('nux_ip', $_SESSION['nux-ip']); $ui->assign('nux_ip', $_SESSION['nux-ip']);
$keys = explode('-', $_SESSION['nux-key']); $keys = explode('-', $_SESSION['nux-key']);
@ -281,18 +281,18 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI
} }
$getmsg = $_GET['msg']; $getmsg = $_GET['msg'];
///get auth notification from mikrotik ///get auth notification from mikrotik
if($getmsg == 'Connected') { if ($getmsg == 'Connected') {
$msg .= Lang::T($getmsg); $msg .= Lang::T($getmsg);
r2(U . 'home&logged=1', 's', $msg); r2(U . 'home&logged=1', 's', $msg);
} else if($getmsg){ } else if ($getmsg) {
$msg .= Lang::T($getmsg); $msg .= Lang::T($getmsg);
r2(U . 'home', 's', $msg); r2(U . 'home', 's', $msg);
} }
} }
} }
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSION['nux-hostname']) && $_c['hs_auth_method'] == 'hchap')) { 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_mac', $_SESSION['nux-mac']);
$ui->assign('nux_ip', $_SESSION['nux-ip']); $ui->assign('nux_ip', $_SESSION['nux-ip']);
$keys = explode('-', $_SESSION['nux-key']); $keys = explode('-', $_SESSION['nux-key']);
@ -308,15 +308,15 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI
} }
$getmsg = $_GET['msg']; $getmsg = $_GET['msg'];
///get auth notification from mikrotik ///get auth notification from mikrotik
if($getmsg == 'Connected') { if ($getmsg == 'Connected') {
$msg .= Lang::T($getmsg); $msg .= Lang::T($getmsg);
r2(U . 'home&logged=1', 's', $msg); r2(U . 'home&logged=1', 's', $msg);
} else if($getmsg){ } else if ($getmsg) {
$msg .= Lang::T($getmsg); $msg .= Lang::T($getmsg);
r2(U . 'home', 's', $msg); r2(U . 'home', 's', $msg);
} }
} }
} }
$tcf = ORM::for_table('tbl_customers_fields') $tcf = ORM::for_table('tbl_customers_fields')
->where('customer_id', $user['id']) ->where('customer_id', $user['id'])

View File

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

View File

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