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_gauche=10; |
59 |
|
$this->marge_droite=10; |
60 |
$this->marge_haute=10; |
$this->marge_haute=10; |
61 |
$this->marge_basse=10; |
$this->marge_basse=10; |
62 |
|
|
86 |
$this->tva=array(); |
$this->tva=array(); |
87 |
|
|
88 |
// Defini position des colonnes |
// Defini position des colonnes |
89 |
$this->posxdesc=11; |
$this->posxdesc=$this->marge_gauche+1; |
90 |
$this->posxtva=121; |
$this->posxtva=121; |
91 |
$this->posxup=132; |
$this->posxup=132; |
92 |
$this->posxqty=151; |
$this->posxqty=151; |
93 |
$this->posxdiscount=162; |
$this->posxdiscount=162; |
94 |
$this->postotalht=177; |
$this->postotalht=177; |
95 |
|
|
96 |
|
$this->atleastonediscount=0; |
97 |
} |
} |
98 |
|
|
99 |
/** |
/** |
136 |
{ |
{ |
137 |
$prop = new Propal($this->db,"",$id); |
$prop = new Propal($this->db,"",$id); |
138 |
$ret=$prop->fetch($id); |
$ret=$prop->fetch($id); |
139 |
|
$nblignes = sizeof($prop->lignes); |
140 |
|
|
141 |
$propref = sanitize_string($prop->ref); |
$propref = sanitize_string($prop->ref); |
142 |
$dir = $conf->propal->dir_output . "/" . $propref; |
$dir = $conf->propal->dir_output . "/" . $propref; |
165 |
$pdf->SetCreator("Dolibarr ".DOL_VERSION); |
$pdf->SetCreator("Dolibarr ".DOL_VERSION); |
166 |
$pdf->SetAuthor($user->fullname); |
$pdf->SetAuthor($user->fullname); |
167 |
|
|
168 |
$pdf->SetMargins($this->marge_haute, $this->marge_basse, 10); // Top, Bottom, Left |
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
169 |
$pdf->SetAutoPageBreak(1,0); |
$pdf->SetAutoPageBreak(1,0); |
170 |
|
|
171 |
$this->_pagehead($pdf, $prop); |
$this->_pagehead($pdf, $prop); |
178 |
$iniY = $tab_top + 8; |
$iniY = $tab_top + 8; |
179 |
$curY = $tab_top + 8; |
$curY = $tab_top + 8; |
180 |
$nexY = $tab_top + 8; |
$nexY = $tab_top + 8; |
|
$nblignes = sizeof($prop->lignes); |
|
181 |
|
|
182 |
// Boucle sur les lignes |
// Boucle sur les lignes |
183 |
for ($i = 0 ; $i < $nblignes ; $i++) |
for ($i = 0 ; $i < $nblignes ; $i++) |
266 |
*/ |
*/ |
267 |
if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) |
if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) |
268 |
{ |
{ |
269 |
$pdf->SetXY (10, 228); |
$pdf->SetXY ($this->marge_gauche, 228); |
270 |
$pdf->SetTextColor(200,0,0); |
$pdf->SetTextColor(200,0,0); |
271 |
$pdf->SetFont('Arial','B',8); |
$pdf->SetFont('Arial','B',8); |
272 |
$pdf->MultiCell(90, 3, $langs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); |
$pdf->MultiCell(90, 3, $langs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); |
285 |
$account = new Account($this->db); |
$account = new Account($this->db); |
286 |
$account->fetch(FACTURE_CHQ_NUMBER); |
$account->fetch(FACTURE_CHQ_NUMBER); |
287 |
|
|
288 |
$pdf->SetXY (10, 227); |
$pdf->SetXY ($this->marge_gauche, 227); |
289 |
$pdf->SetFont('Arial','B',8); |
$pdf->SetFont('Arial','B',8); |
290 |
$pdf->MultiCell(90, 3, "Règlement par chèque à l'ordre de ".$account->proprio." envoyé à:",0,'L',0); |
$pdf->MultiCell(90, 3, "Règlement par chèque à l'ordre de ".$account->proprio." envoyé à:",0,'L',0); |
291 |
$pdf->SetXY (10, 231); |
$pdf->SetXY ($this->marge_gauche, 231); |
292 |
$pdf->SetFont('Arial','',8); |
$pdf->SetFont('Arial','',8); |
293 |
$pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); |
$pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); |
294 |
} |
} |
306 |
$account = new Account($this->db); |
$account = new Account($this->db); |
307 |
$account->fetch(FACTURE_RIB_NUMBER); |
$account->fetch(FACTURE_RIB_NUMBER); |
308 |
|
|
309 |
$this->marges['g']=10; |
$this->marges['g']=$this->marge_gauche; |
310 |
|
|
311 |
$cury=242; |
$cury=242; |
312 |
$pdf->SetXY ($this->marges['g'], $cury); |
$pdf->SetXY ($this->marges['g'], $cury); |
355 |
/* Pour l'instant les conditions de règlement ne sont pas gérées sur les propales */ |
/* Pour l'instant les conditions de règlement ne sont pas gérées sur les propales */ |
356 |
/* |
/* |
357 |
$pdf->SetFont('Arial','B',10); |
$pdf->SetFont('Arial','B',10); |
358 |
$pdf->SetXY(10, 217); |
$pdf->SetXY($this->marge_gauche, 217); |
359 |
$titre = "Conditions de réglement:"; |
$titre = "Conditions de réglement:"; |
360 |
$pdf->MultiCell(80, 5, $titre, 0, 'L'); |
$pdf->MultiCell(80, 5, $titre, 0, 'L'); |
361 |
$pdf->SetFont('Arial','',10); |
$pdf->SetFont('Arial','',10); |
409 |
$pdf->SetFont('Arial','', 9); |
$pdf->SetFont('Arial','', 9); |
410 |
|
|
411 |
// Affiche la mention TVA non applicable selon option |
// Affiche la mention TVA non applicable selon option |
412 |
$pdf->SetXY (10, $tab2_top + 0); |
$pdf->SetXY ($this->marge_gauche, $tab2_top + 0); |
413 |
if ($this->franchise==1) |
if ($this->franchise==1) |
414 |
{ |
{ |
415 |
$pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0); |
$pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0); |
449 |
} |
} |
450 |
|
|
451 |
// Affichage des totaux de TVA par taux (conformément à réglementation) |
// Affichage des totaux de TVA par taux (conformément à réglementation) |
|
$atleastoneratenotnull=0; |
|
452 |
$pdf->SetFillColor(248,248,248); |
$pdf->SetFillColor(248,248,248); |
453 |
foreach( $this->tva as $tvakey => $tvaval ) |
foreach( $this->tva as $tvakey => $tvaval ) |
454 |
{ |
{ |
455 |
if ($tvakey) // On affiche pas taux 0 |
if ($tvakey) // On affiche pas taux 0 |
456 |
{ |
{ |
457 |
$atleastoneratenotnull++; |
$this->atleastoneratenotnull++; |
458 |
|
|
459 |
$index++; |
$index++; |
460 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
465 |
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval * abs((float)$tvakey) / 100 ), 0, 'R', 1); |
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval * abs((float)$tvakey) / 100 ), 0, 'R', 1); |
466 |
} |
} |
467 |
} |
} |
468 |
if (! $atleastoneratenotnull) |
if (! $this->atleastoneratenotnull) |
469 |
{ |
{ |
470 |
$index++; |
$index++; |
471 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
524 |
$langs->load("main"); |
$langs->load("main"); |
525 |
$langs->load("bills"); |
$langs->load("bills"); |
526 |
|
|
527 |
$pdf->Rect( 10, $tab_top, 190, $tab_height); |
// Rect prend une longueur en 3eme param |
528 |
$pdf->line( 10, $tab_top+6, 200, $tab_top+6 ); |
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); |
529 |
|
// line prend une position y en 3eme param |
530 |
|
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); |
531 |
|
|
532 |
$pdf->SetFont('Arial','',10); |
$pdf->SetFont('Arial','',10); |
533 |
|
|
547 |
$pdf->MultiCell(11,2, $langs->trans("Qty"),'','C'); |
$pdf->MultiCell(11,2, $langs->trans("Qty"),'','C'); |
548 |
|
|
549 |
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); |
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); |
550 |
$pdf->SetXY ($this->posxdiscount-1, $tab_top+2); |
if ($this->atleastonediscount) |
551 |
$pdf->MultiCell(16,2, $langs->trans("Discount"),'','C'); |
{ |
552 |
|
$pdf->SetXY ($this->posxdiscount-1, $tab_top+2); |
553 |
|
$pdf->MultiCell(16,2, $langs->trans("Discount"),'','C'); |
554 |
|
} |
555 |
|
|
556 |
$pdf->line($this->postotalht-1, $tab_top, $this->postotalht-1, $tab_top + $tab_height); |
if ($this->atleastonediscount) |
557 |
|
{ |
558 |
|
$pdf->line($this->postotalht-1, $tab_top, $this->postotalht-1, $tab_top + $tab_height); |
559 |
|
} |
560 |
$pdf->SetXY ($this->postotalht-1, $tab_top+2); |
$pdf->SetXY ($this->postotalht-1, $tab_top+2); |
561 |
$pdf->MultiCell(23,2, $langs->trans("TotalHT"),'','C'); |
$pdf->MultiCell(23,2, $langs->trans("TotalHT"),'','C'); |
562 |
|
|
579 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
580 |
$pdf->SetFont('Arial','B',13); |
$pdf->SetFont('Arial','B',13); |
581 |
|
|
582 |
$posy=$this->marge_haute; // La marge Top est de 10, on commence donc a 10 |
$posy=$this->marge_haute; |
583 |
|
|
584 |
$pdf->SetXY(10,$posy); |
$pdf->SetXY($this->marge_gauche,$posy); |
585 |
|
|
586 |
// Logo |
// Logo |
587 |
if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) |
if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) |
588 |
{ |
{ |
589 |
if (is_readable(FAC_PDF_LOGO)) |
if (is_readable(FAC_PDF_LOGO)) |
590 |
{ |
{ |
591 |
$pdf->Image(FAC_PDF_LOGO, 10, $posy, 0, 24); |
$pdf->Image(FAC_PDF_LOGO, $this->marge_gauche, $posy, 0, 24); |
592 |
} |
} |
593 |
else |
else |
594 |
{ |
{ |
617 |
$hautcadre=40; |
$hautcadre=40; |
618 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
619 |
$pdf->SetFont('Arial','',8); |
$pdf->SetFont('Arial','',8); |
620 |
$pdf->SetXY(10,$posy-5); |
$pdf->SetXY($this->marge_gauche,$posy-5); |
621 |
$pdf->MultiCell(66,5, $langs->trans("BillFrom").":"); |
$pdf->MultiCell(66,5, $langs->trans("BillFrom").":"); |
622 |
|
|
623 |
|
|
624 |
$pdf->SetXY(10,$posy); |
$pdf->SetXY($this->marge_gauche,$posy); |
625 |
$pdf->SetFillColor(230,230,230); |
$pdf->SetFillColor(230,230,230); |
626 |
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
627 |
|
|
628 |
|
|
629 |
$pdf->SetXY(10,$posy+3); |
$pdf->SetXY($this->marge_gauche,$posy+3); |
630 |
|
|
631 |
// Nom emetteur |
// Nom emetteur |
632 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
664 |
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW; |
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW; |
665 |
} |
} |
666 |
$pdf->SetFont('Arial','',9); |
$pdf->SetFont('Arial','',9); |
667 |
$pdf->SetXY(12,$posy+8); |
$pdf->SetXY($this->marge_gauche+2,$posy+8); |
668 |
$pdf->MultiCell(80,4, $carac_emetteur); |
$pdf->MultiCell(80,4, $carac_emetteur); |
669 |
|
|
670 |
// Client destinataire |
// Client destinataire |
753 |
$posy=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0); |
$posy=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0); |
754 |
|
|
755 |
$pdf->SetY(-$posy); |
$pdf->SetY(-$posy); |
756 |
$pdf->line(10, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); |
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); |
757 |
$posy--; |
$posy--; |
758 |
|
|
759 |
if ($ligne1) |
if ($ligne1) |
760 |
{ |
{ |
761 |
$pdf->SetXY(8,-$posy); |
$pdf->SetXY($this->marge_gauche,-$posy); |
762 |
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0); |
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0); |
763 |
} |
} |
764 |
|
|
765 |
if ($ligne2) |
if ($ligne2) |
766 |
{ |
{ |
767 |
$posy-=3; |
$posy-=3; |
768 |
$pdf->SetXY(8,-$posy); |
$pdf->SetXY($this->marge_gauche,-$posy); |
769 |
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); |
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); |
770 |
} |
} |
771 |
|
|