Pulizia e gestione saldo totale in dashboard
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user