|
|
@@ -27,6 +27,29 @@ require __DIR__ . '/../vendor/autoload.php';
|
|
|
use Mike42\Escpos\Printer;
|
|
|
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
|
|
|
|
|
|
+// ===================================================================
|
|
|
+// CONFIGURACIÓN: Tamaño de letra para nombres de platos
|
|
|
+// ===================================================================
|
|
|
+// Cambia este valor para ajustar el tamaño de letra de los platos:
|
|
|
+// 14 o menos = Normal (1x1) - tamaño estándar
|
|
|
+// 15-16 = Altura doble (1x2) - más alto
|
|
|
+// 17-18 = Ancho doble (2x1) - más ancho
|
|
|
+// 19+ = Doble completo (2x2) - más grande
|
|
|
+// ===================================================================
|
|
|
+$TAMANO_LETRA_PLATOS = 14;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Función helper para convertir el tamaño numérico a valores de impresora
|
|
|
+ * @param int $size Tamaño configurado (14, 16, 18, etc.)
|
|
|
+ * @return array [ancho, alto] para setTextSize()
|
|
|
+ */
|
|
|
+function getTamanoTexto($size) {
|
|
|
+ if ($size <= 14) return array(1, 1); // Normal
|
|
|
+ if ($size <= 16) return array(1, 2); // Altura doble
|
|
|
+ if ($size <= 18) return array(2, 1); // Ancho doble
|
|
|
+ return array(2, 2); // Doble completo
|
|
|
+}
|
|
|
+
|
|
|
// Recibir datos
|
|
|
$dataPrint = null;
|
|
|
|
|
|
@@ -83,7 +106,7 @@ foreach ($impresos as $nombreImpresora => $datosComanda) {
|
|
|
$printer->setEmphasis(false);
|
|
|
$printer->text($datosComanda['mesa'] . "\n");
|
|
|
|
|
|
- /*
|
|
|
+
|
|
|
$printer->setEmphasis(true);
|
|
|
$printer->text("Mesero: ");
|
|
|
$printer->setEmphasis(false);
|
|
|
@@ -92,7 +115,7 @@ foreach ($impresos as $nombreImpresora => $datosComanda) {
|
|
|
$printer->setEmphasis(true);
|
|
|
$printer->text("Cliente: ");
|
|
|
$printer->setEmphasis(false);
|
|
|
- $printer->text($datosComanda['cliente'] . "\n");*/
|
|
|
+ $printer->text($datosComanda['cliente'] . "\n");
|
|
|
|
|
|
$printer->setEmphasis(true);
|
|
|
$printer->text("Servicio: ");
|
|
|
@@ -108,17 +131,21 @@ foreach ($impresos as $nombreImpresora => $datosComanda) {
|
|
|
$printer->text(str_repeat("-", 45) . "\n");
|
|
|
|
|
|
foreach ($datosComanda['platos'] as $plato) {
|
|
|
- // $plato es un array con [cant, nombre, acompanamientos, notas]
|
|
|
+ // $plato es un array con [cant, nombre, acompanamientos, notas, precio]
|
|
|
$cant = $plato[0];
|
|
|
$nombre = $plato[1];
|
|
|
$acompanamientos = isset($plato[2]) ? $plato[2] : '';
|
|
|
$notas = isset($plato[3]) ? $plato[3] : '';
|
|
|
+ $precio = isset($plato[4]) ? $plato[4] : 0;
|
|
|
|
|
|
- // Cantidad y nombre del plato
|
|
|
+ // Cantidad, nombre y precio del plato con tamaño configurable
|
|
|
+ global $TAMANO_LETRA_PLATOS;
|
|
|
+ $tamano = getTamanoTexto($TAMANO_LETRA_PLATOS);
|
|
|
$printer->setEmphasis(true);
|
|
|
- $printer->setTextSize(1, 1);
|
|
|
- $printer->text(number_format($cant, 0) . "x " . $nombre . "\n");
|
|
|
+ $printer->setTextSize($tamano[0], $tamano[1]);
|
|
|
+ $printer->text(number_format($cant, 0) . "x " . $nombre . " - $" . number_format($precio, 2) . "\n");
|
|
|
$printer->setEmphasis(false);
|
|
|
+ $printer->setTextSize(1, 1);
|
|
|
|
|
|
// Acompañamientos
|
|
|
if (!empty($acompanamientos)) {
|
|
|
@@ -137,13 +164,16 @@ foreach ($impresos as $nombreImpresora => $datosComanda) {
|
|
|
|
|
|
// NOTAS GENERALES DE LA ORDEN
|
|
|
if (!empty($datosComanda['notas'])) {
|
|
|
+ global $TAMANO_LETRA_PLATOS;
|
|
|
+ $tamano = getTamanoTexto($TAMANO_LETRA_PLATOS);
|
|
|
$printer->text("\n");
|
|
|
$printer->setEmphasis(true);
|
|
|
$printer->setTextSize(1, 1);
|
|
|
$printer->text("*** NOTAS ***\n");
|
|
|
- $printer->setTextSize(1, 1);
|
|
|
$printer->setEmphasis(false);
|
|
|
+ $printer->setTextSize($tamano[0], $tamano[1]);
|
|
|
$printer->text($datosComanda['notas'] . "\n");
|
|
|
+ $printer->setTextSize(1, 1);
|
|
|
$printer->text(str_repeat("=", 45) . "\n");
|
|
|
}
|
|
|
|