trabajando en el formulario envio de ferros

This commit is contained in:
2025-04-27 09:51:04 +02:00
parent 9a6a4f89a2
commit 0e444295e3
18 changed files with 184 additions and 124 deletions

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;