mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Fix bug del id de factura
This commit is contained in:
@ -66,6 +66,7 @@ class FacturaLineaModel extends \App\Models\BaseModel {
|
||||
ROUND(SUM(t1.total), 2) AS total"
|
||||
)
|
||||
->where("t1.factura_id", $factura_id)
|
||||
->where("t1.deleted_at", null)
|
||||
->groupBy('t1.iva')
|
||||
->orderBy('t1.iva', 'ASC'); // Ordena por iva en forma ascendente
|
||||
|
||||
@ -88,15 +89,8 @@ class FacturaLineaModel extends \App\Models\BaseModel {
|
||||
"t1.id AS id, t1.factura_id AS factura_id,
|
||||
t1.pedido_linea_impresion_id AS pedido_linea_impresion_id, t1.pedido_maquetacion_id AS pedido_maquetacion_id,
|
||||
t1.descripcion AS descripcion, t1.cantidad as cantidad, t1.precio_unidad AS precio_unidad, t1.iva AS iva,
|
||||
t1.base AS base, t1.total_iva AS total_iva, t1.total AS total, t1.data AS data, t2.pedido_id AS pedido_id,
|
||||
t3.total_aceptado AS total_aceptado, t4.tirada_flexible AS tirada_flexible, t4.descuento_tirada_flexible AS descuento_tirada_flexible,
|
||||
t6.cantidad AS cantidad_albaran"
|
||||
t1.base AS base, t1.total_iva AS total_iva, t1.total AS total, t1.data AS data"
|
||||
)
|
||||
->join("pedidos_linea t2", "t2.id = t1.pedido_linea_impresion_id", "left")
|
||||
->join("presupuestos t3", "t3.id = t2.presupuesto_id", "left")
|
||||
->join("clientes t4", "t4.id = t3.cliente_id", "left")
|
||||
->join("albaranes t5", "t5.pedido_id = t2.pedido_id", "left")
|
||||
->join("albaranes_lineas t6", "t6.albaran_id = t5.id", "left")
|
||||
->where("t1.factura_id", $factura_id)
|
||||
->where("t1.deleted_at", null);
|
||||
|
||||
|
||||
@ -129,6 +129,7 @@ class FacturaModel extends \App\Models\BaseModel {
|
||||
$builder->join("formas_pago t4", "t3.forma_pago_id = t4.id", "left");
|
||||
$builder->join("lg_paises t5", "t2.pais_id = t5.id", "left");
|
||||
|
||||
$builder->where("t1.id", $factura_id);
|
||||
$builder->where("t1.deleted_at IS NULL");
|
||||
$builder->groupBy("t1.id"); // Agrupa por id de la factura
|
||||
|
||||
|
||||
Reference in New Issue
Block a user