wip
This commit is contained in:
parent
1a374ddd2c
commit
8a765bf5fd
@ -425,7 +425,7 @@ if ($mode == 'template' && $user->admin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to remove after test
|
// to remove after test
|
||||||
$object->date = '2015-11-02 22:30:25';
|
$object->date_time = '2015-11-02 22:30:25';
|
||||||
$object->id = 1234;
|
$object->id = 1234;
|
||||||
$object->customer_firstname = 'John';
|
$object->customer_firstname = 'John';
|
||||||
$object->customer_lastname = 'Deuf';
|
$object->customer_lastname = 'Deuf';
|
||||||
@ -433,8 +433,8 @@ $object->vendor_firstname = 'Jim';
|
|||||||
$object->vendor_lastname = 'Big';
|
$object->vendor_lastname = 'Big';
|
||||||
|
|
||||||
$object->barcode = '3700123862396';
|
$object->barcode = '3700123862396';
|
||||||
//$printer->sendToPrinter($object, 1, 16);
|
$printer->sendToPrinter($object, 1, 16);
|
||||||
//setEventMessages($printer->error, $printer->errors, 'errors');
|
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
@ -429,6 +429,7 @@ class dolReceiptPrinter extends Escpos
|
|||||||
$this->template = str_replace('<dol_print_customer_account_balance>', $object->customer_account_balance, $this->template);
|
$this->template = str_replace('<dol_print_customer_account_balance>', $object->customer_account_balance, $this->template);
|
||||||
$this->template = str_replace('<dol_print_vendor_firstname>', $object->vendor_firstname, $this->template);
|
$this->template = str_replace('<dol_print_vendor_firstname>', $object->vendor_firstname, $this->template);
|
||||||
$this->template = str_replace('<dol_print_vendor_lastname>', $object->vendor_lastname, $this->template);
|
$this->template = str_replace('<dol_print_vendor_lastname>', $object->vendor_lastname, $this->template);
|
||||||
|
$this->template = str_replace('<dol_print_date_time>', $object->date_time, $this->template);
|
||||||
|
|
||||||
// parse template
|
// parse template
|
||||||
$p = xml_parser_create();
|
$p = xml_parser_create();
|
||||||
@ -438,6 +439,7 @@ class dolReceiptPrinter extends Escpos
|
|||||||
//print '<pre>'.print_r($vals, true).'</pre>';
|
//print '<pre>'.print_r($vals, true).'</pre>';
|
||||||
// print ticket
|
// print ticket
|
||||||
$level = 0;
|
$level = 0;
|
||||||
|
$html = '<table border="1" style="width:210px"><pre>';
|
||||||
$ret = $this->InitPrinter($printerid);
|
$ret = $this->InitPrinter($printerid);
|
||||||
if ($ret>0) {
|
if ($ret>0) {
|
||||||
setEventMessages($this->error, $this->errors, 'errors');
|
setEventMessages($this->error, $this->errors, 'errors');
|
||||||
@ -446,33 +448,37 @@ class dolReceiptPrinter extends Escpos
|
|||||||
switch ($vals[$line]['tag']) {
|
switch ($vals[$line]['tag']) {
|
||||||
case 'DOL_ALIGN_CENTER':
|
case 'DOL_ALIGN_CENTER':
|
||||||
$this->printer->setJustification(Escpos::JUSTIFY_CENTER);
|
$this->printer->setJustification(Escpos::JUSTIFY_CENTER);
|
||||||
|
$html.='<center>';
|
||||||
$this->printer->text($vals[$line]['value']);
|
$this->printer->text($vals[$line]['value']);
|
||||||
break;
|
break;
|
||||||
case 'DOL_ALIGN_RIGHT':
|
case 'DOL_ALIGN_RIGHT':
|
||||||
$this->printer->setJustification(Escpos::JUSTIFY_RIGHT);
|
$this->printer->setJustification(Escpos::JUSTIFY_RIGHT);
|
||||||
|
$html.='<right>';
|
||||||
break;
|
break;
|
||||||
case 'DOL_ALIGN_LEFT':
|
case 'DOL_ALIGN_LEFT':
|
||||||
$this->printer->setJustification(Escpos::JUSTIFY_LEFT);
|
$this->printer->setJustification(Escpos::JUSTIFY_LEFT);
|
||||||
|
$html.='<left>';
|
||||||
break;
|
break;
|
||||||
case 'DOL_OPEN_DRAWER':
|
case 'DOL_OPEN_DRAWER':
|
||||||
$this->printer->pulse();
|
$this->printer->pulse();
|
||||||
|
$html.= ' ϟ'.nl2br($vals[$line]['value']);
|
||||||
break;
|
break;
|
||||||
case 'DOL_PRINT_BARCODE':
|
case 'DOL_PRINT_BARCODE':
|
||||||
// $vals[$line]['value'] -> barcode($content, $type)
|
// $vals[$line]['value'] -> barcode($content, $type)
|
||||||
$this->printer->barcode($object->barcode);
|
$this->printer->barcode($object->barcode);
|
||||||
break;
|
break;
|
||||||
case 'DOL_PRINT_DATE_TIME':
|
|
||||||
$this->printer->text($object->date);
|
|
||||||
break;
|
|
||||||
case 'DOL_PRINT_QRCODE':
|
case 'DOL_PRINT_QRCODE':
|
||||||
// $vals[$line]['value'] -> qrCode($content, $ec, $size, $model)
|
// $vals[$line]['value'] -> qrCode($content, $ec, $size, $model)
|
||||||
$this->printer->qrcode($vals[$line]['value']);
|
$this->printer->qrcode($vals[$line]['value']);
|
||||||
|
$html.='QRCODE: '.$vals[$line]['value'];
|
||||||
break;
|
break;
|
||||||
case 'DOL_CUT_PAPER_FULL':
|
case 'DOL_CUT_PAPER_FULL':
|
||||||
$this->printer->cut(Escpos::CUT_FULL);
|
$this->printer->cut(Escpos::CUT_FULL);
|
||||||
|
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||||
break;
|
break;
|
||||||
case 'DOL_CUT_PAPER_PARTIAL':
|
case 'DOL_CUT_PAPER_PARTIAL':
|
||||||
$this->printer->cut(Escpos::CUT_PARTIAL);
|
$this->printer->cut(Escpos::CUT_PARTIAL);
|
||||||
|
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||||
break;
|
break;
|
||||||
case 'DOL_USE_FONT_A':
|
case 'DOL_USE_FONT_A':
|
||||||
$this->printer->setFont(Escpos::FONT_A);
|
$this->printer->setFont(Escpos::FONT_A);
|
||||||
@ -488,11 +494,14 @@ class dolReceiptPrinter extends Escpos
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->printer->text($vals[$line]['value']);
|
$this->printer->text($vals[$line]['value']);
|
||||||
|
$html.= nl2br($vals[$line]['value']);
|
||||||
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$line]['tag']).'>';
|
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$line]['tag']).'>';
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$html.= '</pre></table>';
|
||||||
|
print $html;
|
||||||
// Close and print
|
// Close and print
|
||||||
// uncomment next line to see content sent to printer
|
// uncomment next line to see content sent to printer
|
||||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user