Update LDCompta Export

This commit is contained in:
Alexandre SPANGARO 2023-04-29 08:10:23 +02:00
parent 383bc8a4a7
commit cb7d59dd1a

View File

@ -1711,10 +1711,10 @@ class AccountancyExport
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf
* *
* @param array $objectLines data * @param array $objectLines data
* * @param resource $exportFile [=null] File resource to export or print if null
* @return void * @return void
*/ */
public function exportLDCompta($objectLines) public function exportLDCompta($objectLines, $exportFile = null)
{ {
$separator = ';'; $separator = ';';
@ -1725,21 +1725,23 @@ class AccountancyExport
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_lim_reglement = dol_print_date($line->date_lim_reglement, '%Y%m%d'); $date_lim_reglement = dol_print_date($line->date_lim_reglement, '%Y%m%d');
$tab = array();
// TYPE // TYPE
$type_enregistrement = 'E'; // For write movement $type_enregistrement = 'E'; // For write movement
print $type_enregistrement.$separator; $tab[] = $type_enregistrement;
// JNAL // JNAL
print substr($line->code_journal, 0, 2).$separator; $tab[] = substr($line->code_journal, 0, 2);
// NECR // NECR
print $line->id.$separator; $tab[] = $line->id;
// NPIE // NPIE
print $line->piece_num.$separator; $tab[] = $line->piece_num;
// DATP // DATP
print $date_document.$separator; $tab[] = $date_document;
// LIBE // LIBE
print $line->label_operation.$separator; $tab[] = $line->label_operation;
// DATH // DATH
print $date_lim_reglement.$separator; $tab[] = $date_lim_reglement;
// CNPI // CNPI
if ($line->doc_type == 'supplier_invoice') { if ($line->doc_type == 'supplier_invoice') {
if (($line->debit - $line->credit) > 0) { if (($line->debit - $line->credit) > 0) {
@ -1756,7 +1758,7 @@ class AccountancyExport
} else { } else {
$nature_piece = ''; $nature_piece = '';
} }
print $nature_piece.$separator; $tab[] = $nature_piece;
// RACI // RACI
// if (!empty($line->subledger_account)) { // if (!empty($line->subledger_account)) {
// if ($line->doc_type == 'supplier_invoice') { // if ($line->doc_type == 'supplier_invoice') {
@ -1770,71 +1772,76 @@ class AccountancyExport
$racine_subledger_account = ''; // for records of type E leave this field blank $racine_subledger_account = ''; // for records of type E leave this field blank
// } // }
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead $tab[] = $racine_subledger_account; // deprecated CPTG & CPTA use instead
// MONT // MONT
print price(abs($line->debit - $line->credit), 0, '', 1, 2, 2).$separator; $tab[] = price(abs($line->debit - $line->credit), 0, '', 1, 2, 2);
// CODC // CODC
print $line->sens.$separator; $tab[] = $line->sens;
// CPTG // CPTG
print length_accountg($line->numero_compte).$separator; $tab[] = length_accountg($line->numero_compte);
// DATE // DATE
print $date_creation.$separator; $tab[] = $date_creation;
// CLET // CLET
print $line->lettering_code.$separator; $tab[] = $line->lettering_code;
// DATL // DATL
print $line->date_lettering.$separator; $tab[] = $line->date_lettering;
// CPTA // CPTA
if (!empty($line->subledger_account)) { if (!empty($line->subledger_account)) {
print length_accounta($line->subledger_account).$separator; $tab[] = length_accounta($line->subledger_account);
} else { } else {
print $separator; $tab[] = "";
} }
// CNAT // CNAT
if ($line->doc_type == 'supplier_invoice' && !empty($line->subledger_account)) { if ($line->doc_type == 'supplier_invoice' && !empty($line->subledger_account)) {
print 'F'.$separator; $tab[] = 'F';
} elseif ($line->doc_type == 'customer_invoice' && !empty($line->subledger_account)) { } elseif ($line->doc_type == 'customer_invoice' && !empty($line->subledger_account)) {
print 'C'.$separator; $tab[] = 'C';
} else { } else {
print $separator; $tab[] = "";
} }
// SECT // SECT
print $separator; $tab[] = "";
// CTRE // CTRE
print $separator; $tab[] = "";
// NORL // NORL
print $separator; $tab[] = "";
// DATV // DATV
print $separator; $tab[] = "";
// REFD // REFD
print $line->doc_ref.$separator; $tab[] = $line->doc_ref;
// CODH // CODH
print $separator; $tab[] = "";
// NSEQ // NSEQ
print $separator; $tab[] = "";
// MTDV // MTDV
print '0'.$separator; $tab[] = '0';
// CODV // CODV
print $separator; $tab[] = "";
// TXDV // TXDV
print '0'.$separator; $tab[] = '0';
// MOPM // MOPM
print $separator; $tab[] = "";
// BONP // BONP
print $separator; $tab[] = "";
// BQAF // BQAF
print $separator; $tab[] = "";
// ECES // ECES
print $separator; $tab[] = "";
// TXTL // TXTL
print $separator; $tab[] = "";
// ECRM // ECRM
print $separator; $tab[] = "";
// DATK // DATK
print $separator; $tab[] = "";
// HEUK // HEUK
print $separator; $tab[] = "";
print $end_line; $output = implode($separator, $tab).$end_line;
if ($exportFile) {
fwrite($exportFile, $output);
} else {
print $output;
}
} }
} }