dolibarr 23.0.3
dolreceiptprinter.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
3 * Copyright (C) 2020 Andreu Bisquerra <jove@bisquerra.com>
4 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2024 Abbes Bahfir <bafbes@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * or see https://www.gnu.org/
20 */
21
27/*
28 * Tags for ticket template
29 *
30 * {dol_align_left} Left align text
31 * {dol_align_center} Center text
32 * {dol_align_right} Right align text
33 * {dol_use_font_a} Use font A of printer
34 * {dol_use_font_b} Use font B of printer
35 * {dol_use_font_c} Use font C of printer
36 * {dol_bold} Text Bold
37 * {dol_bold_disabled} Disable Text Bold
38 * {dol_double_height} Text double height
39 * {dol_double_width} Text double width
40 * {dol_default_height_width} Text default height and width
41 * {dol_underline} Underline text
42 * {dol_underline_disabled} Disable underline text
43 * {dol_cut_paper_full} Cut ticket completely
44 * {dol_cut_paper_partial} Cut ticket partially
45 * {dol_open_drawer} Open cash drawer
46 * {dol_beep} Activate buzzer
47 * {dol_beep_alternative} Activate buzzer (alternative mode)
48 * {dol_print_barcode} Print barcode
49 * {dol_print_logo} Print logo stored on printer. Example : <print_logo>32|32
50 * {dol_print_logo_old} Print logo stored on printer. Must be followed by logo code. For old printers.
51 * {dol_print_logo_old_cf} Print logo stored on printer. Must be followed by logo code. For old printers. May help for centering image.
52 * {dol_print_object_lines} Print object lines
53 * {dol_print_object_tax} Print object total tax
54 * {dol_print_object_local_tax} Print object local tax
55 * {dol_print_object_total} Print object total
56 * {dol_print_order_lines} Print order lines for Printer
57 * {dol_print_object_lines_with_notes} Print object lines with notes
58 * {dol_print_payment} Print payment method
59 * {dol_print_curr_date} Print the current date/time. Must be followed by format string.
60 *
61 * Code which can be placed everywhere
62 * <dol_value_date> Replaced by date AAAA-MM-DD
63 * <dol_value_date_time> Replaced by date and time AAAA-MM-DD HH:MM:SS
64 * <dol_value_year> Replaced by Year
65 * <dol_value_month_letters> Replaced by month in letters (example : november)
66 * <dol_value_month> Replaced by month number
67 * <dol_value_day> Replaced by day number
68 * <dol_value_day_letters> Replaced by day number
69 * <dol_value_currentdate> Replaced by current date and time
70 * <dol_value_currentdate_notime> Replaced by current date without time
71 * <dol_object_id> Replaced by object id
72 * <dol_object_ref> Replaced by object ref
73 * <dol_value_customer_firstname> Replaced by customer firstname
74 * <dol_value_customer_lastname> Replaced by customer name
75 * <dol_value_customer_mail> Replaced by customer mail
76 * <dol_value_customer_phone> Replaced by customer phone
77 * <dol_value_customer_mobile> Replaced by customer mobile
78 * <dol_value_customer_tax_number> Replaced by customer VAT number
79 * <dol_value_customer_account_balance> Replaced by customer account balance
80 * <dol_value_mysoc_name> Replaced by mysoc name
81 * <dol_value_mysoc_address> Replaced by mysoc address
82 * <dol_value_mysoc_zip> Replaced by mysoc zip
83 * <dol_value_mysoc_town> Replaced by mysoc town
84 * <dol_value_mysoc_country> Replaced by mysoc country
85 * <dol_value_mysoc_idprof1> Replaced by mysoc idprof1
86 * <dol_value_mysoc_idprof2> Replaced by mysoc idprof2
87 * <dol_value_mysoc_idprof3> Replaced by mysoc idprof3
88 * <dol_value_mysoc_idprof4> Replaced by mysoc idprof4
89 * <dol_value_mysoc_idprof5> Replaced by mysoc idprof5
90 * <dol_value_mysoc_idprof6> Replaced by mysoc idprof6
91 * <dol_value_vendor_lastname> Replaced by vendor name
92 * <dol_value_vendor_firstname> Replaced by vendor firstname
93 * <dol_value_vendor_mail> Replaced by vendor mail
94 * <dol_value_customer_points> Replaced by customer points
95 * <dol_value_object_points> Replaced by number of points for this object
96 *
97 * Conditional code at line start (if then Print)
98 * <dol_print_if_customer> Print the line IF a customer is affected to the object
99 * <dol_print_if_vendor> Print the line IF a vendor is affected to the object
100 * <dol_print_if_happy_hour> Print the line IF Happy Hour
101 * <dol_print_if_num_object_unique> Print the line IF object is validated
102 * <dol_print_if_customer_points> Print the line IF customer points > 0
103 * <dol_print_if_object_points> Print the line IF points of the object > 0
104 * <dol_print_if_customer_tax_number> Print the line IF customer has vat number
105 * <dol_print_if_customer_account_balance_positive> Print the line IF customer balance > 0
106 *
107 */
108
109require_once DOL_DOCUMENT_ROOT.'/includes/mike42/escpos-php/autoload.php';
110use Mike42\Escpos\PrintConnectors\FilePrintConnector;
111use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
112use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
113use Mike42\Escpos\PrintConnectors\CupsPrintConnector;
114use Mike42\Escpos\PrintConnectors\DummyPrintConnector;
115use Mike42\Escpos\Printer;
116use Mike42\Escpos\EscposImage;
117
121class dolReceiptPrinter extends Printer
122{
123 const CONNECTOR_DUMMY = 1;
124 const CONNECTOR_FILE_PRINT = 2;
125 const CONNECTOR_NETWORK_PRINT = 3;
126 const CONNECTOR_WINDOWS_PRINT = 4;
127 const CONNECTOR_CUPS_PRINT = 5;
128
132 public $db;
133
137 public $tags;
138
142 public $printer;
146 public $template;
147
152 public $orderprinter;
153
158 public $listprinters;
159
164 public $listprinterstemplates;
165
169 public $profileresprint;
170
174 public $resprint;
175
179 public $error = '';
180
184 public $errors = array();
185
191 public function __construct($db)
192 {
193 $this->db = $db;
194 $this->tags = array(
195 'dol_line_feed' => 'DOL_LINE_FEED',
196 'dol_line_feed_reverse' => 'DOL_LINE_FEED_REVERSE',
197 'dol_align_left' => 'DOL_ALIGN_LEFT',
198 'dol_align_center' => 'DOL_ALIGN_CENTER',
199 'dol_align_right' => 'DOL_ALIGN_RIGHT',
200 'dol_use_font_a' => 'DOL_USE_FONT_A',
201 'dol_use_font_b' => 'DOL_USE_FONT_B',
202 'dol_use_font_c' => 'DOL_USE_FONT_C',
203 'dol_bold' => 'DOL_BOLD',
204 'dol_bold_disabled' => 'DOL_BOLD_DISABLED',
205 'dol_double_height' => 'DOL_DOUBLE_HEIGHT',
206 'dol_double_width' => 'DOL_DOUBLE_WIDTH',
207 'dol_default_height_width' => 'DOL_DEFAULT_HEIGHT_WIDTH',
208 'dol_underline' => 'DOL_UNDERLINE',
209 'dol_underline_disabled' => 'DOL_UNDERLINE_DISABLED',
210 'dol_cut_paper_full' => 'DOL_CUT_PAPER_FULL',
211 'dol_cut_paper_partial' => 'DOL_CUT_PAPER_PARTIAL',
212 'dol_open_drawer' => 'DOL_OPEN_DRAWER',
213 'dol_beep' => 'DOL_BEEP',
214 'dol_beep_alternative' => 'DOL_BEEP_ALTERNATIVE',
215 'dol_print_text' => 'DOL_PRINT_TEXT',
216 'dol_print_barcode' => 'DOL_PRINT_BARCODE',
217 'dol_value_date' => 'DateInvoice',
218 'dol_value_date_time' => 'DateInvoiceWithTime',
219 'dol_value_year' => 'YearInvoice',
220 'dol_value_month_letters' => 'DOL_VALUE_MONTH_LETTERS',
221 'dol_value_month' => 'DOL_VALUE_MONTH',
222 'dol_value_day' => 'DOL_VALUE_DAY',
223 'dol_value_day_letters' => 'DOL_VALUE_DAY',
224 'dol_value_currentdate' => 'DOL_VALUE_CURRENTDATE',
225 'dol_value_currentdate_notime' => 'CurrentDateWithTime',
226 'dol_value_currentdate_letters' => 'DOL_VALUE_CURRENTDATE_LETTERS',
227 'dol_value_currentyear' => 'CurrentYear',
228 'dol_value_currentmonth_letters' => 'DOL_VALUE_CURRENT_MONTH_LETTERS',
229 'dol_value_currentmonth' => 'DOL_VALUE_CURRENT_MONTH',
230 'dol_value_currentday' => 'DOL_VALUE_CURRENT_DAY',
231 'dol_value_currentday_letters' => 'DOL_VALUE_CURRENT_DAY',
232 'dol_print_payment' => 'DOL_PRINT_PAYMENT',
233 'dol_print_curr_date' => 'DOL_PRINT_CURR_DATE',
234 'dol_print_logo' => 'DOL_PRINT_LOGO',
235 'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD',
236 'dol_print_logo_old_cf' => 'DOL_PRINT_LOGO_OLD_CF',
237 'dol_value_object_id' => 'InvoiceID',
238 'dol_value_object_ref' => 'InvoiceRef',
239 'dol_print_object_lines' => 'DOL_PRINT_OBJECT_LINES',
240 'dol_print_object_lines_with_notes' => 'DOL_PRINT_OBJECT_LINES_WITH_NOTES',
241 'dol_print_object_tax' => 'TotalVAT',
242 'dol_print_object_local_tax1' => 'TotalLT1',
243 'dol_print_object_local_tax2' => 'TotalLT2',
244 'dol_print_object_total' => 'Total',
245 'dol_print_object_number' => 'DOL_PRINT_OBJECT_NUMBER',
246 //'dol_value_object_points' => 'DOL_VALUE_OBJECT_POINTS',
247 'dol_print_order_lines' => 'DOL_PRINT_ORDER_LINES',
248 'dol_value_customer_firstname' => 'DOL_VALUE_CUSTOMER_FIRSTNAME',
249 'dol_value_customer_lastname' => 'DOL_VALUE_CUSTOMER_LASTNAME',
250 'dol_value_customer_mail' => 'DOL_VALUE_CUSTOMER_MAIL',
251 'dol_value_customer_phone' => 'DOL_VALUE_CUSTOMER_PHONE',
252 'dol_value_customer_tax_number' => 'DOL_VALUE_CUSTOMER_TAX_NUMBER',
253 //'dol_value_customer_account_balance' => 'DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE',
254 //'dol_value_customer_points' => 'DOL_VALUE_CUSTOMER_POINTS',
255 'dol_value_mysoc_name' => 'DOL_VALUE_MYSOC_NAME',
256 'dol_value_mysoc_address' => 'Address',
257 'dol_value_mysoc_zip' => 'Zip',
258 'dol_value_mysoc_town' => 'Town',
259 'dol_value_mysoc_country' => 'Country',
260 'dol_value_mysoc_idprof1' => 'ProfId1',
261 'dol_value_mysoc_idprof2' => 'ProfId2',
262 'dol_value_mysoc_idprof3' => 'ProfId3',
263 'dol_value_mysoc_idprof4' => 'ProfId4',
264 'dol_value_mysoc_idprof5' => 'ProfId5',
265 'dol_value_mysoc_idprof6' => 'ProfId6',
266 'dol_value_mysoc_tva_intra' => 'VATIntra',
267 'dol_value_mysoc_capital' => 'Capital',
268 'dol_value_mysoc_url' => 'Web',
269 'dol_value_vendor_lastname' => 'VendorLastname',
270 'dol_value_vendor_firstname' => 'VendorFirstname',
271 'dol_value_vendor_mail' => 'VendorEmail',
272 'dol_value_place' => 'DOL_VALUE_PLACE',
273 );
274 }
275
281 public function listPrinters()
282 {
283 global $conf;
284
285 $error = 0;
286 $line = 0;
287 $listofprinters = array();
288
289 $sql = "SELECT rowid, name, fk_type, fk_profile, parameter";
290 $sql .= " FROM ".$this->db->prefix()."printer_receipt";
291 $sql .= " WHERE entity = ".((int) $conf->entity);
292
293 $resql = $this->db->query($sql);
294
295 if ($resql) {
296 $num = $this->db->num_rows($resql);
297 while ($line < $num) {
298 $row = $this->db->fetch_array($resql);
299 if ($row) {
300 switch ($row['fk_type']) {
301 case 1:
302 $row['fk_type_name'] = 'CONNECTOR_DUMMY';
303 break;
304 case 2:
305 $row['fk_type_name'] = 'CONNECTOR_FILE_PRINT';
306 break;
307 case 3:
308 $row['fk_type_name'] = 'CONNECTOR_NETWORK_PRINT';
309 break;
310 case 4:
311 $row['fk_type_name'] = 'CONNECTOR_WINDOWS_PRINT';
312 break;
313 case 5:
314 $row['fk_type_name'] = 'CONNECTOR_CUPS_PRINT';
315 break;
316 default:
317 $row['fk_type_name'] = 'CONNECTOR_UNKNOWN';
318 break;
319 }
320 switch ($row['fk_profile']) {
321 case 0:
322 $row['fk_profile_name'] = 'PROFILE_DEFAULT';
323 break;
324 case 1:
325 $row['fk_profile_name'] = 'PROFILE_SIMPLE';
326 break;
327 case 2:
328 $row['fk_profile_name'] = 'PROFILE_EPOSTEP';
329 break;
330 case 3:
331 $row['fk_profile_name'] = 'PROFILE_P822D';
332 break;
333 default:
334 $row['fk_profile_name'] = 'PROFILE_STAR';
335 break;
336 }
337 $listofprinters[] = $row;
338 }
339 $line++;
340 }
341 } else {
342 $error++;
343 $this->errors[] = $this->db->lasterror;
344 }
345
346 $this->listprinters = $listofprinters;
347
348 return $error;
349 }
350
351
357 public function listPrintersTemplates()
358 {
359 global $conf;
360
361 $error = 0;
362 $line = 0;
363 $listofprinters = array();
364
365 $sql = "SELECT rowid, name, template";
366 $sql .= " FROM ".$this->db->prefix()."printer_receipt_template";
367 $sql .= " WHERE entity = ".$conf->entity;
368
369 $resql = $this->db->query($sql);
370
371 if ($resql) {
372 $num = $this->db->num_rows($resql);
373 while ($line < $num) {
374 $row = $this->db->fetch_array($resql);
375 if ($row) {
376 $listofprinters[] = $row;
377 }
378 $line++;
379 }
380 } else {
381 $error++;
382 $this->errors[] = $this->db->lasterror;
383 }
384
385 $this->listprinterstemplates = $listofprinters;
386
387 return $error;
388 }
389
390
398 public function selectTypePrinter($selected = '', $htmlname = 'printertypeid')
399 {
400 global $langs;
401
402 $options = array(
403 1 => $langs->trans('CONNECTOR_DUMMY'),
404 2 => $langs->trans('CONNECTOR_FILE_PRINT'),
405 3 => $langs->trans('CONNECTOR_NETWORK_PRINT'),
406 4 => $langs->trans('CONNECTOR_WINDOWS_PRINT'),
407 5 => $langs->trans('CONNECTOR_CUPS_PRINT'),
408 );
409
410 $this->resprint = Form::selectarray($htmlname, $options, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth150');
411
412 return 0;
413 }
414
415
423 public function selectProfilePrinter($selected = '', $htmlname = 'printerprofileid')
424 {
425 global $langs;
426
427 $options = array(
428 0 => $langs->trans('PROFILE_DEFAULT'),
429 1 => $langs->trans('PROFILE_SIMPLE'),
430 2 => $langs->trans('PROFILE_EPOSTEP'),
431 3 => $langs->trans('PROFILE_P822D'),
432 4 => $langs->trans('PROFILE_STAR'),
433 );
434
435 $this->profileresprint = Form::selectarray($htmlname, $options, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth150');
436 return 0;
437 }
438
439
449 public function addPrinter($name, $type, $profile, $parameter)
450 {
451 global $conf;
452 $error = 0;
453 $sql = "INSERT INTO ".$this->db->prefix()."printer_receipt";
454 $sql .= " (name, fk_type, fk_profile, parameter, entity)";
455 $sql .= " VALUES ('".$this->db->escape($name)."', ".((int) $type).", ".((int) $profile).", '".$this->db->escape($parameter)."', ".((int) $conf->entity).")";
456 $resql = $this->db->query($sql);
457 if (!$resql) {
458 $error++;
459 $this->errors[] = $this->db->lasterror;
460 }
461 return $error;
462 }
463
474 public function updatePrinter($name, $type, $profile, $parameter, $printerid)
475 {
476 $error = 0;
477
478 $sql = "UPDATE ".$this->db->prefix()."printer_receipt";
479 $sql .= " SET name='".$this->db->escape($name)."'";
480 $sql .= ", fk_type=".((int) $type);
481 $sql .= ", fk_profile=".((int) $profile);
482 $sql .= ", parameter='".$this->db->escape($parameter)."'";
483 $sql .= " WHERE rowid=".((int) $printerid);
484
485 $resql = $this->db->query($sql);
486 if (!$resql) {
487 $error++;
488 $this->errors[] = $this->db->lasterror;
489 }
490 return $error;
491 }
492
499 public function deletePrinter($printerid)
500 {
501 global $conf;
502 $error = 0;
503 $sql = 'DELETE FROM '.$this->db->prefix().'printer_receipt';
504 $sql .= ' WHERE rowid='.((int) $printerid);
505 $resql = $this->db->query($sql);
506 if (!$resql) {
507 $error++;
508 $this->errors[] = $this->db->lasterror;
509 }
510 return $error;
511 }
512
520 public function addTemplate($name, $template)
521 {
522 global $conf;
523 $error = 0;
524 $sql = "INSERT INTO ".$this->db->prefix()."printer_receipt_template";
525 $sql .= " (name, template, entity) VALUES ('".$this->db->escape($name)."'";
526 $sql .= ", '".$this->db->escape($template)."', ".$conf->entity.")";
527 $resql = $this->db->query($sql);
528 if (!$resql) {
529 $error++;
530 $this->errors[] = $this->db->lasterror;
531 }
532 return $error;
533 }
534
541 public function deleteTemplate($templateid)
542 {
543 global $conf;
544 $error = 0;
545 $sql = 'DELETE FROM '.$this->db->prefix().'printer_receipt_template';
546 $sql .= " WHERE rowid = ".((int) $templateid);
547 $sql .= " AND entity = ".$conf->entity;
548 $resql = $this->db->query($sql);
549 if (!$resql) {
550 $error++;
551 $this->errors[] = $this->db->lasterror;
552 }
553 return $error;
554 }
555
564 public function updateTemplate($name, $template, $templateid)
565 {
566 global $conf;
567 $error = 0;
568
569 $sql = "UPDATE ".$this->db->prefix()."printer_receipt_template";
570 $sql .= " SET name='".$this->db->escape($name)."'";
571 $sql .= ", template='".$this->db->escape($template)."'";
572 $sql .= " WHERE rowid=".((int) $templateid);
573 $resql = $this->db->query($sql);
574 if (!$resql) {
575 $error++;
576 $this->errors[] = $this->db->lasterror;
577 }
578 return $error;
579 }
580
581
589 public function sendTestToPrinter($printerid, $addimgandbarcode = 0)
590 {
591 $error = 0;
592 $img = EscposImage::load(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_bw.png');
593
594 // TODO Set the profile into $this->profile (used by initPrinter). Profile not used yet.
595
596 // Init printer
597 $ret = $this->initPrinter($printerid);
598 if ($ret > 0) {
599 setEventMessages("initPrinter error: ".$this->error, $this->errors, 'errors');
600 } else {
601 try {
602 if ($addimgandbarcode) {
603 $this->printer->bitImage($img);
604 }
605 $this->printer->text("Hello World!\n");
606 if ($addimgandbarcode) {
607 $testStr = "1234567890";
608 $this->printer->barcode($testStr);
609 //$this->printer->qrcode($testStr, Printer::QR_ECLEVEL_M, 5, Printer::QR_MODEL_1);
610 }
611 $this->printer->text("\n");
612 $this->printer->text("Most simple example\n");
613 $this->printer->feed();
614 $this->printer->cut();
615
616 // If is DummyPrintConnector send to log to debugging
617 $connector = $this->printer->connector;
618 if ($connector instanceof DummyPrintConnector) {
619 $data = $connector->getData();
620 dol_syslog($data);
621 }
622 // Close and print
623 $this->printer->close();
624 } catch (Exception $e) {
625 $this->errors[] = $e->getMessage();
626 $error++;
627 }
628 }
629 return $error;
630 }
631
640 public function sendToPrinter($object, $templateid, $printerid)
641 {
642 global $mysoc, $langs, $user;
643 global $hookmanager;
644
645 $langs->load('bills');
646
647 $error = 0;
648 $ret = $this->loadTemplate($templateid);
649
650 $now = dol_now('tzuser');
651 // tags a remplacer par leur valeur avant de parser (dol_value_xxx)
652 $this->template = str_replace('{dol_value_object_id}', (string) $object->id, $this->template);
653 $this->template = str_replace('{dol_value_object_ref}', $object->ref, $this->template);
654 //$this->template = str_replace('<dol_value_object_points>', $object->points, $this->template);
655 $this->template = str_replace('{dol_value_date}', dol_print_date($object->date, 'day'), $this->template);
656 $this->template = str_replace('{dol_value_date_time}', dol_print_date($object->date, 'dayhour'), $this->template);
657 $this->template = str_replace('{dol_value_year}', dol_print_date($object->date, '%Y'), $this->template);
658 $this->template = str_replace('{dol_value_month_letters}', $langs->trans("Month".dol_print_date($object->date, '%m')), $this->template);
659 $this->template = str_replace('{dol_value_month}', dol_print_date($object->date, '%m'), $this->template);
660 $this->template = str_replace('{dol_value_day}', dol_print_date($object->date, '%d'), $this->template);
661 $this->template = str_replace('{dol_value_day_letters}', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template);
662
663 $this->template = str_replace('{dol_value_currentdate}', dol_print_date($now, 'dayhour'), $this->template);
664 $this->template = str_replace('{dol_value_currentdate_notime}', dol_print_date($now, 'day'), $this->template);
665 $this->template = str_replace('{dol_value_currentdate_letters}', dol_print_date($now, 'dayhourtext'), $this->template);
666 $this->template = str_replace('{dol_value_currentyear}', dol_print_date($now, '%Y'), $this->template);
667 $this->template = str_replace('{dol_value_currentmonth_letters}', $langs->trans("Month".dol_print_date($now, '%m')), $this->template);
668 $this->template = str_replace('{dol_value_currentmonth}', dol_print_date($now, '%m'), $this->template);
669 $this->template = str_replace('{dol_value_currentday}', dol_print_date($now, '%d'), $this->template);
670 $this->template = str_replace('{dol_value_currentday_letters}', $langs->trans("Day".dol_print_date($now, '%m')[1]), $this->template);
671
672 $this->template = str_replace('{dol_value_customer_firstname}', $object->thirdparty->firstname, $this->template);
673 $this->template = str_replace('{dol_value_customer_lastname}', $object->thirdparty->lastname, $this->template);
674 $this->template = str_replace('{dol_value_customer_mail}', $object->thirdparty->email, $this->template);
675 $this->template = str_replace('{dol_value_customer_phone}', $object->thirdparty->phone, $this->template);
676 //$this->template = str_replace('<dol_value_customer_mobile>', $object->thirdparty->mobile, $this->template);
677 $this->template = str_replace('{dol_value_customer_tax_number}', $object->thirdparty->tva_intra, $this->template);
678 //$this->template = str_replace('<dol_value_customer_account_balance>', $object->customer_account_balance, $this->template);
679 //$this->template = str_replace('<dol_value_customer_points>', $object->customer_points, $this->template);
680
681 $this->template = str_replace('{dol_value_mysoc_name}', $mysoc->name, $this->template);
682 $this->template = str_replace('{dol_value_mysoc_address}', $mysoc->address, $this->template);
683 $this->template = str_replace('{dol_value_mysoc_zip}', $mysoc->zip, $this->template);
684 $this->template = str_replace('{dol_value_mysoc_town}', $mysoc->town, $this->template);
685 $this->template = str_replace('{dol_value_mysoc_country}', $mysoc->country, $this->template);
686 $this->template = str_replace('{dol_value_mysoc_idprof1}', $mysoc->idprof1, $this->template);
687 $this->template = str_replace('{dol_value_mysoc_idprof2}', $mysoc->idprof2, $this->template);
688 $this->template = str_replace('{dol_value_mysoc_idprof3}', $mysoc->idprof3, $this->template);
689 $this->template = str_replace('{dol_value_mysoc_idprof4}', $mysoc->idprof4, $this->template);
690 $this->template = str_replace('{dol_value_mysoc_idprof5}', $mysoc->idprof5, $this->template);
691 $this->template = str_replace('{dol_value_mysoc_idprof6}', $mysoc->idprof6, $this->template);
692 $this->template = str_replace('{dol_value_mysoc_tva_intra}', $mysoc->tva_intra, $this->template);
693 $this->template = str_replace('{dol_value_mysoc_capital}', (string) $mysoc->capital, $this->template);
694 $this->template = str_replace('{dol_value_mysoc_url}', $mysoc->url, $this->template);
695
696 $this->template = str_replace('{dol_value_vendor_firstname}', $user->firstname, $this->template);
697 $this->template = str_replace('{dol_value_vendor_lastname}', $user->lastname, $this->template);
698 $this->template = str_replace('{dol_value_vendor_mail}', $user->email, $this->template);
699
700 $parameters = array('object' => $object);
701 $action = '';
702 $reshook = $hookmanager->executeHooks('sendToPrinterBefore', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
703 if ($reshook < 0) {
704 $this->error = "Error in hook dolReceiptPrinter sendToPrinterBefore ".$reshook;
705 dol_syslog("dolReceiptPrinter::sendToPrinter: error=".$this->error, LOG_ERR);
706 return $reshook;
707 }
708
709 // escape special characters for xml_parse_into_struct
710 $this->template = htmlspecialchars($this->template, ENT_QUOTES | ENT_XML1);
711
712 // parse template
713 $this->template = str_replace("{", "<", $this->template);
714 $this->template = str_replace("}", ">", $this->template);
715
716 if (LIBXML_VERSION < 20900) {
717 // Avoid load of external entities (security problem).
718 // Required only if LIBXML_VERSION < 20900
719 // @phan-suppress-next-line PhanDeprecatedFunctionInternal
720 libxml_disable_entity_loader(true);
721 }
722
723 $vals = array();
724 $index = array();
725
726 $p = xml_parser_create();
727 xml_parse_into_struct($p, $this->template, $vals, $index);
728 xml_parser_free($p);
729
730 //print '<pre>'.print_r($index, true).'</pre>';
731 //print '<pre>'.print_r($vals, true).'</pre>';
732 // print ticket
733 $nbcharactbyline = getDolGlobalInt('RECEIPT_PRINTER_NB_CHARACT_BY_LINE', 48);
734
735 // TODO Set the profile into $this->profile (used by initPrinter). Profile not used yet.
736
737 // Init printer
738 $ret = $this->initPrinter($printerid);
739
740 if ($ret > 0) {
741 setEventMessages($this->error, $this->errors, 'errors');
742 } else {
743 $nboflines = count($vals);
744 for ($tplline = 0; $tplline < $nboflines; $tplline++) {
745 //var_dump($vals[$tplline]['value']);
746 switch ($vals[$tplline]['tag']) {
747 case 'DOL_PRINT_TEXT':
748 $this->printer->text($vals[$tplline]['value']);
749 break;
750 case 'DOL_PRINT_OBJECT_LINES':
751 foreach ($object->lines as $line) {
752 if ($line->fk_product) {
753 $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen((string) $line->qty) - strlen(price($line->subprice)) - 10 - 1;
754 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
755 $this->printer->text($line->ref . $spaces . $line->qty . str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT) . ' ' . str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT) . "\n");
756 $this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n \n");
757 } else {
758 $spacestoadd = $nbcharactbyline - strlen($line->description) - strlen((string) $line->qty) - strlen(price($line->subprice)) - 10 - 1;
759 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
760 $this->printer->text($line->description.$spaces.$line->qty.' '.str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT).' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
761 }
762 }
763 break;
764 case 'DOL_PRINT_OBJECT_LINES_WITH_NOTES':
765 foreach ($object->lines as $line) {
766 if ($line->fk_product) {
767 $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen((string) $line->qty) - 10 - 1;
768 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
769 $this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
770 $this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n");
771 $spacestoadd = $nbcharactbyline - strlen($line->description) - strlen((string) $line->qty) - 10 - 1;
772 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
773 $this->printer->text($line->description."\n");
774 } else {
775 $spacestoadd = $nbcharactbyline - strlen($line->description) - strlen((string) $line->qty) - 10 - 1;
776 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
777 $this->printer->text($line->description.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
778 }
779 }
780 break;
781 case 'DOL_PRINT_OBJECT_TAX':
782 //var_dump($object);
783 $vatarray = array();
784 foreach ($object->lines as $line) {
785 $vat_rate = $line->tva_tx;
786 if (!array_key_exists($vat_rate, $vatarray)) {
787 $vatarray[$vat_rate] = 0;
788 }
789 $vatarray[$vat_rate] += $line->total_tva;
790 }
791 foreach ($vatarray as $vatkey => $vatvalue) {
792 $spacestoadd = $nbcharactbyline - strlen($vatkey) - 12;
793 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
794 $this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n");
795 }
796 break;
797 case 'DOL_PRINT_OBJECT_TAX1':
798 //var_dump($object);
799 $total_localtax1 = 0;
800 foreach ($object->lines as $line) {
801 $total_localtax1 += $line->total_localtax1;
802 }
803 $this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n");
804 break;
805 case 'DOL_PRINT_OBJECT_TAX2':
806 //var_dump($object);
807 $total_localtax2 = 0;
808 foreach ($object->lines as $line) {
809 $total_localtax2 += $line->total_localtax2;
810 }
811 $this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n");
812 break;
813 case 'DOL_PRINT_OBJECT_TOTAL':
814 $title = $langs->trans('TotalHT');
815 $spacestoadd = $nbcharactbyline - strlen($title) - 10;
816 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
817 $this->printer->text($title.$spaces.str_pad(price($object->total_ht), 10, ' ', STR_PAD_LEFT)."\n");
818 $title = $langs->trans('TotalVAT');
819 $spacestoadd = $nbcharactbyline - strlen($title) - 10;
820 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
821 $this->printer->text($title.$spaces.str_pad(price($object->total_tva), 10, ' ', STR_PAD_LEFT)."\n");
822 $title = $langs->trans('TotalTTC');
823 $spacestoadd = $nbcharactbyline - strlen($title) - 10;
824 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
825 $this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
826 break;
827 case 'DOL_PRINT_CURR_DATE':
828 if (strlen($vals[$tplline]['value']) < 2) {
829 $this->printer->text(date('d/m/Y H:i:s')."\n");
830 } else {
831 $this->printer->text(date($vals[$tplline]['value'])."\n");
832 }
833 break;
834 case 'DOL_LINE_FEED':
835 $this->printer->feed();
836 break;
837 case 'DOL_LINE_FEED_REVERSE':
838 $this->printer->feedReverse();
839 break;
840 case 'DOL_ALIGN_CENTER':
841 $this->printer->setJustification(Printer::JUSTIFY_CENTER);
842 break;
843 case 'DOL_ALIGN_RIGHT':
844 $this->printer->setJustification(Printer::JUSTIFY_RIGHT);
845 break;
846 case 'DOL_ALIGN_LEFT':
847 $this->printer->setJustification(Printer::JUSTIFY_LEFT);
848 break;
849 case 'DOL_OPEN_DRAWER':
850 $this->printer->pulse();
851 break;
852 case 'DOL_ACTIVATE_BUZZER':
853 //$this->printer->buzzer();
854 break;
855 case 'DOL_PRINT_BARCODE':
856 // $vals[$tplline]['value'] -> barcode($content, $type)
857 // var_dump($vals[$tplline]['value']);
858 try {
859 $this->printer->barcode($vals[$tplline]['value']);
860 } catch (Exception $e) {
861 $this->errors[] = 'Invalid Barcode value: '.$vals[$tplline]['value'];
862 $error++;
863 }
864 break;
865 case 'DOL_PRINT_LOGO':
866 $img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo);
867 $this->printer->graphics($img);
868 break;
869 case 'DOL_PRINT_LOGO_OLD':
870 $img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo);
871 $this->printer->bitImage($img);
872 break;
873 case 'DOL_PRINT_LOGO_OLD_CF':
874 $img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo);
875 $this->printer->bitImageColumnFormat($img);
876 break;
877 case 'DOL_PRINT_QRCODE':
878 // $vals[$tplline]['value'] -> qrCode($content, $ec, $size, $model)
879 $this->printer->qrcode($vals[$tplline]['value']);
880 break;
881 case 'DOL_CUT_PAPER_FULL':
882 $this->printer->cut(Printer::CUT_FULL);
883 break;
884 case 'DOL_CUT_PAPER_PARTIAL':
885 $this->printer->cut(Printer::CUT_PARTIAL);
886 break;
887 case 'DOL_USE_FONT_A':
888 $this->printer->setFont(Printer::FONT_A);
889 break;
890 case 'DOL_USE_FONT_B':
891 $this->printer->setFont(Printer::FONT_B);
892 break;
893 case 'DOL_USE_FONT_C':
894 $this->printer->setFont(Printer::FONT_C);
895 break;
896 case 'DOL_BOLD':
897 $this->printer->setEmphasis(true);
898 break;
899 case 'DOL_BOLD_DISABLED':
900 $this->printer->setEmphasis(false);
901 break;
902 case 'DOL_DOUBLE_HEIGHT':
903 $this->printer->setTextSize(1, 2);
904 break;
905 case 'DOL_DOUBLE_WIDTH':
906 $this->printer->setTextSize(2, 1);
907 break;
908 case 'DOL_DEFAULT_HEIGHT_WIDTH':
909 $this->printer->setTextSize(1, 1);
910 break;
911 case 'DOL_UNDERLINE':
912 $this->printer->setUnderline(1);
913 break;
914 case 'DOL_UNDERLINE_DISABLED':
915 $this->printer->setUnderline(0);
916 break;
917 case 'DOL_BEEP':
918 $this->printer->getPrintConnector() -> write("\x1e");
919 break;
920 case 'DOL_BEEP_ALTERNATIVE': //if DOL_BEEP not works
921 $this->printer->getPrintConnector() -> write(Printer::ESC . "B" . chr(4) . chr(1));
922 break;
923 case 'DOL_PRINT_ORDER_LINES':
924 foreach ($object->lines as $line) {
925 if ($line->special_code == $this->orderprinter) {
926 $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen((string) $line->qty) - 10 - 1;
927 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
928 $this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
929 $this->printer->text(strip_tags(htmlspecialchars_decode($line->desc))."\n");
930 }
931 }
932 break;
933 case 'DOL_PRINT_PAYMENT':
934 $sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
935 $sql .= " cp.code";
936 $sql .= " FROM ".$this->db->prefix()."paiement_facture as pf, ".$this->db->prefix()."paiement as p";
937 $sql .= " LEFT JOIN ".$this->db->prefix()."c_paiement as cp ON p.fk_paiement = cp.id";
938 $sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $object->id);
939 $sql .= " ORDER BY p.datep";
940 $resql = $this->db->query($sql);
941 if ($resql) {
942 $num = $this->db->num_rows($resql);
943 $i = 0;
944 while ($i < $num) {
945 $row = $this->db->fetch_object($resql);
946 $spacestoadd = $nbcharactbyline - strlen($langs->transnoentitiesnoconv("PaymentTypeShort".$row->code)) - 12;
947 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
948 $amount_payment = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
949 if ($row->code == "LIQ") {
950 $amount_payment += $row->pos_change; // Show amount with excess received if is cash payment
951 }
952 $this->printer->text($spaces.$langs->transnoentitiesnoconv("PaymentTypeShort".$row->code).' '.str_pad(price($amount_payment), 10, ' ', STR_PAD_LEFT)."\n");
953 if ($row->code == "LIQ" && $row->pos_change > 0) { // Print change only in cash payments
954 $spacestoadd = $nbcharactbyline - strlen($langs->trans("Change")) - 12;
955 $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
956 $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->pos_change), 10, ' ', STR_PAD_LEFT)."\n");
957 }
958 $i++;
959 }
960 }
961 break;
962 case 'DOL_VALUE_PLACE':
963 $sql = "SELECT floor, label FROM ".$this->db->prefix()."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref)));
964 $resql = $this->db->query($sql);
965 $obj = $this->db->fetch_object($resql);
966 if ($obj) {
967 $this->printer->text($obj->label);
968 }
969 break;
970 default:
971 $parameters = array('vals' => $vals[$tplline],'object' => $object,'nbcharactbyline' => $nbcharactbyline);
972 $action = '';
973 $reshook = $hookmanager->executeHooks('sendToPrinterAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
974
975 if (!$reshook || $reshook < 0) {
976 $this->printer->text($vals[$tplline]['tag']);
977 $this->printer->text($vals[$tplline]['value']);
978 $this->errors[] = 'UnknowTag: &lt;'.strtolower($vals[$tplline]['tag']).'&gt;';
979 $error++;
980 }
981 break;
982 }
983 }
984 // If is DummyPrintConnector send to log to debugging
985 $connector = $this->printer->connector;
986 if ($connector instanceof DummyPrintConnector || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
987 $data = $connector->getData();
988 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
989 echo rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
990 }
991 dol_syslog($data);
992 }
993 // Close and print
994 $this->printer->close();
995 }
996 return $error;
997 }
998
1005 public function loadTemplate($templateid)
1006 {
1007 $error = 0;
1008
1009 $sql = "SELECT template";
1010 $sql .= " FROM ".$this->db->prefix()."printer_receipt_template";
1011 $sql .= " WHERE rowid = ".((int) $templateid);
1012 $sql .= " AND entity IN (".getEntity('printer_receipt_template').")";
1013
1014 $resql = $this->db->query($sql);
1015 if ($resql) {
1016 $obj = $this->db->fetch_object($resql);
1017 } else {
1018 $error++;
1019 $this->errors[] = $this->db->lasterror;
1020 }
1021 if (empty($obj)) {
1022 $error++;
1023 $this->errors[] = 'TemplateDontExist';
1024 } else {
1025 $this->template = $obj->template;
1026 }
1027
1028 return $error;
1029 }
1030
1031
1038 public function initPrinter($printerid)
1039 {
1040 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
1041 $this->connector = new DummyPrintConnector();
1042 $this->printer = new Printer($this->connector, $this->profile);
1043 return;
1044 }
1045
1046 $error = 0;
1047 $sql = "SELECT rowid, name, fk_type, fk_profile, parameter";
1048 $sql .= " FROM ".$this->db->prefix()."printer_receipt";
1049 $sql .= " WHERE rowid = ".((int) $printerid);
1050 $sql .= " AND entity IN (".getEntity('printer_receipt').")";
1051
1052 $resql = $this->db->query($sql);
1053 if ($resql) {
1054 $obj = $this->db->fetch_array($resql);
1055 if (empty($obj)) {
1056 $error++;
1057 $this->errors[] = 'PrinterDontExist';
1058 }
1059 if (!$error) {
1060 $parameter = (isset($obj['parameter']) ? $obj['parameter'] : '');
1061
1062 dol_syslog("initPrinter printerid=".$printerid." parameter=".$parameter);
1063
1064 try {
1065 $type = empty($obj['fk_type']) ? 0 : (int) $obj['fk_type'];
1066 $found = true;
1067 switch ($type) {
1068 case 1:
1069 $this->connector = new DummyPrintConnector();
1070 break;
1071 case 2:
1072 $this->connector = new FilePrintConnector($parameter);
1073 break;
1074 case 3:
1075 $parameters = explode(':', $parameter);
1076 if (empty($parameters[1])) {
1077 $this->connector = new NetworkPrintConnector($parameters[0]);
1078 } else {
1079 $this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
1080 }
1081 break;
1082 case 4: // LPT1, smb://...
1083 $this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
1084 break;
1085 case 5:
1086 $this->connector = new CupsPrintConnector($parameter);
1087 break;
1088 default:
1089 $found = false;
1090 break;
1091 }
1092
1093 // TODO Set the profile into $this->profile by the caller of this method initPrinter. Profile not used yet.
1094 // Note: currently $this->profile is always null, so will load "default".
1095 if ($found) {
1096 $this->printer = new Printer($this->connector, $this->profile);
1097 } else {
1098 $error++;
1099 $this->errors[] = 'CONNECTOR_UNKNOWN';
1100 }
1101 } catch (Exception $e) {
1102 $this->errors[] = $e->getMessage();
1103 $error++;
1104 }
1105 }
1106 } else {
1107 $error++;
1108 $this->errors[] = $this->db->lasterror;
1109 }
1110
1111 return $error;
1112 }
1113}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
static selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='minwidth75', $addjscombo=1, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
Return a HTML select string, built from an array of key+value.
Class to manage Receipt Printers.
selectTypePrinter($selected='', $htmlname='printertypeid')
Form to Select type printer.
addPrinter($name, $type, $profile, $parameter)
Function to Add a printer in db.
updatePrinter($name, $type, $profile, $parameter, $printerid)
Function to Update a printer in db.
sendToPrinter($object, $templateid, $printerid)
Function to Print Receipt Ticket.
listPrinters()
List printers into the array ->listprinters.
loadTemplate($templateid)
Function to load Template into $this->template.
updateTemplate($name, $template, $templateid)
Function to Update a printer template in db.
initPrinter($printerid)
Function Init Printer into $this->printer.
deleteTemplate($templateid)
Function to delete a printer template in db.
deletePrinter($printerid)
Function to Delete a printer from db.
selectProfilePrinter($selected='', $htmlname='printerprofileid')
Form to Select Profile printer.
addTemplate($name, $template)
Function to add a printer template in db.
listPrintersTemplates()
List printers templates.
sendTestToPrinter($printerid, $addimgandbarcode=0)
Function to Send Test page to Printer.
global $mysoc
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
Definition receipt.php:464