aa
This commit is contained in:
@@ -70,6 +70,20 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public function test(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$articoli = $this->queryTest();
|
||||||
|
|
||||||
|
return view('article_test', ['articoli' => $$articoli]);
|
||||||
|
|
||||||
|
} 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
|
public function exportArticlesSales(Request $request): Response
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -133,4 +147,19 @@ class ArticleController extends Controller
|
|||||||
return new Response('Error exporting articles: ' . $e->getMessage(), 500);
|
return new Response('Error exporting articles: ' . $e->getMessage(), 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function queryTest(): \Response
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$duplicati = DB::table('T_WEB_Articoli')
|
||||||
|
->select('idArticolo', 'Titolo', 'DataPubblicazione', 'Ean13', DB::raw('count(*) as total'))
|
||||||
|
->groupBy('idArticolo', 'Titolo', 'DataPubblicazione', 'Ean13')
|
||||||
|
->having('total', '>', 1) // Cerca solo i duplicati
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$response->setContent($duplicati);
|
||||||
|
return $response;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return new Response('Error exporting articles: ' . $e->getMessage(), 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
39
resources/views/article_test.php
Normal file
39
resources/views/article_test.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Articoli </title>
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h1 class="mb-4">Articoli </h1>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tbody>
|
||||||
|
<!--<pre>{{ print_r($articoliVenduti, true) }}</pre>-->
|
||||||
|
|
||||||
|
@if ($articoliVenduti->isEmpty())
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="text-center">Nessun articolo trovato.</td>
|
||||||
|
</tr>
|
||||||
|
@else
|
||||||
|
@foreach ($articoli as $articolo)
|
||||||
|
@if (isset($articolo->idArticolo))
|
||||||
|
<tr>
|
||||||
|
<td>{{ $articolo->idArticolo }}</td>
|
||||||
|
<td>{{ $articolo->Titolo }}</td>
|
||||||
|
<td>{{ \Carbon\Carbon::parse($articolo->DataPubblicazione)->format('d/m/Y') }}</td>
|
||||||
|
<td>{{ $articolo->totaleVenduto }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -6407,3 +6407,4 @@ Route::get('/export-articles-sales', [ArticleController::class, 'exportArticlesS
|
|||||||
Route::get('/export-articles-sales-json', [ArticleController::class, 'exportArticlesSalesByJSON']);
|
Route::get('/export-articles-sales-json', [ArticleController::class, 'exportArticlesSalesByJSON']);
|
||||||
|
|
||||||
Route::get('/view-articles-sales', [ArticleController::class, 'showArticlesSales']);
|
Route::get('/view-articles-sales', [ArticleController::class, 'showArticlesSales']);
|
||||||
|
Route::get('/article-test', [ArticleController::class, 'test']);
|
||||||
|
|||||||
Reference in New Issue
Block a user