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;
|
$refCliente = isset($json->fila[1]) ? trim($json->fila[1]) : null;
|
||||||
//$descripcion = isset($json->fila[2]) ? trim($json->fila[2]) : null;
|
//$descripcion = isset($json->fila[2]) ? trim($json->fila[2]) : null;
|
||||||
$tirada = isset($json->fila[3]) ? (float) $json->fila[3] : 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)) {
|
if (empty($isbn)) {
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
@ -173,8 +173,8 @@ class ImportadorCatalogo extends BaseResourceController
|
|||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
// SOLO un tipo: negro O color
|
// SOLO un tipo: negro O color
|
||||||
$colorPaginas = (int)($libro->color_paginas ?? 0);
|
$colorPaginas = (int) ($libro->color_paginas ?? 0);
|
||||||
$negroPaginas = (int)($libro->negro_paginas ?? 0);
|
$negroPaginas = (int) ($libro->negro_paginas ?? 0);
|
||||||
|
|
||||||
if ($colorPaginas > 0 && $negroPaginas == 0) {
|
if ($colorPaginas > 0 && $negroPaginas == 0) {
|
||||||
// Libro completamente en color
|
// Libro completamente en color
|
||||||
@ -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);
|
return $this->respond($response);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -298,51 +310,5 @@ 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');
|
$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('deleted_at', null)
|
||||||
->where('id', $printer_id)
|
->where('id', $printer_id)
|
||||||
->orderBy('name', 'asc')
|
->orderBy('name', 'asc')
|
||||||
|
|||||||
Reference in New Issue
Block a user