From 51416626fbab96e2ad514044360cf0fab25487b6 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 30 Aug 2023 09:01:37 +0700 Subject: [PATCH] Fix Print Invoice --- system/controllers/prepaid.php | 11 ++++------- ui/ui/invoice-print.tpl | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php index 28c85ccd..e3910e1b 100644 --- a/system/controllers/prepaid.php +++ b/system/controllers/prepaid.php @@ -114,7 +114,6 @@ switch ($action) { case 'print': $id = _post('id'); - $d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one(); $ui->assign('d', $d); @@ -367,19 +366,17 @@ switch ($action) { break; case 'refill-post': - $user = _post('id_customer'); $code = _post('code'); - + $user = ORM::for_table('tbl_customers')->where('id', _post('id_customer'))->find_one(); $v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one(); run_hook('refill_customer'); #HOOK if ($v1) { - if (Package::rechargeUser($user, $v1['routers'], $v1['id_plan'], "Refill", "Voucher")) { + if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Refill", "Voucher")) { $v1->status = "1"; - $v1->user = $c['username']; + $v1->user = $user['username']; $v1->save(); - $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(); + $in = ORM::for_table('tbl_transactions')->where('username', $user['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'); diff --git a/ui/ui/invoice-print.tpl b/ui/ui/invoice-print.tpl index 942692ec..09899735 100644 --- a/ui/ui/invoice-print.tpl +++ b/ui/ui/invoice-print.tpl @@ -33,7 +33,7 @@ ============================================
{$_L['Type']} : {$d['type']}
{$_L['Plan_Name']} : {$d['plan_name']}
- {$_L['Plan_Price']} : {Lang::moneyFormat($in['price'])}
+ {$_L['Plan_Price']} : {Lang::moneyFormat($d['price'])}

{$_L['Username']} : {$d['username']}
{$_L['Password']} : **********