Pulizia e gestione saldo totale in dashboard

This commit is contained in:
Amministratore 2023-04-17 13:51:28 +02:00
parent 78f6db1bca
commit 83ce999b38
4 changed files with 59 additions and 64 deletions

View File

@ -38,8 +38,10 @@ class MovimentiController extends Controller
public static function dashboard() public static function dashboard()
{ {
$bilancio=Movimenti::getSaldo(date('Y')); $bilancio=Movimenti::getSaldo(date('Y'));
$saldo=Movimenti::getSaldoTot();
return view('layouts.dashboard',[ return view('layouts.dashboard',[
'bilancio'=>$bilancio, 'bilancio'=>$bilancio,
'saldo'=>$saldo,
]); ]);
} }
@ -191,14 +193,8 @@ class MovimentiController extends Controller
->whereYear('mov_data','=',$anno) ->whereYear('mov_data','=',$anno)
->where('mov_fk_categoria','=',$id) ->where('mov_fk_categoria','=',$id)
->sum('mov_importo'); ->sum('mov_importo');
$coll[]=$movrow; $coll[]=$movrow;
$collx[]=$movrow; $collx[]=$movrow;
//$coll[] = ['totale' => $movrow];
// $coll[]=array_push(array_sum($coll['totale']));
// $coll[]=array_push($coll,$totale);
} }
$totale[]=array_sum($collx); $totale[]=array_sum($collx);
unset($collx); unset($collx);
@ -234,8 +230,6 @@ class MovimentiController extends Controller
->whereYear('mov_data','=',$anno) ->whereYear('mov_data','=',$anno)
->where('mov_fk_categoria','=',$id) ->where('mov_fk_categoria','=',$id)
->sum('mov_importo'); ->sum('mov_importo');
//$coll[] = str_replace(".",",",$movrow);
$coll[] = $movrow; $coll[] = $movrow;
} }

View File

@ -11,7 +11,6 @@ class Movimenti extends Model
{ {
use HasFactory; use HasFactory;
public static function getList() { public static function getList() {
return DB::table('movimentis') return DB::table('movimentis')
->join('categories','movimentis.mov_fk_categoria','=','categories.id') ->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'); 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) { public static function insSpesa($request) {
DB::table('movimentis')->insert( DB::table('movimentis')->insert(
[ [
@ -145,7 +148,6 @@ class Movimenti extends Model
public static function importEstrattoIng($filename) public static function importEstrattoIng($filename)
{ {
//$file = str_replace('/EC/','',$filename);
$inputPath='/var/www/html/bubofamily/public/storage/'.$filename; $inputPath='/var/www/html/bubofamily/public/storage/'.$filename;
$outputPath='/var/www/html/bubofamily/public/'.$filename; $outputPath='/var/www/html/bubofamily/public/'.$filename;
rename($inputPath,$outputPath); rename($inputPath,$outputPath);
@ -162,14 +164,11 @@ class Movimenti extends Model
'userid'=>1, 'userid'=>1,
]); ]);
} }
}); });
//dd($outputPath);
} }
public static function importEstrattoCR($filename) public static function importEstrattoCR($filename)
{ {
//$file = str_replace('/EC/','',$filename);
$inputPath='/var/www/html/bubofamily/public/storage/'.$filename; $inputPath='/var/www/html/bubofamily/public/storage/'.$filename;
$outputPath='/var/www/html/bubofamily/public/'.$filename.'.csv'; $outputPath='/var/www/html/bubofamily/public/'.$filename.'.csv';
rename($inputPath,$outputPath); rename($inputPath,$outputPath);
@ -200,12 +199,10 @@ class Movimenti extends Model
]; ];
} }
Movimenti::insEntrata($dati); Movimenti::insEntrata($dati);
// dd($dati); }
});
} }
});
//dd($outputPath);
}
private static function dateFormat($type,$string) private static function dateFormat($type,$string)
{ {
if($type) if($type)
@ -217,4 +214,5 @@ class Movimenti extends Model
return $year.'-'.$month.'-'.$day; return $year.'-'.$month.'-'.$day;
} }
} }
} }

View File

@ -8,7 +8,7 @@
<div class="container"> <div class="container">
<!-- Content here --> <!-- Content here -->
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-10">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
Contatto Contatto
@ -65,7 +65,7 @@
</tr> </tr>
</table > </table >
</div> </div>
<div class="col-lg-12"> <div class="col-lg-10">
<a class="btn btn-primary" href="addOther?id={{ $anagrafiche[0]->id }}">Nuovo Altro Contatto</i></a> <a class="btn btn-primary" href="addOther?id={{ $anagrafiche[0]->id }}">Nuovo Altro Contatto</i></a>
</div> </div>
<div> <div>

View File

@ -38,8 +38,8 @@
<i class="fa fa-balance-scale fa-5x"></i> <i class="fa fa-balance-scale fa-5x"></i>
</div> </div>
<div class="col-xs-9 text-right"> <div class="col-xs-9 text-right">
<div class="huge">{{ $bilancio }}</div> <div class="huge">{{ $saldo }}</div>
<div>Bilancio attuale</div> <div>Saldo attuale</div>
</div> </div>
</div> </div>
</div> </div>
@ -52,6 +52,7 @@
</a> </a>
</div> </div>
</div> </div>
<!-- WIDGET --> <!-- WIDGET -->
<div class="col-lg-3 col-md-6"> <div class="col-lg-3 col-md-6">
<div class="panel panel-warning"> <div class="panel panel-warning">
@ -75,6 +76,7 @@
</a> </a>
</div> </div>
</div> </div>
<!-- WIDGET --> <!-- WIDGET -->
<div class="col-lg-3 col-md-6"> <div class="col-lg-3 col-md-6">
<div class="panel panel-danger"> <div class="panel panel-danger">
@ -98,6 +100,7 @@
</a> </a>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection