resend invoice

This commit is contained in:
Ibnu Maksum 2023-10-20 13:57:12 +07:00
parent 7ebf95f4be
commit d95e4d1d84
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
5 changed files with 43 additions and 34 deletions

View File

@ -75,4 +75,30 @@ class Message
} }
return "$via: $msg"; return "$via: $msg";
} }
public static function sendInvoice($cust, $trx){
global $config;
$textInvoice = Lang::getNotifText('invoice_paid');
$textInvoice = str_replace('[[company_name]]', $config['CompanyName'], $textInvoice);
$textInvoice = str_replace('[[address]]', $config['address'], $textInvoice);
$textInvoice = str_replace('[[phone]]', $config['phone'], $textInvoice);
$textInvoice = str_replace('[[invoice]]', $trx['invoice'], $textInvoice);
$textInvoice = str_replace('[[date]]', Lang::dateAndTimeFormat($trx['recharged_on'], $trx['recharged_time']), $textInvoice);
$textInvoice = str_replace('[[payment_gateway]]', $config['gateway'], $textInvoice);
$textInvoice = str_replace('[[payment_channel]]', $config['channel'], $textInvoice);
$textInvoice = str_replace('[[type]]', $trx['type'], $textInvoice);
$textInvoice = str_replace('[[plan_name]]', $trx['plan_name'], $textInvoice);
$textInvoice = str_replace('[[plan_price]]', Lang::moneyFormat($trx['price']), $textInvoice);
$textInvoice = str_replace('[[name]]', $cust['fullname'], $textInvoice);
$textInvoice = str_replace('[[user_name]]', $trx['username'], $textInvoice);
$textInvoice = str_replace('[[user_password]]', $cust['password'], $textInvoice);
$textInvoice = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($trx['expiration'], $trx['time']), $textInvoice);
$textInvoice = str_replace('[[footer]]', $config['note'], $textInvoice);
if ($config['user_notification_payment'] == 'sms') {
Message::sendSMS($cust['phonenumber'], $textInvoice);
} else if ($config['user_notification_payment'] == 'wa') {
Message::sendWhatsapp($cust['phonenumber'], $textInvoice);
}
}
} }

View File

@ -317,29 +317,7 @@ class Package
} }
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one(); $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
Message::sendInvoice($c, $in);
$textInvoice = Lang::getNotifText('invoice_paid');
$textInvoice = str_replace('[[company_name]]', $_c['CompanyName'], $textInvoice);
$textInvoice = str_replace('[[address]]', $_c['address'], $textInvoice);
$textInvoice = str_replace('[[phone]]', $_c['phone'], $textInvoice);
$textInvoice = str_replace('[[invoice]]', $in['invoice'], $textInvoice);
$textInvoice = str_replace('[[date]]', Lang::dateTimeFormat($date_now), $textInvoice);
$textInvoice = str_replace('[[payment_gateway]]', $_c['gateway'], $textInvoice);
$textInvoice = str_replace('[[payment_channel]]', $_c['channel'], $textInvoice);
$textInvoice = str_replace('[[type]]', $in['type'], $textInvoice);
$textInvoice = str_replace('[[plan_name]]', $in['plan_name'], $textInvoice);
$textInvoice = str_replace('[[plan_price]]', Lang::moneyFormat($in['price']), $textInvoice);
$textInvoice = str_replace('[[name]]', $c['fullname'], $textInvoice);
$textInvoice = str_replace('[[user_name]]', $in['username'], $textInvoice);
$textInvoice = str_replace('[[user_password]]', $c['password'], $textInvoice);
$textInvoice = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($in['expiration'], $in['time']), $textInvoice);
$textInvoice = str_replace('[[footer]]', $_c['note'], $textInvoice);
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $textInvoice);
} else if ($_c['user_notification_payment'] == 'wa') {
Message::sendWhatsapp($c['phonenumber'], $textInvoice);
}
return true; return true;
} }

View File

@ -81,7 +81,8 @@ switch ($action) {
->where('username', $user['username']) ->where('username', $user['username'])
->where('status', 1) ->where('status', 1)
->find_one(); ->find_one();
run_hook('customer_find_unpaid'); #HOOK run_hook('custome
r_find_unpaid'); #HOOK
if ($d) { if ($d) {
if (empty($d['pg_url_payment'])) { if (empty($d['pg_url_payment'])) {
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment")); r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));

View File

@ -142,11 +142,15 @@ switch ($action) {
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one(); $d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
$ui->assign('in', $d); $ui->assign('in', $d);
if(!empty($routes['3'])){ if(!empty($routes['3']) && $routes['3']=='send'){
$c = ORM::for_table('tbl_customers')->where('username', $d['username'])->find_one();
r2(U . 'prepaid/view/'.$id, 'e', "Success send to customer"); if($c){
Message::sendInvoice($c, $d);
r2(U . 'prepaid/view/'.$id, 's', "Success send to customer");
}
r2(U . 'prepaid/view/'.$id, 'd', "Customer not found");
} }
$ui->assign('_title', 'View Invoice');
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'],$d['recharged_time'])); $ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'],$d['recharged_time']));
$ui->display('invoice.tpl'); $ui->display('invoice.tpl');
break; break;

View File

@ -1,9 +1,9 @@
{include file="sections/header.tpl"} {include file="sections/header.tpl"}
<div class="row"> <div class="row">
<div class="col-md-6 col-sm-12"> <div class="col-md-6 col-sm-12 col-md-offset-3">
<div class="panel panel-hovered panel-primary panel-stacked mb30"> <div class="panel panel-hovered panel-primary panel-stacked mb30">
<div class="panel-heading">PRINT INVOICE</div> <div class="panel-heading">{$in['invoice']}</div>
<div class="panel-body"> <div class="panel-body">
<div class="well"> <div class="well">
<fieldset> <fieldset>
@ -34,12 +34,12 @@
</div> </div>
<form class="form-horizontal" method="post" action="{$_url}prepaid/print" target="_blank"> <form class="form-horizontal" method="post" action="{$_url}prepaid/print" target="_blank">
<input type="hidden" name="id" value="{$in['id']}"> <input type="hidden" name="id" value="{$in['id']}">
<a href="{$_url}prepaid/list" class="btn btn-primary btn-sm"><i
class="ion-reply-all"></i>{$_L['Finish']}</a>
<a href="{$_url}prepaid/view/{$in['id']}/send" class="btn btn-info text-black btn-sm"><i
class="glyphicon glyphicon-envelope"></i> {Lang::T("Resend To Customer")}</a>
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-print"></i> <button type="submit" class="btn btn-default btn-sm"><i class="fa fa-print"></i>
{$_L['Click_Here_to_Print']}</button> {$_L['Click_Here_to_Print']}</button>
<a href="{$_url}prepaid/view/{$in['id']}/print" class="btn btn-info"><i
class="glyphicon glyphicon-envelope"></i> {Lang::T("Resend To Customer")}</a>
<a href="{$_url}prepaid/list" class="btn btn-primary"><i
class="ion-reply-all"></i>{$_L['Finish']}</a>
</form> </form>
</div> </div>