Debug FEC model export

This commit is contained in:
Alexandre SPANGARO 2018-10-14 06:16:14 +02:00
parent 8779d3043f
commit d9e1312924
2 changed files with 38 additions and 8 deletions

View File

@ -651,19 +651,39 @@ class AccountancyExport
*/
public function exportFEC($objectLines)
{
$separator = ';';
$separator = "\t";
$end_line = "\n";
print "JournalCode" . $separator;
print "JournalLib" . $separator;
print "EcritureNum" . $separator;
print "EcritureDate" . $separator;
print "CompteNum" . $separator;
print "CompteLib" . $separator;
print "CompAuxNum" . $separator;
print "CompAuxLib" . $separator;
print "PieceRef" . $separator;
print "PieceDate" . $separator;
print "EcritureLib" . $separator;
print "Debit" . $separator;
print "Credit" . $separator;
print "EcritureLet" . $separator;
print "DateLet" . $separator;
print "ValidDate" . $separator;
print "Montantdevise" . $separator;
print "Idevise";
print $end_line;
foreach ( $objectLines as $line ) {
$date_creation = dol_print_date($line->date_creation, '%d%m%Y');
$date_doc = dol_print_date($line->doc_date, '%d%m%Y');
$date_valid = dol_print_date($line->date_validated, '%d%m%Y');
// FEC:JournalCode
print $line->code_journal;
print $line->code_journal . $separator;
// FEC:JournalLib
print $line->journal_label;
print $line->journal_label . $separator;
// FEC:EcritureNum
print $line->piece_num . $separator;
@ -693,10 +713,10 @@ class AccountancyExport
print $line->label_operation . $separator;
// FEC:Debit
print price($line->debit) . $separator;
print price2num($line->debit) . $separator;
// FEC:Credit
print price($line->credit) . $separator;
print price2num($line->credit) . $separator;
// FEC:EcritureLet
print $line->lettering_code . $separator;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
/* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,11 +27,21 @@ $code = $conf->global->MAIN_INFO_ACCOUNTANT_CODE;
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
$siren = $conf->global->MAIN_INFO_SIREN;
$date_export = "_" . dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
header('Content-Type: text/csv');
$completefilename = ($code?$code . "_":"") . ($prefix?$prefix . "_":"") . $filename . ($nodateexport?"":$date_export) . "." . $format;
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11") // Specific filename for FEC model export
{
$completefilename = $siren . "FEC" . $search_date_end . $endaccountingperiod . "." . $format;
}
else
{
$completefilename = ($code?$code . "_":"") . ($prefix?$prefix . "_":"") . $filename . ($nodateexport?"":$date_export) . "." . $format;
}
header('Content-Disposition: attachment;filename=' . $completefilename);