ordini e test
This commit is contained in:
@@ -38,6 +38,27 @@ class ArticleController extends Controller
|
||||
|
||||
return $articoli;
|
||||
|
||||
}
|
||||
private function queryOrdini()
|
||||
{
|
||||
try {
|
||||
$ordini = DB::table('T_WEB_Ordini as O')
|
||||
->join('T_WEB_Articoli as A', 'O.CodArticoloGM', '=', 'A.IdArticolo')
|
||||
->select(
|
||||
'O.DataOra',
|
||||
'O.Qta',
|
||||
'A.Titolo'
|
||||
)
|
||||
->orderBy('O.DataOra', 'desc')
|
||||
->get();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Registrazione dell'errore
|
||||
return response()->json(['error' => 'Si è verificato un errore durante il recupero dei dati: ' . $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
return $ordini;
|
||||
|
||||
}
|
||||
private function queryArticlesSales()
|
||||
{
|
||||
@@ -142,6 +163,20 @@ class ArticleController extends Controller
|
||||
|
||||
}
|
||||
}
|
||||
public function showOrdini(Request $request)
|
||||
{
|
||||
try {
|
||||
|
||||
$ordini = $this->queryOrdini();
|
||||
|
||||
return view('ordini_test', ['ordini' => $ordini]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Potresti considerare di registrare l'errore per debugging
|
||||
return new Response('Error exporting articles: ' . $e->getMessage(), 500);
|
||||
|
||||
}
|
||||
}
|
||||
public function exportArticlesSales(Request $request): Response
|
||||
{
|
||||
try {
|
||||
|
||||
35
resources/views/ordini_test.blade.php
Normal file
35
resources/views/ordini_test.blade.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Articoli Venduti</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Tutti gli Ordini</h1>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data Ora</th>
|
||||
<th>Quantità</th>
|
||||
<th>Titolo Articolo</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($ordini as $ordine)
|
||||
<tr>
|
||||
<td>{{ \Carbon\Carbon::parse($ordine->DataOra)->format('d/m/Y H:i:s') }}</td>
|
||||
<td>{{ $ordine->Qta }}</td>
|
||||
<td>{{ $ordine->Titolo }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -6467,4 +6467,5 @@ Route::get('/export-articles-sales-json', [ArticleController::class, 'exportArti
|
||||
|
||||
Route::get('/view-articles-sales', [ArticleController::class, 'showArticlesSales']);
|
||||
Route::get('/view-articles-test', [ArticleController::class, 'showtest']);
|
||||
Route::get('/view-ordini-test', [ArticleController::class, 'showOrdini']);
|
||||
Route::get('/article-test', [ArticleController::class, 'test']);
|
||||
|
||||
Reference in New Issue
Block a user