aa
This commit is contained in:
@@ -232,7 +232,7 @@ class ArticleController extends Controller
|
|||||||
->leftJoin(DB::raw('(SELECT CodArticolo, SUM(TRY_CAST(Qta AS INT)) as totFat FROM T_WEB_ArticoliFatturati WHERE ISNUMERIC(Qta) = 1 GROUP BY CodArticolo) u'), function ($join) {
|
->leftJoin(DB::raw('(SELECT CodArticolo, SUM(TRY_CAST(Qta AS INT)) as totFat FROM T_WEB_ArticoliFatturati WHERE ISNUMERIC(Qta) = 1 GROUP BY CodArticolo) u'), function ($join) {
|
||||||
$join->on('T_WEB_Articoli.IdArticolo', '=', 'u.CodArticolo');
|
$join->on('T_WEB_Articoli.IdArticolo', '=', 'u.CodArticolo');
|
||||||
})
|
})
|
||||||
/*->leftJoin(DB::raw('(
|
->leftJoin(DB::raw('(
|
||||||
SELECT v.IdCollana, v.Descrizione as DescrizioneCollana
|
SELECT v.IdCollana, v.Descrizione as DescrizioneCollana
|
||||||
FROM T_WEB_Collane v
|
FROM T_WEB_Collane v
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
@@ -247,15 +247,15 @@ class ArticleController extends Controller
|
|||||||
JOIN (SELECT IdArgomento, MAX(DataOra) as data12 from T_WEB_Argomenti GROUP BY IdArgomento) h2
|
JOIN (SELECT IdArgomento, MAX(DataOra) as data12 from T_WEB_Argomenti GROUP BY IdArgomento) h2
|
||||||
ON g2.IdArgomento = h.IdArgomento AND g2.DataOra = h.data12 ) i2'), function ($join) {
|
ON g2.IdArgomento = h.IdArgomento AND g2.DataOra = h.data12 ) i2'), function ($join) {
|
||||||
$join->on('T_WEB_Articoli.ListaArgomenti', '=', 'i2.IdArgomento');
|
$join->on('T_WEB_Articoli.ListaArgomenti', '=', 'i2.IdArgomento');
|
||||||
})*/
|
})
|
||||||
|
|
||||||
->select(
|
->select(
|
||||||
'T_WEB_Articoli.*',
|
'T_WEB_Articoli.*',
|
||||||
'f.DescrizioneStatoProdotto',
|
/*'f.DescrizioneStatoProdotto',
|
||||||
'i.DescrizioneTipologia',
|
'i.DescrizioneTipologia',
|
||||||
'n.DescrizioneFormato',
|
'n.DescrizioneFormato',
|
||||||
'y.DescrizioneCollana',
|
// 'y.DescrizioneCollana',
|
||||||
'i2.DescrArgomento',
|
// 'i2.DescrArgomento',
|
||||||
DB::raw('COALESCE(o.totVen, 0) as totVen'),
|
DB::raw('COALESCE(o.totVen, 0) as totVen'),
|
||||||
DB::raw('COALESCE(u.totFat, 0) as totFat'),
|
DB::raw('COALESCE(u.totFat, 0) as totFat'),
|
||||||
DB::raw('COALESCE(p.venduti3mesi, 0) as venduti3mesi'),
|
DB::raw('COALESCE(p.venduti3mesi, 0) as venduti3mesi'),
|
||||||
@@ -265,13 +265,13 @@ class ArticleController extends Controller
|
|||||||
DB::raw('COALESCE(q.venduti6mesi, 0) as venduti6mesi'),
|
DB::raw('COALESCE(q.venduti6mesi, 0) as venduti6mesi'),
|
||||||
DB::raw('COALESCE(q.rank6M, 0) as rank6M'),
|
DB::raw('COALESCE(q.rank6M, 0) as rank6M'),
|
||||||
DB::raw('COALESCE(r.venduti1anno, 0) as venduti1anno'),
|
DB::raw('COALESCE(r.venduti1anno, 0) as venduti1anno'),
|
||||||
DB::raw('COALESCE(r.rank1Y, 0) as rank1Y'),
|
DB::raw('COALESCE(r.rank1Y, 0) as rank1Y'),*/
|
||||||
DB::raw('s.ultimoOrdine')
|
DB::raw('s.ultimoOrdine')
|
||||||
)
|
)
|
||||||
->where('DescrizioneStatoProdotto', 'In commercio')
|
->where('DescrizioneStatoProdotto', 'In commercio')
|
||||||
->where('DescrizioneTipologia', 'Libri')
|
->where('DescrizioneTipologia', 'Libri')
|
||||||
//->orderBy('rank1Y', 'asc')
|
//->orderBy('rank1Y', 'asc')
|
||||||
->orderBy('totVen', 'desc')
|
// ->orderBy('totVen', 'desc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
if ($articoliVenduti->isEmpty()) {
|
if ($articoliVenduti->isEmpty()) {
|
||||||
@@ -591,7 +591,7 @@ class ArticleController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return new Response('Error exporting exportArticlesSalesByJSON_Base: ' . $e->getMessage() . 'Articoli: ' . json_decode($articoliVenduti), 500);
|
return new Response('Error exporting exportArticlesSalesByJSON_Base: ' . $e->getMessage() . '\n Articoli: ' . json_decode($articoliVenduti), 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user