mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 16:42:53 +01:00
FIX: FEC export format
This commit is contained in:
@@ -658,9 +658,9 @@ class AccountancyExport
|
||||
print $end_line;
|
||||
|
||||
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');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_doc = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_valid = dol_print_date($line->date_validated, '%Y%m%d');
|
||||
|
||||
// FEC:JournalCode
|
||||
print $line->code_journal . $separator;
|
||||
@@ -696,10 +696,10 @@ class AccountancyExport
|
||||
print $line->label_operation . $separator;
|
||||
|
||||
// FEC:Debit
|
||||
print price2num($line->debit) . $separator;
|
||||
print price2fec($line->debit) . $separator;
|
||||
|
||||
// FEC:Credit
|
||||
print price2num($line->credit) . $separator;
|
||||
print price2fec($line->credit) . $separator;
|
||||
|
||||
// FEC:EcritureLet
|
||||
print $line->lettering_code . $separator;
|
||||
|
||||
@@ -4523,6 +4523,35 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to format a value into a defined format for French administration (no thousand separator & decimal separator force to ',' with two decimals)
|
||||
* Function used into accountancy FEC export
|
||||
*
|
||||
* @param float $amount Amount to format
|
||||
* @return string Chain with formatted upright
|
||||
*
|
||||
* @see price2num() Revert function of price2fec
|
||||
*/
|
||||
function price2fec($amount)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Clean parameters
|
||||
if (empty($amount)) $amount=0; // To have a numeric value if amount not defined or = ''
|
||||
$amount = (is_numeric($amount)?$amount:0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number)
|
||||
|
||||
// Output decimal number by default (french)
|
||||
$nbdecimal= 2;
|
||||
|
||||
// Output separators by default (french)
|
||||
$dec=','; $thousand='';
|
||||
|
||||
// Format number
|
||||
$output=number_format($amount, $nbdecimal, $dec, $thousand);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a dimension with best unit
|
||||
|
||||
Reference in New Issue
Block a user