mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/listado_facturas_pedidos' into 'main'
arreglado See merge request jjimenez/safekat!807
This commit is contained in:
@ -27,9 +27,9 @@ class FacturaModel extends \App\Models\BaseModel
|
||||
];
|
||||
|
||||
const SORTABLE_PEDIDOS = [
|
||||
1 => "t1.numero",
|
||||
2 => "t2.nombre",
|
||||
3 => "t4.cantidad",
|
||||
1 => "t1.id",
|
||||
2 => "t1.numero",
|
||||
3 => "t4.ejemplares",
|
||||
4 => "t2.nombre",
|
||||
5 => "t1.estado",
|
||||
6 => "t1.fecha_factura_at",
|
||||
@ -166,9 +166,10 @@ class FacturaModel extends \App\Models\BaseModel
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
public function getSumatoriosFacturacionCliente($cliente_id = -1){
|
||||
public function getSumatoriosFacturacionCliente($cliente_id = -1)
|
||||
{
|
||||
|
||||
if($cliente_id == -1){
|
||||
if ($cliente_id == -1) {
|
||||
return [
|
||||
'total_facturacion' => 0,
|
||||
'total_pendiente' => 0
|
||||
@ -253,7 +254,17 @@ class FacturaModel extends \App\Models\BaseModel
|
||||
$builder->join("pedidos t6", "t5.pedido_id = t6.id", "left");
|
||||
|
||||
$builder->where("t1.deleted_at IS NULL");
|
||||
$builder->where("t6.id", $pedido_id);
|
||||
$builder->groupStart()
|
||||
->where("t6.id", $pedido_id)
|
||||
->orWhere("t1.factura_rectificada_id IN (
|
||||
SELECT f.numero
|
||||
FROM facturas f
|
||||
JOIN facturas_pedidos_lineas fpl ON f.id = fpl.factura_id
|
||||
JOIN pedidos_linea pl ON fpl.pedido_linea_id = pl.id
|
||||
JOIN pedidos p ON pl.pedido_id = p.id
|
||||
WHERE p.id = {$pedido_id}
|
||||
)")
|
||||
->groupEnd();
|
||||
|
||||
$builder->groupBy("t1.id"); // Agrupa por id de la factura
|
||||
|
||||
|
||||
Reference in New Issue
Block a user