From f45f3740e2aa1517938bb62bb4e472ff45dfaf23 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 28 Oct 2022 08:10:39 +0200 Subject: [PATCH 1/3] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- .../accountancy/class/accountancyexport.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index ec24af642fd..db58cb2ccbc 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -657,9 +657,12 @@ class AccountancyExport /** * Export format : WinFic - eWinfic - WinSis Compta + * Last review for this format : 2022-10-28 Alexandre Spangaro (aspangaro@open-dsi.fr) * + * Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf * * @param array $TData data + * * @return void */ public function exportWinfic(&$TData) @@ -679,7 +682,7 @@ class AccountancyExport $Tab = array(); //$Tab['type_ligne'] = 'M'; - $Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2); + $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2), 2); //We use invoice date $data->doc_date not $date_ecriture which is the transfert date //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ? @@ -688,11 +691,11 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); - $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); + $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6), 6, '0'); if ($data->sens == 'D') { $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -704,9 +707,9 @@ class AccountancyExport $Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } - $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); + $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); - $Tab['lettrage'] = str_repeat(' ', 2); + $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); $Tab['code_piece'] = str_repeat(' ', 5); From 4bd9bdaccd509172cf7b483e6eefde78acf42338 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Nov 2022 07:56:24 +0100 Subject: [PATCH 2/3] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- .../class/accountancyexport.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index db58cb2ccbc..022a8ecd3c0 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -657,7 +657,7 @@ class AccountancyExport /** * Export format : WinFic - eWinfic - WinSis Compta - * Last review for this format : 2022-10-28 Alexandre Spangaro (aspangaro@open-dsi.fr) + * Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr) * * Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf * @@ -670,10 +670,14 @@ class AccountancyExport global $conf; $end_line = "\r\n"; + $index = 1; //We should use dol_now function not time however this is wrong date to transfert in accounting //$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy + + // Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted + foreach ($TData as $data) { $code_compta = $data->numero_compte; if (!empty($data->subledger_account)) { @@ -691,11 +695,11 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(dol_trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); - $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6), 6, '0'); + $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6, 'right', 'UTF-8', 1), 6, '0'); if ($data->sens == 'D') { $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -707,11 +711,11 @@ class AccountancyExport $Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } - $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); + $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30); $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); - $Tab['code_piece'] = str_repeat(' ', 5); + $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5), 5, ' ', STR_PAD_LEFT); $Tab['code_stat'] = str_repeat(' ', 4); @@ -735,6 +739,8 @@ class AccountancyExport $Tab['end_line'] = $end_line; print implode('|', $Tab); + + $index++; } } From d3d55240f911cbf98878e935dd107b02ea8952da Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Nov 2022 08:00:37 +0100 Subject: [PATCH 3/3] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- htdocs/accountancy/class/accountancyexport.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 022a8ecd3c0..73035c55d5d 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -686,7 +686,7 @@ class AccountancyExport $Tab = array(); //$Tab['type_ligne'] = 'M'; - $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2), 2); + $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2, 'right', 'UTF-8', 1), 2); //We use invoice date $data->doc_date not $date_ecriture which is the transfert date //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ? @@ -695,7 +695,7 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6, 'right', 'UTF-8', 1), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); @@ -713,9 +713,9 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30); - $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); + $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left', 'UTF-8', 1), 2); - $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5), 5, ' ', STR_PAD_LEFT); + $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5, 'left', 'UTF-8', 1), 5, ' ', STR_PAD_LEFT); $Tab['code_stat'] = str_repeat(' ', 4);