Compare commits
No commits in common. "53e75ae357f856ecba99c158425f0fa2cdba2882" and "45a7688fbd02fdb020c2e3f163c37423352da458" have entirely different histories.
53e75ae357
...
45a7688fbd
3 changed files with 4 additions and 21 deletions
|
@ -43,12 +43,7 @@ class PedidosExportHelper
|
|||
static public function pedidosDeOllas()
|
||||
{
|
||||
$filePath = "csv/exports/pedidos-de-ollas-" . now()->format('Y-m-d') . ".csv";
|
||||
$barrios = GrupoDeCompra::barriosMenosPrueba()
|
||||
->whereHas('subpedidos', function ($query) {
|
||||
$tipo_olla = self::getTipoId('olla');
|
||||
$query->where('tipo_pedido_id', $tipo_olla);
|
||||
})
|
||||
->get();
|
||||
$barrios = GrupoDeCompra::barriosMenosPrueba()->get();
|
||||
|
||||
$contenido = self::generarContenidoCSV($barrios,
|
||||
fn($grupoId) => "subpedidos.grupo_de_compra_id = $grupoId
|
||||
|
@ -67,7 +62,7 @@ class PedidosExportHelper
|
|||
*/
|
||||
public static function cantidadDeOllasParaCSV(Collection $barrios, Collection $contenido)
|
||||
{
|
||||
$tipo_olla = self::getTipoId('olla');
|
||||
$tipo_olla = TipoPedido::where('nombre', 'olla')->first()->id;
|
||||
|
||||
$parametros = collect(CsvHelper::getRecords(resource_path("csv/parametros.csv"), "No se pudo leer el archivo."));
|
||||
$fila = [
|
||||
|
@ -246,13 +241,4 @@ class PedidosExportHelper
|
|||
}
|
||||
return $transporte;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getTipoId(string $tipo)
|
||||
{
|
||||
$tipo_olla = TipoPedido::where('nombre', $tipo)->first()->id;
|
||||
return $tipo_olla;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,8 @@ class OllasController extends Controller
|
|||
$pedido = $gdc->subpedidos()->firstOrCreate([
|
||||
'nombre' => 'Pedido de Ollas de ' . $gdc->nombre,
|
||||
'tipo_pedido_id' => $tipoOlla->id,
|
||||
'cantidad_ollas' => 0,
|
||||
]);
|
||||
if (!$pedido->cantidad_ollas) {
|
||||
$pedido->cantidad_ollas = 0;
|
||||
$pedido->save();
|
||||
}
|
||||
return response()->json(new PedidoOllasResource($pedido));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
id|nombre|valor
|
||||
bono-transporte|'Bono de transporte'|15
|
||||
monto-transporte|'Monto para bono de transporte'|500
|
||||
monto-olla|'Monto por olla'|800
|
||||
monto-olla|'Monto por olla'|1200
|
||||
|
|
|
Loading…
Add table
Reference in a new issue