New : Add FEC Export in accountancy

This commit is contained in:
Alexandre SPANGARO 2018-10-08 21:01:21 +02:00
parent 08ca85e995
commit 75b9862c14
4 changed files with 143 additions and 51 deletions

View File

@ -54,6 +54,7 @@ class AccountancyExport
public static $EXPORT_TYPE_COGILOG = 8;
public static $EXPORT_TYPE_AGIRIS = 9;
public static $EXPORT_TYPE_CONFIGURABLE = 10;
public static $EXPORT_TYPE_FEC = 11;
/**
@ -107,6 +108,7 @@ class AccountancyExport
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
);
}
@ -161,6 +163,10 @@ class AccountancyExport
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
),
self::$EXPORT_TYPE_FEC => array(
'label' => $langs->trans('Modelcsv_FEC'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
),
'cr'=> array (
'1' => $langs->trans("Unix"),
@ -228,6 +234,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_CONFIGURABLE :
$this->exportConfigurable($TData);
break;
case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
@ -613,6 +622,80 @@ class AccountancyExport
}
}
/**
* Export format : FEC
*
* @param array $objectLines data
*
* @return void
*/
public function exportFEC($objectLines)
{
$separator = ';';
$end_line = "\n";
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;
// FEC:JournalLib
print $line->journal_label;
// FEC:EcritureNum
print $line->piece_num . $separator;
// FEC:EcritureDate
print $date_creation . $separator;
// FEC:CompteNum
print $line->numero_compte . $separator
// FEC:CompteLib
print $line->label_compte . $separator;
// FEC:CompAuxNum
print $line->subledger_account . $separator;
// FEC:CompAuxLib
print $line->subledger_label . $separator;
// FEC:PieceRef
print $line->doc_ref . $separator;
// FEC:PieceDate
print $date_doc . $separator;
// FEC:EcritureLib
print $line->label_operation . $separator;
// FEC:Debit
print price($line->debit) . $separator;
// FEC:Credit
print price($line->credit) . $separator;
// FEC:EcritureLet
print $line->lettering_code . $separator;
// FEC:DateLet
print $line->date_lettering . $separator;
// FEC:ValidDate
print $date_valid . $separator;
// FEC:Montantdevise
print $line->multicurrency_amount . $separator;
// FEC:Idevise
print $line->multicurrency_code;
print $end_line;
}
}
/**
*

View File

@ -718,6 +718,10 @@ class BookKeeping extends CommonObject
$sql .= " t.credit,";
$sql .= " t.montant,";
$sql .= " t.sens,";
$sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
$sql .= " t.code_journal,";
@ -786,6 +790,10 @@ class BookKeeping extends CommonObject
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering;
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;

View File

@ -22,8 +22,8 @@ CREATE TABLE llx_accounting_bookkeeping
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- | multi company id
doc_date date NOT NULL, -- FEC:PieceDate
doc_type varchar(30) NOT NULL, -- FEC:PieceRef | facture_client/reglement_client/facture_fournisseur/reglement_fournisseur
doc_ref varchar(300) NOT NULL, -- | facture_client/reglement_client/... reference number
doc_type varchar(30) NOT NULL, -- | facture_client/reglement_client/facture_fournisseur/reglement_fournisseur
doc_ref varchar(300) NOT NULL, -- FEC:PieceRef | facture_client/reglement_client/... reference number
fk_doc integer NOT NULL, -- | facture_client/reglement_client/... rowid
fk_docdet integer NOT NULL, -- | facture_client/reglement_client/... line rowid
thirdparty_code varchar(32), -- Third party code (customer or supplier) when record is saved (may help debug)

View File

@ -263,6 +263,7 @@ Modelcsv_ebp=Export towards EBP
Modelcsv_cogilog=Export towards Cogilog
Modelcsv_agiris=Export towards Agiris
Modelcsv_configurable=Export Configurable
Modelcsv_FEC=Export FEC (Art. L47 A) (Test)
ChartofaccountsId=Chart of accounts Id
## Tools - Init accounting account on product / service