xml envios

This commit is contained in:
amazuecos
2024-08-12 10:59:53 +02:00
parent 5648f43413
commit 070ffb934d
2 changed files with 82 additions and 82 deletions

View File

@ -55,11 +55,13 @@ class PedidoModel extends \App\Models\BaseModel
public static $labelField = "id"; public static $labelField = "id";
public function obtenerDatosForm($pedido_id){ public function obtenerDatosForm($pedido_id)
{
$builder = $this->db $builder = $this->db
->table($this->table . " t1") ->table($this->table . " t1")
->select( ->select(
"t4.id AS cliente_id, t4.nombre AS cliente, CONCAT(t5.first_name, ' ', t5.last_name) AS comercial"); "t4.id AS cliente_id, t4.nombre AS cliente, CONCAT(t5.first_name, ' ', t5.last_name) AS comercial"
);
$builder->join("pedidos_linea t2", "t2.pedido_id = t1.id", "left"); $builder->join("pedidos_linea t2", "t2.pedido_id = t1.id", "left");
$builder->join("presupuestos t3", "t2.presupuesto_id = t3.id", "left"); $builder->join("presupuestos t3", "t2.presupuesto_id = t3.id", "left");
@ -70,7 +72,8 @@ class PedidoModel extends \App\Models\BaseModel
return $builder->get()->getResultObject(); return $builder->get()->getResultObject();
} }
public function obtenerLineasPedido($pedido_id){ public function obtenerLineasPedido($pedido_id)
{
$builder = $this->db $builder = $this->db
->table($this->table . " t1") ->table($this->table . " t1")
->select( ->select(
@ -135,19 +138,19 @@ class PedidoModel extends \App\Models\BaseModel
$pedido_presupuesto_lineas = $query->get()->getResultObject(); $pedido_presupuesto_lineas = $query->get()->getResultObject();
return $pedido_presupuesto_lineas; return $pedido_presupuesto_lineas;
} }
public function getPedidoClienteDirecciones($pedido_id){ public function getPedidoPresupuestoDirecciones($pedido_id)
{
$query = $this->db->table($this->table) $query = $this->db->table($this->table)
->select([ ->select([
'pedidos.id as pedidoId',
'clientes.nombre as customerName', 'clientes.nombre as customerName',
'cliente_direcciones.*', 'presupuesto_direcciones.*',
'lg_paises.code3' 'lg_paises.code3'
]) ])
->join('pedidos_linea', 'pedidos_linea.id = pedidos.id', 'left') ->join('pedidos_linea', 'pedidos_linea.id = pedidos.id', 'left')
->join('presupuestos', 'presupuestos.id = pedidos_linea.presupuesto_id', 'left') ->join('presupuestos', 'presupuestos.id = pedidos_linea.presupuesto_id', 'left')
->join('clientes', 'clientes.id = presupuestos.cliente_id', 'left') ->join('clientes', 'clientes.id = presupuestos.cliente_id', 'left')
->join('cliente_direcciones', 'clientes.id = cliente_direcciones.cliente_id', 'left') ->join('cliente_direcciones', 'clientes.id = cliente_direcciones.cliente_id', 'left')
->join('lg_paises','lg_paises.id = cliente_direcciones.pais_id','left') ->join('lg_paises', 'lg_paises.id = presupuesto_direcciones.pais_id', 'left')
->where('pedidos.id', $pedido_id); ->where('pedidos.id', $pedido_id);
$pedido_cliente_direcciones = $query->get()->getResultObject(); $pedido_cliente_direcciones = $query->get()->getResultObject();
return $pedido_cliente_direcciones; return $pedido_cliente_direcciones;

View File

@ -70,7 +70,7 @@ class PedidoXMLService extends BaseService
$acabado = "mate"; $acabado = "mate";
} }
$xmlCover = $xml->createElement('Cover'); $xmlCover = $xml->createElement('Cover');
$xmlCover->appendChild($xml->createElement('Sides', $presupuestoLineaTipoCubierta->paginas)); //! PAGINAS CUBIERTA $xmlCover->appendChild($xml->createElement('Sides', $presupuestoLineaTipoCubierta->paginas / 2)); //! PAGINAS CUBIERTA
$xmlCover->appendChild($xml->createElement('Paper', $presupuestoLineaTipoCubierta->papelCode)); //? $xmlCover->appendChild($xml->createElement('Paper', $presupuestoLineaTipoCubierta->papelCode)); //?
$xmlCover->appendChild($xml->createElement('Weight', $presupuestoLineaTipoCubierta->gramaje)); $xmlCover->appendChild($xml->createElement('Weight', $presupuestoLineaTipoCubierta->gramaje));
$xmlCover->appendChild($xml->createElement('Flaps', $data->pedido_presupuesto->solapas)); $xmlCover->appendChild($xml->createElement('Flaps', $data->pedido_presupuesto->solapas));
@ -80,38 +80,35 @@ class PedidoXMLService extends BaseService
} }
$xml_services_el = $xml->createElement('Services'); $xml_services_el = $xml->createElement('Services');
$xml_services_el->appendChild($xml->createElement('Bookmark', $data->pedido_presupuesto->marcapaginas)); $xml_services_el->appendChild($xml->createElement('Bookmark', $data->pedido_presupuesto->marcapaginas));
//? Retractilado5 y Retractilado o ambas
$xml_services_el->appendChild($xml->createElement('ShrinkWrapping', $data->pedido_presupuesto->retractilado)); $xml_services_el->appendChild($xml->createElement('ShrinkWrapping', $data->pedido_presupuesto->retractilado));
//? $xml_services_el->appendChild($xml->createElement('PlakeneT', $data->pedido_presupuesto->plakeneT)); //? $xml_services_el->appendChild($xml->createElement('PlakeneT', $data->pedido_presupuesto->plakeneT));
$xml_services_el->appendChild($xml->createElement('Urgent', $data->pedido_presupuesto->urgent)); //? $xml_services_el->appendChild($xml->createElement('Urgent', $data->pedido_presupuesto->urgent));
$xml_services_el->appendChild($xml->createElement('Prototype', $data->pedido_presupuesto->prototipo)); $xml_services_el->appendChild($xml->createElement('Prototype', $data->pedido_presupuesto->prototipo));
$xml_services_el->appendChild($xml->createElement('Layout', $data->pedido_presupuesto->maquetacion)); //? $xml_services_el->appendChild($xml->createElement('Layout', $data->pedido_presupuesto->maquetacion));
$xml_services_el->appendChild($xml->createElement('Correction', $data->pedido_presupuesto->correccion)); //? $xml_services_el->appendChild($xml->createElement('Correction', $data->pedido_presupuesto->correccion));
$xml_services_el->appendChild($xml->createElement('Review', $data->pedido_presupuesto->revision)); //? $xml_services_el->appendChild($xml->createElement('Review', $data->pedido_presupuesto->revision));
$xml_services_el->appendChild($xml->createElement('Design', $data->pedido_presupuesto->diseno)); //? $xml_services_el->appendChild($xml->createElement('Design', $data->pedido_presupuesto->diseno));
$xml_products_el->appendChild($xml_services_el); $xml_products_el->appendChild($xml_services_el);
$xml_envios_el = $xml->createElement('Shipments'); $xml_envios_el = $xml->createElement('Shipments');
foreach ($data->pedido_cliente_direcciones as $pedido_cliente_direccion) { foreach ($data->pedido_presupuesto_direcciones as $pedido_presupuesto_direccion) {
$xml_envio_el = $xml->createElement('Shipment'); $xml_envio_el = $xml->createElement('Shipment');
//! Tirada o cantidad de envios? $xml_envio_el->appendChild($xml->createElement('Qty', $pedido_presupuesto_direccion->cantidad));
$xml_envio_el->appendChild($xml->createElement('Qty', $data->pedido_presupuesto->tirada)); $xml_envio_el->appendChild($xml->createElement('Price', $data->pedido_presupuesto_direccion->precio));
//! Precio del presupuesto o del envio? $xml_envio_el->appendChild($xml->createElement('Attention', $pedido_presupuesto_direccion->att));
$xml_envio_el->appendChild($xml->createElement('Price', $data->pedido_presupuesto->total_aceptado)); $xml_envio_el->appendChild($xml->createElement('Email', $pedido_presupuesto_direccion->email));
$xml_envio_el->appendChild($xml->createElement('Attention', $pedido_cliente_direccion->att)); $xml_envio_el->appendChild($xml->createElement('Address', $pedido_presupuesto_direccion->direccion));
$xml_envio_el->appendChild($xml->createElement('Email', $pedido_cliente_direccion->email)); $xml_envio_el->appendChild($xml->createElement('Province', $pedido_presupuesto_direccion->provincia));
$xml_envio_el->appendChild($xml->createElement('Address', $pedido_cliente_direccion->direccion)); $xml_envio_el->appendChild($xml->createElement('City', $pedido_presupuesto_direccion->ciudad));
$xml_envio_el->appendChild($xml->createElement('Province', $pedido_cliente_direccion->provincia)); $xml_envio_el->appendChild($xml->createElement('Zip', $pedido_presupuesto_direccion->cp));
$xml_envio_el->appendChild($xml->createElement('City', $pedido_cliente_direccion->ciudad)); $xml_envio_el->appendChild($xml->createElement('CountryCode', $pedido_presupuesto_direccion->code3));
$xml_envio_el->appendChild($xml->createElement('Zip', $pedido_cliente_direccion->cp)); $xml_envio_el->appendChild($xml->createElement('Telephone', $pedido_presupuesto_direccion->telefono));
$xml_envio_el->appendChild($xml->createElement('CountryCode', $pedido_cliente_direccion->code3));
$xml_envio_el->appendChild($xml->createElement('Telephone', $pedido_cliente_direccion->telefono));
$xml_envios_el->appendChild($xml_envio_el); $xml_envios_el->appendChild($xml_envio_el);
} }
$xml_products_el->appendChild($xml_envios_el); $xml_products_el->appendChild($xml_envios_el);
$xml_products_el->appendChild($xml->createElement('Comments', $data->pedido_presupuesto->comentarios_safekat)); $xml_products_el->appendChild($xml->createElement('Comments', $data->pedido_presupuesto->comentarios_safekat));
$xml_products_el->appendChild($xml->createElement('CommentsClient', $data->pedido_presupuesto->comentarios_cliente)); $xml_products_el->appendChild($xml->createElement('CommentsClient', $data->pedido_presupuesto->comentarios_cliente));
} }
protected static function get_color_interior($pre_linea): ?string protected static function get_color_interior($pre_linea): ?string
{ {