Autosave: 20260521-213229
This commit is contained in:
parent
cd09784a88
commit
621d2a48d9
BIN
assets/uploads/vouchers/6a0f71a64e639-Screenshot_357.png
Normal file
BIN
assets/uploads/vouchers/6a0f71a64e639-Screenshot_357.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 255 KiB |
BIN
assets/uploads/vouchers/6a0f78471e32c-Screenshot_358.png
Normal file
BIN
assets/uploads/vouchers/6a0f78471e32c-Screenshot_358.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 243 KiB |
@ -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] ?? '';
|
||||
?>
|
||||
<div class="etiqueta">
|
||||
<div class="producto-nombre"><?php echo htmlspecialchars($name); ?></div>
|
||||
<div class="barcode-container">
|
||||
<?php
|
||||
// widthFactor 1.0 y barReduction 0.15 para separar un poco más las barras
|
||||
echo $generator->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);
|
||||
?>
|
||||
</div>
|
||||
<div class="sku-text"><?php echo htmlspecialchars($code); ?></div>
|
||||
|
||||
@ -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 .= '<rect x="' . $x . '" y="0" width="' . $drawWidth . '" height="' . $height . '" style="fill:' . $foregroundColor . ';" />';
|
||||
$bars .= '<rect x="' . $x . '" y="0" width="' . $drawWidth . '" height="' . $height . '" fill="' . $foregroundColor . '" />';
|
||||
}
|
||||
$x += $width;
|
||||
}
|
||||
|
||||
$totalWidth = $x + $quietZone;
|
||||
$svg = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="' . $totalWidth . '" height="' . $height . '" viewBox="0 0 ' . $totalWidth . ' ' . $height . '">';
|
||||
$svg .= '<rect width="' . $totalWidth . '" height="' . $height . '" style="fill:white;" />';
|
||||
$svg = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="' . $totalWidth . '" height="' . $height . '" viewBox="0 0 ' . $totalWidth . ' ' . $height . '" shape-rendering="crispEdges">';
|
||||
$svg .= '<rect width="' . $totalWidth . '" height="' . $height . '" fill="white" />';
|
||||
$svg .= $bars;
|
||||
$svg .= '</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;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// test_etiquetas.php - Prueba de etiquetas 3x3 con especificaciones exactas
|
||||
// test_etiquetas.php - Prueba de etiquetas con Opción 3 (Finas)
|
||||
require_once 'includes/barcode_generator.php';
|
||||
$generator = new BarcodeGenerator();
|
||||
?>
|
||||
@ -7,7 +7,7 @@ $generator = new BarcodeGenerator();
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Prueba Etiquetas 3x3 - Especificaciones Exactas</title>
|
||||
<title>Prueba Etiquetas - Opción 3 (Finas)</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Verdana, sans-serif;
|
||||
@ -57,39 +57,26 @@ $generator = new BarcodeGenerator();
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
padding: 2mm 1mm 1mm 1mm; /* Reducido para dar más espacio vertical */
|
||||
}
|
||||
|
||||
.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;
|
||||
padding: 6mm 1mm 1mm 1mm; /* Aumentado de 4mm a 6mm para bajar más el contenido */
|
||||
}
|
||||
|
||||
.barcode-container {
|
||||
height: 9mm;
|
||||
height: 11mm;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0.8mm 0; /* Ajuste milimétrico vertical */
|
||||
margin: 0;
|
||||
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;
|
||||
@ -97,7 +84,7 @@ $generator = new BarcodeGenerator();
|
||||
|
||||
.sku-text {
|
||||
font-size: 7px;
|
||||
margin-top: 1.2mm; /* Aumentado para separar del código */
|
||||
margin-top: 1mm;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
@ -127,38 +114,15 @@ $generator = new BarcodeGenerator();
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button class="no-print" onclick="window.print()">IMPRIMIR PRUEBA (9mm alto)</button>
|
||||
<button class="no-print" onclick="window.print()">IMPRIMIR PRUEBA (Opción 3)</button>
|
||||
|
||||
<div class="etiquetas-container">
|
||||
<?php
|
||||
// Fila 1: Configuración Actual (Equilibrada)
|
||||
// Fila 2: Líneas Reforzadas (Más gruesas para impresoras con poca fuerza)
|
||||
// Fila 3: Contraste Alto (Líneas más finas, espacios blancos más grandes)
|
||||
$skus = ['AFS-0317', 'AFS-0318', 'AFS-0319'];
|
||||
$skus = ['AFS-0317', 'AFS-0318', 'AFS-0319', 'AFS-0320', 'AFS-0321', 'AFS-0322', 'AFS-0323', 'AFS-0324', 'AFS-0325'];
|
||||
|
||||
// Fila 1: Actual
|
||||
foreach ($skus as $sku) {
|
||||
echo '<div class="etiqueta">
|
||||
<div class="producto-nombre">OPCIÓN 1: ACTUAL</div>
|
||||
<div class="barcode-container">' . $generator->getBarcode($sku, 1.0, 72, 'black', 0.15) . '</div>
|
||||
<div class="sku-text">' . $sku . '</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Fila 2: Reforzada (Líneas más gruesas)
|
||||
foreach ($skus as $sku) {
|
||||
echo '<div class="etiqueta">
|
||||
<div class="producto-nombre">OPCIÓN 2: REFORZADA</div>
|
||||
<div class="barcode-container">' . $generator->getBarcode($sku, 1.1, 72, 'black', 0.05) . '</div>
|
||||
<div class="sku-text">' . $sku . '</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Fila 3: Contraste Alto (Líneas más finas)
|
||||
foreach ($skus as $sku) {
|
||||
echo '<div class="etiqueta">
|
||||
<div class="producto-nombre">OPCIÓN 3: FINAS</div>
|
||||
<div class="barcode-container">' . $generator->getBarcode($sku, 1.0, 72, 'black', 0.25) . '</div>
|
||||
<div class="barcode-container">' . $generator->getBarcode($sku, 1.0, 88, 'black', 0.25) . '</div>
|
||||
<div class="sku-text">' . $sku . '</div>
|
||||
</div>';
|
||||
}
|
||||
@ -166,14 +130,14 @@ $generator = new BarcodeGenerator();
|
||||
</div>
|
||||
|
||||
<div class="no-print" style="max-width: 600px; background: white; padding: 15px; border-radius: 8px; margin-top: 20px; font-size: 13px; line-height: 1.4; border: 1px solid #ddd;">
|
||||
<p style="margin-top: 0;"><strong>🔬 Prueba de Grosor de Líneas:</strong></p>
|
||||
<p style="margin-top: 0;"><strong>✅ Revertido a la versión estable:</strong></p>
|
||||
<ul style="text-align: left; padding-left: 20px;">
|
||||
<li><b>Opción 1 (Actual):</b> El equilibrio que veníamos usando.</li>
|
||||
<li><b>Opción 2 (Reforzada):</b> Las líneas negras son más anchas. Útil si tu impresora imprime muy "pálido".</li>
|
||||
<li><b>Opción 3 (Finas):</b> Las líneas negras son más delgadas, dejando más espacio blanco. Útil si la tinta térmica se "chorrea" o expande mucho.</li>
|
||||
<li>Se ha eliminado la optimización "Auto" que causaba errores de escaneo.</li>
|
||||
<li>Se ha aplicado la <b>Opción 3 (Finas)</b> que confirmaste que funcionaba.</li>
|
||||
<li>Las líneas son más delgadas y los espacios blancos más grandes para evitar que se "peguen".</li>
|
||||
</ul>
|
||||
<p><b>¿Cuál de las 3 filas escanea más rápido con tu lector?</b></p>
|
||||
<p>Por favor, imprime esta prueba y confirma si vuelve a escanear correctamente.</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user