table css-row, on-close showWindow event, redirect parent on exit, open cash-drawer always on start printing, pole-display fixed bug.
This commit is contained in:
+13
-14
@@ -4,7 +4,7 @@
|
||||
Desc. : JS - Fonia Custom Class v3
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 19th, 2009.
|
||||
Last Modified : September 21st, 2025.
|
||||
Last Modified : December 3rd, 2025.
|
||||
|
||||
(c) 2009 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'use strict';
|
||||
|
||||
var FoniaJS = {
|
||||
version: "3.0.0",
|
||||
version: "3.0.1",
|
||||
APP_ID: 0,
|
||||
APP_SID: "",
|
||||
WEB_HOST: "",
|
||||
@@ -21,7 +21,7 @@ var FoniaJS = {
|
||||
WEB_FULLPATH: "",
|
||||
WEB_MOBILE: 0,
|
||||
AUTH_LEVEL: 9,
|
||||
User: {ID:null, UID:null, GID:0, Level:0},
|
||||
User: {ID:null, UID:0, GID:0, Level:0},
|
||||
phpversion: "",
|
||||
locales: [],
|
||||
deflocal: "",
|
||||
@@ -486,9 +486,10 @@ var FoniaJS = {
|
||||
});
|
||||
}).modal('show');
|
||||
},
|
||||
showWindow: function(id_wind, s_judul, s_isi, i_width, s_toolb, f_onload, b_scroll) {//oke
|
||||
showWindow: function(id_wind, s_judul, s_isi, i_width, s_toolb, f_onload, f_offload, b_scroll) {//oke
|
||||
var t_width = '', t_toolb = '', t_scroll = (typeof b_scroll == 'boolean' && b_scroll == false) ? '' : 'modal-dialog-scrollable';
|
||||
var f_oncall = (typeof f_onload == "function") ? f_onload : function(){};
|
||||
var f_offcall = (typeof f_offload == "function") ? f_offload : function(){};
|
||||
if (typeof i_width == 'string') { t_width = 'modal-'+i_width; } else
|
||||
if (i_width <= 300) { t_width = 'modal-sm'; } else
|
||||
if (i_width <= 400) { t_width = 'modal-400'; } else
|
||||
@@ -513,6 +514,7 @@ var FoniaJS = {
|
||||
f_oncall();
|
||||
FoniaJS.FormDecorated();
|
||||
}).on('hidden.bs.modal', function(e){
|
||||
f_offcall();
|
||||
$(this).remove();
|
||||
}).modal('show');
|
||||
return '#win'+id_wind;
|
||||
@@ -721,9 +723,6 @@ Request.JSONF = function(options){//oke
|
||||
};
|
||||
var make_option = function(ini){//oke
|
||||
var optIni = $('#'+ini.id);
|
||||
/*if (ini.css) {
|
||||
optIni.prop('disabled', ini.css=='disabled');
|
||||
}*/
|
||||
if (!optIni) return;
|
||||
if (ini.avalue) {
|
||||
optIni.empty();
|
||||
@@ -764,6 +763,9 @@ Request.JSONF = function(options){//oke
|
||||
});
|
||||
strHead += '<th data-class-name="c">'+strAksi+'</th>';
|
||||
aSortCol.push(null);
|
||||
} else {
|
||||
strHead += '<th data-class-name="hid"> </th>';
|
||||
aSortCol.push(null);
|
||||
}
|
||||
strHead += '</tr></thead>';
|
||||
|
||||
@@ -791,11 +793,11 @@ Request.JSONF = function(options){//oke
|
||||
if (keyi == 0) return;
|
||||
strBody += '<td>' + vali + '</td>';
|
||||
});
|
||||
if (ini.option.length > 0) {
|
||||
var _tbtn1 = "", _tbtn2 = "";
|
||||
if (val[0].rowcss) {
|
||||
_tbtn1 += '<span class="rowcss '+val[0].rowcss+'"></span>';
|
||||
}
|
||||
if (ini.option.length > 0) {
|
||||
if (val[0].button.length > 0) {
|
||||
$.each(val[0].button, function(keyb, valb){
|
||||
var _icon = (valb[0]=='fon-tabel-dt') ? 'pencil' : valb[0];
|
||||
@@ -812,9 +814,8 @@ Request.JSONF = function(options){//oke
|
||||
if (val[0].checkbox) {
|
||||
_tbtn1 += '<div><input class="form-check-input" type="checkbox" id="'+ChkField+'_cbox_'+val[0].checkbox.field+'" value="'+val[0].checkbox.value+'"></div>';
|
||||
}
|
||||
strBody += '<td class="">'+_tbtn1+_tbtn2+'</td>';
|
||||
}
|
||||
strBody += '</tr>';
|
||||
strBody += '<td class="">'+_tbtn1+_tbtn2+'</td></tr>';
|
||||
});
|
||||
strBody += '</tbody>';
|
||||
|
||||
@@ -850,11 +851,11 @@ Request.JSONF = function(options){//oke
|
||||
|
||||
$.each(jsono.data, function(key, val){
|
||||
var optval = val[0]; jsono.data[key].shift();
|
||||
if (ini.option.length > 0) {
|
||||
var _tbtn1 = "", _tbtn2 = "";
|
||||
if (optval.rowcss) {
|
||||
_tbtn1 += '<span class="rowcss '+optval.rowcss+'"></span>';
|
||||
}
|
||||
if (ini.option.length > 0) {
|
||||
if (optval.button.length > 0) {
|
||||
$.each(optval.button, function(keyb, valb){
|
||||
var _icon = (valb[0]=='fon-tabel-dt') ? 'pencil' : valb[0];
|
||||
@@ -871,8 +872,8 @@ Request.JSONF = function(options){//oke
|
||||
if (optval.checkbox) {
|
||||
_tbtn1 += '<div><input class="form-check-input" type="checkbox" id="'+ChkField+'_cbox_'+optval.checkbox.field+'" value="'+optval.checkbox.value+'"></div>';
|
||||
}
|
||||
jsono.data[key].push(_tbtn1+_tbtn2);
|
||||
}
|
||||
jsono.data[key].push(_tbtn1+_tbtn2);
|
||||
});
|
||||
return JSON.stringify(jsono);
|
||||
}
|
||||
@@ -988,7 +989,6 @@ Request.JSONF = function(options){//oke
|
||||
}
|
||||
});
|
||||
}
|
||||
//if (ini.config.live){
|
||||
$('#'+ini.id+'Tabel tbody').on('click', 'td.dtr-control', function(){
|
||||
var tr = $(this).closest('tr');
|
||||
var row = otabel.row(tr);
|
||||
@@ -1010,7 +1010,6 @@ Request.JSONF = function(options){//oke
|
||||
tr.addClass('dt-hasChild parent');
|
||||
}
|
||||
});
|
||||
//}
|
||||
}
|
||||
var otabel = $('#'+ini.id+'Tabel').DataTable(opsi);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /assets/js/pole-display.js
|
||||
Desc. : JS Class Tampil Data di Pole Display POS
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : October 12th, 2025.
|
||||
|
||||
(c) 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var cPOLEDISPLAY = function(port, options){
|
||||
var _cd_port = '';
|
||||
var _cd_pole = '';
|
||||
var _options = {
|
||||
rx: { start: '\x02', end: '\x0D', width: null },
|
||||
baudRate: 9600,
|
||||
dataBits: 8,
|
||||
stopBits: 1,
|
||||
parity: 'NONE',
|
||||
flowControl: 'NONE'
|
||||
};
|
||||
|
||||
this.construct = function (port, options){//oke
|
||||
$.extend(_options, options);
|
||||
_cd_port = port;
|
||||
};
|
||||
|
||||
this.Open = function (){
|
||||
if (_cd_pole === '') {
|
||||
qz.serial.openPort(_cd_port, _options).then(() => {
|
||||
_cd_pole = _cd_port;
|
||||
this.cd_Error(_cd_port+' opened');
|
||||
}).then(() => {
|
||||
qz.serial.sendData(_cd_pole, {type:'HEX',data:'x1Bx40'}, _options).catch(this.cd_Error);
|
||||
}).catch(this.cd_Error);
|
||||
}
|
||||
};
|
||||
|
||||
this.Close = function (){
|
||||
qz.serial.closePort(_cd_port).then(() => {
|
||||
_cd_pole = '';
|
||||
this.cd_Error(_cd_port+' closed');
|
||||
}).catch(this.cd_Error);
|
||||
};
|
||||
|
||||
this.Send = function (txt){
|
||||
if (_cd_pole === '') return false;
|
||||
var ascii_to_hexa = function(str) {
|
||||
var arr1 = [];
|
||||
for (var n = 0, l = str.length; n < l; n++) {
|
||||
var hex = Number(str.charCodeAt(n)).toString(16);
|
||||
if (hex.length==1) hex = '0' + hex;
|
||||
arr1.push(hex.toUpperCase());
|
||||
}
|
||||
return 'x' + arr1.join('x');
|
||||
};
|
||||
var _txt = txt;
|
||||
if (Array.isArray(txt)) {
|
||||
_txt = '';
|
||||
txt.forEach((ele) => {
|
||||
_txt += this.cd_Text(ele['t'], ele['a']);
|
||||
});
|
||||
}
|
||||
qz.serial.sendData(_cd_pole, {type:'HEX',data:'x10C'+ascii_to_hexa(_txt)}, _options).catch(this.cd_Error);
|
||||
};
|
||||
|
||||
this.cd_Text = function (text, align){
|
||||
const totWidth = 20;
|
||||
const txtLength = text.length;
|
||||
if (txtLength >= totWidth) {
|
||||
return text.substring(0, totWidth);
|
||||
}
|
||||
const padding = totWidth - txtLength;
|
||||
var lPadding = 0;
|
||||
var rPadding = padding;
|
||||
if (align === null) align = 'L';
|
||||
if (align == 'C'){
|
||||
lPadding = Math.floor(padding / 2);
|
||||
rPadding = Math.ceil(padding / 2);
|
||||
} else if (align == 'R'){
|
||||
lPadding = padding;
|
||||
rPadding = 0;
|
||||
}
|
||||
return " ".repeat(lPadding) + text + " ".repeat(rPadding);
|
||||
};
|
||||
|
||||
this.cd_Error = function (err){//oke
|
||||
console.error(err);
|
||||
};
|
||||
|
||||
this.construct(port, options);
|
||||
};
|
||||
+19
-65
@@ -4,9 +4,9 @@
|
||||
Desc. : JS Class Printer & Printer POS
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 27th, 2007.
|
||||
Last Modified : January 26th, 2021.
|
||||
Last Modified : December 3rd, 2025.
|
||||
|
||||
(c) 2008 - 2021, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 2007 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
@@ -92,51 +92,23 @@ var cPRINTER = function(url, options){
|
||||
this.construct(url, options);
|
||||
};
|
||||
|
||||
/*
|
||||
showPreview: function() {
|
||||
toolbar: true,
|
||||
toolbarPosition: "top",
|
||||
toolbarHeight: 35,
|
||||
toolbarMenu: "PP,_,PS,PN,PB",
|
||||
toolbarOnload: function() {
|
||||
$("butPPrint").addEvent("click", function() {
|
||||
if (this.winPreview) {
|
||||
this.winPreview.close();
|
||||
}
|
||||
window.print();
|
||||
}.bind(this));
|
||||
$("butPNormal").addEvent("click", function() {
|
||||
this.winPreview.options.zoomfont = 100;
|
||||
$("winPreview_content").setStyle("font-size", this.winPreview.options.zoomfont + "%");
|
||||
}.bind(this));
|
||||
$("butPSmall").addEvent("click", function() {
|
||||
this.winPreview.options.zoomfont -= 10;
|
||||
$("winPreview_content").setStyle("font-size", this.winPreview.options.zoomfont + "%");
|
||||
}.bind(this));
|
||||
$("butPBig").addEvent("click", function() {
|
||||
this.winPreview.options.zoomfont += 10;
|
||||
$("winPreview_content").setStyle("font-size", this.winPreview.options.zoomfont + "%");
|
||||
}.bind(this));
|
||||
$("winPreview_content").setStyle("font-size", this.options.zoom + "%");
|
||||
}.bind(this)
|
||||
});
|
||||
},
|
||||
});*/
|
||||
|
||||
var cPRINTERPOS = function(url, options) {
|
||||
var b_default = false;
|
||||
var _options = {
|
||||
'url': '',
|
||||
'param': [],
|
||||
'printer': null
|
||||
'printer': null,
|
||||
'cut_paper': "\x1D\x56\x41",
|
||||
'open_draw': "\x1B\x70\x30\x19\x19",
|
||||
'chr_norm': "\x1B\x21\x01",
|
||||
'chr_bold': "\x1B\x21\x10",
|
||||
'chr_sbold': "\x1B\x21\x31",
|
||||
'chr_uline': "\x1B\x21\x80"
|
||||
};
|
||||
this.construct = function(url, options) {
|
||||
$.extend(_options, options);
|
||||
_options.url = url;
|
||||
if (FoniaJS._def_printer) _options.printer = FoniaJS._def_printer;
|
||||
/*if ($('#configPrinter')) {
|
||||
_options.printer = $('#configPrinter').html();
|
||||
}*/
|
||||
};
|
||||
this.detectPrinter = function() {
|
||||
if (!qz.websocket.isActive()) {
|
||||
@@ -170,9 +142,6 @@ var cPRINTERPOS = function(url, options) {
|
||||
if (data.name != undefined) {
|
||||
nama_p = data.name;
|
||||
}
|
||||
/*if ($('#configPrinter')) {
|
||||
$('#configPrinter').html(nama_p);
|
||||
}*/
|
||||
parent._options.param.push('Printer='+nama_p);
|
||||
return parent.do_print(nama_p, parent._options.url, parent._options.param);
|
||||
}, function(data) {
|
||||
@@ -207,13 +176,6 @@ var cPRINTERPOS = function(url, options) {
|
||||
}).send();
|
||||
};
|
||||
this.gen_escp = function(adata) {
|
||||
var cut_paper = "\x1D\x56\x41";
|
||||
var open_draw = "\x1B\x70\x30\x19\x19";
|
||||
var nv_image = "\x1D\x28\x4C\x06\x00\x30\x45\x30\x30\x01\x01";
|
||||
var chr_norm = "\x1B\x21\x01";
|
||||
var chr_bold = "\x1B\x21\x10";
|
||||
var chr_sbold = "\x1B\x21\x31";
|
||||
var chr_uline = "\x1B\x21\x80";
|
||||
var ohead = [];
|
||||
var osheet = [], ocetak = [];
|
||||
ohead.push("\x1B\x40");
|
||||
@@ -223,17 +185,13 @@ var cPRINTERPOS = function(url, options) {
|
||||
ohead.push("\x1B\x32");
|
||||
}
|
||||
if (parseInt(adata.config.fontsize) == 2) {
|
||||
chr_norm = "\x1B\x21\x02";
|
||||
}
|
||||
if (adata.config.nvlogo) {
|
||||
ohead.push((this.options.nv_cmd?this.options.nv_cmd:nv_image));
|
||||
ohead.push(chr_norm);
|
||||
_options.chr_norm = "\x1B\x21\x02";
|
||||
}
|
||||
if (adata.header.length > 0) {
|
||||
for (i = 0; i < adata.header.length; i++) {
|
||||
if (i==0 && !adata.config.nvlogo && adata.config.logo==null) ohead.push(chr_bold);
|
||||
if (i==0 && adata.config.logo==null) ohead.push(_options.chr_bold);
|
||||
ohead.push(adata.header[i] + "\x0A");
|
||||
if (i==0 && !adata.config.nvlogo && adata.config.logo==null) ohead.push(chr_norm);
|
||||
if (i==0 && adata.config.logo==null) ohead.push(_options.chr_norm);
|
||||
}
|
||||
}
|
||||
for (s = 0; s < adata.content.length; s++) {
|
||||
@@ -241,28 +199,24 @@ var cPRINTERPOS = function(url, options) {
|
||||
osheet = ohead.slice(0);
|
||||
for (i = 0; i < adata.content[s].length; i++) {
|
||||
var tmp_cont = adata.content[s][i];
|
||||
tmp_cont = tmp_cont.replace('_SBOLD_', chr_sbold)
|
||||
.replace('_BOLD_', chr_bold)
|
||||
.replace('_NORM_', chr_norm)
|
||||
.replace('_ULINE_', chr_uline);
|
||||
tmp_cont = tmp_cont.replace('_SBOLD_', _options.chr_sbold)
|
||||
.replace('_BOLD_', _options.chr_bold)
|
||||
.replace('_NORM_', _options.chr_norm)
|
||||
.replace('_ULINE_', _options.chr_uline);
|
||||
osheet.push(tmp_cont + "\x0A");
|
||||
}
|
||||
if (adata.config.cutpaper) {
|
||||
osheet.push(cut_paper + "\x0A");
|
||||
osheet.push(_options.cut_paper + "\x0A");
|
||||
}
|
||||
//osheet.push("\x1B\x65\x02");//feed up 2row
|
||||
ocetak = ocetak.concat(osheet);
|
||||
}
|
||||
var notaout = [];
|
||||
if (adata.config.opendraw && adata.config.opendrawbegin) {
|
||||
notaout.push(open_draw);
|
||||
if (adata.config.opendraw) {
|
||||
notaout.push(_options.open_draw);
|
||||
}
|
||||
for (i = 0; i < adata.config.times; i++) {
|
||||
notaout = notaout.concat(ocetak);
|
||||
}
|
||||
if (adata.config.opendraw && adata.config.opendrawbegin == false) {
|
||||
notaout.push(open_draw);
|
||||
}
|
||||
return notaout;
|
||||
};
|
||||
this.gen_epl = function(adata) {
|
||||
|
||||
+8
-6
@@ -6,7 +6,7 @@
|
||||
Desc. : v3 - HTML5 Page Generator (jQuery & Bootstrap)
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 10th, 2008.
|
||||
Last Modified : September 21st, 2025.
|
||||
Last Modified : October 3rd, 2025.
|
||||
|
||||
(c) 2008 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -116,13 +116,15 @@ final class App {
|
||||
$href1 = $this->apps['WEB_PATH'].'../';
|
||||
$href2 = "";
|
||||
} else {
|
||||
$_host = str_replace(['http://','https://'], "", $this->apps['PARENT_SITE']);
|
||||
$_prot = "//";
|
||||
$_host = (isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : $this->apps['PARENT_SITE']);
|
||||
$_host = str_replace(['http://','https://'], "", $_host);
|
||||
if ($this->apps['PARENT_SUB']==true) {
|
||||
$href1 = $_prot;
|
||||
$href2 = ".". $_host;
|
||||
$_subs = explode('.', $_host);
|
||||
if (count($_subs) > 2) array_shift($_subs);
|
||||
$href1 = "//";
|
||||
$href2 = "." . implode('.', $_subs);
|
||||
} else {
|
||||
$href1 = $_prot . $_host .'/';
|
||||
$href1 = "//" . $_host . '/';
|
||||
$href2 = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
Desc. : v4 - Class cetak POS
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : November 1st, 2023.
|
||||
Last Modified : December 3rd, 2025.
|
||||
|
||||
(c) 2008 - 2023, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 2008 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
@@ -17,7 +17,7 @@ declare(strict_types=1);
|
||||
namespace siaupheng\fonia3\Printer;
|
||||
|
||||
/* VERSI BARU DENGAN MULTI SHEET */
|
||||
class PrintPOS {//up: 20180108
|
||||
class PrintPOS {//up: 20251203
|
||||
private $_header = [];
|
||||
private $_avalue = [];
|
||||
private $_astyle = [];
|
||||
@@ -25,18 +25,15 @@ class PrintPOS {//up: 20180108
|
||||
private $_maxchr = 40;
|
||||
private $_config = [
|
||||
'fontsize' => 1,
|
||||
'nvlogo' => false,
|
||||
'opendraw' => false,
|
||||
'opendrawbegin' => true,
|
||||
'cutpaper' => false,
|
||||
'logo' => null ];
|
||||
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
public function set_opendrawer($bbegin = true) {
|
||||
public function set_opendrawer() {
|
||||
$this->_config['opendraw'] = true;
|
||||
$this->_config['opendrawbegin'] = $bbegin;
|
||||
}
|
||||
|
||||
public function set_cutpaper() {
|
||||
@@ -51,9 +48,7 @@ class PrintPOS {//up: 20180108
|
||||
if ($nsize > 0) $this->_config['fontsize'] = $nsize;
|
||||
}
|
||||
|
||||
public function set_printnv_logo() {//up: 2015-03-23
|
||||
$this->_config['nvlogo'] = true;
|
||||
}
|
||||
public function set_printnv_logo() {}//delete
|
||||
|
||||
public function set_header_logo($logo_file = "") {//up: 2019-01-08
|
||||
if ($logo_file=="") return;
|
||||
@@ -62,15 +57,13 @@ class PrintPOS {//up: 20180108
|
||||
}
|
||||
}
|
||||
|
||||
public function add_header($nvlogo = false, $extra = array()) {//up: 2018-12-25
|
||||
$this->_config['nvlogo'] = $nvlogo;
|
||||
if ($nvlogo==false && $this->_config['logo']==null) $this->_header[] = $_SESSION['__WEB_APP']['REG_NAME'];
|
||||
public function add_header() {//up: 2025-12-03
|
||||
$extra = func_get_args();
|
||||
if (count($extra) > 0) {
|
||||
foreach ($extra as $_val) {
|
||||
$this->_header[] = $_val;
|
||||
}
|
||||
}
|
||||
$this->_header[] = $_SESSION['__WEB_APP']['REG_CITY'];
|
||||
}
|
||||
|
||||
public function add_sheet() {//up: 20170321
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ final class Table {
|
||||
$this->__bnobutton = true;
|
||||
}
|
||||
|
||||
public function add_field($tfield = "", $theader = "", $tstyle = "left", $tformat = "", $tfooter = "", $totype = "") {
|
||||
public function add_field($tfield = "", $theader = "", $tstyle = "l", $tformat = "", $tfooter = "", $totype = "") {
|
||||
$this->__aheader[] = $theader;
|
||||
$this->__afield[] = $tfield;
|
||||
$this->__astyle[] = $tstyle;
|
||||
|
||||
Reference in New Issue
Block a user