Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2019-10-11 16:10:21 +02:00
commit 520a2652e1
2 changed files with 124 additions and 82 deletions

View File

@ -926,91 +926,131 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportLDCompta($objectLines) public function exportLDCompta($objectLines)
{ {
$separator = ';'; $separator = ';';
$end_line = "\n"; $end_line = "\r\n";
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date_document = dol_print_date($line->doc_date, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
// TYPE // TYPE
$type_enregistrement = 'E'; // For write movement $type_enregistrement = 'E'; // For write movement
print $type_enregistrement . $separator; print $type_enregistrement . $separator;
// JNAL // JNAL
print substr($line->code_journal, 0, 2) . $separator; print substr($line->code_journal, 0, 2) . $separator;
// NECR // NECR
print $line->id . $separator; print $line->id . $separator;
// NPIE // NPIE
print $line->piece_num . $separator; print $line->piece_num . $separator;
// DATP // DATP
print $date_document . $separator; print $date_document . $separator;
// LIBE // LIBE
print $line->label_operation . $separator; print $line->label_operation . $separator;
// DATH // DATH
print $line->date_lim_reglement . $separator; print $line->date_lim_reglement . $separator;
// CNPI // CNPI
if ($line->doc_type == 'supplier_invoice') { if ($line->doc_type == 'supplier_invoice') {
if ($line->montant < 0) { if ($line->montant < 0) {
$nature_piece = 'AF'; $nature_piece = 'AF';
} else { } else {
$nature_piece = 'FF'; $nature_piece = 'FF';
} }
} elseif ($line->doc_type == 'customer_invoice') { } elseif ($line->doc_type == 'customer_invoice') {
if ($line->montant < 0) { if ($line->montant < 0) {
$nature_piece = 'AC'; $nature_piece = 'AC';
} else { } else {
$nature_piece = 'FC'; $nature_piece = 'FC';
} }
} else { } else {
$nature_piece = ''; $nature_piece = '';
} }
print $nature_piece . $separator; print $nature_piece . $separator;
// RACI // RACI
/* /*
if (! empty($line->subledger_account)) { if (! empty($line->subledger_account)) {
if ($line->doc_type == 'supplier_invoice') { if ($line->doc_type == 'supplier_invoice') {
$racine_subledger_account = '40'; $racine_subledger_account = '40';
} elseif ($line->doc_type == 'customer_invoice') { } elseif ($line->doc_type == 'customer_invoice') {
$racine_subledger_account = '41'; $racine_subledger_account = '41';
} else { } else {
$nature_piece = ''; $nature_piece = '';
} }
print $racine_subledger_account . $separator; print $racine_subledger_account . $separator;
} else { } else {
print $separator; print $separator;
} }
*/ */
// MONT print $separator; // deprecated CPTG & CPTA use instead
print price(abs($line->montant)) . $separator; // MONT
// CODC print price(abs($line->montant), 0, '', 1, 2) . $separator;
print $line->sens . $separator; // CODC
// CPTG print $line->sens . $separator;
print length_accountg($line->numero_compte) . $separator; // CPTG
// DATE print length_accountg($line->numero_compte) . $separator;
print $date_creation . $separator; // DATE
// CLET print $date_creation . $separator;
print $line->lettering_code . $separator; // CLET
// DATL print $line->lettering_code . $separator;
print $line->date_lettering . $separator; // DATL
// CPTA print $line->date_lettering . $separator;
if (! empty($line->subledger_account)) { // CPTA
print length_accounta($line->subledger_account) . $separator; if (! empty($line->subledger_account)) {
} print length_accounta($line->subledger_account) . $separator;
// CNAT } else {
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) { print $separator;
print 'F'; }
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) { // CNAT
print 'C'; if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
} else { print 'F' . $separator;
print ''; } elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
} print 'C' . $separator;
print $end_line; } else {
} print $separator;
} }
// SECT
print $separator;
// CTRE
print $separator;
// NORL
print $separator;
// DATV
print $separator;
// REFD
print $line->doc_ref . $separator;
// CODH
print $separator;
// NSEQ
print $separator;
// MTDV
print '0' . $separator;
// CODV
print $separator;
// TXDV
print '0' . $separator;
// MOPM
print $separator;
// BONP
print $separator;
// BQAF
print $separator;
// ECES
print $separator;
// TXTL
print $separator;
// ECRM
print $separator;
// DATK
print $separator;
// HEUK
print $separator;
print $end_line;
}
}
/** /**
* Export format : Charlemagne * Export format : Charlemagne

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -82,6 +82,8 @@ class box_factures_imp extends ModeleBoxes
$facturestatic = new Facture($this->db); $facturestatic = new Facture($this->db);
$societestatic = new Societe($this->db); $societestatic = new Societe($this->db);
$langs->load("bills");
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max));
if ($user->rights->facture->lire) if ($user->rights->facture->lire)