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
return $mail;
}
private function fputcsvSeparatedBySemicolon($file, $arr)
{
fputcsv($file, $arr, ";");
}
/**
* @param $year
* @param int $month
......@@ -121,8 +126,8 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
$file = fopen($path, 'w');
//Write header
fputcsv($file, [
"Numéro d'anonymisation",
$this->fputcsvSeparatedBySemicolon($file, [
"Numero d'anonymisation",
'Montant (€)',
'Montant en lettres',
'Date',
......@@ -137,7 +142,7 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
foreach ($data as $row) {
//Write intermediate total line before moving to next client
if ($previousAnonymousToken !== $row['anonymous_token']) {
fputcsv($file, [
$this->fputcsvSeparatedBySemicolon($file, [
'TOTAL ' . $row['anonymous_token'],
$clientTotal,
$nf->format($clientTotal),
......@@ -146,7 +151,7 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
$clientTotal = 0;
}
//Write transaction line
fputcsv($file, [
$this->fputcsvSeparatedBySemicolon($file, [
$row['anonymous_token'],
$row['montant'],
$this->currencySpellout($nf, $row['montant']),
......@@ -156,14 +161,14 @@ class SendCcasTransactionsExportToPrestatairesCommand extends Command
$prestaTotal += $row['montant'];
}
//Write last intermediate total line
fputcsv($file, [
$this->fputcsvSeparatedBySemicolon($file, [
'TOTAL ' . $row['anonymous_token'],
number_format($clientTotal, 2),
$this->currencySpellout($nf, $clientTotal),
'',
]);
//Write final total line
fputcsv($file, [
$this->fputcsvSeparatedBySemicolon($file, [
'TOTAL ' . $p->getRaison(),
number_format($prestaTotal, 2),
$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