55 |
$this->page_largeur = 210; |
$this->page_largeur = 210; |
56 |
$this->page_hauteur = 297; |
$this->page_hauteur = 297; |
57 |
$this->format = array($this->page_largeur,$this->page_hauteur); |
$this->format = array($this->page_largeur,$this->page_hauteur); |
58 |
|
$this->marge_haute=10; |
59 |
|
$this->marge_basse=10; |
60 |
|
|
61 |
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
62 |
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
96 |
|
|
97 |
/** |
/** |
98 |
\brief Fonction générant la facture sur le disque |
\brief Fonction générant la facture sur le disque |
99 |
\param facid id de la facture à générer |
\param id Id de la facture à générer |
100 |
\return int 1=ok, 0=ko |
\return int 1=ok, 0=ko |
101 |
\remarks Variables utilisées |
\remarks Variables utilisées |
102 |
\remarks MAIN_INFO_SOCIETE_NOM |
\remarks MAIN_INFO_SOCIETE_NOM |
112 |
\remarks FAC_PDF_TEL |
\remarks FAC_PDF_TEL |
113 |
\remarks FAC_PDF_ADRESSE |
\remarks FAC_PDF_ADRESSE |
114 |
*/ |
*/ |
115 |
function write_pdf_file($facid) |
function write_pdf_file($id) |
116 |
{ |
{ |
117 |
global $user,$langs,$conf; |
global $user,$langs,$conf; |
118 |
|
|
122 |
|
|
123 |
if ($conf->facture->dir_output) |
if ($conf->facture->dir_output) |
124 |
{ |
{ |
125 |
$fac = new Facture($this->db,"",$facid); |
$fac = new Facture($this->db,"",$id); |
126 |
$ret=$fac->fetch($facid); |
$ret=$fac->fetch($id); |
127 |
|
|
128 |
$facref = sanitize_string($fac->ref); |
$facref = sanitize_string($fac->ref); |
129 |
$dir = $conf->facture->dir_output . "/" . $facref; |
$dir = $conf->facture->dir_output . "/" . $facref; |
140 |
|
|
141 |
if (file_exists($dir)) |
if (file_exists($dir)) |
142 |
{ |
{ |
143 |
// Initialisation facture vierge |
// Initialisation document vierge |
144 |
$pdf=new FPDF('P','mm',$this->format); |
$pdf=new FPDF('P','mm',$this->format); |
145 |
$pdf->Open(); |
$pdf->Open(); |
146 |
$pdf->AddPage(); |
$pdf->AddPage(); |
152 |
$pdf->SetCreator("Dolibarr ".DOL_VERSION); |
$pdf->SetCreator("Dolibarr ".DOL_VERSION); |
153 |
$pdf->SetAuthor($user->fullname); |
$pdf->SetAuthor($user->fullname); |
154 |
|
|
155 |
$pdf->SetMargins(10, 8, 10); // Top, Bottom, Left |
$pdf->SetMargins($this->marge_haute, $this->marge_basse, 10); // Top, Bottom, Left |
156 |
$pdf->SetAutoPageBreak(1,0); |
$pdf->SetAutoPageBreak(1,0); |
157 |
|
|
158 |
$this->_pagehead($pdf, $fac); |
$this->_pagehead($pdf, $fac); |
652 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
653 |
$pdf->SetFont('Arial','B',13); |
$pdf->SetFont('Arial','B',13); |
654 |
|
|
655 |
$posy=10; // La marge Top est de 10, on commence donc a 10 |
$posy=$this->marge_haute; // La marge Top est de 10, on commence donc a 10 |
656 |
|
|
657 |
$pdf->SetXY(10,$posy); |
$pdf->SetXY(10,$posy); |
658 |
|
|
822 |
$pdf->SetDrawColor(224,224,224); |
$pdf->SetDrawColor(224,224,224); |
823 |
|
|
824 |
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page |
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page |
825 |
$posy=11 + ($ligne1?3:0) + ($ligne2?3:0); |
$posy=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0); |
826 |
|
|
827 |
$pdf->SetY(-$posy); |
$pdf->SetY(-$posy); |
828 |
$pdf->line(10, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); |
$pdf->line(10, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); |