diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56210401..273041d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
# CHANGELOG
+## 2023.8.16
+
+- Admin Can Add Balance to Customer
+- Show Balance in user
+- Using Select2 for Dropdown
+
## 2023.8.15
- Fix PPPOE Delete Customer
diff --git a/README.md b/README.md
index 128d6cb4..9c802f68 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,8 @@
- Voucher Generator and Print
- Self registration
+- User Balance
+- Auto Renewal Package using Balance
- Multi Router Mikrotik
- Hotspot & PPPOE
- Easy Installation
diff --git a/system/autoload/Package.php b/system/autoload/Package.php
index 26e1a5cc..0a803dfc 100644
--- a/system/autoload/Package.php
+++ b/system/autoload/Package.php
@@ -62,6 +62,7 @@ class Package
$textInvoice = str_replace('[[plan_price]]', $_c['currency_code'] . " " . number_format($p['price'], 2, $_c['dec_point'], $_c['thousands_sep']), $textInvoice);
$textInvoice = str_replace('[[user_name]]', $c['username'], $textInvoice);
$textInvoice = str_replace('[[user_password]]', $c['password'], $textInvoice);
+ $textInvoice = str_replace('[[footer]]', $_c['note'], $textInvoice);
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $textInvoice);
@@ -255,6 +256,7 @@ class Package
$textInvoice = str_replace('[[user_name]]', $in['username'], $textInvoice);
$textInvoice = str_replace('[[user_password]]', $c['password'], $textInvoice);
$textInvoice = str_replace('[[expired_date]]', date($_c['date_format'], strtotime($in['expiration'])) . " " . $in['time'], $textInvoice);
+ $textInvoice = str_replace('[[footer]]', $_c['note'], $textInvoice);
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $textInvoice);
@@ -263,4 +265,40 @@ class Package
}
return true;
}
+
+ public static function changeTo($username, $plan_id)
+ {
+ global $_c;
+ $c = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
+ $p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
+ $b = ORM::for_table('tbl_user_recharges')->where('customer_id', $c['id'])->find_one();
+ $mikrotik = Mikrotik::info($p['routers']);
+ if ($p['type'] == 'Hotspot') {
+ if ($b) {
+ if (!$_c['radius_mode']) {
+ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
+ Mikrotik::removeHotspotUser($client, $c['username']);
+ Mikrotik::addHotspotUser($client, $p, $c);
+ }
+ } else {
+ if (!$_c['radius_mode']) {
+ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
+ Mikrotik::addHotspotUser($client, $p, $c);
+ }
+ }
+ } else {
+ if ($b) {
+ if (!$_c['radius_mode']) {
+ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
+ Mikrotik::removePpoeUser($client, $c['username']);
+ Mikrotik::addPpoeUser($client, $p, $c);
+ }
+ } else {
+ if (!$_c['radius_mode']) {
+ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
+ Mikrotik::addPpoeUser($client, $p, $c);
+ }
+ }
+ }
+ }
}
diff --git a/system/controllers/order.php b/system/controllers/order.php
index d1098e27..19ee3e2d 100644
--- a/system/controllers/order.php
+++ b/system/controllers/order.php
@@ -122,16 +122,16 @@ switch ($action) {
run_hook('customer_buy_plan'); #HOOK
include 'system/paymentgateway/' . $config['payment_gateway'] . '.php';
call_user_func($config['payment_gateway'] . '_validate_config');
- if ($routes['2'] != '0') {
+ if ($routes['2']>0) {
$router = ORM::for_table('tbl_routers')->where('enabled', '1')->find_one($routes['2']);
- if (empty($router) || empty($plan)) {
- r2(U . $back, 'e', Lang::T("Plan Not found"));
- }
}else{
$router['id'] = 0;
$router['name'] = 'balance';
}
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3']);
+ if (empty($router) || empty($plan)) {
+ r2(U . "order/package", 'e', Lang::T("Plan Not found"));
+ }
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php
index 0fbee57f..0ba294d0 100644
--- a/system/controllers/prepaid.php
+++ b/system/controllers/prepaid.php
@@ -72,8 +72,6 @@ switch ($action) {
$type = _post('type');
$server = _post('server');
$plan = _post('plan');
-
- $date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time = date("H:i:s");
@@ -83,212 +81,28 @@ switch ($action) {
}
if ($msg == '') {
- $c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
- $p = ORM::for_table('tbl_plans')->where('id', $plan)->where('enabled', '1')->find_one();
- $b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
-
- $mikrotik = Mikrotik::info($server);
- if($p['validity_unit']=='Months'){
- $date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
- }else if($p['validity_unit']=='Days'){
- $date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' day'));
- }else if($p['validity_unit']=='Hrs'){
- $datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' hour')));
- $date_exp = $datetime[0];
- $time = $datetime[1];
- }else if($p['validity_unit']=='Mins'){
- $datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' minute')));
- $date_exp = $datetime[0];
- $time = $datetime[1];
+ if(Package::rechargeUser($id_customer, $server, $plan, "Recharge", $admin['fullname'])){
+ $c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
+ $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
+ $ui->assign('in', $in);
+ $ui->assign('date', date("Y-m-d H:i:s"));
+ $ui->display('invoice.tpl');
+ _log('[' . $admin['username'] . ']: ' . 'Recharge '.$c['username'].' ['.$in['plan_name'].']['.Lang::moneyFormat($in['price']).']', 'Admin', $admin['id']);
+ }else{
+ r2(U . 'prepaid/recharge', 'e', "Failed to recharge account");
}
- run_hook('recharge_customer'); #HOOK
- if ($type == 'Hotspot') {
- if ($b) {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::removeHotspotUser($client,$c['username']);
- Mikrotik::addHotspotUser($client,$p,$c);
- }
-
- $b->customer_id = $id_customer;
- $b->username = $c['username'];
- $b->plan_id = $plan;
- $b->namebp = $p['name_plan'];
- $b->recharged_on = $date_only;
- $b->expiration = $date_exp;
- $b->time = $time;
- $b->status = "on";
- $b->method = "admin";
- $b->routers = $server;
- $b->type = "Hotspot";
- $b->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "admin";
- $t->routers = $server;
- $t->type = "Hotspot";
- $t->save();
- } else {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::addHotspotUser($client,$p,$c);
- }
-
- $d = ORM::for_table('tbl_user_recharges')->create();
- $d->customer_id = $id_customer;
- $d->username = $c['username'];
- $d->plan_id = $plan;
- $d->namebp = $p['name_plan'];
- $d->recharged_on = $date_only;
- $d->expiration = $date_exp;
- $d->time = $time;
- $d->status = "on";
- $d->method = "admin";
- $d->routers = $server;
- $d->type = "Hotspot";
- $d->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "admin";
- $t->routers = $server;
- $t->type = "Hotspot";
- $t->save();
- }
- Message::sendTelegram( "$admin[fullname] #Recharge Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
- "\nRouter: ".$server.
- "\nPrice: ".$p['price']);
- } else {
-
- if ($b) {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::removePpoeUser($client,$c['username']);
- Mikrotik::addPpoeUser($client,$p,$c);
- }
-
- $b->customer_id = $id_customer;
- $b->username = $c['username'];
- $b->plan_id = $plan;
- $b->namebp = $p['name_plan'];
- $b->recharged_on = $date_only;
- $b->expiration = $date_exp;
- $b->time = $time;
- $b->status = "on";
- $b->method = "admin";
- $b->routers = $server;
- $b->type = "PPPOE";
- $b->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "admin";
- $t->routers = $server;
- $t->type = "PPPOE";
- $t->save();
- } else {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::addPpoeUser($client,$p,$c);
- }
-
- $d = ORM::for_table('tbl_user_recharges')->create();
- $d->customer_id = $id_customer;
- $d->username = $c['username'];
- $d->plan_id = $plan;
- $d->namebp = $p['name_plan'];
- $d->recharged_on = $date_only;
- $d->expiration = $date_exp;
- $d->time = $time;
- $d->status = "on";
- $d->method = "admin";
- $d->routers = $server;
- $d->type = "PPPOE";
- $d->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "admin";
- $t->routers = $server;
- $t->type = "PPPOE";
- $t->save();
- }
- Message::sendTelegram( "$admin[fullname] #Recharge Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
- "\nRouter: ".$server.
- "\nPrice: ".$p['price']);
- }
-
- $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
- $ui->assign('in', $in);
-
- $msg = "*$config[CompanyName]*\n".
- "$config[address]\n".
- "$config[phone]\n".
- "\n\n".
- "INVOICE: *$in[invoice]*\n".
- "$_L[Date] : $date_now\n".
- "$_L[Sales] : $admin[fullname]\n".
- "\n\n".
- "$_L[Type] : *$in[type]*\n".
- "$_L[Plan_Name] : *$in[plan_name]*\n".
- "$_L[Plan_Price] : *$config[currency_code] ".number_format($in['price'],2,$config['dec_point'],$config['thousands_sep'])."*\n\n".
- "$_L[Username] : *$in[username]*\n".
- "$_L[Password] : **********\n\n".
- "$_L[Created_On] :\n*".date($config['date_format'], strtotime($in['recharged_on']))."*\n".
- "$_L[Expires_On] :\n*".date($config['date_format'], strtotime($in['expiration']))." $in[time]*\n".
- "\n\n".
- "$config[note]";
-
- if ($_c['user_notification_payment'] == 'sms') {
- Message::sendSMS($c['phonenumber'], $msg);
- } else if ($_c['user_notification_payment'] == 'wa') {
- Message::sendWhatsapp($c['phonenumber'], $msg);
- }
-
- $ui->assign('date', $date_now);
- $ui->display('invoice.tpl');
} else {
r2(U . 'prepaid/recharge', 'e', $msg);
}
break;
case 'print':
- $date_now = date("Y-m-d H:i:s");
$id = _post('id');
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
$ui->assign('d', $d);
- $ui->assign('date', $date_now);
+ $ui->assign('date', date("Y-m-d H:i:s"));
run_hook('print_invoice'); #HOOK
$ui->display('invoice-print.tpl');
break;
@@ -328,6 +142,7 @@ switch ($action) {
}
$d->delete();
}
+ _log('[' . $admin['username'] . ']: ' . 'Delete Plan for Customer '.$c['username'].' ['.$in['plan_name'].']['.Lang::moneyFormat($in['price']).']', 'Admin', $admin['id']);
r2(U . 'prepaid/list', 's', $_L['Delete_Successfully']);
}
break;
@@ -352,7 +167,8 @@ switch ($action) {
$d->recharged_on = $recharged_on;
$d->expiration = $expiration;
$d->save();
- //TODO set mikrotik for editedd plan
+ Package::changeTo($username,$id_plan);
+ _log('[' . $admin['username'] . ']: ' . 'Edit Plan for Customer '.$d['username'].' to ['.$d['plan_name'].']['.Lang::moneyFormat($d['price']).']', 'Admin', $admin['id']);
r2(U . 'prepaid/list', 's', $_L['Updated_Successfully']);
} else {
r2(U . 'prepaid/edit/' . $id, 'e', $msg);
@@ -526,7 +342,7 @@ switch ($action) {
case 'refill':
$ui->assign('xfooter', '');
-
+ $ui->assign('_title', $_L['Refill_Account']);
$c = ORM::for_table('tbl_customers')->find_many();
$ui->assign('c', $c);
run_hook('view_refill'); #HOOK
@@ -540,221 +356,50 @@ switch ($action) {
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
- $c = ORM::for_table('tbl_customers')->find_one($user);
- $p = ORM::for_table('tbl_plans')->find_one($v1['id_plan']);
- $b = ORM::for_table('tbl_user_recharges')->where('customer_id', $user)->find_one();
-
- $date_now = date("Y-m-d H:i:s");
- $date_only = date("Y-m-d");
- $time = date("H:i:s");
-
- $mikrotik = Mikrotik::info($v1['routers']);
-
- if($p['validity_unit']=='Months'){
- $date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
- }else if($p['validity_unit']=='Days'){
- $date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' day'));
- }else if($p['validity_unit']=='Hrs'){
- $datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' hour')));
- $date_exp = $datetime[0];
- $time = $datetime[1];
- }else if($p['validity_unit']=='Mins'){
- $datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' minute')));
- $date_exp = $datetime[0];
- $time = $datetime[1];
- }
run_hook('refill_customer'); #HOOK
if ($v1) {
- if ($v1['type'] == 'Hotspot') {
- if ($b) {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::removeHotspotUser($client,$c['username']);
- Mikrotik::addHotspotUser($client,$p,$c);
- }
-
- $b->customer_id = $user;
- $b->username = $c['username'];
- $b->plan_id = $v1['id_plan'];
- $b->namebp = $p['name_plan'];
- $b->recharged_on = $date_only;
- $b->expiration = $date_exp;
- $b->time = $time;
- $b->status = "on";
- $b->method = "voucher";
- $b->routers = $v1['routers'];
- $b->type = "Hotspot";
- $b->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "voucher";
- $t->routers = $v1['routers'];
- $t->type = "Hotspot";
- $t->save();
- } else {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::addHotspotUser($client,$p,$c);
- }
-
- $d = ORM::for_table('tbl_user_recharges')->create();
- $d->customer_id = $user;
- $d->username = $c['username'];
- $d->plan_id = $v1['id_plan'];
- $d->namebp = $p['name_plan'];
- $d->recharged_on = $date_only;
- $d->expiration = $date_exp;
- $d->time = $time;
- $d->status = "on";
- $d->method = "voucher";
- $d->routers = $v1['routers'];
- $d->type = "Hotspot";
- $d->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "voucher";
- $t->routers = $v1['routers'];
- $t->type = "Hotspot";
- $t->save();
- }
-
+ if(Package::rechargeUser($user, $v1['routers'], $v1['id_plan'], "Refill", "Voucher")){
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
-
- Message::sendTelegram( "$admin[fullname] #Refill #Voucher #Hotspot for #u$c[username]\n".$p['name_plan'].
- "\nCode: ".$code.
- "\nRouter: ".$v1['routers'].
- "\nPrice: ".$p['price']);
- } else {
- if ($b) {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::removePpoeUser($client,$c['username']);
- Mikrotik::addPpoeUser($client,$p,$c);
- }
-
- $b->customer_id = $user;
- $b->username = $c['username'];
- $b->plan_id = $v1['id_plan'];
- $b->namebp = $p['name_plan'];
- $b->recharged_on = $date_only;
- $b->expiration = $date_exp;
- $b->time = $time;
- $b->status = "on";
- $b->method = "voucher";
- $b->routers = $v1['routers'];
- $b->type = "PPPOE";
- $b->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "voucher";
- $t->routers = $v1['routers'];
- $t->type = "PPPOE";
- $t->save();
- } else {
- if(!$config['radius_mode']){
- $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
- Mikrotik::addPpoeUser($client,$p,$c);
- }
-
- $d = ORM::for_table('tbl_user_recharges')->create();
- $d->customer_id = $user;
- $d->username = $c['username'];
- $d->plan_id = $v1['id_plan'];
- $d->namebp = $p['name_plan'];
- $d->recharged_on = $date_only;
- $d->expiration = $date_exp;
- $d->time = $time;
- $d->status = "on";
- $d->method = "voucher";
- $d->routers = $v1['routers'];
- $d->type = "PPPOE";
- $d->save();
-
- // insert table transactions
- $t = ORM::for_table('tbl_transactions')->create();
- $t->invoice = "INV-" . _raid(5);
- $t->username = $c['username'];
- $t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
- $t->recharged_on = $date_only;
- $t->expiration = $date_exp;
- $t->time = $time;
- $t->method = "voucher";
- $t->routers = $v1['routers'];
- $t->type = "PPPOE";
- $t->save();
- }
-
- $v1->status = "1";
- $v1->user = $c['username'];
- $v1->save();
-
-
- Message::sendTelegram( "$admin[fullname] Refill #Voucher #PPPOE for #u$c[username]\n".$p['name_plan'].
- "\nCode: ".$code.
- "\nRouter: ".$v1['routers'].
- "\nPrice: ".$p['price']);
+ $c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
+ $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
+ $ui->assign('in', $in);
+ $ui->assign('date', date("Y-m-d H:i:s"));
+ $ui->display('invoice.tpl');
+ }else{
+ r2(U . 'prepaid/refill', 'e', "Failed to refill account");
}
- $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
- $ui->assign('in', $in);
-
-
- $msg = "*$config[CompanyName]*\n".
- "$config[address]\n".
- "$config[phone]\n".
- "\n\n".
- "INVOICE: *$in[invoice]*\n".
- "$_L[Date] : $date_now\n".
- "$_L[Sales] : $admin[fullname]\n".
- "\n\n".
- "$_L[Type] : *$in[type]*\n".
- "$_L[Plan_Name] : *$in[plan_name]*\n".
- "$_L[Plan_Price] : *$config[currency_code] ".number_format($in['price'],2,$config['dec_point'],$config['thousands_sep'])."*\n\n".
- "$_L[Username] : *$in[username]*\n".
- "$_L[Password] : **********\n\n".
- "$_L[Created_On] :\n*".date($config['date_format'], strtotime($in['recharged_on']))."*\n".
- "$_L[Expires_On] :\n*".date($config['date_format'], strtotime($in['expiration']))." $in[time]*\n".
- "\n\n".
- "$config[note]";
-
- if ($_c['user_notification_payment'] == 'sms') {
- Message::sendSMS($c['phonenumber'], $msg);
- } else if ($_c['user_notification_payment'] == 'wa') {
- Message::sendWhatsapp($c['phonenumber'], $msg);
- }
- $ui->assign('date', $date_now);
- $ui->display('invoice.tpl');
} else {
r2(U . 'prepaid/refill', 'e', $_L['Voucher_Not_Valid']);
}
break;
+ case 'deposit':
+ $ui->assign('_title', Lang::T('Refill Balance'));
+ $ui->assign('c', ORM::for_table('tbl_customers')->find_many());
+ $ui->assign('p', ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many());
+ run_hook('view_deposit'); #HOOK
+ $ui->display('deposit.tpl');
+ break;
+ case 'deposit-post':
+ $user = _post('id_customer');
+ $plan = _post('id_plan');
+ run_hook('deposit_customer'); #HOOK
+ if (!empty($user) && !empty($plan)) {
+ if(Package::rechargeUser($user, 'balance', $plan, "Deposit", $admin['fullname'])){
+ $c = ORM::for_table('tbl_customers')->where('id', $user)->find_one();
+ $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
+ $ui->assign('in', $in);
+ $ui->assign('date', date("Y-m-d H:i:s"));
+ $ui->display('invoice.tpl');
+ }else{
+ r2(U . 'prepaid/refill', 'e', "Failed to refill account");
+ }
+ } else {
+ r2(U . 'prepaid/refill', 'e', "All field is required");
+ }
+ break;
default:
echo 'action not defined';
}
diff --git a/system/controllers/services.php b/system/controllers/services.php
index d36277d7..ed44feb3 100644
--- a/system/controllers/services.php
+++ b/system/controllers/services.php
@@ -91,7 +91,7 @@ switch ($action) {
$data_limit = _post('data_limit');
$data_unit = _post('data_unit');
$id_bw = _post('id_bw');
- $price = _post('pricebp');
+ $price = _post('price');
$sharedusers = _post('sharedusers');
$validity = _post('validity');
$validity_unit = _post('validity_unit');
diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php
index 0516eea8..4e6ca82a 100644
--- a/system/lan/english/common.lan.php
+++ b/system/lan/english/common.lan.php
@@ -363,3 +363,5 @@ $_L['Disable_auto_renewal'] = 'Disable auto renewal?';
$_L['Auto_Renewal_On'] = 'Auto Renewal On';
$_L['Enable_auto_renewal'] = 'Enable auto renewal?';
$_L['Auto_Renewal_Off'] = 'Auto Renewal Off';
+$_L['Refill_Balance'] = 'Refill Balance';
+$_L['Invoice_Footer'] = 'Invoice Footer';
diff --git a/system/uploads/notifications.default.json b/system/uploads/notifications.default.json
index aff56897..21e9c1cc 100644
--- a/system/uploads/notifications.default.json
+++ b/system/uploads/notifications.default.json
@@ -3,6 +3,6 @@
"reminder_7_day": "Hello *[[name]]*, \r\nyour internet package *[[package]]* will be expired in 7 days.",
"reminder_3_day": "Hello *[[name]]*, \r\nyour internet package *[[package]]* will be expired in 3 days.",
"reminder_1_day": "Hello *[[name]]*,\r\n your internet package *[[package]]* will be expired tomorrow.",
- "invoice_paid": "*[[company_name]]*\r\n[[address]]\r\n[[phone]]\r\n\r\n\r\nINVOICE: *[[invoice]]*\r\nDate : [[date]]\r\n[[payment_gateway]] [[payment_channel]]\r\n\r\n\r\nType : *[[type]]*\r\nPackage : *[[plan_name]]*\r\nPrice : *[[plan_price]]*\r\n\r\nUsername : *[[user_name]]*\r\nPassword : ***********\r\n\r\nExpired : *[[expired_date]]*\r\n\r\n\r\nThank you...",
- "invoice_balance": "*[[company_name]]*\r\n[[address]]\r\n[[phone]]\r\n\r\n\r\nINVOICE: *[[invoice]]*\r\nDate : [[date]]\r\n[[payment_gateway]] [[payment_channel]]\r\n\r\n\r\nType : *[[type]]*\r\nPackage : *[[plan_name]]*\r\nPrice : *[[plan_price]]*\r\n\r\nThank you..."
+ "invoice_paid": "*[[company_name]]*\r\n[[address]]\r\n[[phone]]\r\n\r\n\r\nINVOICE: *[[invoice]]*\r\nDate : [[date]]\r\n[[payment_gateway]] [[payment_channel]]\r\n\r\n\r\nType : *[[type]]*\r\nPackage : *[[plan_name]]*\r\nPrice : *[[plan_price]]*\r\n\r\nUsername : *[[user_name]]*\r\nPassword : ***********\r\n\r\nExpired : *[[expired_date]]*\r\n\r\n====================\r\n[[footer]]",
+ "invoice_balance": "*[[company_name]]*\r\n[[address]]\r\n[[phone]]\r\n\r\n\r\nINVOICE: *[[invoice]]*\r\nDate : [[date]]\r\n[[payment_gateway]] [[payment_channel]]\r\n\r\n\r\nType : *[[type]]*\r\nPackage : *[[plan_name]]*\r\nPrice : *[[plan_price]]*\r\n\r\n====================\r\n[[footer]]"
}
diff --git a/ui/ui/app-notifications.tpl b/ui/ui/app-notifications.tpl
index ab5a40e1..6446adf1 100644
--- a/ui/ui/app-notifications.tpl
+++ b/ui/ui/app-notifications.tpl
@@ -82,7 +82,8 @@
[[plan_price]] Internet Package Prices.
[[user_name]] Username internet.
[[user_password]] User password.
- [[expired_date]] Expired datetime.
+ [[expired_date]] Expired datetime.
+ [[footer]] Invoice Footer.
@@ -107,7 +108,8 @@
[[plan_price]] Internet Package Prices.
[[user_name]] Username internet.
[[user_password]] User password.
- [[trx_date]] Transaction datetime.
+ [[trx_date]] Transaction datetime.
+ [[footer]] Invoice Footer.
diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl
index 83ee92ae..02e44903 100644
--- a/ui/ui/app-settings.tpl
+++ b/ui/ui/app-settings.tpl
@@ -247,6 +247,24 @@
add dst-host=tawk.to
add dst-host=*.tawk.to
+
+
+
+
+ {Lang::T('Invoice')}
+
+
+
diff --git a/ui/ui/community.tpl b/ui/ui/community.tpl
index d4e730fe..9d673bf1 100644
--- a/ui/ui/community.tpl
+++ b/ui/ui/community.tpl
@@ -10,9 +10,9 @@
@@ -28,7 +28,7 @@
@@ -63,9 +63,9 @@
@@ -101,7 +101,7 @@
@@ -114,7 +114,7 @@
$50 Paid Support donation confirmation? Or ask any Donation Alternative
@@ -126,7 +126,7 @@
@@ -142,12 +142,24 @@
+
+
diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl
index a7924686..495e0e8e 100644
--- a/ui/ui/customers.tpl
+++ b/ui/ui/customers.tpl
@@ -36,6 +36,7 @@
{$_L['Username']}
{$_L['Full_Name']}
+ {Lang::T('Balance')}
{$_L['Phone_Number']}
{$_L['Email']}
{$_L['Created_On']}
@@ -48,6 +49,7 @@
{$ds['username']}
{$ds['fullname']}
+ {Lang::moneyFormat($ds['balance'])}
{$ds['phonenumber']}
{$ds['email']}
{$ds['created_at']}
diff --git a/ui/ui/deposit.tpl b/ui/ui/deposit.tpl
new file mode 100644
index 00000000..02e5810e
--- /dev/null
+++ b/ui/ui/deposit.tpl
@@ -0,0 +1,47 @@
+{include file="sections/header.tpl"}
+
+
+
+
+
{Lang::T('Refill Balance')}
+
+
+
+
+
+{include file="sections/footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/hotspot-add.tpl b/ui/ui/hotspot-add.tpl
index 67a4a972..06b361e2 100644
--- a/ui/ui/hotspot-add.tpl
+++ b/ui/ui/hotspot-add.tpl
@@ -71,7 +71,7 @@