Commit d18f317b by Yvon

use semicolon as separator instead of komma for excel auto column split

parent 6a72ef72
...@@ -98,6 +98,11 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command ...@@ -98,6 +98,11 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
return $mail; return $mail;
} }
private function fputcsvSeparatedBySemicolon($file, $arr)
{
fputcsv($file, $arr, ";");
}
/** /**
* @param $year * @param $year
* @param int $month * @param int $month
...@@ -121,8 +126,8 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command ...@@ -121,8 +126,8 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
$file = fopen($path, 'w'); $file = fopen($path, 'w');
//Write header //Write header
fputcsv($file, [ $this->fputcsvSeparatedBySemicolon($file, [
"Numéro d'anonymisation", "Numero d'anonymisation",
'Montant (€)', 'Montant (€)',
'Montant en lettres', 'Montant en lettres',
'Date', 'Date',
...@@ -137,7 +142,7 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command ...@@ -137,7 +142,7 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
foreach ($data as $row) { foreach ($data as $row) {
//Write intermediate total line before moving to next client //Write intermediate total line before moving to next client
if ($previousAnonymousToken !== $row['anonymous_token']) { if ($previousAnonymousToken !== $row['anonymous_token']) {
fputcsv($file, [ $this->fputcsvSeparatedBySemicolon($file, [
'TOTAL ' . $row['anonymous_token'], 'TOTAL ' . $row['anonymous_token'],
$clientTotal, $clientTotal,
$nf->format($clientTotal), $nf->format($clientTotal),
...@@ -146,7 +151,7 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command ...@@ -146,7 +151,7 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
$clientTotal = 0; $clientTotal = 0;
} }
//Write transaction line //Write transaction line
fputcsv($file, [ $this->fputcsvSeparatedBySemicolon($file, [
$row['anonymous_token'], $row['anonymous_token'],
$row['montant'], $row['montant'],
$this->currencySpellout($nf, $row['montant']), $this->currencySpellout($nf, $row['montant']),
...@@ -156,14 +161,14 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command ...@@ -156,14 +161,14 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
$prestaTotal += $row['montant']; $prestaTotal += $row['montant'];
} }
//Write last intermediate total line //Write last intermediate total line
fputcsv($file, [ $this->fputcsvSeparatedBySemicolon($file, [
'TOTAL ' . $row['anonymous_token'], 'TOTAL ' . $row['anonymous_token'],
number_format($clientTotal, 2), number_format($clientTotal, 2),
$this->currencySpellout($nf, $clientTotal), $this->currencySpellout($nf, $clientTotal),
'', '',
]); ]);
//Write final total line //Write final total line
fputcsv($file, [ $this->fputcsvSeparatedBySemicolon($file, [
'TOTAL ' . $p->getRaison(), 'TOTAL ' . $p->getRaison(),
number_format($prestaTotal, 2), number_format($prestaTotal, 2),
$this->currencySpellout($nf, $prestaTotal), $this->currencySpellout($nf, $prestaTotal),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment