diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index c8685c333a5..7da0aa70450 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1798,22 +1798,27 @@ class pdf_sponge extends ModelePDFFactures // Get Total HT $total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); - // Total remise - $total_line_remise = 0; + // Total discount + $total_discount_on_lines = 0; foreach ($object->lines as $i => $line) { $resdiscount = pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); - $total_line_remise += (is_numeric($resdiscount) ? $resdiscount : 0); - // Gestion remise sous forme de ligne négative + + $total_discount_on_lines += (is_numeric($resdiscount) ? $resdiscount : 0); + // If line was a negative line, we do not count the discount as a discount if ($line->total_ht < 0) { - $total_line_remise += -$line->total_ht; + $total_discount_on_lines += -$line->total_ht; } } - if ($total_line_remise > 0) { + $multicurrency_total_discount_on_lines = price2num($total_discount_on_lines * $object->multicurrency_tx, 'CT'); + + if ($total_discount_on_lines > 0) { $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', true); $pdf->SetXY($col2x, $tab2_top + $tab2_hl); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', true); + + $total_discount_to_show = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $multicurrency_total_discount_on_lines : $total_discount_on_lines); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_discount_to_show, 0, $outputlangs), 0, 'R', true); $index++; @@ -1822,7 +1827,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($col1x, $tab2_top); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', true); $pdf->SetXY($col2x, $tab2_top); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', true); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_discount_on_lines + $total_ht, 0, $outputlangs), 0, 'R', true); $index++; } diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 6bde80b6427..1f62e804b9b 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -42,6 +42,7 @@ * @var Form $form * @var HookManager $hookmanager * @var Translate $langs + * @var Conf $conf * @var User $user */ @@ -121,7 +122,7 @@ print ''.$langs->trans('PriceUHT').'multicurrency_code != $conf->currency) { - print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; + print ''.$langs->trans('PriceUTTC').' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; } if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { @@ -210,7 +211,7 @@ print ''.$langs->trans('TotalHTShort').''; // Multicurrency if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''; + print ''.$langs->trans('TotalHTShort').' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; } if ($outputalsopricetotalwithtax) {