diff --git a/app/Http/Controllers/MovimentiController.php b/app/Http/Controllers/MovimentiController.php index b409fef..2de60be 100644 --- a/app/Http/Controllers/MovimentiController.php +++ b/app/Http/Controllers/MovimentiController.php @@ -37,9 +37,11 @@ class MovimentiController extends Controller public static function dashboard() { - $bilancio=Movimenti::getSaldo(date('Y')); + $bilancio=Movimenti::getSaldo(date('Y')); + $saldo=Movimenti::getSaldoTot(); return view('layouts.dashboard',[ 'bilancio'=>$bilancio, + 'saldo'=>$saldo, ]); } @@ -191,14 +193,8 @@ class MovimentiController extends Controller ->whereYear('mov_data','=',$anno) ->where('mov_fk_categoria','=',$id) ->sum('mov_importo'); - - $coll[]=$movrow; $collx[]=$movrow; - //$coll[] = ['totale' => $movrow]; - // $coll[]=array_push(array_sum($coll['totale'])); - - // $coll[]=array_push($coll,$totale); } $totale[]=array_sum($collx); unset($collx); @@ -234,8 +230,6 @@ class MovimentiController extends Controller ->whereYear('mov_data','=',$anno) ->where('mov_fk_categoria','=',$id) ->sum('mov_importo'); - - //$coll[] = str_replace(".",",",$movrow); $coll[] = $movrow; } diff --git a/app/Models/Movimenti.php b/app/Models/Movimenti.php index 9081b49..c7195fa 100644 --- a/app/Models/Movimenti.php +++ b/app/Models/Movimenti.php @@ -11,7 +11,6 @@ class Movimenti extends Model { use HasFactory; - public static function getList() { return DB::table('movimentis') ->join('categories','movimentis.mov_fk_categoria','=','categories.id') @@ -26,6 +25,10 @@ class Movimenti extends Model return DB::table('movimentis')->whereYear('mov_data','=',$date)->sum('mov_importo'); } + public static function getSaldoTot() { + return DB::table('movimentis')->sum('mov_importo'); + } + public static function insSpesa($request) { DB::table('movimentis')->insert( [ @@ -145,7 +148,6 @@ class Movimenti extends Model public static function importEstrattoIng($filename) { - //$file = str_replace('/EC/','',$filename); $inputPath='/var/www/html/bubofamily/public/storage/'.$filename; $outputPath='/var/www/html/bubofamily/public/'.$filename; rename($inputPath,$outputPath); @@ -162,14 +164,11 @@ class Movimenti extends Model 'userid'=>1, ]); } - }); - //dd($outputPath); } public static function importEstrattoCR($filename) { - //$file = str_replace('/EC/','',$filename); $inputPath='/var/www/html/bubofamily/public/storage/'.$filename; $outputPath='/var/www/html/bubofamily/public/'.$filename.'.csv'; rename($inputPath,$outputPath); @@ -200,12 +199,10 @@ class Movimenti extends Model ]; } Movimenti::insEntrata($dati); - // dd($dati); } - }); - //dd($outputPath); } + private static function dateFormat($type,$string) { if($type) @@ -217,4 +214,5 @@ class Movimenti extends Model return $year.'-'.$month.'-'.$day; } } + } diff --git a/resources/views/anagrafica/dettagli.blade.php b/resources/views/anagrafica/dettagli.blade.php index bebe1bd..4405962 100644 --- a/resources/views/anagrafica/dettagli.blade.php +++ b/resources/views/anagrafica/dettagli.blade.php @@ -8,7 +8,7 @@