Merge remote-tracking branch 'upstream/develop' into extrafields_object_filter

This commit is contained in:
Frédéric France
2024-10-26 18:30:17 +02:00
9 changed files with 190 additions and 33 deletions

View File

@@ -1113,8 +1113,6 @@ TicketMessageMailSignatureText
TicketSetupPage
Tiers
Timeline
TotalDiscount
TotalHTBeforeDiscount
Transfer
TryAnotherConnectionMode
UndefinedKey

View File

@@ -2670,11 +2670,11 @@ function pdf_getSizeForImage($realpath)
/**
* Return line total amount discount
*
* @param Facture $object Object
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int<0,2> $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return float|string Return total of line excl tax
* @param Commande|Facture|Propal $object Object
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int<0,2> $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return float|string Return total of line excl tax
*/
function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0)
{

View File

@@ -912,13 +912,45 @@ class pdf_einstein extends ModelePDFCommandes
$useborder = 0;
$index = 0;
// Get Total HT
$total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
// Total remise
$total_line_remise = 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
if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht;
}
}
if ($total_line_remise > 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', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
// Show total NET before discount
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->SetXY($col1x, $tab2_top+ $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
$total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top);
$pdf->SetXY($col2x, $tab2_top+ $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total

View File

@@ -1123,12 +1123,44 @@ class pdf_eratosthene extends ModelePDFCommandes
$useborder = 0;
$index = 0;
// Get Total HT
$total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
// Total remise
$total_line_remise = 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
if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht;
}
}
if ($total_line_remise > 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', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
// Show total NET before discount
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
$total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total

View File

@@ -1395,13 +1395,45 @@ class pdf_crabe extends ModelePDFFactures
$useborder = 0;
$index = 0;
// Get Total HT
$total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
// Total remise
$total_line_remise = 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
if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht;
}
}
if ($total_line_remise > 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', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
// Show total NET before discount
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') ? "TotalHT" : "Total").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities(!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') ? "TotalHT" : "Total") : ''), 0, 'L', 1);
$total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total

View File

@@ -1663,25 +1663,22 @@ class pdf_sponge extends ModelePDFFactures
}
}
if ($total_line_remise > 0) {
if (getDolGlobalString('MAIN_SHOW_AMOUNT_DISCOUNT')) {
$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', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$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', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
$index++;
}
// Show total NET before discount
if (getDolGlobalString('MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT')) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
$index++;
}
// Total HT

View File

@@ -1096,13 +1096,45 @@ class pdf_azur extends ModelePDFPropales
$useborder = 0;
$index = 0;
// Get Total HT
$total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
// Total remise
$total_line_remise = 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
if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht;
}
}
if ($total_line_remise > 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', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
// Show total NET before discount
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total

View File

@@ -1201,13 +1201,45 @@ class pdf_cyan extends ModelePDFPropales
$useborder = 0;
$index = 0;
// Get Total HT
$total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
// Total remise
$total_line_remise = 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
if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht;
}
}
if ($total_line_remise > 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', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
// Show total NET before discount
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top);
$pdf->SetXY($col1x, $tab2_top+ $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
$total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top);
$pdf->SetXY($col2x, $tab2_top+ $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total

View File

@@ -1316,3 +1316,5 @@ NbRecordQualified=Number of qualified records
auto=auto
UploadFile=Direct import of document
OrClickToSelectAFile=or click to select a file on disk
TotalDiscount=Total discount
TotalHTBeforeDiscount=Total net before discount