refactor/totales #41

Merged
atasistro merged 16 commits from refactor/totales into master 2025-04-13 23:22:10 -03:00
2 changed files with 12 additions and 1 deletions
Showing only changes of commit 2ca91addb0 - Show all commits

View file

@ -52,6 +52,15 @@ class GrupoDeCompra extends Model
return $total;
}
public function totalDevoluciones()
{
$total = 0;
foreach ($this->pedidosAprobados() as $subpedido) {
$total = $total + $subpedido->devoluciones_total;
}
return $total;
}
public function totalATransferir()
{
return $this->totalCentralesQueNoPaganTransporte()

View file

@ -17,9 +17,11 @@ class GrupoDeCompraResource extends JsonResource
return [
'id' => $this->id,
'nombre' => $this->nombre,
'pedidos' => $this->subpedidos,
'devoluciones_habilitadas' => $this->devoluciones_habilitadas,
'pedidos' => SubpedidoResource::collection($this->subpedidos),
'total_a_recaudar' => $this->totalARecaudar(),
'total_barrial' => $this->totalBarrial(),
'total_devoluciones' => $this->totalDevoluciones(),
'total_a_transferir' => $this->totalATransferir(),
'total_transporte' => $this->totalTransporte(),
'cantidad_transporte' => number_format($this->cantidadTransporte(),0),