2
0
forked from Wavyzz/dolibarr

Merge pull request #22236 from frederic34/fixaurore

clean aurore model
This commit is contained in:
Laurent Destailleur
2022-09-13 01:08:37 +02:00
committed by GitHub

View File

@@ -140,10 +140,10 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur, $this->page_hauteur);
$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
$this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
$this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
$this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
$this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
$this->option_logo = 1; // Display logo
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
@@ -168,24 +168,18 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->postotalht = 174;
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$this->posxtva = 101;
$this->posxup = 118;
$this->posxup = 112;
$this->posxqty = 135;
$this->posxunit = 151;
} else {
$this->posxtva = 102;
$this->posxup = 126;
$this->posxup = 120;
$this->posxqty = 145;
$this->posxunit = 162;
}
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
$this->posxup = $this->posxtva;
}
$this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
$this->posxpicture = $this->posxup - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
if ($this->page_largeur < 210) { // To work with US executive format
$this->posxpicture -= 20;
$this->posxtva -= 20;
$this->posxup -= 20;
$this->posxqty -= 20;
$this->posxunit -= 20;
@@ -276,7 +270,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
}
if (count($realpatharray) == 0) {
$this->posxpicture = $this->posxtva;
$this->posxpicture = $this->posxup;
}
if ($conf->supplier_proposal->dir_output) {
@@ -358,7 +352,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
if (empty($this->atleastonediscount)) {
$delta = ($this->postotalht - $this->posxdiscount);
$this->posxpicture += $delta;
$this->posxtva += $delta;
$this->posxup += $delta;
$this->posxqty += $delta;
$this->posxunit += $delta;
@@ -460,7 +453,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) {
$curX = $this->posxpicture - 1;
$pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
$pdf->Image($realpatharray[$i], $curX + (($this->posxup - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
// $pdf->Image does not increase value return by getY, so we save it manually
$posYAfterImage = $curY + $imglinesize['height'];
}
@@ -472,7 +465,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
if ($posYAfterImage > 0) {
$descWidth = $this->posxpicture - $curX;
} else {
$descWidth = $this->posxtva - $curX;
$descWidth = $this->posxup - $curX;
}
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
@@ -528,22 +521,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
// VAT Rate
/*
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-3, 3, $vat_rate, 0, 'R');
}
// Unit price before discount
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxup, $curY);
if ($up_excl_tax > 0)
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
*/
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxqty, $curY);
@@ -805,7 +782,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$posy = $pdf->GetY() + 1;
}
/* PHFAVRE
/*
elseif ($object->availability_code || $object->availability) // Show availability conditions
{
$pdf->SetFont('','B', $default_font_size - 2);
@@ -1138,22 +1115,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
/*
if ($object->close_code == 'discount_vat')
{
$index++;
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1);
$resteapayer=0;
}
*/
$index++;
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(224, 224, 224);
@@ -1226,16 +1187,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height);
//$pdf->line($this->posxtva-2, $tab_top, $this->posxtva-2, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxtva - 5, $tab_top + 1);
$pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
}
}
$pdf->line($this->posxup - 3, $tab_top, $this->posxup - 3, $tab_top + $tab_height);
$pdf->line($this->posxup + 1, $tab_top, $this->posxup + 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxup - 1, $tab_top + 1);
$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
@@ -1349,12 +1301,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_fourn), 65), '', 'R');
}
/* PHFAVRE
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R');
*/
if ($object->thirdparty->code_fournisseur) {
$posy += 4;