Cambiamento nelle funzioni di importazione degli estratticonto

This commit is contained in:
Amministratore 2024-07-23 08:09:06 +00:00
parent 337504b127
commit 1bdc1b76c6

View File

@ -184,33 +184,43 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
public static function importEstrattoIng($filename)
{
$inputPath='/var/www/html/bubofamily/public/storage/'.$filename;
$outputPath='/var/www/html/bubofamily/public/'.$filename;
// $outputPath='/var/www/html/bubofamily/public/'.$filename.'.csv';
$outputPath = $inputPath.'.csv';
rename($inputPath,$outputPath);
$collection = (new FastExcel)->import($outputPath, function ($line){
$collection = (new FastExcel)->configureCsv(";")->import($outputPath, function ($line){
if($line['DATA VALUTA'])
{
if($line['ENTRATE']!=null)
{
$importo = $line['ENTRATE'];
} elseif($line['USCITE']!=null)
{
$importo = $line['USCITE'];
}
$euro=str_replace(',','.',str_replace('+','',str_replace('.','', $importo)));
list($giorno,$mese,$anno) = explode('/',$line['DATA VALUTA']);
$data="$anno-$mese-$giorno";
self::insEntrata([
'mov_data'=>self::dateFormat(0,$line['DATA VALUTA']),
'mov_fk_categoria'=>1,
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
'mov_importo'=>trim(str_replace(',','.',(str_replace('.','',str_replace('€', '', $line['IMPORTO IN EURO']))))),
'mov_importo'=>$euro,
'mov_fk_tags'=>1,
'userid'=>1,
]);
}
});
unlink($outputPath);
}
public static function importEstrattoCR($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';
$outputPath = $inputPath.'.csv';
rename($inputPath,$outputPath);
$collection = (new FastExcel)->configureCsv(';')->import($filename.'.csv', function ($line){
$collection = (new FastExcel)->configureCsv(';')->import($outputPath, function ($line){
if($line['VALUTA'])
{
if($line['DARE']<>'')
@ -241,6 +251,7 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
self::insEntrata($dati);
}
});
unlink($outputPath);
}
public static function getYearsFromMovimenti()