From 1857c145d16065b5e5028290d7cb89b3dd56f7d0 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 16 Jan 2024 11:41:12 +0700 Subject: [PATCH] fix print --- system/autoload/Lang.php | 12 +++++++++++- system/controllers/prepaid.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/system/autoload/Lang.php b/system/autoload/Lang.php index 38d56e3a..eafcc870 100644 --- a/system/autoload/Lang.php +++ b/system/autoload/Lang.php @@ -112,7 +112,17 @@ class Lang if($config['printer_cols']){ $cols = $config['printer_cols']; } - return str_pad($text, $cols, $pad_string, $pad_type); + $text = trim($text); + $texts = explode("\n", $text); + if(count($texts)>1){ + $text = ''; + foreach($texts as $t){ + $text.= self::pad(trim($t), $pad_string, $pad_type)."\n"; + } + return $text; + }else{ + return str_pad(trim($text), $cols, $pad_string, $pad_type); + } } public static function pads($textLeft, $textRight, $pad_string = ' '){ diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php index ea521c8a..63f27c86 100644 --- a/system/controllers/prepaid.php +++ b/system/controllers/prepaid.php @@ -159,7 +159,7 @@ switch ($action) { case 'print': $id = _post('id'); $d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one(); - $ui->assign('d', $d); + $ui->assign('in', $d); $ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'], $d['recharged_time'])); run_hook('print_invoice'); #HOOK