Inizializzazione dei dropdown di categoria e tags

This commit is contained in:
2023-07-07 13:36:33 +02:00
parent 957cc88a3f
commit 031e4957b4
4 changed files with 47 additions and 21 deletions

View File

@@ -22,12 +22,12 @@ class Categorie extends Model
public static function listSpesa()
{
return DB::table('categories')->where('cat_uscita','=',1)->get();
return DB::table('categories')->where('cat_uscita','=',1)->orderBy('cat_name')->get();
}
public static function listEntrata()
{
return DB::table('categories')->where('cat_entrata','=',1)->get();
return DB::table('categories')->where('cat_entrata','=',1)->orderBy('cat_name')->get();
}
public static function inserisci($request){

View File

@@ -10,6 +10,8 @@ use Rap2hpoutre\FastExcel\FastExcel;
class Movimenti extends Model
{
use HasFactory;
protected $dates = ['mov_data'];
protected $casts = [ 'mov_data'=>'datetime'];
public static function getList() {
return DB::table('movimentis')
@@ -179,7 +181,8 @@ class Movimenti extends Model
if($line['DARE']<>'')
{
$dati=[
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
'mov_data'=>self::dateFormat(0,$line['VALUTA']), // date_format(date_create($movimento->mov_data),'d/m/Y'
// 'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
'mov_fk_categoria'=>1,
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
'mov_importo'=>'-'.trim(str_replace(',','.',(str_replace('.','',$line['DARE'])))),
@@ -191,6 +194,7 @@ class Movimenti extends Model
{
$dati=[
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
//'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
'mov_fk_categoria'=>1,
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
'mov_importo'=>trim(str_replace(',','.',(str_replace('.','',$line['AVERE'])))),
@@ -216,11 +220,11 @@ class Movimenti extends Model
if($type)
{
$string=$string->format('Y-m-d');
// $string=$string->format('Y-m-d');
list($year,$month,$day) = explode('-',$string);
return $day.'/'.$month.'/'.$year;
} else {
$string=$string->format('d/m/Y');
// $string=$string->format('d/m/Y');
list($day,$month,$year) =explode('/',$string);
return $year.'-'.$month.'-'.$day;
}