Debug v22

This commit is contained in:
ldestailleur 2025-07-25 15:41:57 +02:00
parent 493443182e
commit a27ff8b053
2 changed files with 16 additions and 10 deletions

View file

@ -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++;
}

View file

@ -42,6 +42,7 @@
* @var Form $form
* @var HookManager $hookmanager
* @var Translate $langs
* @var Conf $conf
* @var User $user
*/
@ -121,7 +122,7 @@ print '<th class="linecoluht right nowraponall">'.$langs->trans('PriceUHT').'</t
// Multicurrency
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
print '<th class="linecoluht_currency right" style="width: 80px">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</th>';
print '<th class="linecoluht_currency right" style="width: 80px">'.$langs->trans('PriceUTTC').' ('.$langs->getCurrencySymbol($this->multicurrency_code).')</th>';
}
if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
@ -210,7 +211,7 @@ print '<th class="linecolht right">'.$langs->trans('TotalHTShort').'</th>';
// Multicurrency
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
print '<th class="linecoltotalht_currency right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</th>';
print '<th class="linecoltotalht_currency right">'.$langs->trans('TotalHTShort').' ('.$langs->getCurrencySymbol($this->multicurrency_code).')</th>';
}
if ($outputalsopricetotalwithtax) {