aa
This commit is contained in:
@@ -275,7 +275,7 @@ class ArticleController extends Controller
|
||||
DB::raw('COALESCE(u.totFat, 0) as totFat'),
|
||||
DB::raw('COALESCE(p.venduti3mesi, 0) as venduti3mesi'),
|
||||
DB::raw('COALESCE(t.fat3mesi, 0) as fat3mesi'),
|
||||
DB::raw('COALESCE(t2.fat6mesi, 0) as fat6mesi'),
|
||||
DB::raw('COALESCE(t.fat6mesi, 0) as fat6mesi'),
|
||||
DB::raw('COALESCE(p.rank3M, 0) as rank3M'),
|
||||
DB::raw('COALESCE(t.fatrank3M, 0) as fatrank3M'),
|
||||
DB::raw('COALESCE(t2.fatrank6M, 0) as fatrank6M'),
|
||||
@@ -298,12 +298,11 @@ class ArticleController extends Controller
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Registrazione dell'errore
|
||||
echo "Errore: " . $e->getMessage();
|
||||
return response()->json(['error' => 'Si è verificato un errore durante il recupero dei dati: ' . $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
// Restituisci una risposta JSON con i dati
|
||||
return response()->json(['data' => $articoliVenduti]);
|
||||
return $articoliVenduti;
|
||||
|
||||
}
|
||||
private function queryArticlesFatturati()
|
||||
@@ -568,44 +567,13 @@ class ArticleController extends Controller
|
||||
$articoliVenduti = $this->queryArticlesFatturati();
|
||||
} else {
|
||||
$articoliVenduti = $this->queryArticlesSales();
|
||||
// ritorna response()->json(['data' => $articoliVenduti]);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
echo $articoliVenduti;
|
||||
echo '<table border="1">';
|
||||
echo '<tr><th>IdArticolo</th><th>Titolo</th><th>DataPubblicazione</th><th>ISBN</th><th>IdCollana</th><th>DescrizioneCollana</th><th>DescrArgomento</th><th>ListaArgomenti</th><th>Pagine</th><th>IdTipoFormato</th><th>Misure</th><th>totVen</th><th>totFat</th><th>rank3M</th><th>fatrank3M</th><th>fatrank6M</th><th>rank6M</th></tr>';
|
||||
foreach ($articoliVenduti as $articolo) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . htmlspecialchars($articolo->IdArticolo) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->Titolo) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->DataPubblicazione) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->Ean13) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->IdCollana) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->DescrizioneCollana) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->DescrArgomento) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->ListaArgomenti) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->Pagine) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->IdTipoFormato) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->Misure) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->totVen) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->totFat) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->rank3M) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->fatrank3M) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->fatrank6M) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($articolo->rank6M) . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
|
||||
if ($articoliVenduti->isEmpty()) {
|
||||
return response()->json(['message' => 'Nessun articolo trovato.'], 404);
|
||||
} else {
|
||||
|
||||
// Mappa i risultati nella struttura JSON desiderata
|
||||
$result = collect($articoliVenduti)->map(function ($articoloVenduto) {
|
||||
$result = $articoliVenduti->map(function ($articoloVenduto) {
|
||||
return [
|
||||
'IdArticolo' => $articoloVenduto->IdArticolo,
|
||||
'title' => $articoloVenduto->Titolo,
|
||||
|
||||
Reference in New Issue
Block a user