aa
This commit is contained in:
@@ -84,6 +84,41 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
return $ordini;
|
return $ordini;
|
||||||
|
|
||||||
|
}
|
||||||
|
private function queryOrdiniByIdArticolo($idArticolo)
|
||||||
|
{
|
||||||
|
ini_set("memory_limit", "512M");
|
||||||
|
try {
|
||||||
|
$ordini = DB::table('T_WEB_Ordini as O')
|
||||||
|
->leftJoin(DB::raw('(
|
||||||
|
SELECT
|
||||||
|
IdArticolo,
|
||||||
|
MAX(DataOra) as data
|
||||||
|
FROM T_WEB_Articoli
|
||||||
|
GROUP BY IdArticolo
|
||||||
|
) b'), 'O.CodArticoloGM', '=', 'b.IdArticolo')
|
||||||
|
->join('T_WEB_Articoli as A', function ($join) {
|
||||||
|
$join->on('O.CodArticoloGM', '=', 'A.IdArticolo')
|
||||||
|
->on('b.data', '=', 'A.DataOra');
|
||||||
|
})
|
||||||
|
->select(
|
||||||
|
DB::raw('ROW_NUMBER() OVER (ORDER BY O.DataOra DESC) AS progressivo'),
|
||||||
|
'O.DataOra',
|
||||||
|
'O.Qta',
|
||||||
|
'A.Titolo',
|
||||||
|
'A.Ean13'
|
||||||
|
)
|
||||||
|
->orderBy('O.DataOra', 'desc')
|
||||||
|
->where('IdArticolo', '>', $idArticolo)
|
||||||
|
->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 queryshowInfoArticolo($idArticolo)
|
private function queryshowInfoArticolo($idArticolo)
|
||||||
{
|
{
|
||||||
@@ -240,6 +275,20 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public function showOrdiniByIdArticolo($idArticolo)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$ordini = $this->queryOrdiniByIdArticolo($idArticolo);
|
||||||
|
|
||||||
|
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 showInfoArticolo($idArticolo)
|
public function showInfoArticolo($idArticolo)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -79,7 +79,11 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<td>@if (isset($articolo->totaleVenduti)){{ $articolo->totaleVenduti }}@endif</td>
|
<td>@if (isset($articolo->totaleVenduti))
|
||||||
|
<a href="/apimacro/public/view-ordini-by-idarticolo/{{$articolo->IdArticolo}}"
|
||||||
|
target="_blank">{{ $articolo->totaleVenduti }}</a>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>@if (isset($articolo->venduti3mesi))
|
<td>@if (isset($articolo->venduti3mesi))
|
||||||
{{ $articolo->venduti3mesi }}
|
{{ $articolo->venduti3mesi }}
|
||||||
|
|||||||
@@ -37,9 +37,10 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>@if (isset($articolo->totaleVenduti))
|
<td>@if (isset($articolo->totaleVenduti))
|
||||||
{{ number_format($articolo->totaleVenduti, 0, ',', '.') }}
|
<a href="/apimacro/public/view-ordini-by-idarticolo/{{$articolo->IdArticolo}}"
|
||||||
@endif
|
target="_blank">{{ $articolo->totaleVenduti }}</a>
|
||||||
</td>
|
@endif
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
@@ -6468,6 +6468,7 @@ Route::get('/export-articles-sales-json', [ArticleController::class, 'exportArti
|
|||||||
Route::get('/view-articles-sales', [ArticleController::class, 'showArticlesSales']);
|
Route::get('/view-articles-sales', [ArticleController::class, 'showArticlesSales']);
|
||||||
Route::get('/view-lista-ordini-totale/{data_start}', [ArticleController::class, 'showArticoliByDataStart']);
|
Route::get('/view-lista-ordini-totale/{data_start}', [ArticleController::class, 'showArticoliByDataStart']);
|
||||||
Route::get('/view-ordini-test/{numrec}', [ArticleController::class, 'showOrdini']);
|
Route::get('/view-ordini-test/{numrec}', [ArticleController::class, 'showOrdini']);
|
||||||
|
Route::get('/view-ordini-by-idarticolo/{idarticolo}', [ArticleController::class, 'showOrdiniByIdArticolo']);
|
||||||
Route::get('/article-test', [ArticleController::class, 'test']);
|
Route::get('/article-test', [ArticleController::class, 'test']);
|
||||||
Route::get('/view-info-articolo/{idarticolo}', [ArticleController::class, 'showInfoArticolo']);
|
Route::get('/view-info-articolo/{idarticolo}', [ArticleController::class, 'showInfoArticolo']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user