upgrade all with dice compatible
This commit is contained in:
+37
-33
@@ -2,13 +2,13 @@
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Printing/PrintHTML.php
|
||||
Module : /Printer/PrintHTML.php
|
||||
Desc. : Class cetak HTML
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : September 30th, 2025.
|
||||
Last Modified : August 21st, 2026.
|
||||
|
||||
(c) 2008 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
@@ -16,38 +16,40 @@ declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Printer;
|
||||
|
||||
use \flight\Session;
|
||||
|
||||
final class PrintHTML {
|
||||
private $__avalue = [];
|
||||
private $__atabel = [];
|
||||
private $__css = "table";
|
||||
private $__tstamp = "";
|
||||
protected array $webapp;
|
||||
protected array $webuser;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct(Session $session) {
|
||||
$this->webapp = $session->get('__WEB_APP', ['APP_NAME'=>'', 'APP_VER'=>'']);
|
||||
$this->webuser = $session->get('__WEB_USER', ['UserID'=>0, 'Username'=>'']);
|
||||
}
|
||||
|
||||
public function set_css($style = "") {
|
||||
if ($style=="") return;
|
||||
$this->__css = $style;
|
||||
public function set_css(string $style): void {
|
||||
if (!empty($style)) $this->__css = $style;
|
||||
}
|
||||
|
||||
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="", $nkol=1) {//up 2012-03-07
|
||||
$this->__atabel[] = [$tnama, $nlebar, $ffunc, $talign, $nkol];
|
||||
public function add_field(string $nama, int $lebar=0, string $align="L", string $func="", int $kol=1): void {
|
||||
$this->__atabel[] = [ $nama, $lebar, $func, $align, $kol ];
|
||||
}
|
||||
|
||||
public function show_fields() {//todo: deleted
|
||||
}
|
||||
|
||||
public function clear() {
|
||||
public function clear(): void {
|
||||
$this->__avalue = [];
|
||||
}
|
||||
|
||||
public function add_value() {
|
||||
public function add_value(): void {
|
||||
$tmp_arr = func_get_args();
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0]; //up 2009-09-27
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];
|
||||
if (is_array($this->__atabel[$i][2]) && trim("".$tmp_val)<>"") { //up 2010-05-28
|
||||
if (is_array($this->__atabel[$i][2]) && trim("".$tmp_val)<>"") {
|
||||
$tmp_val = $this->__atabel[$i][2][$tmp_val];
|
||||
} else if (function_exists($this->__atabel[$i][2]) && trim("".$tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->__atabel[$i][2], $tmp_val);
|
||||
@@ -59,7 +61,7 @@ final class PrintHTML {
|
||||
$this->__avalue[] = $tmp_out;
|
||||
}
|
||||
|
||||
public function add_span() {
|
||||
public function add_span(): void {
|
||||
$tmp_arr = func_get_args();
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($tmp_arr); $i++) {
|
||||
@@ -79,15 +81,15 @@ final class PrintHTML {
|
||||
$this->__avalue[] = $tmp_out;
|
||||
}
|
||||
|
||||
public function add_stamp($ctk_ke=1, $bnama=false) {//up 2023-10-13
|
||||
$this->__tstamp = $this->get_stamp($ctk_ke, $bnama);
|
||||
public function add_stamp(int $ctk_ke=1, bool $cetak_nama=false): void {
|
||||
$this->__tstamp = $this->get_stamp($ctk_ke, $cetak_nama);
|
||||
}
|
||||
|
||||
public function get_stamp($ctk_ke=1, $bnama=false) {//up 2012-10-11
|
||||
return $_SESSION['__WEB_APP']['APP_NAME']."v".$_SESSION['__WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
|
||||
public function get_stamp(int $ctk_ke=1, bool $cetak_nama=false): string {
|
||||
return $this->webapp['APP_NAME']."v".$this->webapp['APP_VER'].date("\@ymd.His")."-".isi_nol($this->webuser['UserID'], 3).(($cetak_nama)?"/".strtoupper($this->webuser['Username']):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
|
||||
}
|
||||
|
||||
public function show($jumlah_ctk=1) {//up 2012-10-11
|
||||
public function show(int $jumlah_ctk=1) {
|
||||
$out = "<table class=\"".$this->__css."\"><thead>";
|
||||
|
||||
// header out
|
||||
@@ -111,27 +113,29 @@ final class PrintHTML {
|
||||
for ($i=1; $i<=$jumlah_ctk; $i++) echo $out;
|
||||
}
|
||||
|
||||
public function set_align($ttext, $nlen, $tdir="L", $bline=false, $bhead=false, $ncol=1, $textra="") {//up 2011-04-14
|
||||
$tstyle = $this->create_style($tdir);
|
||||
if ($bline===true) {
|
||||
return "<tr><td colspan=\"".count($this->__atabel)."\" class=\"".$tstyle." ".$textra."\">".$ttext."</td></tr>";
|
||||
public function set_align(string $text, int $width=0, string $dir="L", bool $line=false, bool $head=false, int $col=1, string $extra=""): string {
|
||||
$tstyle = $this->create_style($dir);
|
||||
if ($line===true) {
|
||||
return "<tr><td colspan=\"".count($this->__atabel)."\" class=\"".$tstyle." ".$extra."\">".$text."</td></tr>";
|
||||
} else {
|
||||
return (($bhead===true)?"<th":"<td").(($ncol>1)?" colspan=\"".$ncol."\"":"")." class=\"".$tstyle." ".$textra."\" ".(($bhead===true)?"width=\"".$nlen."\"":"").">".$ttext.(($bhead===true)?"</th>":"</td>");
|
||||
return (($head===true)?"<th":"<td").(($col>1)?" colspan=\"".(string)$col."\"":"")." class=\"".$tstyle." ".$extra."\" ".(($head===true)?"width=\"".(string)$width."\"":"").">".$text.(($head===true)?"</th>":"</td>");
|
||||
}
|
||||
}
|
||||
|
||||
private function create_style($tstyle="L") { //up 2014-10-12
|
||||
private function create_style(string $style="L"): string {
|
||||
// style = Left Right Center No-Border No-Left No-Right Bold Italic
|
||||
$apad = ["L"=>"l", "R"=>"r", "C"=>"c", "NB"=>"nb", "NL"=>"noleft", "NR"=>"noright", "B"=>"b", "I"=>"i"];
|
||||
$_astyle = explode(",", $tstyle);
|
||||
$thasil = "";
|
||||
$_astyle = explode(",", $style);
|
||||
$ahasil = [];
|
||||
foreach ($_astyle as $_key => $_val) {
|
||||
$thasil .= " ".$apad[$_val];
|
||||
$ahasil[] = $apad[$_val];
|
||||
}
|
||||
return substr($thasil,1);
|
||||
return implode(' ', $ahasil);
|
||||
}
|
||||
|
||||
public function add_pagebreak() {}//delete: not used anymore
|
||||
//todo: deprecated
|
||||
public function show_fields() {}
|
||||
public function add_pagebreak() {}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+55
-50
@@ -2,13 +2,13 @@
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Printing/PrintPOS.php
|
||||
Module : /Printer/PrintPOS.php
|
||||
Desc. : Class cetak POS
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : December 3rd, 2025.
|
||||
Last Modified : August 21st, 2026.
|
||||
|
||||
(c) 2008 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
@@ -16,48 +16,54 @@ declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Printer;
|
||||
|
||||
/* VERSI BARU DENGAN MULTI SHEET */
|
||||
class PrintPOS {//up: 20251203
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
|
||||
class PrintPOS {
|
||||
private $_header = [];
|
||||
private $_avalue = [];
|
||||
private $_astyle = [];
|
||||
private $_ncont = 0;
|
||||
private $_maxchr = 40;
|
||||
private $_config = [
|
||||
'fontsize' => 1,
|
||||
'opendraw' => false,
|
||||
'cutpaper' => false,
|
||||
'logo' => null ];
|
||||
'fontsize' => 1,
|
||||
'opendraw' => false,
|
||||
'cutpaper' => false,
|
||||
'logo' => null,
|
||||
];
|
||||
private array $webapp;
|
||||
private array $webuser;
|
||||
protected Engine $app;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct(Engine $app, Session $session) {
|
||||
$this->app = $app;
|
||||
$this->webapp = $session->get('__WEB_APP', ['APP_NAME'=>'', 'APP_VER'=>'', 'REAL_PATH'=>'']);
|
||||
$this->webuser = $session->get('__WEB_USER', ['UserID'=>0, 'Username'=>'']);
|
||||
}
|
||||
|
||||
public function set_opendrawer() {
|
||||
public function set_opendrawer(): void {
|
||||
$this->_config['opendraw'] = true;
|
||||
}
|
||||
|
||||
public function set_cutpaper() {
|
||||
public function set_cutpaper(): void {
|
||||
$this->_config['cutpaper'] = true;
|
||||
}
|
||||
|
||||
public function set_maxchr($nmax = 0) {//up: 2015-03-22
|
||||
if ($nmax > 0) $this->_maxchr = $nmax;
|
||||
public function set_maxchr(int $max = 0): void {
|
||||
if ($max > 0) $this->_maxchr = $max;
|
||||
}
|
||||
|
||||
public function set_fontsize($nsize = 1) {//up: 2015-09-30
|
||||
if ($nsize > 0) $this->_config['fontsize'] = $nsize;
|
||||
public function set_fontsize(int $size = 1): void {
|
||||
if ($size > 0) $this->_config['fontsize'] = $size;
|
||||
}
|
||||
|
||||
public function set_printnv_logo() {}//delete
|
||||
|
||||
public function set_header_logo($logo_file = "") {//up: 2019-01-08
|
||||
if ($logo_file=="") return;
|
||||
if (file_exists($_SESSION['__WEB_APP']['REAL_PATH']."assets/images/".$logo_file)) {
|
||||
$this->_config['logo'] = $_SESSION['__WEB_APP']['WEB_PATH']."assets/images/".$logo_file;
|
||||
public function set_header_logo(string $logo_file = ""): void {
|
||||
if (!empty($logo_file) && file_exists($this->webapp['REAL_PATH']."assets/images/".$logo_file)) {
|
||||
$this->_config['logo'] = $this->webapp['WEB_PATH']."assets/images/".$logo_file;
|
||||
}
|
||||
}
|
||||
|
||||
public function add_header() {//up: 2025-12-03
|
||||
public function add_header(): void {
|
||||
$extra = func_get_args();
|
||||
if (count($extra) > 0) {
|
||||
foreach ($extra as $_val) {
|
||||
@@ -66,11 +72,11 @@ class PrintPOS {//up: 20251203
|
||||
}
|
||||
}
|
||||
|
||||
public function add_sheet() {//up: 20170321
|
||||
public function add_sheet(): void {
|
||||
$this->_ncont++;
|
||||
}
|
||||
|
||||
public function add() {//up: 20180524
|
||||
public function add(): void {
|
||||
$val_arr = func_get_args(); $ttext = ""; $tstyle = "L";
|
||||
if (is_array($val_arr[0])) {
|
||||
foreach($val_arr as $aval) {
|
||||
@@ -84,32 +90,32 @@ class PrintPOS {//up: 20251203
|
||||
$this->_astyle[$this->_ncont][] = $tstyle;
|
||||
}
|
||||
|
||||
public function addl($ttext = "") {
|
||||
$this->add($ttext);
|
||||
public function addl(string $text = ""): void {
|
||||
$this->add($text);
|
||||
}
|
||||
|
||||
public function addr($ttext = "") {
|
||||
$this->add($ttext, "R");
|
||||
public function addr(string $text = ""): void {
|
||||
$this->add($text, "R");
|
||||
}
|
||||
|
||||
public function addc($ttext = "") {
|
||||
$this->add($ttext, "C");
|
||||
public function addc(string $text = ""): void {
|
||||
$this->add($text, "C");
|
||||
}
|
||||
|
||||
public function add_line($tmp = "-") {
|
||||
$this->add("__LINE ".$tmp);
|
||||
public function add_line(string $line = "-"): void {
|
||||
$this->add("__LINE ".$line);
|
||||
}
|
||||
|
||||
public function add_empty($nrep = 1) {
|
||||
for ($i=0;$i<$nrep;$i++) $this->add("");
|
||||
public function add_empty(int $baris = 1): void {
|
||||
for ($i=0; $i<$baris; $i++) $this->add("");
|
||||
}
|
||||
|
||||
public function add_stamp($ctk_ke=1, $bnama=false) {
|
||||
$this->add($_SESSION['__WEB_APP']['APP_NAME']."v".$_SESSION['__WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):""));
|
||||
public function add_stamp(int $ctk_ke=1, bool $cetak_nama=false): void {
|
||||
$this->add($this->webapp['APP_NAME']."v".$this->webapp['APP_VER'].date("\@ymd.His")."-".isi_nol($this->webuser['UserID'], 3).(($cetak_nama)?"/".strtoupper($this->webuser['Username']):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):""));
|
||||
}
|
||||
|
||||
private function _json_out() {//up: 2016-11-12
|
||||
$acontent = array();
|
||||
public function show(int $jumlah_ctk=1): void {
|
||||
$acontent = [];
|
||||
$nmax = $this->_maxchr;
|
||||
|
||||
for ($s=0; $s<count($this->_avalue); $s++) {
|
||||
@@ -123,24 +129,23 @@ class PrintPOS {//up: 20251203
|
||||
}
|
||||
}
|
||||
|
||||
$aout = array('type' => "escp");
|
||||
$this->_config['times'] = $jumlah_ctk;
|
||||
$aout = ['type' => "escp"];
|
||||
$aout['config'] = $this->_config;
|
||||
$aout['header'] = $this->_header;
|
||||
$aout['content'] = $acontent;
|
||||
send_json($aout);
|
||||
$this->app->json($aout);
|
||||
}
|
||||
|
||||
public function show($jumlah_ctk=1) {
|
||||
$this->_config['times'] = $jumlah_ctk;
|
||||
$this->_json_out();
|
||||
public function set_align(string $text, int $len=0, string $dir="L"): string {
|
||||
$apad = ["L"=>STR_PAD_RIGHT, "R"=>STR_PAD_LEFT, "C"=>STR_PAD_BOTH];
|
||||
$nlen = ($len==0) ? strlen($text) : $len;
|
||||
$ttext = (strlen($text)>$len) ? substr($text, 0, $len) : $text;
|
||||
return str_pad($text, $len, " ", $apad[$dir]);
|
||||
}
|
||||
|
||||
public function set_align($ttext, $nlen=0, $tdir="L") {//up: 20180524
|
||||
$apad = array("L"=>STR_PAD_RIGHT, "R"=>STR_PAD_LEFT, "C"=>STR_PAD_BOTH);
|
||||
$nlen = ($nlen==0) ? strlen($ttext) : $nlen;
|
||||
$ttext = (strlen($ttext)>$nlen) ? substr($ttext, 0, $nlen) : $ttext;
|
||||
return str_pad($ttext, $nlen, " ", $apad[$tdir]);
|
||||
}
|
||||
//todo: deprecated
|
||||
public function set_printnv_logo() {}//delete
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+49
-48
@@ -2,13 +2,13 @@
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Printing/PrintRAW.php
|
||||
Module : /Printer/PrintRAW.php
|
||||
Desc. : Class cetak RAW
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : November 1st, 2023.
|
||||
|
||||
(c) 2008 - 2023, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
@@ -16,6 +16,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Printer;
|
||||
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
|
||||
class PrintRAW {
|
||||
private $_header = [];
|
||||
private $_avalue = [];
|
||||
@@ -24,57 +27,59 @@ class PrintRAW {
|
||||
private $_maxchr = 40;
|
||||
private $_spacekol = " ";
|
||||
private $_config = [
|
||||
'fontsize' => "01",
|
||||
'nvlogo' => false,
|
||||
'opendraw' => false,
|
||||
'opendrawbegin' => false,
|
||||
'cutpaper' => false ];
|
||||
'fontsize' => "01",
|
||||
'nvlogo' => false,
|
||||
'opendraw' => false,
|
||||
'cutpaper' => false,
|
||||
];
|
||||
protected Engine $app;
|
||||
protected array $webapp;
|
||||
protected array $webuser;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct(Engine $app, Session $session) {
|
||||
$this->app = $app;
|
||||
$this->webapp = $session->get('__WEB_APP', ['APP_NAME'=>'', 'APP_VER'=>'', 'REAL_PATH'=>'']);
|
||||
$this->webuser = $session->get('__WEB_USER', ['UserID'=>0, 'Username'=>'']);
|
||||
}
|
||||
|
||||
public function set_opendrawer($bbegin = true) {
|
||||
public function set_opendrawer(): void {
|
||||
$this->_config['opendraw'] = true;
|
||||
$this->_config['opendrawbegin'] = $bbegin;
|
||||
}
|
||||
|
||||
public function set_cutpaper() {
|
||||
public function set_cutpaper(): void {
|
||||
$this->_config['cutpaper'] = true;
|
||||
}
|
||||
|
||||
public function set_maxchr($nmax = 0) {//up: 2015-03-22
|
||||
if ($nmax > 0) $this->_maxchr = $nmax;
|
||||
public function set_maxchr(int $max = 0): void {
|
||||
if ($max > 0) $this->_maxchr = $max;
|
||||
}
|
||||
|
||||
public function set_fontsize($nsize = 1) {//up: 2015-09-30
|
||||
if ($nsize > 0) $this->_config['fontsize'] = str_pad($nsize, 2, "0", STR_PAD_LEFT);
|
||||
|
||||
public function set_fontsize(int $size = 1): void {
|
||||
if ($size > 0) $this->_config['fontsize'] = str_pad((string)$size, 2, "0", STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public function set_printnv_logo() {//up: 2015-03-23
|
||||
public function set_printnv_logo(): void {
|
||||
$this->_config['nvlogo'] = true;
|
||||
}
|
||||
|
||||
public function add_header($nvlogo = false, $extra = []) {//up: 2016-11-12
|
||||
public function add_header(bool $nvlogo = false, array $extra = []): void {
|
||||
$this->_config['nvlogo'] = $nvlogo;
|
||||
$this->_header[] = $_SESSION['__WEB_APP']['REG_NAME'];
|
||||
if (count($extra) > 0) {
|
||||
foreach ($extra as $_val) {
|
||||
$this->_header[] = $_val;
|
||||
}
|
||||
}
|
||||
$this->_header[] = $_SESSION['__WEB_APP']['REG_CITY'];
|
||||
}
|
||||
|
||||
public function add_sheet() {//up: 20170321
|
||||
public function add_sheet(): void {
|
||||
$this->_ncont++;
|
||||
}
|
||||
|
||||
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="") {
|
||||
$this->_atabel[] = [$tnama, $nlebar, $ffunc, $talign];
|
||||
public function add_field(string $nama, int $lebar=0, string $align="L", string $func=""): void {
|
||||
$this->_atabel[] = [ $nama, $lebar, $func, $align ];
|
||||
}
|
||||
|
||||
public function show_fields() {
|
||||
public function show_fields(): void {
|
||||
$tmp_out = "<b>";
|
||||
for ($i=0; $i<count($this->_atabel); $i++) {
|
||||
$tmp_out .= $this->set_align($this->_atabel[$i][0], $this->_atabel[$i][1], "C");
|
||||
@@ -86,13 +91,13 @@ class PrintRAW {
|
||||
$this->_avalue[$this->_ncont][] = "__LINE -";
|
||||
}
|
||||
|
||||
public function add_value() {
|
||||
public function add_value(): void {
|
||||
$tmp_arr = func_get_args();
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0]; //up 2009-09-27
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
|
||||
$tmp_out = "";
|
||||
for ($i=0; $i<count($this->_atabel); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];
|
||||
if (is_array($this->_atabel[$i][2]) && trim($tmp_val)<>"") { //up 2010-05-28
|
||||
if (is_array($this->_atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = $this->_atabel[$i][2][$tmp_val];
|
||||
} else if (function_exists($this->_atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->_atabel[$i][2], $tmp_val);
|
||||
@@ -104,24 +109,24 @@ class PrintRAW {
|
||||
$this->_avalue[$this->_ncont][] = $tmp_out;
|
||||
}
|
||||
|
||||
public function add($ttext = "") {
|
||||
$this->_avalue[$this->_ncont][] = $ttext;
|
||||
public function add(string $text): void {
|
||||
$this->_avalue[$this->_ncont][] = $text;
|
||||
}
|
||||
|
||||
public function add_line($tmp = "-") {
|
||||
$this->add("__LINE ".$tmp);
|
||||
public function add_line(string $line = "-"): void {
|
||||
$this->add("__LINE ".$line);
|
||||
}
|
||||
|
||||
public function add_empty($nrep = 1) {
|
||||
for ($i=0;$i<$nrep;$i++) $this->add("");
|
||||
public function add_empty(int $rep = 1): void {
|
||||
for ($i=0;$i<$rep;$i++) $this->add("");
|
||||
}
|
||||
|
||||
public function add_stamp($ctk_ke=1, $bnama=false) {
|
||||
$this->add($_SESSION['__WEB_APP']['APP_NAME']."v".$_SESSION['__WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):""));
|
||||
public function add_stamp(int $ctk_ke=1, bool $cetak_nama=false): void {
|
||||
$this->add($this->webapp['APP_NAME']."v".$this->webapp['APP_VER'].date("\@ymd.His")."-".isi_nol($this->webuser['UserID'], 3).(($cetak_nama)?"/".strtoupper($this->webuser['Username']):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):""));
|
||||
}
|
||||
|
||||
private function _json_out() {//up: 2016-11-12
|
||||
$acontent = array();
|
||||
public function show(int $jumlah_ctk=1): void {
|
||||
$acontent = [];
|
||||
$nmax = $this->_maxchr;
|
||||
|
||||
for ($s=0; $s<count($this->_avalue); $s++) {
|
||||
@@ -135,22 +140,18 @@ class PrintRAW {
|
||||
}
|
||||
}
|
||||
|
||||
$aout = array('type' => "escp");
|
||||
$this->_config['times'] = $jumlah_ctk;
|
||||
$aout = ['type' => "escp"];
|
||||
$aout['config'] = $this->_config;
|
||||
$aout['header'] = $this->_header;
|
||||
$aout['content'] = $acontent;
|
||||
send_json($aout);
|
||||
$this->app->json($aout);
|
||||
}
|
||||
|
||||
public function show($jumlah_ctk=1) {
|
||||
$this->_config['times'] = $jumlah_ctk;
|
||||
$this->_json_out();
|
||||
}
|
||||
|
||||
public function set_align($ttext, $nlen, $tdir="L") {
|
||||
$apad = array("L"=>STR_PAD_RIGHT, "R"=>STR_PAD_LEFT, "C"=>STR_PAD_BOTH);
|
||||
$ttext = (strlen($ttext)>$nlen) ? substr($ttext, 0, $nlen) : $ttext;
|
||||
return str_pad($ttext, $nlen, " ", $apad[$tdir]);
|
||||
public function set_align(string $text, int $len, string $dir="L"): string {
|
||||
$apad = ["L"=>STR_PAD_RIGHT, "R"=>STR_PAD_LEFT, "C"=>STR_PAD_BOTH];
|
||||
$ttext = (strlen($text)>$len) ? substr($text, 0, $len) : $text;
|
||||
return str_pad($text, $len, " ", $apad[$dir]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user