diff --git a/assets/uploads/vouchers/6a0f71a64e639-Screenshot_357.png b/assets/uploads/vouchers/6a0f71a64e639-Screenshot_357.png new file mode 100644 index 00000000..e592e412 Binary files /dev/null and b/assets/uploads/vouchers/6a0f71a64e639-Screenshot_357.png differ diff --git a/assets/uploads/vouchers/6a0f78471e32c-Screenshot_358.png b/assets/uploads/vouchers/6a0f78471e32c-Screenshot_358.png new file mode 100644 index 00000000..4809a8d7 Binary files /dev/null and b/assets/uploads/vouchers/6a0f78471e32c-Screenshot_358.png differ diff --git a/imprimir_etiquetas_termica.php b/imprimir_etiquetas_termica.php index c08a320c..4100172c 100644 --- a/imprimir_etiquetas_termica.php +++ b/imprimir_etiquetas_termica.php @@ -62,40 +62,27 @@ if (empty($codes)) { box-sizing: border-box; display: flex; flex-direction: column; - justify-content: center; + justify-content: flex-start; /* Cambiado de center a flex-start para controlar el inicio */ align-items: center; overflow: hidden; text-align: center; - padding: 2mm 1mm 1mm 1mm; /* Reducido para dar más espacio vertical */ + padding: 6mm 1mm 1mm 1mm; /* Aumentado de 4mm a 6mm para bajar más el contenido */ border: 0.1mm solid #eee; /* Guía visual en pantalla */ } - .producto-nombre { - font-size: 6px; - line-height: 1.1; - margin-bottom: 1.5mm; /* Aumentado para separar del código */ - text-transform: uppercase; - display: -webkit-box; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - overflow: hidden; - width: 100%; - word-break: break-all; - } - .barcode-container { - height: 9mm; + height: 11mm; display: flex; justify-content: center; align-items: center; - margin: 0.8mm 0; /* Ajuste milimétrico vertical */ + margin: 0; /* Eliminado margen para control total con el padding de la etiqueta */ padding: 0 1mm; box-sizing: border-box; width: 100%; } .barcode-container svg { - height: 9mm; + height: 11mm; /* Aumentado de 9mm a 11mm */ width: auto; display: block; margin: 0 auto; @@ -103,7 +90,7 @@ if (empty($codes)) { .sku-text { font-size: 7px; - margin-top: 1.2mm; /* Aumentado para separar del código */ + margin-top: 1mm; /* Reducido ligeramente */ letter-spacing: 0.5px; } @@ -148,11 +135,10 @@ if (empty($codes)) { $name = $product_names[$index] ?? ''; ?>
-
getBarcode($code, 1.0, 72, 'black', 0.15); + // Altura aumentada a 88 para mayor facilidad de escaneo + echo $generator->getBarcode($code, 1.0, 88, 'black', 0.25); ?>
diff --git a/includes/barcode_generator.php b/includes/barcode_generator.php index 46144c60..bedd3119 100644 --- a/includes/barcode_generator.php +++ b/includes/barcode_generator.php @@ -27,14 +27,14 @@ class BarcodeGenerator if ($i % 2 == 0) { // Even indices are bars, odd are spaces // Apply bar reduction to increase white space between bars $drawWidth = max(0.4, $width - $barReduction); - $bars .= ''; + $bars .= ''; } $x += $width; } $totalWidth = $x + $quietZone; - $svg = ''; - $svg .= ''; + $svg = ''; + $svg .= ''; $svg .= $bars; $svg .= ''; @@ -43,36 +43,23 @@ class BarcodeGenerator private function getBarcodeData($code) { + // Remove any accidental spaces and trim + $code = str_replace(' ', '', trim($code)); $len = strlen($code); - $indices = []; + $indices = [104]; // Start B (Standard Set B) - // Check if code is purely numeric and has even length for Code 128C - // Or just use Code 128B as fallback - if (ctype_digit($code) && $len >= 2) { - $indices[] = 105; // Start C - for ($i = 0; $i < $len; $i += 2) { - if ($i + 1 < $len) { - $indices[] = (int)substr($code, $i, 2); - } else { - // Odd number of digits, switch to B for the last one - $indices[] = 100; // Code B - $indices[] = $this->getCharValue('B', $code[$i]); - } - } - } else { - $indices[] = 104; // Start B - for ($i = 0; $i < $len; $i++) { - $val = $this->getCharValue('B', $code[$i]); - if ($val !== null) { - $indices[] = $val; - } + for ($i = 0; $i < $len; $i++) { + $char = $code[$i]; + $val = $this->getCharValue('B', $char); + if ($val !== null) { + $indices[] = $val; } } // Checksum calculation $sum = $indices[0]; - for ($k = 1; $k < count($indices); $k++) { - $sum += ($indices[$k] * $k); + for ($i = 1; $i < count($indices); $i++) { + $sum += ($indices[$i] * $i); } $checksum = $sum % 103; $indices[] = $checksum; diff --git a/test_etiquetas.php b/test_etiquetas.php index 5a293c5b..28c5b638 100644 --- a/test_etiquetas.php +++ b/test_etiquetas.php @@ -1,5 +1,5 @@ @@ -7,7 +7,7 @@ $generator = new BarcodeGenerator(); - Prueba Etiquetas 3x3 - Especificaciones Exactas + Prueba Etiquetas - Opción 3 (Finas)