diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 91a5bb867b2a58f0157d96a2b9982bee430c989a..5aba1f7128111f185cd8e450992bae3b15521195 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -258,38 +258,32 @@ class pdf_propale_azur extends ModelePDFPropales if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs); - $pdf->SetXY ($this->posxtva, $curY); $pdf->MultiCell($this->posxup-$this->posxtva-1, 4, $vat_rate, 0, 'R'); } // Prix unitaire HT avant remise + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs); $pdf->SetXY ($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($object->lines[$i]->subprice), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-1, 4, $up_excl_tax, 0, 'R', 0); // Quantity + $qty = pdf_getlineqty($object, $i, $outputlangs); $pdf->SetXY ($this->posxqty, $curY); - if ($object->lines[$i]->special_code != 3) $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $object->lines[$i]->qty, 0, 'R'); + $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $qty, 0, 'R'); // Remise sur ligne $pdf->SetXY ($this->posxdiscount, $curY); - if ($object->lines[$i]->remise_percent && $object->lines[$i]->special_code != 3) + if ($object->lines[$i]->remise_percent) { - $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs), 0, 'R'); + $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs); + $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, $remise_percent, 0, 'R'); } // Total HT ligne + $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); $pdf->SetXY ($this->postotalht, $curY); - if ($object->lines[$i]->special_code == 3) - { - // Ligne produit en option - $pdf->MultiCell(26, 4, $outputlangs->transnoentities("Option"), 0, 'R', 0); - } - else - { - $total = price($object->lines[$i]->total_ht); - $pdf->MultiCell(26, 4, $total, 0, 'R', 0); - } + $pdf->MultiCell(26, 4, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $tvaligne=$object->lines[$i]->total_tva; diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index dcc595621329d7e5aed6aba183d0c9cbf7500ab3..83100a00314dcfa44d51bb1b7ba0f8b9df9db724 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -520,4 +520,89 @@ function pdf_getlinevatrate($object,$i,$outputlangs) } } +/** + * Return line unit price excluding tax + * @param object Object + * @param $i Current line number + * @param outputlang Object lang for output + */ +function pdf_getlineupexcltax($object,$i,$outputlangs) +{ + if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) + { + // TODO add hook function + } + else + { + return price($object->lines[$i]->subprice); + } +} + +/** + * Return line quantity + * @param object Object + * @param $i Current line number + * @param outputlang Object lang for output + */ +function pdf_getlineqty($object,$i,$outputlangs) +{ + if ($object->lines[$i]->special_code != 3) + { + if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) + { + // TODO add hook function + } + else + { + return $object->lines[$i]->qty; + } + } +} + +/** + * Return line remise percent + * @param object Object + * @param $i Current line number + * @param outputlang Object lang for output + */ +function pdf_getlineremisepercent($object,$i,$outputlangs) +{ + if ($object->lines[$i]->special_code != 3) + { + if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) + { + // TODO add hook function + } + else + { + return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs); + } + } +} + +/** + * Return line total excluding tax + * @param object Object + * @param $i Current line number + * @param outputlang Object lang for output + */ +function pdf_getlinetotalexcltax($object,$i,$outputlangs) +{ + if ($object->lines[$i]->special_code == 3) + { + return $outputlangs->transnoentities("Option"); + } + else + { + if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) + { + // TODO add hook function + } + else + { + return price($object->lines[$i]->total_ht); + } + } +} + ?> \ No newline at end of file