version 1.0

This commit is contained in:
Guillermo Gutierrez
2023-08-11 11:08:47 -07:00
commit 994709a3e5
223 changed files with 23438 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Livewire;
use App\Exports\VentasExport;
use App\Models\Venta;
use Carbon\Carbon;
use Livewire\Component;
use Maatwebsite\Excel\Facades\Excel;
class ReporteController extends Component
{
public $fecha_inicio, $fecha_final;
public function render()
{
return view('venta.reporte',[
'ventas' => Venta::whereBetween('created_at',[$this->fecha_inicio,$this->fecha_final])->get()
]);
}
public function export()
{
$this->validate([
'fecha_inicio' => 'required|date',
'fecha_final' => 'required|date',
]);
return Excel::download(new VentasExport($this->fecha_inicio, $this->fecha_final),'venta-'.Carbon::now()->format('Y-m-d').'.xlsx');
}
}