From b9408baef3c286fc42a97c7b674d26f6a4aa2845 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 14:27:20 +0100 Subject: [PATCH] Fix if price net was not saved, we recalculate it at output --- htdocs/expensereport/card.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3c7253f9065..ff55935ea09 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2076,8 +2076,22 @@ else print ''; print ''.dol_escape_htmltag($line->comments).''; print ''.vatrate($line->vatrate, true).''; - print ''.price($line->value_unit_ht).''; + // Unit price HT + print ''; + if (! empty($line->value_unit_ht)) + { + print price($line->value_unit_ht); + } + else + { + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $line->vatrate)); + $pricenettoshow = price2num($line->value_unit / (1 + $tmpvat / 100), 'MU'); + print $pricenettoshow; + } + print ''; + print ''.price($line->value_unit).''; + print ''.dol_escape_htmltag($line->qty).''; if ($action != 'editline') @@ -2148,12 +2162,12 @@ else // Unit price print ''; - print ''; + print ''; print ''; // Unit price with tax print ''; - print ''; + print ''; print ''; // Quantity