Merge pull request #22724 from aspangaro/14p42
FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format
This commit is contained in:
commit
f0b4cfc875
@ -657,9 +657,12 @@ class AccountancyExport
|
||||
|
||||
/**
|
||||
* Export format : WinFic - eWinfic - WinSis Compta
|
||||
* 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
|
||||
*
|
||||
* @param array $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportWinfic(&$TData)
|
||||
@ -667,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)) {
|
||||
@ -679,7 +686,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, '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 ?
|
||||
@ -688,11 +695,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($index, 6, 'right', 'UTF-8', 1), 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, 'right', 'UTF-8', 1), 6, '0');
|
||||
|
||||
if ($data->sens == 'D') {
|
||||
$Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
@ -704,11 +711,11 @@ 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, 'right', 'UTF-8', 1), 30);
|
||||
|
||||
$Tab['lettrage'] = str_repeat(' ', 2);
|
||||
$Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left', 'UTF-8', 1), 2);
|
||||
|
||||
$Tab['code_piece'] = str_repeat(' ', 5);
|
||||
$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);
|
||||
|
||||
@ -732,6 +739,8 @@ class AccountancyExport
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode('|', $Tab);
|
||||
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user