Fix: PDF works with US executive format.

This commit is contained in:
Laurent Destailleur 2012-10-21 15:50:53 +02:00
parent 70cf195fb4
commit fbb3ce63a7
10 changed files with 177 additions and 56 deletions

View File

@ -100,13 +100,21 @@ class pdf_einstein extends ModelePDFCommandes
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
// Defini position des colonnes
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
$this->posxtva=111;
$this->posxup=126;
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@ -610,7 +618,12 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFont('','', $default_font_size - 1);
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$useborder=0;
$index = 0;
@ -1039,26 +1052,28 @@ class pdf_einstein extends ModelePDFCommandes
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -603,27 +603,29 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur - 100 - $this->marge_droite;
$posx=$this->page_largeur - $this->marge_droite - $widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80, 4, $outputlangs->transnoentities("Recipient").":", 0, 'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 4, $outputlangs->transnoentities("Recipient").":", 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0,0,0);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -100,13 +100,21 @@ class pdf_crabe extends ModelePDFFactures
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
// Defini position des colonnes
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
$this->posxtva=111;
$this->posxup=126;
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@ -727,7 +735,12 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('','', $default_font_size - 1);
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$useborder=0;
$index = 0;
@ -1227,26 +1240,28 @@ class pdf_crabe extends ModelePDFFactures
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -88,7 +88,7 @@ class pdf_soleil extends ModelePDFFicheinter
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined
// Defini position des colonnes
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
}
@ -564,26 +564,28 @@ class pdf_soleil extends ModelePDFFicheinter
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->SetXY($posx+2,$posy-5);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0,0,0);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(100,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(100,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -87,6 +87,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->posxqty=168;
$this->posxdiscount=162;
$this->postotalht=177;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxcomm-=20;
//$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->atleastoneratenotnull=0;
@ -627,9 +636,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetXY(102,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
// Cadre client destinataire
$pdf->Rect(100, $posy, 100, $hautcadre);
// If SHIPPING contact defined on invoice, we use it
$usecontact=false;
$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
@ -654,14 +660,29 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
// Show customer/recipient
$pdf->SetXY(102,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(106,4, $carac_client_name, 0, 'L');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
//if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
//$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY(102,$posy+8);
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->SetXY($posx+2,$posy+8);
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -99,13 +99,21 @@ class pdf_azur extends ModelePDFPropales
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
// Defini position des colonnes
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
$this->posxtva=111;
$this->posxup=126;
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@ -645,7 +653,12 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFont('','', $default_font_size - 1);
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$index = 0;
@ -1112,26 +1125,28 @@ class pdf_azur extends ModelePDFPropales
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":", 0, 'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -103,6 +103,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@ -455,7 +463,12 @@ if ($pageposafter > $pageposbefore) {
}
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$index=0;
@ -932,26 +945,28 @@ if ($pageposafter > $pageposbefore) {
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,$object->contact,$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -112,6 +112,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@ -619,7 +627,12 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetFont('','', $default_font_size - 1);
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$useborder=0;
$index = 0;
@ -1038,26 +1051,28 @@ if ($pageposafter > $pageposbefore) {
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}

View File

@ -305,4 +305,25 @@ DemandReasonTypeSRC_SHOP=Shop contact
DemandReasonTypeSRC_WOM=Word of mouth
DemandReasonTypeSRC_PARTNER=Partner
DemandReasonTypeSRC_EMPLOYEE=Employee
DemandReasonTypeSRC_SPONSORING=Sponsorship
DemandReasonTypeSRC_SPONSORING=Sponsorship
#### Paper formats ####
PaperFormatEU4A0=Format 4A0
PaperFormatEU2A0=Format 2A0
PaperFormatEUA0=Format A0
PaperFormatEUA1=Format A1
PaperFormatEUA2=Format A2
PaperFormatEUA3=Format A3
PaperFormatEUA4=Format A4
PaperFormatEUA5=Format A5
PaperFormatEUA6=Format A6
PaperFormatUSLETTER=Format Letter US
PaperFormatUSLEGAL=Format Legal US
PaperFormatUSEXECUTIVE=Format Executive US
PaperFormatUSLEDGER=Format Ledger/Tabloid
PaperFormatCAP1=Format P1 Canada
PaperFormatCAP2=Format P2 Canada
PaperFormatCAP3=Format P3 Canada
PaperFormatCAP4=Format P4 Canada
PaperFormatCAP5=Format P5 Canada
PaperFormatCAP6=Format P6 Canada

View File

@ -322,8 +322,8 @@ PaperFormatEUA4=Format A4
PaperFormatEUA5=Format A5
PaperFormatEUA6=Format A6
PaperFormatUSLETTER=Format Lettre US
PaperFormatUSLEGAL=Formato Legal US
PaperFormatUSEXECUTIVE=Formato Exécutif US
PaperFormatUSLEGAL=Format Legal US
PaperFormatUSEXECUTIVE=Format Exécutif US
PaperFormatUSLEDGER=Format Ledger/Tabloid
PaperFormatCAP1=Format P1 Canadien
PaperFormatCAP2=Format P2 Canadien