Change Attribute to Bill Only

This commit is contained in:
Ibnu Maksum 2024-03-15 10:38:05 +07:00
parent 532fbf7337
commit c82b6b6acf
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
9 changed files with 131 additions and 137 deletions

View File

@ -32,29 +32,21 @@ class Package
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one(); $p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one();
$add_cost = 0;
// Zero cost recharge
if (isset($zero) && $zero == 1) {
$p['price'] = 0;
}else{
// Additional cost // Additional cost
$add_cost = 0; list($bills, $add_cost) = User::getBills($id_customer);
$add_rem = User::getAttribute("Additional Remaining", $id_customer);
// if empty then it doesnt have cycle, if zero then it finish
if ($add_rem != 0) {
$add_cost = User::getAttribute("Additional Cost", $id_customer);
if (empty($add_cost)) {
$add_cost = 0;
}
}
if ($add_cost > 0 && $router_name != 'balance') { if ($add_cost > 0 && $router_name != 'balance') {
$bills = User::getAttributes("Bill", $id_customer);
foreach ($bills as $k => $v) { foreach ($bills as $k => $v) {
$note .= $k . " : " . Lang::moneyFormat($v) . "\n"; $note .= $k . " : " . Lang::moneyFormat($v) . "\n";
} }
} }
// Zero cost recharge
if (isset($zero) && $zero == 1) {
$p['price'] = 0;
$add_cost = 0;
} }
if (!$p['enabled']) { if (!$p['enabled']) {
if (!isset($admin) || !isset($admin['id']) || empty($admin['id'])) { if (!isset($admin) || !isset($admin['id']) || empty($admin['id'])) {
r2(U . 'home', 'e', Lang::T('Plan Not found')); r2(U . 'home', 'e', Lang::T('Plan Not found'));
@ -576,8 +568,8 @@ class Package
"\nPrice: " . Lang::moneyFormat($p['price'])); "\nPrice: " . Lang::moneyFormat($p['price']));
} }
} }
if ($add_rem > 0) { if (count($bills) > 0) {
User::setAttribute('Additional Remaining', ($add_rem - 1), $id_customer); User::billsPaid($bills, $id_customer);
} }
run_hook("recharge_user_finish"); run_hook("recharge_user_finish");
Message::sendInvoice($c, $t); Message::sendInvoice($c, $t);

View File

@ -26,6 +26,60 @@ class User
return 0; return 0;
} }
public static function getBills($id = 0)
{
if (!$id) {
$id = User::getID();
if (!$id) {
return [];
}
}
$addcost = 0;
$bills = [];
$attrs = User::getAttributes('Bill', $id);
foreach ($attrs as $k => $v) {
// if has : then its an installment
if (strpos($v, ":") === false) {
// Not installment
$bills[$k] = $v;
$addcost += $v;
} else {
// installment
list($cost, $rem) = explode(":", $v);
// :0 installment is done
if ($rem != 0) {
$bills[$k] = $cost;
$addcost += $cost;
}
}
}
return [$bills, $addcost];
}
public static function billsPaid($bills, $id = 0)
{
if (!$id) {
$id = User::getID();
if (!$id) {
return [];
}
}
foreach ($bills as $k => $v) {
// if has : then its an installment
$v = User::getAttribute($k, $id);
if (strpos($v, ":") === false) {
// Not installment, no need decrement
} else {
// installment
list($cost, $rem) = explode(":", $v);
// :0 installment is done
if ($rem != 0) {
User::setAttribute($k, "$cost:".($rem - 1), $id);
}
}
}
}
public static function setAttribute($name, $value, $id = 0) public static function setAttribute($name, $value, $id = 0)
{ {
if (!$id) { if (!$id) {
@ -35,7 +89,7 @@ class User
} }
} }
$f = ORM::for_table('tbl_customers_fields')->where('field_name', $name)->where('customer_id', $id)->find_one(); $f = ORM::for_table('tbl_customers_fields')->where('field_name', $name)->where('customer_id', $id)->find_one();
if(!$f){ if (!$f) {
$f = ORM::for_table('tbl_customers_fields')->create(); $f = ORM::for_table('tbl_customers_fields')->create();
$f->customer_id = $id; $f->customer_id = $id;
$f->field_name = $name; $f->field_name = $name;
@ -45,7 +99,7 @@ class User
if ($result) { if ($result) {
return $result; return $result;
} }
}else{ } else {
$f->field_value = $value; $f->field_value = $value;
$f->save(); $f->save();
return $f['id']; return $f['id'];

View File

@ -97,20 +97,14 @@ switch ($action) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard"); _alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
} }
$id_customer = $routes['2']; $id_customer = $routes['2'];
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one(); $plan_id = $routes['3'];
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->where('plan_id', $plan_id)->find_one();
if ($b) { if ($b) {
$gateway = 'Recharge'; $gateway = 'Recharge';
$channel = $admin['fullname']; $channel = $admin['fullname'];
$cust = User::_info($id_customer); $cust = User::_info($id_customer);
$plan = ORM::for_table('tbl_plans')->find_one($b['plan_id']); $plan = ORM::for_table('tbl_plans')->find_one($b['plan_id']);
$add_cost = 0; list($bills, $add_cost) = User::getBills($id_customer);
$add_rem = User::getAttribute("Additional Remaining", $id_customer);
if($add_rem != 0){
$add_cost = User::getAttribute("Additional Cost", $id_customer);
if (empty($add_cost)) {
$add_cost = 0;
}
}
if ($using == 'balance' && $config['enable_balance'] == 'yes') { if ($using == 'balance' && $config['enable_balance'] == 'yes') {
if (!$cust) { if (!$cust) {
r2(U . 'prepaid/recharge', 'e', Lang::T('Customer not found')); r2(U . 'prepaid/recharge', 'e', Lang::T('Customer not found'));
@ -127,10 +121,8 @@ switch ($action) {
$zero = 1; $zero = 1;
$gateway = 'Recharge Zero'; $gateway = 'Recharge Zero';
} }
$bills = User::getAttributes("Bill", $id_customer);
$ui->assign('bills', $bills); $ui->assign('bills', $bills);
$ui->assign('add_cost', $add_cost); $ui->assign('add_cost', $add_cost);
$ui->assign('add_rem', $add_rem);
$ui->assign('cust', $cust); $ui->assign('cust', $cust);
$ui->assign('gateway', $gateway); $ui->assign('gateway', $gateway);
$ui->assign('channel', $channel); $ui->assign('channel', $channel);
@ -138,16 +130,19 @@ switch ($action) {
$ui->assign('using', 'cash'); $ui->assign('using', 'cash');
$ui->assign('plan', $plan); $ui->assign('plan', $plan);
$ui->display('recharge-confirm.tpl'); $ui->display('recharge-confirm.tpl');
} }else{
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan'); r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
}
break;
case 'deactivate': case 'deactivate':
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard"); _alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
} }
$id_customer = $routes['2']; $id_customer = $routes['2'];
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one(); $plan_id = $routes['3'];
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->where('plan_id', $plan_id)->find_one();
if ($b) { if ($b) {
$p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->where('enabled', '1')->find_one(); $p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->find_one();
if ($p) { if ($p) {
if ($p['is_radius']) { if ($p['is_radius']) {
Radius::customerDeactivate($b['username']); Radius::customerDeactivate($b['username']);
@ -175,14 +170,16 @@ switch ($action) {
break; break;
case 'sync': case 'sync':
$id_customer = $routes['2']; $id_customer = $routes['2'];
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->where('status', 'on')->find_one(); $bs = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->where('status', 'on')->findMany();
if ($b) { if ($bs) {
$routers = [];
foreach ($bs as $b) {
$c = ORM::for_table('tbl_customers')->find_one($id_customer); $c = ORM::for_table('tbl_customers')->find_one($id_customer);
$p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->where('enabled', '1')->find_one(); $p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->where('enabled', '1')->find_one();
if ($p) { if ($p) {
$routers[] = $b['routers'];
if ($p['is_radius']) { if ($p['is_radius']) {
Radius::customerAddPlan($c, $p, $p['expiration'] . ' ' . $p['time']); Radius::customerAddPlan($c, $p, $p['expiration'] . ' ' . $p['time']);
r2(U . 'customers/view/' . $id_customer, 's', 'Success sync customer to Radius');
} else { } else {
$mikrotik = Mikrotik::info($b['routers']); $mikrotik = Mikrotik::info($b['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
@ -191,12 +188,11 @@ switch ($action) {
} else if ($b['type'] == 'PPPOE') { } else if ($b['type'] == 'PPPOE') {
Mikrotik::addPpoeUser($client, $p, $c); Mikrotik::addPpoeUser($client, $p, $c);
} }
r2(U . 'customers/view/' . $id_customer, 's', 'Success sync customer to Mikrotik');
} }
} else {
r2(U . 'customers/view/' . $id_customer, 'e', 'Customer plan is inactive');
} }
} }
r2(U . 'customers/view/' . $id_customer, 's', 'Sync success to '.implode(", ",$routers));
}
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan'); r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
break; break;
case 'viewu': case 'viewu':

View File

@ -131,18 +131,8 @@ switch ($action) {
$router = Mikrotik::info($trx['routers']); $router = Mikrotik::info($trx['routers']);
$plan = ORM::for_table('tbl_plans')->find_one($trx['plan_id']); $plan = ORM::for_table('tbl_plans')->find_one($trx['plan_id']);
$bandw = ORM::for_table('tbl_bandwidth')->find_one($plan['id_bw']); $bandw = ORM::for_table('tbl_bandwidth')->find_one($plan['id_bw']);
list($bills, $add_cost) = User::getBills($id_customer);
$add_cost = 0;
$add_rem = User::getAttribute("Additional Remaining", $id_customer);
if ($add_rem != 0) {
$add_cost = User::getAttribute("Additional Cost", $id_customer);
if (empty($add_cost)) {
$add_cost = 0;
}else{
$bills = User::getAttributes("Bill", $id_customer);
$ui->assign('bills', $bills); $ui->assign('bills', $bills);
}
}
$ui->assign('add_cost', $add_cost); $ui->assign('add_cost', $add_cost);
$ui->assign('trx', $trx); $ui->assign('trx', $trx);
$ui->assign('router', $router); $ui->assign('router', $router);
@ -167,14 +157,7 @@ switch ($action) {
} else { } else {
$router_name = $plan['routers']; $router_name = $plan['routers'];
} }
$add_cost = 0; list($bills, $add_cost) = User::getBills($id_customer);
$add_rem = User::getAttribute("Additional Remaining", $id_customer);
if ($add_rem != 0) {
$add_cost = User::getAttribute("Additional Cost", $id_customer);
if (empty($add_cost)) {
$add_cost = 0;
}
}
if ($plan && $plan['enabled'] && $user['balance'] >= $plan['price']) { if ($plan && $plan['enabled'] && $user['balance'] >= $plan['price']) {
if (Package::rechargeUser($user['id'], $router_name, $plan['id'], 'Customer', 'Balance')) { if (Package::rechargeUser($user['id'], $router_name, $plan['id'], 'Customer', 'Balance')) {
// if success, then get the balance // if success, then get the balance
@ -210,16 +193,12 @@ switch ($action) {
} }
if (isset($_POST['send']) && $_POST['send'] == 'plan') { if (isset($_POST['send']) && $_POST['send'] == 'plan') {
$target = ORM::for_table('tbl_customers')->where('username', _post('username'))->find_one(); $target = ORM::for_table('tbl_customers')->where('username', _post('username'))->find_one();
$add_rem = User::getAttribute("Additional Remaining", $target['id']); list($bills, $add_cost) = User::getBills($target['id']);
if ($add_rem != 0) {
$add_cost = User::getAttribute("Additional Cost", $target['id']);
if (!empty($add_cost)) { if (!empty($add_cost)) {
$bills = User::getAttributes("Bill", $target['id']);
$ui->assign('bills', $bills); $ui->assign('bills', $bills);
$ui->assign('add_cost', $add_cost); $ui->assign('add_cost', $add_cost);
$plan['price'] += $add_cost; $plan['price'] += $add_cost;
} }
}
if (!$target) { if (!$target) {
r2(U . 'home', 'd', Lang::T('Username not found')); r2(U . 'home', 'd', Lang::T('Username not found'));
} }
@ -363,13 +342,7 @@ switch ($action) {
} }
$add_cost = 0; $add_cost = 0;
if ($router['name'] != 'balance') { if ($router['name'] != 'balance') {
$add_rem = User::getAttribute("Additional Remaining", $id_customer); list($bills, $add_cost) = User::getBills($id_customer);
if ($add_rem != 0) {
$add_cost = User::getAttribute("Additional Cost", $id_customer);
if (empty($add_cost)) {
$add_cost = 0;
}
}
} }
if (empty($id)) { if (empty($id)) {
$d = ORM::for_table('tbl_payment_gateway')->create(); $d = ORM::for_table('tbl_payment_gateway')->create();

View File

@ -115,14 +115,7 @@ switch ($action) {
$channel = $admin['fullname']; $channel = $admin['fullname'];
$cust = User::_info($id_customer); $cust = User::_info($id_customer);
$plan = ORM::for_table('tbl_plans')->find_one($planId); $plan = ORM::for_table('tbl_plans')->find_one($planId);
$add_cost = 0; list($bills, $add_cost) = User::getBills($id_customer);
$add_rem = User::getAttribute("Additional Remaining", $id_customer);
if($add_rem != 0){
$add_cost = User::getAttribute("Additional Cost", $id_customer);
if (empty($add_cost)) {
$add_cost = 0;
}
}
if ($using == 'balance' && $config['enable_balance'] == 'yes') { if ($using == 'balance' && $config['enable_balance'] == 'yes') {
if (!$cust) { if (!$cust) {
r2(U . 'prepaid/recharge', 'e', Lang::T('Customer not found')); r2(U . 'prepaid/recharge', 'e', Lang::T('Customer not found'));
@ -139,10 +132,8 @@ switch ($action) {
$zero = 1; $zero = 1;
$gateway = 'Recharge Zero'; $gateway = 'Recharge Zero';
} }
$bills = User::getAttributes("Bill", $id_customer);
$ui->assign('bills', $bills); $ui->assign('bills', $bills);
$ui->assign('add_cost', $add_cost); $ui->assign('add_cost', $add_cost);
$ui->assign('add_rem', $add_rem);
$ui->assign('cust', $cust); $ui->assign('cust', $cust);
$ui->assign('gateway', $gateway); $ui->assign('gateway', $gateway);
$ui->assign('channel', $channel); $ui->assign('channel', $channel);
@ -173,14 +164,7 @@ switch ($action) {
$gateway = 'Recharge'; $gateway = 'Recharge';
$channel = $admin['fullname']; $channel = $admin['fullname'];
$cust = User::_info($id_customer); $cust = User::_info($id_customer);
$add_cost = 0; list($bills, $add_cost) = User::getBills($id_customer);
$add_rem = User::getAttribute("Additional Remaining", $id_customer);
if($add_rem != 0){
$add_cost = User::getAttribute("Additional Cost", $id_customer);
if (empty($add_cost)) {
$add_cost = 0;
}
}
if ($using == 'balance' && $config['enable_balance'] == 'yes') { if ($using == 'balance' && $config['enable_balance'] == 'yes') {
$plan = ORM::for_table('tbl_plans')->find_one($planId); $plan = ORM::for_table('tbl_plans')->find_one($planId);
if (!$cust) { if (!$cust) {

View File

@ -54,16 +54,15 @@ foreach ($d as $ds) {
} }
Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']);
} }
echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n"; echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired']) . "\n";
//update database user dengan status off //update database user dengan status off
$u->status = 'off'; $u->status = 'off';
$u->save(); $u->save();
// autorenewal from deposit // autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) { if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
$add_rem = User::getAttribute("Additional Remaining", $ds['customer_id']); list($bills, $add_cost) = User::getBills($ds['customer_id']);
if ($add_rem != 0) { if ($add_cost > 0) {
$add_cost = User::getAttribute("Additional Cost", $ds['customer_id']);
if (!empty($add_cost)) { if (!empty($add_cost)) {
$p['price'] += $add_cost; $p['price'] += $add_cost;
} }
@ -116,16 +115,15 @@ foreach ($d as $ds) {
} }
Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']);
} }
echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n"; echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired']) . "\n";
$u->status = 'off'; $u->status = 'off';
$u->save(); $u->save();
// autorenewal from deposit // autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) { if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
$add_rem = User::getAttribute("Additional Remaining", $ds['customer_id']); list($bills, $add_cost) = User::getBills($ds['customer_id']);
if ($add_rem != 0) { if ($add_cost > 0) {
$add_cost = User::getAttribute("Additional Cost", $ds['customer_id']);
if (!empty($add_cost)) { if (!empty($add_cost)) {
$p['price'] += $add_cost; $p['price'] += $add_cost;
} }

View File

@ -38,9 +38,8 @@ foreach ($d as $ds) {
$u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one(); $u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one(); $p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$add_rem = User::getAttribute("Additional Remaining", $ds['customer_id']); list($bills, $add_cost) = User::getBills($ds['customer_id']);
if ($add_rem != 0) { if ($add_cost > 0) {
$add_cost = User::getAttribute("Additional Cost", $ds['customer_id']);
if (!empty($add_cost)) { if (!empty($add_cost)) {
$p['price'] += $add_cost; $p['price'] += $add_cost;
} }

View File

@ -107,25 +107,28 @@
</ul> </ul>
<div class="row"> <div class="row">
<div class="col-xs-4"> <div class="col-xs-4">
<a href="{$_url}customers/deactivate/{$d['id']}" id="{$d['id']}" <a href="{$_url}customers/deactivate/{$d['id']}/{$package['plan_id']}" id="{$d['id']}"
class="btn btn-danger btn-block btn-sm" class="btn btn-danger btn-block btn-sm"
onclick="return confirm('This will deactivate Customer Plan, and make it expired')">{Lang::T('Deactivate')}</a> onclick="return confirm('This will deactivate Customer Plan, and make it expired')">{Lang::T('Deactivate')}</a>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-8">
<a href="{$_url}customers/recharge/{$d['id']}" <a href="{$_url}customers/recharge/{$d['id']}/{$package['plan_id']}"
onclick="return confirm('This will extend Customer plan, same as recharge')"
class="btn btn-success btn-sm btn-block">{Lang::T('Recharge')}</a> class="btn btn-success btn-sm btn-block">{Lang::T('Recharge')}</a>
</div> </div>
<div class="col-xs-4">
<a href="{$_url}customers/sync/{$d['id']}"
onclick="return confirm('This will sync Customer to Mikrotik?')"
class="btn btn-primary btn-sm btn-block">{Lang::T('Sync')}</a>
</div>
</div> </div>
</div> </div>
</div> </div>
{/foreach} {/foreach}
<a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block mt-1">{Lang::T('Back')}</a><br> <div class="row">
<div class="col-xs-4">
<a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block">{Lang::T('Back')}</a>
</div>
<div class="col-xs-8">
<a href="{$_url}customers/sync/{$d['id']}"
onclick="return confirm('This will sync Customer to Mikrotik?')"
class="btn btn-info btn-sm btn-block">{Lang::T('Sync')}</a>
</div>
</div>
</div> </div>
<div class="col-sm-8 col-md-8"> <div class="col-sm-8 col-md-8">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">

View File

@ -55,7 +55,7 @@
</ul> </ul>
<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 $add_rem != 0 and $using neq 'zero' and $add_cost>0} {if $using neq 'zero' and $add_cost>0}
{foreach $bills as $k => $v} {foreach $bills as $k => $v}
<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)}</span>
@ -65,11 +65,6 @@
<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">{Lang::moneyFormat($add_cost)}</span>
</li> </li>
{if $add_rem != ''}
<li class="list-group-item">
<b>{Lang::T('Remaining')}</b> <span class="pull-right">{$add_rem}</span>
</li>
{/if}
<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>{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>