Merge branch 'add/envio_ferros' into 'main'

Add/envio ferros

See merge request jjimenez/safekat!745
This commit is contained in:
2025-04-27 10:14:05 +00:00
20 changed files with 453 additions and 172 deletions

View File

@ -37,7 +37,7 @@ class EnvioLineaModel extends Model
->select(
"t1.id, t1.pedido_id as pedido, t3.id as presupuesto,
t3.titulo as titulo, t1.unidades_envio as unidadesEnvio, t1.unidades_envio as unidadesEnvioRaw,
t1.unidades_total as unidadesTotal,
t1.unidades_total as unidadesTotal, t2.tipo_envio as tipo_envio,
IFNULL((
SELECT SUM(t_sub.unidades_envio)
FROM envios_lineas t_sub

View File

@ -32,13 +32,14 @@ class EnvioModel extends Model
'created_at',
'updated_at',
'cajas',
'tipo_envio',
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
public function getDatatableQuery(): BaseBuilder
public function getDatatableQuery($tipo_envio = "estandar"): BaseBuilder
{
$builder = $this->db
->table($this->table . " t1")
@ -51,6 +52,24 @@ class EnvioModel extends Model
$builder->join("lg_paises t3", "t3.id = t1.pais_id", "left");
$builder->join("pedidos t4", "t4.id = t2.pedido_id", "left");
$builder->join('ordenes_trabajo t5', 't5.pedido_id = t4.id');
$builder->where("t1.tipo_envio", $tipo_envio);
$builder->groupBy("t1.id");
return $builder;
}
public function getDatatableQueryFerroPrototipo(): BaseBuilder
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id, GROUP_CONCAT(DISTINCT t5.id) AS ots,
t1.att, t1.direccion, t1.ciudad, t3.nombre as pais, t1.cp, t1.email, t1.telefono, t1.finalizado"
);
$builder->join("lg_paises t3", "t3.id = t1.pais_id", "left");
$builder->join("pedidos t4", "t4.id = t2.pedido_id", "left");
$builder->join('ordenes_trabajo t5', 't5.pedido_id = t4.id');
$builder->whereIn("t1.tipo_envio", ["estandar"]);
$builder->groupBy("t1.id");
return $builder;

View File

@ -45,6 +45,7 @@ class PresupuestoDireccionesModel extends \App\Models\BaseModel
"proveedor_id",
"proveedor",
"entregaPieCalle",
"is_ferro_prototipo"
];
protected $returnType = "App\Entities\Presupuestos\PresupuestoDireccionesEntity";
@ -69,7 +70,8 @@ class PresupuestoDireccionesModel extends \App\Models\BaseModel
t1.email AS email, t1.direccion AS direccion, t1.pais_id AS pais_id, t2.nombre AS pais,
t1.municipio AS municipio, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono,
t1.peso AS peso, t1.cantidad AS cantidad, t1.precio AS precio, t1.margen AS margen,
t1.proveedor_id AS proveedor_id, t1.proveedor AS proveedor, t1.entregaPieCalle AS entregaPieCalle"
t1.proveedor_id AS proveedor_id, t1.proveedor AS proveedor, t1.entregaPieCalle AS entregaPieCalle,
t1.is_ferro_prototipo AS is_ferro_prototipo"
);
$builder->where('t1.presupuesto_id', $presupuesto_id);