Skip to content

Commit f954b5f

Browse files
authored
Merge pull request #45 from PiruloDev/desarrollo
Fixes orden de salida v1
2 parents 821db87 + 4fe1e7b commit f954b5f

4 files changed

Lines changed: 60 additions & 12 deletions

File tree

Frontend/app/Http/Controllers/Reportes/OrdenSalidaController.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,39 @@
1111
class OrdenSalidaController extends Controller
1212
{
1313
public function index()
14-
{
15-
$ventas = OrdenSalida::with('cliente')->get();
16-
$clientes = Clientes::where('ACTIVO_CLI', 1)->get(); // solo clientes activos
17-
$pedidos = \DB::table('pedidos')->select('ID_PEDIDO', 'ID_CLIENTE')->get();
18-
19-
return view('reportes.index', compact('ventas', 'clientes', 'pedidos'));
20-
}
14+
{
15+
Log::info('Accediendo a OrdenSalidaController@index');
16+
17+
try {
18+
$ventas = OrdenSalida::with('cliente')->get();
19+
$clientes = Clientes::where('ACTIVO_CLI', 1)->get();
20+
$pedidos = \DB::table('pedidos')->select('ID_PEDIDO', 'ID_CLIENTE')->get();
21+
22+
Log::info('Datos de OrdenSalida cargados', [
23+
'ventas_count' => count($ventas),
24+
'clientes_count' => count($clientes),
25+
'pedidos_count' => count($pedidos)
26+
]);
27+
28+
return view('Reportes.index', compact('ventas', 'clientes', 'pedidos'));
29+
} catch (\Exception $e) {
30+
Log::error('Error en OrdenSalidaController@index: ' . $e->getMessage(), [
31+
'trace' => $e->getTraceAsString()
32+
]);
33+
34+
return view('Reportes.index', [
35+
'ventas' => collect([]),
36+
'clientes' => collect([]),
37+
'pedidos' => collect([])
38+
])->with('error', 'Error al cargar las órdenes de salida. Por favor revisa los logs.');
39+
}
40+
}
2141

2242

2343

2444
public function create()
2545
{
26-
return view('reportes.create');
46+
return view('Reportes.create');
2747
}
2848

2949
public function edit($id)
@@ -34,7 +54,7 @@ public function edit($id)
3454
return abort(404, 'Orden no encontrada');
3555
}
3656

37-
return view('reportes.edit', compact('venta'));
57+
return view('Reportes.edit', compact('venta'));
3858
}
3959

4060
public function store(Request $request)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container py-5">
5+
<div class="alert alert-info">
6+
<h4>Funcionalidad disponible en el Listado</h4>
7+
<p>Esta acción ahora se realiza directamente mediante ventanas modales en la página principal de órdenes de salida.</p>
8+
<a href="{{ route('ordenes.salida.index') }}" class="btn btn-primary">Volver al listado</a>
9+
</div>
10+
</div>
11+
@endsection
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container py-5">
5+
<div class="alert alert-info">
6+
<h4>Funcionalidad disponible en el Listado</h4>
7+
<p>Esta acción ahora se realiza directamente mediante ventanas modales en la página principal de órdenes de salida.</p>
8+
<a href="{{ route('ordenes.salida.index') }}" class="btn btn-primary">Volver al listado</a>
9+
</div>
10+
</div>
11+
@endsection

Frontend/resources/views/Reportes/index.blade.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
<div class="orden-card">
3333
<div class="card-header-custom">
3434
<span class="orden-id">Orden #{{ $venta->ID_FACTURA }}</span>
35-
<span class="fecha-badge">{{ \Carbon\Carbon::parse($venta->FECHA_FACTURACION)->format('d/m/Y H:i') }}</span>
35+
<span class="fecha-badge">
36+
@if($venta->FECHA_FACTURACION)
37+
{{ \Carbon\Carbon::parse($venta->FECHA_FACTURACION)->format('d/m/Y H:i') }}
38+
@else
39+
N/A
40+
@endif
41+
</span>
3642
</div>
3743
<div class="card-body-custom">
3844
<div class="info-row">
@@ -53,8 +59,8 @@
5359
{{ $venta->ID_FACTURA }},
5460
{{ $venta->ID_CLIENTE }},
5561
{{ $venta->ID_PEDIDO }},
56-
'{{ \Carbon\Carbon::parse($venta->FECHA_FACTURACION)->format('Y-m-d\TH:i') }}',
57-
{{ $venta->TOTAL_FACTURA }}
62+
'{{ $venta->FECHA_FACTURACION ? \Carbon\Carbon::parse($venta->FECHA_FACTURACION)->format("Y-m-d\TH:i") : "" }}',
63+
{{ $venta->TOTAL_FACTURA ?? 0 }}
5864
)">Editar</button>
5965
<form action="{{ route('ordenes.salida.destroy',$venta->ID_FACTURA) }}" method="POST" style="flex: 1;">
6066
@csrf

0 commit comments

Comments
 (0)