Add retained warranty for all invoice for crabe PDF
This commit is contained in:
parent
6acf10c0d4
commit
d65c17df7d
@ -1377,47 +1377,33 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
|
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
|
||||||
|
|
||||||
// Retained warranty
|
// Retained warranty
|
||||||
if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty))))
|
if ($object->displayRetainedWarranty())
|
||||||
{
|
{
|
||||||
$displayWarranty = false;
|
$pdf->SetTextColor(40, 40, 40);
|
||||||
|
$pdf->SetFillColor(255, 255, 255);
|
||||||
|
|
||||||
// Check if this situation invoice is 100% for real
|
$retainedWarranty = $object->getRetainedWarrantyAmount();
|
||||||
if (!empty($object->lines)) {
|
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
|
||||||
$displayWarranty = true;
|
|
||||||
foreach ($object->lines as $i => $line) {
|
|
||||||
if ($line->product_type < 2 && $line->situation_percent < 100) {
|
|
||||||
$displayWarranty = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($displayWarranty) {
|
// Billed - retained warranty
|
||||||
$pdf->SetTextColor(40, 40, 40);
|
$index++;
|
||||||
$pdf->SetFillColor(255, 255, 255);
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
|
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
|
||||||
|
|
||||||
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||||
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
|
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
|
||||||
|
|
||||||
// Billed - retained warranty
|
// retained warranty
|
||||||
$index++;
|
$index++;
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
|
|
||||||
|
|
||||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
|
||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
|
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
|
||||||
|
|
||||||
// retained warranty
|
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
|
||||||
$index++;
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
|
||||||
|
|
||||||
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
|
|
||||||
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
|
|
||||||
|
|
||||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
|
|
||||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
|
||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user