Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
d18f317b
Commit
d18f317b
authored
Jun 13, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use semicolon as separator instead of komma for excel auto column split
parent
6a72ef72
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
SendCcasTransactionsExportToPrestatairesCommand.php
...mmand/SendCcasTransactionsExportToPrestatairesCommand.php
+11
-6
No files found.
src/Command/SendCcasTransactionsExportToPrestatairesCommand.php
View file @
d18f317b
...
@@ -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"
,
"Num
e
ro 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
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment