mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
faltan las direcciones
This commit is contained in:
@ -183,7 +183,7 @@ class Importadorpresupuestos extends \App\Controllers\BaseResourceController
|
||||
'ferro' => $data['datosGenerales']->ferro,
|
||||
'ferroDigital' => $data['datosGenerales']->ferro_digital,
|
||||
'marcapaginas' => $data['datosGenerales']->marcapaginas,
|
||||
//'prototipo' => $data['datosGenerales']->prototipo
|
||||
'prototipo' => $data['datosGenerales']->prototipo
|
||||
]
|
||||
]
|
||||
|
||||
@ -523,8 +523,25 @@ class Importadorpresupuestos extends \App\Controllers\BaseResourceController
|
||||
$sobrecubierta = false;
|
||||
}
|
||||
|
||||
$datosSave = model('App\Models\Presupuestos\ImportadorModel')->getDatosGuardar($presupuesto_id);
|
||||
$direcciones = model('App\Models\Presupuestos\ImportadorModel')->getDirecciones($presupuesto_id);
|
||||
|
||||
$direcciones = (array) $direcciones;
|
||||
$direcciones = array_map(fn($item) => (array) $item, $direcciones);
|
||||
$direccionesToSend = [];
|
||||
foreach($direcciones as $direccion){
|
||||
$direccion['pais_id'] =
|
||||
model('App\Models\Configuracion\PaisModel')->select('id')->like('nombre', $direccion['pais'])->first()->id;
|
||||
$tempData = [];
|
||||
$tempData['direccion'] = $direccion;
|
||||
$tempData['entregaPalets'] = false;
|
||||
$tempData['unidades'] = $direccion['unidades'];
|
||||
array_push($direccionesToSend, $tempData);
|
||||
}
|
||||
|
||||
$datos = array(
|
||||
"tirada" => array(intval($this->request->getPost('tirada') ?? 0)),
|
||||
"selectedTirada" => intval($this->request->getPost('tirada') ?? 0),
|
||||
"paginas" => intval($this->request->getPost('paginas') ?? 0),
|
||||
"tamanio" => $tamanio,
|
||||
"tipo_presupuesto_id" => $tipo_presupuesto_id,
|
||||
@ -541,9 +558,21 @@ class Importadorpresupuestos extends \App\Controllers\BaseResourceController
|
||||
|
||||
"sobrecubierta" => $sobrecubierta,
|
||||
"guardas" => false,
|
||||
|
||||
"servicios" => $this->request->getPost('servicios') ?? [],
|
||||
|
||||
"datosCabecera" => [
|
||||
"titulo" => $datosSave->titulo ?? "",
|
||||
"autor" => $datosSave->autor ?? "",
|
||||
"coleccion" => $datosSave->coleccion ?? "",
|
||||
"isbn" => $datosSave->isbn ?? "",
|
||||
"referenciaCliente" => $datosSave->referenciaCliente ?? ""
|
||||
],
|
||||
'entrega_taller' => $datosSave->entrega_taller,
|
||||
'direcciones' => $direccionesToSend
|
||||
);
|
||||
|
||||
$value = (new Presupuestocliente())->calcular($datos);
|
||||
$value = (new Presupuestocliente())->guardar($datos);
|
||||
|
||||
$returnData = [
|
||||
'success' => true,
|
||||
|
||||
@ -976,7 +976,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$paginasColorConsecutivas = $reqData['pagColorConsecutivas'] ?? 0;
|
||||
$papelInteriorDiferente = $reqData['papelInteriorDiferente'] ?? 0;
|
||||
|
||||
$tipo = $reqData['tipo'];
|
||||
$tipo = $reqData['tipo'] ?? "";
|
||||
|
||||
$paginasCuadernillo = $reqData['paginasCuadernillo'] ?? 32;
|
||||
$papelInteriorDiferente = intval($reqData['papelInteriorDiferente'] ?? null);
|
||||
@ -1002,7 +1002,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$direcciones = $reqData['direcciones'] ?? [];
|
||||
|
||||
if($tipo != "")
|
||||
$tipo_impresion_id = $this->getTipoImpresion($tipo, $cubierta['tipoCubierta']);
|
||||
else
|
||||
$tipo_impresion_id = $reqData['tipo_presupuesto_id'] ?? 0;
|
||||
|
||||
if ($papelInteriorDiferente) {
|
||||
$papel['negro'] = $modelPapelGenerico->where('id', $interior['papelInterior']['negro'])->first()->toArray();
|
||||
|
||||
@ -72,6 +72,9 @@ class ImportadorModel extends \App\Models\BaseModel
|
||||
if($query > 0){
|
||||
$datosGenerales->prototipo = 1;
|
||||
}
|
||||
else{
|
||||
$datosGenerales->prototipo = 0;
|
||||
}
|
||||
|
||||
$builder = $db->table('pedido_libro_linea t1')
|
||||
->select('t1.tipo as tipo, t1.hq as hq, t1.paginas as paginas, t1.papel_id as papel_id,
|
||||
@ -92,6 +95,34 @@ class ImportadorModel extends \App\Models\BaseModel
|
||||
|
||||
}
|
||||
|
||||
public function getDatosGuardar($id){
|
||||
|
||||
$db = \Config\Database::connect($this->DBGroup); // Conectar a olderp
|
||||
$db = \Config\Database::connect($this->DBGroup); // Conectar a olderp
|
||||
$builder = $db->table('pedido_libro t1')
|
||||
->select('
|
||||
t1.titulo, t1.autor, t1.coleccion, t1.isbn, t1.customer_reference as referencia_cliente,
|
||||
t1.envios_recogecliente as entrega_taller')
|
||||
->join('papel_formato t2', 't1.papel_formato_id = t2.id', 'left')
|
||||
->where('t1.id', $id)
|
||||
->where('t1.deleted_at', NULL);
|
||||
$query = $builder->get();
|
||||
$datosGenerales = $query->getRow();
|
||||
return $query->getRow();
|
||||
}
|
||||
|
||||
public function getDirecciones($id){
|
||||
|
||||
$db = \Config\Database::connect($this->DBGroup); // Conectar a olderp
|
||||
$builder = $db->table('pedido_libro_envios t1')
|
||||
->select('t1.ejemplares as unidades, t1.att, t1.email, t1.direccion, t1.pais,
|
||||
t2.nombre as provincia, t1.ciudad as municipio, t1.cp, t1.telefono')
|
||||
->join(('provincias t2'), 't1.provincia = t2.code', 'left')
|
||||
->where('t1.pedido_libro_id', $id);
|
||||
$query = $builder->get();
|
||||
return $query->getResultObject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -185,6 +185,20 @@ class Importador {
|
||||
data.solapas_sobrecubierta = $('#compSolapasSobrecubierta').val();
|
||||
data.acabado_sobrecubierta = this.acabadosSobrecubierta.getVal();
|
||||
|
||||
data.servicios = {
|
||||
marcapaginas: $('#marcapaginas').prop('checked')?1:0,
|
||||
serviciosExtra: []
|
||||
};
|
||||
|
||||
if($('#ferro').prop('checked')){
|
||||
data.servicios.serviciosExtra.push(30);
|
||||
}
|
||||
if($('#ferroDigital').prop('checked')){
|
||||
data.servicios.serviciosExtra.push(29);
|
||||
}
|
||||
if($('#prototipo').prop('checked')){
|
||||
data.servicios.serviciosExtra.push(9);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user