forked from nathalie/pedi2
Agregado total devoluciones y devoluciones habilitadas a resource + metodo para total devoluciones
This commit is contained in:
parent
c46073ed06
commit
2ca91addb0
2 changed files with 12 additions and 1 deletions
|
@ -52,6 +52,15 @@ class GrupoDeCompra extends Model
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function totalDevoluciones()
|
||||||
|
{
|
||||||
|
$total = 0;
|
||||||
|
foreach ($this->pedidosAprobados() as $subpedido) {
|
||||||
|
$total = $total + $subpedido->devoluciones_total;
|
||||||
|
}
|
||||||
|
return $total;
|
||||||
|
}
|
||||||
|
|
||||||
public function totalATransferir()
|
public function totalATransferir()
|
||||||
{
|
{
|
||||||
return $this->totalCentralesQueNoPaganTransporte()
|
return $this->totalCentralesQueNoPaganTransporte()
|
||||||
|
|
|
@ -17,9 +17,11 @@ class GrupoDeCompraResource extends JsonResource
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'nombre' => $this->nombre,
|
'nombre' => $this->nombre,
|
||||||
'pedidos' => $this->subpedidos,
|
'devoluciones_habilitadas' => $this->devoluciones_habilitadas,
|
||||||
|
'pedidos' => SubpedidoResource::collection($this->subpedidos),
|
||||||
'total_a_recaudar' => $this->totalARecaudar(),
|
'total_a_recaudar' => $this->totalARecaudar(),
|
||||||
'total_barrial' => $this->totalBarrial(),
|
'total_barrial' => $this->totalBarrial(),
|
||||||
|
'total_devoluciones' => $this->totalDevoluciones(),
|
||||||
'total_a_transferir' => $this->totalATransferir(),
|
'total_a_transferir' => $this->totalATransferir(),
|
||||||
'total_transporte' => $this->totalTransporte(),
|
'total_transporte' => $this->totalTransporte(),
|
||||||
'cantidad_transporte' => number_format($this->cantidadTransporte(),0),
|
'cantidad_transporte' => number_format($this->cantidadTransporte(),0),
|
||||||
|
|
Loading…
Add table
Reference in a new issue