Agregado método de controlador para faltantes y sobrantes

This commit is contained in:
Alejandro Tasistro 2025-09-14 12:12:53 -03:00
parent 0ecff9ae68
commit 7d87471d8b

View file

@ -65,6 +65,23 @@ class ComisionesController
return response()->download($files[0]);
}
public function descargarFaltantesYSobrantes()
{
try {
PedidosExportHelper::faltantesYSobrantes();
} catch (CannotInsertRecord|InvalidArgument|Exception $e) {
return response()->json(['message' => $e->getMessage()], 500);
}
$pattern = storage_path('csv/exports/faltantes-y-sobrantes-*.csv');
$files = glob($pattern);
usort($files, function ($a, $b) {
return filemtime($b) <=> filemtime($a);
});
return response()->download($files[0]);
}
public function descargarNotas()
{
try {