mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Arreglado bug impresora de tickets (logistica)
This commit is contained in:
@ -123,7 +123,7 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
$refCliente = isset($json->fila[1]) ? trim($json->fila[1]) : null;
|
||||
//$descripcion = isset($json->fila[2]) ? trim($json->fila[2]) : null;
|
||||
$tirada = isset($json->fila[3]) ? (float) $json->fila[3] : null;
|
||||
//$precio_compra = isset($json->fila[4]) ? (float) $json->fila[4] : null;
|
||||
$precio_compra = isset($json->fila[4]) ? (float) $json->fila[4] : null;
|
||||
|
||||
if (empty($isbn)) {
|
||||
return $this->response->setJSON([
|
||||
@ -157,7 +157,7 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
$colorPaginas = (int) ($libro->color_paginas ?? 0);
|
||||
$negroPaginas = (int) ($libro->negro_paginas ?? 0);
|
||||
$papelInteriorDiferente = ($colorPaginas > 0 && $negroPaginas > 0) ? 1 : 0;
|
||||
|
||||
|
||||
// --- Interior (lo que cambiamos ahora)
|
||||
if ($papelInteriorDiferente) {
|
||||
// Mixto: páginas en negro + color
|
||||
@ -173,9 +173,9 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
];
|
||||
} else {
|
||||
// SOLO un tipo: negro O color
|
||||
$colorPaginas = (int)($libro->color_paginas ?? 0);
|
||||
$negroPaginas = (int)($libro->negro_paginas ?? 0);
|
||||
|
||||
$colorPaginas = (int) ($libro->color_paginas ?? 0);
|
||||
$negroPaginas = (int) ($libro->negro_paginas ?? 0);
|
||||
|
||||
if ($colorPaginas > 0 && $negroPaginas == 0) {
|
||||
// Libro completamente en color
|
||||
$interior = [
|
||||
@ -198,7 +198,7 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
$sobrecubierta['gramaje'] = $libro->sobrecubierta_gramaje;
|
||||
$sobrecubierta['solapas'] = $libro->sobrecubierta_solapas;
|
||||
$sobrecubierta['acabado'] = $libro->sobrecubierta_acabado_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$dataToImport = [
|
||||
@ -229,7 +229,7 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
'paginasColor' => $colorPaginas,
|
||||
'papelInteriorDiferente' => $papelInteriorDiferente,
|
||||
'paginasCuadernillo' => 32,
|
||||
|
||||
|
||||
'interior' => $interior,
|
||||
|
||||
'cubierta' => [
|
||||
@ -281,6 +281,18 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
]
|
||||
];
|
||||
|
||||
// Ajuste del precio a RAMA
|
||||
$dataToUpdate = [
|
||||
'total_aceptado' => ($tirada * $precio_compra),
|
||||
'total_aceptado_revisado' => ($tirada * $precio_compra),
|
||||
'total_precio_unidad' => $precio_compra
|
||||
];
|
||||
$presupuestoModel = model('App\Models\Presupuestos\Presupuestomodel');
|
||||
$presupuestoModel->update($response['data']['sk_id'], $dataToUpdate);
|
||||
|
||||
|
||||
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@ -293,56 +305,10 @@ class ImportadorCatalogo extends BaseResourceController
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function guardar()
|
||||
{
|
||||
helper(['form']);
|
||||
|
||||
// Access the entire POST data
|
||||
$post_data = $this->request->getJSON(true);
|
||||
|
||||
//return $this->respond(var_dump($post_data));
|
||||
|
||||
// Instancia de presupuesto cliente
|
||||
$presupuestocliente = new Presupuestocliente();
|
||||
try {
|
||||
$response = $presupuestocliente->guardar($post_data);
|
||||
|
||||
// DEBUG LINE
|
||||
//return $this->respond($response);
|
||||
|
||||
if (!isset($response['sk_id'])) {
|
||||
return $this->respond([
|
||||
'status' => 400,
|
||||
'error' => 'Missing sk_id',
|
||||
'message' => 'El identificador sk_id es requerido pero no se recibió.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$response = [
|
||||
'status' => 200,
|
||||
'error' => null,
|
||||
'data' => [
|
||||
'sk_id' => $response['sk_id'],
|
||||
'sk_url' => $response['sk_url'] ?? null
|
||||
]
|
||||
];
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $this->respond([
|
||||
'status' => 500,
|
||||
'error' => 'Server error',
|
||||
'message' => 'Error inesperado durante el procesado'
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ class LogisticaController extends BaseController
|
||||
}
|
||||
|
||||
$modelImpresora = model('App\Models\Configuracion\ImpresoraEtiquetaModel');
|
||||
$impresora = $modelImpresora->select('id, name')
|
||||
$impresora = $modelImpresora->select('id, name, ip, port, user, pass')
|
||||
->where('deleted_at', null)
|
||||
->where('id', $printer_id)
|
||||
->orderBy('name', 'asc')
|
||||
|
||||
Reference in New Issue
Block a user