Merge pull request #18417 from aspangaro/13p12

FIX #18389 Accountancy - Bug on LDcompta10 export for supplier invoice
This commit is contained in:
Laurent Destailleur 2021-08-17 01:09:06 +02:00 committed by GitHub
commit 7e1d4e1706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1296,7 +1296,9 @@ class AccountancyExport
/**
* Export format : LD Compta version 10 & higher
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
* Last review for this format : 08-15-2021 Alexandre Spangaro (aspangaro@open-dsi.fr)
*
* Help : http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
*
* @param array $objectLines data
*
@ -1460,14 +1462,14 @@ class AccountancyExport
print $date_lim_reglement.$separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if (($line->debit - $line->credit) > 0) {
if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign.
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
if (($line->debit - $line->credit) < 0) {
$nature_piece = 'AC';
if (($line->amount) < 0) {
$nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign.
} else {
$nature_piece = 'FC';
}