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) {
|
->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');
|
$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
|
FROM T_WEB_Ordini
|
||||||
WHERE DataOra >= DATEADD(MONTH, -3, GETDATE())
|
WHERE DataOra >= DATEADD(MONTH, -3, GETDATE())
|
||||||
GROUP BY CodArticoloGM) p'), function ($join) {
|
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) {
|
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,12 +266,11 @@ 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('totVen', 'desc')
|
// ->orderBy('totVen', 'desc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -550,7 +550,7 @@ class ArticleController extends Controller
|
|||||||
$articoliVenduti = $this->queryArticlesSales();
|
$articoliVenduti = $this->queryArticlesSales();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($articoliVenduti) {
|
if ($articoliVenduti->isNotEmpty()) {
|
||||||
|
|
||||||
// Mappa i risultati nella struttura JSON desiderata
|
// Mappa i risultati nella struttura JSON desiderata
|
||||||
$result = $articoliVenduti->map(function ($articoloVenduto) {
|
$result = $articoliVenduti->map(function ($articoloVenduto) {
|
||||||
@@ -591,7 +591,7 @@ class ArticleController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2221,7 +2221,7 @@ Route::get('/testcli', function () {
|
|||||||
$cliente->Telefono = '';
|
$cliente->Telefono = '';
|
||||||
$cliente->Email = 'email@email.com';
|
$cliente->Email = 'email@email.com';
|
||||||
$cliente->CodClienteGM = '';
|
$cliente->CodClienteGM = '';
|
||||||
$cliente->IdNazione = 227; // ITALIA
|
$cliente->IdNazione = 227; // ITALIA
|
||||||
$cliente->IdInternet = 68499;
|
$cliente->IdInternet = 68499;
|
||||||
try {
|
try {
|
||||||
$cliente->save();
|
$cliente->save();
|
||||||
@@ -2369,7 +2369,7 @@ Route::post('/updatecreate', function (Request $request) {
|
|||||||
$cliente = null;
|
$cliente = null;
|
||||||
if ($clienteinGM) {
|
if ($clienteinGM) {
|
||||||
$productLogger->addLog('', 'Cliente su GM! ' . json_encode($clienteinGM) . 'con IdInternet=' . $myidInternet);
|
$productLogger->addLog('', 'Cliente su GM! ' . json_encode($clienteinGM) . 'con IdInternet=' . $myidInternet);
|
||||||
// $cliente = $clienteinGM;
|
// $cliente = $clienteinGM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cliente === null) {
|
if ($cliente === null) {
|
||||||
@@ -2395,7 +2395,7 @@ Route::post('/updatecreate', function (Request $request) {
|
|||||||
$cliente->Email = $email;
|
$cliente->Email = $email;
|
||||||
$cliente->CodClienteGM = $codClienteGM;
|
$cliente->CodClienteGM = $codClienteGM;
|
||||||
if ($nazione == 'IT') {
|
if ($nazione == 'IT') {
|
||||||
$cliente->IdNazione = 227; // ITALIA
|
$cliente->IdNazione = 227; // ITALIA
|
||||||
} else {
|
} else {
|
||||||
//++DA FARE !! PER ALTRE NAZIONI
|
//++DA FARE !! PER ALTRE NAZIONI
|
||||||
$cliente->IdNazione = $nazione;
|
$cliente->IdNazione = $nazione;
|
||||||
@@ -2464,7 +2464,7 @@ Route::post('/updatecreate', function (Request $request) {
|
|||||||
$clientedest->Telefono = $telefono;
|
$clientedest->Telefono = $telefono;
|
||||||
$clientedest->Email = $email;
|
$clientedest->Email = $email;
|
||||||
if ($nazione == 'IT') {
|
if ($nazione == 'IT') {
|
||||||
$clientedest->IdNazione = 227; // ITALIA
|
$clientedest->IdNazione = 227; // ITALIA
|
||||||
} else {
|
} else {
|
||||||
//++DA FARE !! PER ALTRE NAZIONI
|
//++DA FARE !! PER ALTRE NAZIONI
|
||||||
$clientedest->IdNazione = $nazione;
|
$clientedest->IdNazione = $nazione;
|
||||||
@@ -2495,7 +2495,7 @@ Route::post('/updatecreate', function (Request $request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// $productLogger->setLogandSendEmail('Check Ordine... ');
|
// $productLogger->setLogandSendEmail('Check Ordine... ');
|
||||||
} //end if status
|
} //end if status
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user