diff --git a/app/Models/Movimenti.php b/app/Models/Movimenti.php index f2aa5dc..b887844 100644 --- a/app/Models/Movimenti.php +++ b/app/Models/Movimenti.php @@ -201,23 +201,7 @@ public function ContoA() public static function listByCatMonth($month,$cat,$year) { - // $expression= DB::raw('SELECT - // a.id, - // a.mov_data, - // a.mov_importo_dare, - // a.mov_importo_avere, - // a.mov_descrizione, - // c.cat_name, - // t.tag_name, - // (SELECT Count(entity_id) as quanti FROM gen_docs WHERE entity=0 AND entity_id = a.id) as quanti - // FROM movimentis as a - // JOIN tags as t ON a.mov_fk_tags=t.id - // JOIN categories as c ON a.mov_fk_categoria=c.id - // WHERE Month(a.mov_data)='.$month.' AND Year(a.mov_data)='.$year.' AND a.mov_fk_categoria='.$cat - // ); - // $query = $expression->getValue(DB::connection()->getQueryGrammar()); - // return DB::select($query); - return self::with(['Tags', 'Categorie']) + return self::with(['Tags', 'Categorie']) ->whereMonth('mov_data', $month) ->whereYear('mov_data', $year) ->where('mov_fk_categoria', $cat) @@ -226,21 +210,6 @@ public function ContoA() public static function listByCategory($cat) { - // $expression=DB::raw(' SELECT a.id, - // a.mov_data, - // a.mov_importo_dare, - // a.mov_importo_avere, - // a.mov_descrizione, - // c.cat_name, - // t.tag_name, - // (SELECT Count(entity_id) as quanti FROM gen_docs WHERE entity=0 AND entity_id = a.id) as quanti - // FROM movimentis as a - // JOIN tags as t ON a.mov_fk_tags=t.id - // JOIN categories as c ON a.mov_fk_categoria=c.id - // WHERE a.mov_fk_categoria = '.$cat ); - - // $query = $expression->getValue(DB::connection()->getQueryGrammar()); - // return DB::select($query); return self::with(['Tags', 'Categorie']) ->where('mov_fk_categoria', $cat) ->get();