Omitiendo pedido de ollas de métodos que trabajan con pedidos
This commit is contained in:
parent
208cb31b53
commit
8fb810c73f
1 changed files with 19 additions and 3 deletions
|
@ -12,6 +12,7 @@ use Illuminate\Support\Collection;
|
|||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Csv\Exception;
|
||||
use Mpdf\MpdfException;
|
||||
|
||||
class GrupoDeCompra extends Model
|
||||
{
|
||||
|
@ -37,7 +38,14 @@ class GrupoDeCompra extends Model
|
|||
|
||||
public function pedidosAprobados()
|
||||
{
|
||||
return $this->subpedidos->where('aprobado', 1);
|
||||
return $this->pedidosHogares()
|
||||
->where('aprobado', 1);
|
||||
}
|
||||
|
||||
public function pedidosHogares()
|
||||
{
|
||||
return $this->subpedidos
|
||||
->where('tipo_pedido_id', '=', 1);
|
||||
}
|
||||
|
||||
public function totalARecaudar()
|
||||
|
@ -120,11 +128,15 @@ class GrupoDeCompra extends Model
|
|||
return TransporteHelper::cantidadTransporte($this->totalCentralesQuePaganTransporte());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws MpdfException
|
||||
*/
|
||||
public function exportarPedidosAPdf()
|
||||
{
|
||||
$subpedidos = $this->pedidosAprobados();
|
||||
$fecha = now()->format('Y-m-d');
|
||||
PdfHelper::exportarPedidos($this->nombre . '-' . $fecha . '.pdf', $subpedidos);
|
||||
$filepath = $this->nombre . '-' . $fecha . '.pdf';
|
||||
PdfHelper::exportarPedidos($filepath, $subpedidos);
|
||||
}
|
||||
|
||||
function pedidoParaPdf(): array
|
||||
|
@ -154,11 +166,15 @@ class GrupoDeCompra extends Model
|
|||
return $view->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws MpdfException
|
||||
*/
|
||||
public static function exportarPedidosBarrialesAPdf()
|
||||
{
|
||||
$barrios = GrupoDeCompra::barriosMenosPrueba()->get();
|
||||
$fecha = now()->format('Y-m-d');
|
||||
PdfHelper::exportarPedidos('pedidos_por_barrio-' . $fecha . '.pdf', $barrios);
|
||||
$filepath = 'pedidos_por_barrio-' . $fecha . '.pdf';
|
||||
PdfHelper::exportarPedidos($filepath, $barrios);
|
||||
}
|
||||
|
||||
static function filaVacia(string $product, int $columns): array
|
||||
|
|
Loading…
Add table
Reference in a new issue