botones albaran finalizado

This commit is contained in:
2025-04-22 00:50:31 +02:00
parent fc1b69f2fe
commit 2050f0ae1e
8 changed files with 375 additions and 178 deletions

View File

@ -36,7 +36,7 @@ class AlbaranLineaModel extends \App\Models\BaseModel
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
protected $deletedField = 'deleted_at';
/**
* Get resource data for creating PDFs.
@ -48,24 +48,24 @@ class AlbaranLineaModel extends \App\Models\BaseModel
public function getResourceForPdf($albaran_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.albaran_id AS albaran_id, t1.titulo AS titulo, t1.isbn AS isbn,
t1.ref_cliente AS ref_cliente, t1.cantidad AS cantidad, t1.cajas AS cajas,
t1.ejemplares_por_caja AS ejemplares_por_caja, t1.precio_unidad AS precio_unidad,
t1.total AS total, pedidos.id AS pedido"
"t1.id, t1.titulo as titulo, t1.isbn as isbn, t1.ref_cliente as ref_cliente,
t1.cantidad as unidades, t1.precio_unidad as precio_unidad, t1.iva_reducido as iva_reducido,
t1.total as total, pedidos.id AS pedido"
)
->join("pedidos_linea", "t1.pedido_linea_id = pedidos_linea.id", "left")
->join("pedidos", "pedidos_linea.pedido_id = pedidos.id", "left");
$builder->where("t1.deleted_at IS NULL");
$builder->where("t1.albaran_id", $albaran_id);
return $builder;
}
public function getDatatableQuery($albaran_id = null){
public function getDatatableQuery($albaran_id = null)
{
$builder = $this->db
->table($this->table . " t1")
->select(

View File

@ -182,17 +182,19 @@ class AlbaranModel extends \App\Models\BaseModel
public function getResourceForPdf($albaran_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.pedido_id AS pedido_id, t1.presupuesto_id AS presupuesto_id,
t1.presupuesto_direccion_id AS presupuesto_direccion_id, t1.cliente_id AS cliente_id,
t1.serie_id AS serie_id, t1.numero_albaran AS numero_albaran, t1.mostrar_precios AS mostrar_precios,
t1.total AS total, t1.direccion_albaran AS direccion_albaran, t1.att_albaran AS att_albaran,
t1.user_created_id AS user_created_id, t1.user_updated_id AS user_updated_id,
t1.created_at AS created_at, t1.updated_at AS updated_at,
t2.nombre AS cliente"
);
->select("
t1.id,
t1.att_albaran AS att,
t1.direccion_albaran AS direccion,
t1.envio_id,
t1.numero_albaran AS numero_albaran,
DATE_FORMAT(t1.created_at, '%d/%m/%Y') AS fecha_creacion,
DATE_FORMAT(t1.fecha_albaran, '%d/%m/%Y') AS fecha_albaran,
t1.mostrar_precios AS mostrar_precios,
t2.nombre AS cliente,
t1.cajas AS cajas
") ;
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
$builder->where("t1.deleted_at IS NULL");