dolibarr  9.0.0
accountancyexport.class.php
Go to the documentation of this file.
1 <?php
2 /*
3  * Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
6  * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
7  * Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
8  * Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@zendsi.com>
9  * Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
10  * Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
11  * Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
12 
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  */
27 
40 require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
41 
43 {
47  public static $EXPORT_TYPE_NORMAL = 1; // CSV
48  public static $EXPORT_TYPE_CONFIGURABLE = 10; // CSV
49  public static $EXPORT_TYPE_CEGID = 2;
50  public static $EXPORT_TYPE_COALA = 3;
51  public static $EXPORT_TYPE_BOB50 = 4;
52  public static $EXPORT_TYPE_CIEL = 5;
53  public static $EXPORT_TYPE_QUADRATUS = 6;
54  public static $EXPORT_TYPE_EBP = 7;
55  public static $EXPORT_TYPE_COGILOG = 8;
56  public static $EXPORT_TYPE_AGIRIS = 9;
57  public static $EXPORT_TYPE_FEC = 11;
58 
59 
63  public $errors = array();
64 
69  public $separator = '';
70 
75  public $end_line = '';
76 
82  public function __construct(DoliDB &$db)
83  {
84  global $conf;
85 
86  $this->db = &$db;
87  $this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
88  $this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?"\n":($conf->global->ACCOUNTING_EXPORT_ENDLINE==1?"\n":"\r\n");
89  }
90 
96  public static function getType()
97  {
98  global $langs;
99 
100  return array (
101  //self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
102  self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
103  self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
104  self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
105  self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
106  self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
107  self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
108  self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
109  self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
110  self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
111  self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
112  );
113  }
114 
121  private static function getFormatCode($type)
122  {
123  $formatcode = array (
124  //self::$EXPORT_TYPE_NORMAL => 'csv',
125  self::$EXPORT_TYPE_CONFIGURABLE => 'csv',
126  self::$EXPORT_TYPE_CEGID => 'cegid',
127  self::$EXPORT_TYPE_COALA => 'coala',
128  self::$EXPORT_TYPE_BOB50 => 'bob50',
129  self::$EXPORT_TYPE_CIEL => 'ciel',
130  self::$EXPORT_TYPE_QUADRATUS => 'quadratus',
131  self::$EXPORT_TYPE_EBP => 'ebp',
132  self::$EXPORT_TYPE_COGILOG => 'cogilog',
133  self::$EXPORT_TYPE_AGIRIS => 'agiris',
134  self::$EXPORT_TYPE_FEC => 'fec',
135  );
136 
137  return $formatcode[$type];
138  }
139 
145  public static function getTypeConfig()
146  {
147  global $conf, $langs;
148 
149  return array (
150  'param' => array(
151  /*self::$EXPORT_TYPE_NORMAL => array(
152  'label' => $langs->trans('Modelcsv_normal'),
153  'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
154  'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
155  'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
156  'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
157  ),*/
158  self::$EXPORT_TYPE_CEGID => array(
159  'label' => $langs->trans('Modelcsv_CEGID'),
160  ),
161  self::$EXPORT_TYPE_COALA => array(
162  'label' => $langs->trans('Modelcsv_COALA'),
163  ),
164  self::$EXPORT_TYPE_BOB50 => array(
165  'label' => $langs->trans('Modelcsv_bob50'),
166  ),
167  self::$EXPORT_TYPE_CIEL => array(
168  'label' => $langs->trans('Modelcsv_ciel'),
169  'ACCOUNTING_EXPORT_FORMAT' => 'txt',
170  ),
171  self::$EXPORT_TYPE_QUADRATUS => array(
172  'label' => $langs->trans('Modelcsv_quadratus'),
173  'ACCOUNTING_EXPORT_FORMAT' => 'txt',
174  ),
175  self::$EXPORT_TYPE_EBP => array(
176  'label' => $langs->trans('Modelcsv_ebp'),
177  ),
178  self::$EXPORT_TYPE_COGILOG => array(
179  'label' => $langs->trans('Modelcsv_cogilog'),
180  ),
181  self::$EXPORT_TYPE_AGIRIS => array(
182  'label' => $langs->trans('Modelcsv_agiris'),
183  ),
184  self::$EXPORT_TYPE_CONFIGURABLE => array(
185  'label' => $langs->trans('Modelcsv_configurable'),
186  'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
187  'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
188  'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
189  'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
190  ),
191  self::$EXPORT_TYPE_FEC => array(
192  'label' => $langs->trans('Modelcsv_FEC'),
193  'ACCOUNTING_EXPORT_FORMAT' => 'txt',
194  ),
195  ),
196  'cr'=> array (
197  '1' => $langs->trans("Unix"),
198  '2' => $langs->trans("Windows")
199  ),
200  'format' => array (
201  'csv' => $langs->trans("csv"),
202  'txt' => $langs->trans("txt")
203  ),
204  );
205  }
206 
207 
214  public function export(&$TData)
215  {
216  global $conf, $langs;
217  global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
218 
219  // Define name of file to save
220  $filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV);
221  $type_export = 'general_ledger';
222 
223  include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
224 
225 
226  switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) {
227  case self::$EXPORT_TYPE_NORMAL :
228  case self::$EXPORT_TYPE_CONFIGURABLE :
229  $this->exportConfigurable($TData);
230  break;
231  case self::$EXPORT_TYPE_NORMAL :
232  case self::$EXPORT_TYPE_CEGID :
233  $this->exportCegid($TData);
234  break;
235  case self::$EXPORT_TYPE_COALA :
236  $this->exportCoala($TData);
237  break;
238  case self::$EXPORT_TYPE_BOB50 :
239  $this->exportBob50($TData);
240  break;
241  case self::$EXPORT_TYPE_CIEL :
242  $this->exportCiel($TData);
243  break;
244  case self::$EXPORT_TYPE_QUADRATUS :
245  $this->exportQuadratus($TData);
246  break;
247  case self::$EXPORT_TYPE_EBP :
248  $this->exportEbp($TData);
249  break;
250  case self::$EXPORT_TYPE_COGILOG :
251  $this->exportCogilog($TData);
252  break;
253  case self::$EXPORT_TYPE_AGIRIS :
254  $this->exportAgiris($TData);
255  break;
256  case self::$EXPORT_TYPE_FEC :
257  $this->exportFEC($TData);
258  break;
259  default:
260  $this->errors[] = $langs->trans('accountancy_error_modelnotfound');
261  break;
262  }
263  }
264 
265 
273  public function exportCegid($objectLines)
274  {
275  foreach ( $objectLines as $line ) {
276  $date = dol_print_date($line->doc_date, '%d%m%Y');
277  $separator = ";";
278  $end_line = "\n";
279 
280  print $date . $separator;
281  print $line->code_journal . $separator;
282  print length_accountg($line->numero_compte) . $separator;
283  print length_accounta($line->subledger_account) . $separator;
284  print $line->sens . $separator;
285  print price($line->montant) . $separator;
286  print $line->label_operation . $separator;
287  print $line->doc_ref;
288  print $end_line;
289  }
290  }
291 
299  public function exportCogilog($objectLines)
300  {
301  foreach ( $objectLines as $line ) {
302  $date = dol_print_date($line->doc_date, '%d%m%Y');
303  $separator = ";";
304  $end_line = "\n";
305 
306  print $line->code_journal . $separator;
307  print $date . $separator;
308  print $line->piece_num . $separator;
309  print length_accountg($line->numero_compte) . $separator;
310  print '' . $separator;
311  print $line->label_operation . $separator;
312  print $date . $separator;
313  if ($line->sens=='D') {
314  print price($line->montant) . $separator;
315  print '' . $separator;
316  }elseif ($line->sens=='C') {
317  print '' . $separator;
318  print price($line->montant) . $separator;
319  }
320  print $line->doc_ref . $separator;
321  print $line->label_operation . $separator;
322  print $end_line;
323  }
324  }
325 
333  public function exportCoala($objectLines)
334  {
335  // Coala export
336  $separator = ";";
337  $end_line = "\n";
338 
339  foreach ( $objectLines as $line ) {
340  $date = dol_print_date($line->doc_date, '%d/%m/%Y');
341  print $date . $separator;
342  print $line->code_journal . $separator;
343  print length_accountg($line->numero_compte) . $separator;
344  print $line->piece_num . $separator;
345  print $line->doc_ref . $separator;
346  print price($line->debit) . $separator;
347  print price($line->credit) . $separator;
348  print 'E' . $separator;
349  print length_accountg($line->subledger_account) . $separator;
350  print $end_line;
351  }
352  }
353 
361  public function exportBob50($objectLines)
362  {
363 
364  // Bob50
365  $separator = ";";
366  $end_line = "\n";
367 
368  foreach ( $objectLines as $line ) {
369  print $line->piece_num . $separator;
370  $date = dol_print_date($line->doc_date, '%d/%m/%Y');
371  print $date . $separator;
372 
373  if (empty($line->subledger_account)) {
374  print 'G' . $separator;
375  print length_accounta($line->numero_compte) . $separator;
376  } else {
377  if (substr($line->numero_compte, 0, 3) == '411') {
378  print 'C' . $separator;
379  }
380  if (substr($line->numero_compte, 0, 3) == '401') {
381  print 'F' . $separator;
382  }
383  print length_accountg($line->subledger_account) . $separator;
384  }
385 
386  print price($line->debit) . $separator;
387  print price($line->credit) . $separator;
388  print dol_trunc($line->label_operation, 32) . $separator;
389  print $end_line;
390  }
391  }
392 
400  public function exportCiel(&$TData)
401  {
402  global $conf;
403 
404  $end_line ="\r\n";
405 
406  $i = 1;
407  $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
408  foreach ( $TData as $data ) {
409  $code_compta = $data->numero_compte;
410  if (! empty($data->subledger_account))
411  $code_compta = $data->subledger_account;
412 
413  $Tab = array ();
414  $Tab['num_ecriture'] = str_pad($i, 5);
415  $Tab['code_journal'] = str_pad($data->code_journal, 2);
416  $Tab['date_ecriture'] = $date_ecriture;
417  $Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
418  $Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
419  $Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
420  $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . dol_string_unaccent($data->label_operation), 25), 25);
421  $Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
422  $Tab['type_montant'] = str_pad($data->sens, 1);
423  $Tab['vide'] = str_repeat(' ', 18);
424  $Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
425  $Tab['end'] = 'O2003';
426 
427  $Tab['end_line'] = $end_line;
428 
429  print implode($Tab);
430  $i ++;
431  }
432  }
433 
441  public function exportQuadratus(&$TData)
442  {
443  global $conf;
444 
445  $end_line ="\r\n";
446 
447  //We should use dol_now function not time however this is wrong date to transfert in accounting
448  //$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
449  //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
450  foreach ( $TData as $data ) {
451  $code_compta = $data->numero_compte;
452  if (! empty($data->subledger_account))
453  $code_compta = $data->subledger_account;
454 
455  $Tab = array ();
456  $Tab['type_ligne'] = 'M';
457  $Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
458  $Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
459  $Tab['folio'] = '000';
460 
461  //We use invoice date $data->doc_date not $date_ecriture which is the transfert date
462  //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
463  //$Tab['date_ecriture'] = $date_ecriture;
464  $Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
465  $Tab['filler'] = ' ';
466  $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 20), 20);
467  $Tab['sens'] = $data->sens; // C or D
468  $Tab['signe_montant'] = '+';
469 
470  //elarifr le montant doit etre en centimes sans point decimal !
471  $Tab['montant'] = str_pad(abs($data->montant*100), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
472  // $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
473  $Tab['contrepartie'] = str_repeat(' ', 8);
474 
475  // elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
476  if (! empty($data->date_echeance))
477  //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
478  $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y' ); // elarifr: format must be ddmmyy
479  else
480  $Tab['date_echeance'] = '000000';
481 
482  //elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5)
483  //$Tab['lettrage'] = str_repeat(' ', 5);
484  $Tab['lettrage'] = str_repeat(' ', 2);
485  $Tab['codestat'] = str_repeat(' ', 3);
486  $Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
487 
488  //elarifr keep correct quadra named field instead of anon filler
489  //$Tab['filler2'] = str_repeat(' ', 20);
490  $Tab['affaire'] = str_repeat(' ', 10);
491  $Tab['quantity1'] = str_repeat(' ', 10);
492  $Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
493  $Tab['devis'] = str_pad($conf->currency, 3);
494  $Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
495  $Tab['filler3'] = str_repeat(' ', 3);
496 
497  //elarifr keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!!
498  //as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec
499  //todo we should filter more than only accent to avoid wrong line size
500  //TODO: remove invoice number doc_ref in libelle,
501  //TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
502  //$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30);
503  $Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30);
504  $Tab['codetva'] = str_repeat(' ', 2);
505 
506  //elarifr we need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
507  //$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
508  $Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10);
509  $Tab['filler4'] = str_repeat(' ', 73);
510 
511  $Tab['end_line'] = $end_line;
512 
513  print implode($Tab);
514  }
515  }
516 
517 
525  public function exportEbp($objectLines)
526  {
527 
528  $separator = ',';
529  $end_line = "\n";
530 
531  foreach ( $objectLines as $line ) {
532 
533  $date = dol_print_date($line->doc_date, '%d%m%Y');
534 
535  print $line->id . $separator;
536  print $date . $separator;
537  print $line->code_journal . $separator;
538  print length_accountg($line->numero_compte) . $separator;
539  print substr(length_accountg($line->numero_compte),0,2) . $separator;
540  print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $separator;
541  print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$separator;
542  print price2num($line->montant).$separator;
543  print $line->sens.$separator;
544  print $date . $separator;
545  print 'EUR';
546  print $end_line;
547  }
548  }
549 
550 
558  public function exportAgiris($objectLines)
559  {
560 
561  $separator = ';';
562  $end_line = "\n";
563 
564  foreach ( $objectLines as $line ) {
565 
566  $date = dol_print_date($line->doc_date, '%d%m%Y');
567 
568  print $line->piece_num . $separator;
569  print $line->label_operation . $separator;
570  print $date . $separator;
571  print $line->label_operation . $separator;
572 
573  if (empty($line->subledger_account)) {
574  print length_accountg($line->numero_compte) . $separator;
575  print $line->label_compte . $separator;
576  } else {
577  print length_accounta($line->subledger_account) . $separator;
578  print $line->subledger_label . $separator;
579  }
580 
581  print $line->doc_ref . $separator;
582  print price($line->debit) . $separator;
583  print price($line->credit) . $separator;
584  print price($line->montant) . $separator;
585  print $line->sens . $separator;
586  print $line->lettering_code . $separator;
587  print $line->code_journal;
588  print $end_line;
589  }
590  }
591 
599  public function exportConfigurable($objectLines)
600  {
601  global $conf;
602 
603  foreach ($objectLines as $line) {
604  $tab = array();
605  // export configurable
606  $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
607  $tab[] = $line->piece_num;
608  $tab[] = $date;
609  $tab[] = $line->doc_ref;
610  $tab[] = $line->label_operation;
611  $tab[] = length_accountg($line->numero_compte);
612  $tab[] = length_accounta($line->subledger_account);
613  $tab[] = price($line->debit);
614  $tab[] = price($line->credit);
615  $tab[] = price($line->montant);
616  $tab[] = $line->code_journal;
617 
618  $separator = $this->separator;
619  print implode($separator, $tab) . $this->end_line;
620  }
621  }
622 
630  public function exportFEC($objectLines)
631  {
632  $separator = "\t";
633  $end_line = "\n";
634 
635  print "JournalCode" . $separator;
636  print "JournalLib" . $separator;
637  print "EcritureNum" . $separator;
638  print "EcritureDate" . $separator;
639  print "CompteNum" . $separator;
640  print "CompteLib" . $separator;
641  print "CompAuxNum" . $separator;
642  print "CompAuxLib" . $separator;
643  print "PieceRef" . $separator;
644  print "PieceDate" . $separator;
645  print "EcritureLib" . $separator;
646  print "Debit" . $separator;
647  print "Credit" . $separator;
648  print "EcritureLet" . $separator;
649  print "DateLet" . $separator;
650  print "ValidDate" . $separator;
651  print "Montantdevise" . $separator;
652  print "Idevise";
653  print $end_line;
654 
655  foreach ( $objectLines as $line ) {
656  $date_creation = dol_print_date($line->date_creation, '%d%m%Y');
657  $date_doc = dol_print_date($line->doc_date, '%d%m%Y');
658  $date_valid = dol_print_date($line->date_validated, '%d%m%Y');
659 
660  // FEC:JournalCode
661  print $line->code_journal . $separator;
662 
663  // FEC:JournalLib
664  print $line->journal_label . $separator;
665 
666  // FEC:EcritureNum
667  print $line->piece_num . $separator;
668 
669  // FEC:EcritureDate
670  print $date_creation . $separator;
671 
672  // FEC:CompteNum
673  print $line->numero_compte . $separator;
674 
675  // FEC:CompteLib
676  print $line->label_compte . $separator;
677 
678  // FEC:CompAuxNum
679  print $line->subledger_account . $separator;
680 
681  // FEC:CompAuxLib
682  print $line->subledger_label . $separator;
683 
684  // FEC:PieceRef
685  print $line->doc_ref . $separator;
686 
687  // FEC:PieceDate
688  print $date_doc . $separator;
689 
690  // FEC:EcritureLib
691  print $line->label_operation . $separator;
692 
693  // FEC:Debit
694  print price2num($line->debit) . $separator;
695 
696  // FEC:Credit
697  print price2num($line->credit) . $separator;
698 
699  // FEC:EcritureLet
700  print $line->lettering_code . $separator;
701 
702  // FEC:DateLet
703  print $line->date_lettering . $separator;
704 
705  // FEC:ValidDate
706  print $date_valid . $separator;
707 
708  // FEC:Montantdevise
709  print $line->multicurrency_amount . $separator;
710 
711  // FEC:Idevise
712  print $line->multicurrency_code;
713 
714  print $end_line;
715  }
716  }
717 
724  public static function trunc($str, $size)
725  {
726  return dol_trunc($str, $size, 'right', 'UTF-8', 1);
727  }
728 }
static getFormatCode($type)
Return string to summarize the format (Used to generated export filename)
print
Draft customers invoices.
Definition: index.php:91
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding &#39;...&#39; if string larger than length.
static getTypeConfig()
Array with all export type available (key + label) and parameters for config.
Class to manage Dolibarr database access.
static trunc($str, $size)
__construct(DoliDB &$db)
Constructor.
exportCoala($objectLines)
Export format : COALA.
exportBob50($objectLines)
Export format : BOB50.
exportCogilog($objectLines)
Export format : COGILOG.
static getType()
Array with all export type available (key + label)
exportQuadratus(&$TData)
Export format : Quadratus.
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
exportAgiris($objectLines)
Export format : Agiris Isacompta.
dol_string_unaccent($str)
Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName.
dol_now($mode='gmt')
Return date for now.
exportCegid($objectLines)
Export format : CEGID.
exportConfigurable($objectLines)
Export format : Configurable.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
exportFEC($objectLines)
Export format : FEC.
Class AccountancyExport.
exportCiel(&$TData)
Export format : CIEL.
exportEbp($objectLines)
Export format : EBP.
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous) ...
export(&$TData)
Function who chose which export to use with the default config, and make the export into a file...
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is &#39;...