Merge pull request #12074 from aspangaro/11.0_LDcompta
Update new LDCompta export
This commit is contained in:
commit
112a074c82
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user