funcion/pedido-ollas #47
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\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use League\Csv\Exception;
|
use League\Csv\Exception;
|
||||||
|
use Mpdf\MpdfException;
|
||||||
|
|
||||||
class GrupoDeCompra extends Model
|
class GrupoDeCompra extends Model
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,14 @@ class GrupoDeCompra extends Model
|
||||||
|
|
||||||
public function pedidosAprobados()
|
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()
|
public function totalARecaudar()
|
||||||
|
@ -120,11 +128,15 @@ class GrupoDeCompra extends Model
|
||||||
return TransporteHelper::cantidadTransporte($this->totalCentralesQuePaganTransporte());
|
return TransporteHelper::cantidadTransporte($this->totalCentralesQuePaganTransporte());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws MpdfException
|
||||||
|
*/
|
||||||
public function exportarPedidosAPdf()
|
public function exportarPedidosAPdf()
|
||||||
{
|
{
|
||||||
$subpedidos = $this->pedidosAprobados();
|
$subpedidos = $this->pedidosAprobados();
|
||||||
$fecha = now()->format('Y-m-d');
|
$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
|
function pedidoParaPdf(): array
|
||||||
|
@ -154,11 +166,15 @@ class GrupoDeCompra extends Model
|
||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws MpdfException
|
||||||
|
*/
|
||||||
public static function exportarPedidosBarrialesAPdf()
|
public static function exportarPedidosBarrialesAPdf()
|
||||||
{
|
{
|
||||||
$barrios = GrupoDeCompra::barriosMenosPrueba()->get();
|
$barrios = GrupoDeCompra::barriosMenosPrueba()->get();
|
||||||
$fecha = now()->format('Y-m-d');
|
$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
|
static function filaVacia(string $product, int $columns): array
|
||||||
|
|
Loading…
Add table
Reference in a new issue