aa
This commit is contained in:
@@ -11,6 +11,16 @@ use App\Article;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
private function queryTest(){
|
||||
$articoli = DB::table('T_WEB_Articoli as A')
|
||||
->leftJoin(DB::raw('(SELECT CodArticoloGM, SUM(Qta) as totaleVenduti FROM T_WEB_Ordini GROUP BY CodArticoloGM) O'), 'A.IdArticolo', '=', 'O.CodArticoloGM')
|
||||
->select('A.IdArticolo', 'A.Descrizione', DB::raw('COALESCE(O.totaleVenduti, 0) as totaleVenduti'))
|
||||
->orderBy('totaleVenduti', 'desc')
|
||||
->get();
|
||||
|
||||
return $articoli;
|
||||
|
||||
}
|
||||
private function queryArticlesSales()
|
||||
{
|
||||
try {
|
||||
@@ -69,7 +79,8 @@ class ArticleController extends Controller
|
||||
)
|
||||
->where('DescrizioneStatoProdotto', 'In commercio')
|
||||
->where('DescrizioneTipologia', 'Libri')
|
||||
->orderBy('rank1Y', 'asc')
|
||||
//->orderBy('rank1Y', 'asc')
|
||||
->orderBy('totaleVenduti', 'desc')
|
||||
->get();
|
||||
|
||||
if ($articoliVenduti->isEmpty()) {
|
||||
@@ -99,6 +110,20 @@ class ArticleController extends Controller
|
||||
|
||||
}
|
||||
}
|
||||
public function showtest(Request $request)
|
||||
{
|
||||
try {
|
||||
|
||||
$articoliVenduti = $this->queryTest();
|
||||
|
||||
return view('export_articles_test', ['articoli' => $articoliVenduti]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Potresti considerare di registrare l'errore per debugging
|
||||
return new Response('Error exporting articles: ' . $e->getMessage(), 500);
|
||||
|
||||
}
|
||||
}
|
||||
public function exportArticlesSales(Request $request): Response
|
||||
{
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user