Cambiamento nelle funzioni di importazione degli estratticonto
This commit is contained in:
parent
337504b127
commit
1bdc1b76c6
@ -184,33 +184,43 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
|||||||
public static function importEstrattoIng($filename)
|
public static function importEstrattoIng($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.'.csv';
|
||||||
|
$outputPath = $inputPath.'.csv';
|
||||||
rename($inputPath,$outputPath);
|
rename($inputPath,$outputPath);
|
||||||
|
$collection = (new FastExcel)->configureCsv(";")->import($outputPath, function ($line){
|
||||||
$collection = (new FastExcel)->import($outputPath, function ($line){
|
|
||||||
if($line['DATA VALUTA'])
|
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']);
|
list($giorno,$mese,$anno) = explode('/',$line['DATA VALUTA']);
|
||||||
$data="$anno-$mese-$giorno";
|
$data="$anno-$mese-$giorno";
|
||||||
self::insEntrata([
|
self::insEntrata([
|
||||||
'mov_data'=>self::dateFormat(0,$line['DATA VALUTA']),
|
'mov_data'=>self::dateFormat(0,$line['DATA VALUTA']),
|
||||||
'mov_fk_categoria'=>1,
|
'mov_fk_categoria'=>1,
|
||||||
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
'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,
|
'mov_fk_tags'=>1,
|
||||||
'userid'=>1,
|
'userid'=>1,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
unlink($outputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function importEstrattoCR($filename)
|
public static function importEstrattoCR($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';
|
||||||
|
$outputPath = $inputPath.'.csv';
|
||||||
rename($inputPath,$outputPath);
|
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['VALUTA'])
|
||||||
{
|
{
|
||||||
if($line['DARE']<>'')
|
if($line['DARE']<>'')
|
||||||
@ -241,6 +251,7 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
|||||||
self::insEntrata($dati);
|
self::insEntrata($dati);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
unlink($outputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getYearsFromMovimenti()
|
public static function getYearsFromMovimenti()
|
||||||
|
Loading…
Reference in New Issue
Block a user