diff --git a/system/autoload/Message.php b/system/autoload/Message.php
index 59c2ab7f..71fb36f4 100644
--- a/system/autoload/Message.php
+++ b/system/autoload/Message.php
@@ -56,9 +56,10 @@ class Message
return "$via: $msg";
}
- public static function sendBalanceNotification($phone, $name, $balance, $message, $via)
+ public static function sendBalanceNotification($phone, $name, $balance, $balance_now, $message, $via)
{
$msg = str_replace('[[name]]', "*$name*", $message);
+ $msg = str_replace('[[current_balance]]', Lang::moneyFormat($balance_now), $msg);
$msg = str_replace('[[balance]]', "*" . Lang::moneyFormat($balance) . "*", $msg);
if (
!empty($phone) && strlen($phone) > 5
diff --git a/system/autoload/Package.php b/system/autoload/Package.php
index 34b2c8ae..8e9a2317 100644
--- a/system/autoload/Package.php
+++ b/system/autoload/Package.php
@@ -5,8 +5,6 @@
**/
-use PEAR2\Net\RouterOS;
-
class Package
{
/**
@@ -49,7 +47,9 @@ class Package
$t->type = "Balance";
$t->save();
+ $balance_before = $c['balance'];
Balance::plus($id_customer, $p['price']);
+ $balance = $c['balance'] + $p['price'];
$textInvoice = Lang::getNotifText('invoice_balance');
$textInvoice = str_replace('[[company_name]]', $_c['CompanyName'], $textInvoice);
@@ -66,6 +66,8 @@ class Package
$textInvoice = str_replace('[[user_name]]', $c['username'], $textInvoice);
$textInvoice = str_replace('[[user_password]]', $c['password'], $textInvoice);
$textInvoice = str_replace('[[footer]]', $_c['note'], $textInvoice);
+ $textInvoice = str_replace('[[balance_before]]', Lang::moneyFormat($balance_before), $textInvoice);
+ $textInvoice = str_replace('[[balance]]', Lang::moneyFormat($balance), $textInvoice);
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $textInvoice);
diff --git a/system/controllers/home.php b/system/controllers/home.php
index e2ecaaac..c2eef6ce 100644
--- a/system/controllers/home.php
+++ b/system/controllers/home.php
@@ -25,7 +25,7 @@ if (_post('send') == 'balance') {
if ($user['balance'] < $balance) {
r2(U . 'home', 'd', Lang::T('insufficient balance'));
}
- if (!empty($config['minimum_transfer']) && intval($balance) <= intval($config['minimum_transfer'])) {
+ if (!empty($config['minimum_transfer']) && intval($balance) < intval($config['minimum_transfer'])) {
r2(U . 'home', 'd', Lang::T('Minimum Transfer') . ' ' . Lang::moneyFormat($config['minimum_transfer']));
}
if ($user['username'] == $target['username']) {
@@ -66,22 +66,22 @@ if (_post('send') == 'balance') {
$d->pg_url_payment = 'balance';
$d->status = 2;
$d->save();
- Message::sendBalanceNotification($user['phonenumber'], $target['fullname'] . ' (' . $target['username'] . ')', $balance, Lang::getNotifText('balance_send'), $config['user_notification_payment']);
- Message::sendBalanceNotification($target['phonenumber'], $user['fullname'] . ' (' . $user['username'] . ')', $balance, Lang::getNotifText('balance_received'), $config['user_notification_payment']);
+ Message::sendBalanceNotification($user['phonenumber'], $target['fullname'] . ' (' . $target['username'] . ')', $balance, ($user['balance'] - $balance), Lang::getNotifText('balance_send'), $config['user_notification_payment']);
+ Message::sendBalanceNotification($target['phonenumber'], $user['fullname'] . ' (' . $user['username'] . ')', $balance, ($target['balance'] + $balance), Lang::getNotifText('balance_received'), $config['user_notification_payment']);
Message::sendTelegram("#u$user[username] send balance to #u$target[username] \n" . Lang::moneyFormat($balance));
r2(U . 'home', 's', Lang::T('Sending balance success'));
}
} else {
r2(U . 'home', 'd', Lang::T('Failed, balance is not available'));
}
-}else if (_post('send') == 'plan') {
+} else if (_post('send') == 'plan') {
$active = ORM::for_table('tbl_user_recharges')
->where('username', _post('username'))
->find_one();
- $router = ORM::for_table('tbl_routers') ->where('name', $active['routers'])->find_one();
- if($router){
- r2(U . "order/send/$router[id]/$active[plan_id]&u=".trim(_post('username')), 's', Lang::T('Review package before recharge'));
- }else{
+ $router = ORM::for_table('tbl_routers')->where('name', $active['routers'])->find_one();
+ if ($router) {
+ r2(U . "order/send/$router[id]/$active[plan_id]&u=" . trim(_post('username')), 's', Lang::T('Review package before recharge'));
+ } else {
r2(U . 'package/order', 'w', Lang::T('Your friend do not have active package'));
}
}
diff --git a/ui/ui/app-notifications.tpl b/ui/ui/app-notifications.tpl
index 5b6d8e12..b3d14000 100644
--- a/ui/ui/app-notifications.tpl
+++ b/ui/ui/app-notifications.tpl
@@ -111,6 +111,8 @@
[[user_name]] Username internet.
[[user_password]] User password.
[[trx_date]] Transaction datetime.
+ [[balance_before]] Balance Before.
+ [[balance]] Balance After.
[[footer]] Invoice Footer.
[[name]] Receiver name.
- [[balance]] how much balance have been send.
+ [[balance]] how much balance have been send.
+ [[current_balance]] Current Balance.
[[name]] Sender name.
- [[balance]] how much balance have been received.
+ [[balance]] how much balance have been received.
+ [[current_balance]] Current Balance.