|
@@ -67,8 +67,15 @@ function printTextBold($printer, $label, $value) {
|
|
|
|
|
|
|
|
// Get data from POST
|
|
// Get data from POST
|
|
|
$dataPrint = null;
|
|
$dataPrint = null;
|
|
|
|
|
+
|
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST["dataPrint"])) {
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST["dataPrint"])) {
|
|
|
- $dataPrint = json_decode($_POST["dataPrint"]);
|
|
|
|
|
|
|
+ // Si es string JSON, decodificar
|
|
|
|
|
+ if(is_string($_POST["dataPrint"])){
|
|
|
|
|
+ $dataPrint = json_decode($_POST["dataPrint"]);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // Si jQuery ya lo deserializó como array, convertir a objeto
|
|
|
|
|
+ $dataPrint = json_decode(json_encode($_POST["dataPrint"]));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($dataPrint) {
|
|
if ($dataPrint) {
|
|
@@ -134,12 +141,18 @@ if ($dataPrint) {
|
|
|
|
|
|
|
|
// Imprimir acompañamientos si existen
|
|
// Imprimir acompañamientos si existen
|
|
|
if (isset($producto->acompanamientos) && $producto->acompanamientos != "") {
|
|
if (isset($producto->acompanamientos) && $producto->acompanamientos != "") {
|
|
|
- $printer->text(" CON: " . strtoupper($producto->acompanamientos) . "\n");
|
|
|
|
|
|
|
+ $printer->setEmphasis(true);
|
|
|
|
|
+ $printer->text(" CON: ");
|
|
|
|
|
+ $printer->setEmphasis(false);
|
|
|
|
|
+ $printer->text(strtoupper($producto->acompanamientos) . "\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Imprimir notas si existen
|
|
// Imprimir notas si existen
|
|
|
if (isset($producto->notas) && $producto->notas != "") {
|
|
if (isset($producto->notas) && $producto->notas != "") {
|
|
|
- $printer->text(" * " . strtoupper($producto->notas) . "\n");
|
|
|
|
|
|
|
+ $printer->setEmphasis(true);
|
|
|
|
|
+ $printer->text(" NOTA: ");
|
|
|
|
|
+ $printer->setEmphasis(false);
|
|
|
|
|
+ $printer->text(strtoupper($producto->notas) . "\n");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -166,7 +179,7 @@ if ($dataPrint) {
|
|
|
if (isset($dataPrint->notas_orden) && $dataPrint->notas_orden != "") {
|
|
if (isset($dataPrint->notas_orden) && $dataPrint->notas_orden != "") {
|
|
|
$printer->setJustification(Printer::JUSTIFY_LEFT);
|
|
$printer->setJustification(Printer::JUSTIFY_LEFT);
|
|
|
$printer->setEmphasis(true);
|
|
$printer->setEmphasis(true);
|
|
|
- $printer->text("NOTAS ORDEN: \n");
|
|
|
|
|
|
|
+ $printer->text("NOTAS ORDEN:\n");
|
|
|
$printer->setEmphasis(false);
|
|
$printer->setEmphasis(false);
|
|
|
$notasLines = wordwrap($dataPrint->notas_orden, 48, "\n", true);
|
|
$notasLines = wordwrap($dataPrint->notas_orden, 48, "\n", true);
|
|
|
foreach (explode("\n", $notasLines) as $linea) {
|
|
foreach (explode("\n", $notasLines) as $linea) {
|