aa
This commit is contained in:
@@ -200,7 +200,7 @@ class ArticleController extends Controller
|
||||
->leftJoin(DB::raw('(SELECT CodArticoloGM, SUM(Qta) as totVen FROM T_WEB_Ordini GROUP BY CodArticoloGM) o'), function ($join) {
|
||||
$join->on('T_WEB_Articoli.IdArticolo', '=', 'o.CodArticoloGM');
|
||||
})
|
||||
->leftJoin(DB::raw('(SELECT CodArticoloGM, SUM(Qta) as venduti3mesi, RANK() OVER (ORDER BY SUM(Qta) DESC) as rank3M
|
||||
/*->leftJoin(DB::raw('(SELECT CodArticoloGM, SUM(Qta) as venduti3mesi, RANK() OVER (ORDER BY SUM(Qta) DESC) as rank3M
|
||||
FROM T_WEB_Ordini
|
||||
WHERE DataOra >= DATEADD(MONTH, -3, GETDATE())
|
||||
GROUP BY CodArticoloGM) p'), function ($join) {
|
||||
@@ -248,14 +248,15 @@ class ArticleController extends Controller
|
||||
ON g2.IdArgomento = h.IdArgomento AND g2.DataOra = h.data12 ) i2'), function ($join) {
|
||||
$join->on('T_WEB_Articoli.ListaArgomenti', '=', 'i2.IdArgomento');
|
||||
})
|
||||
*/
|
||||
|
||||
->select(
|
||||
'T_WEB_Articoli.*',
|
||||
/*'f.DescrizioneStatoProdotto',
|
||||
'T_WEB_Articoli.*'
|
||||
/*', f.DescrizioneStatoProdotto',
|
||||
'i.DescrizioneTipologia',
|
||||
'n.DescrizioneFormato',
|
||||
// 'y.DescrizioneCollana',
|
||||
// 'i2.DescrArgomento',
|
||||
'y.DescrizioneCollana',
|
||||
'i2.DescrArgomento',
|
||||
DB::raw('COALESCE(o.totVen, 0) as totVen'),
|
||||
DB::raw('COALESCE(u.totFat, 0) as totFat'),
|
||||
DB::raw('COALESCE(p.venduti3mesi, 0) as venduti3mesi'),
|
||||
@@ -265,12 +266,11 @@ class ArticleController extends Controller
|
||||
DB::raw('COALESCE(q.venduti6mesi, 0) as venduti6mesi'),
|
||||
DB::raw('COALESCE(q.rank6M, 0) as rank6M'),
|
||||
DB::raw('COALESCE(r.venduti1anno, 0) as venduti1anno'),
|
||||
DB::raw('COALESCE(r.rank1Y, 0) as rank1Y'),*/
|
||||
DB::raw('s.ultimoOrdine')
|
||||
DB::raw('COALESCE(r.rank1Y, 0) as rank1Y'),
|
||||
DB::raw('s.ultimoOrdine')*/
|
||||
)
|
||||
->where('DescrizioneStatoProdotto', 'In commercio')
|
||||
->where('DescrizioneTipologia', 'Libri')
|
||||
//->orderBy('rank1Y', 'asc')
|
||||
// ->orderBy('totVen', 'desc')
|
||||
->get();
|
||||
|
||||
@@ -550,7 +550,7 @@ class ArticleController extends Controller
|
||||
$articoliVenduti = $this->queryArticlesSales();
|
||||
}
|
||||
|
||||
if ($articoliVenduti) {
|
||||
if ($articoliVenduti->isNotEmpty()) {
|
||||
|
||||
// Mappa i risultati nella struttura JSON desiderata
|
||||
$result = $articoliVenduti->map(function ($articoloVenduto) {
|
||||
@@ -591,7 +591,7 @@ class ArticleController extends Controller
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return new Response('Error exporting exportArticlesSalesByJSON_Base: ' . $e->getMessage() . '\n Articoli: ' . json_decode($articoliVenduti), 500);
|
||||
return new Response('Error exporting exportArticlesSalesByJSON_Base: ' . $e->getMessage() . '<br>Articoli: ' . json_decode($articoliVenduti), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user