SIstemato importo a doppia registrazione su modello

This commit is contained in:
Amministratore 2025-10-15 13:25:31 +02:00
parent 80ea0959cf
commit c983b42bc0

View File

@ -201,22 +201,6 @@ 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'])
->whereMonth('mov_data', $month)
->whereYear('mov_data', $year)
@ -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();