71 |
dolibarr_print_error($this->db); |
dolibarr_print_error($this->db); |
72 |
} |
} |
73 |
$this->db->free($result); |
$this->db->free($result); |
74 |
|
|
75 |
|
// Defini position des colonnes |
76 |
|
$this->posxdesc=11; |
77 |
|
$this->posxtva=121; |
78 |
|
$this->posxup=133; |
79 |
|
$this->posxqty=151; |
80 |
|
$this->posxdiscount=163; |
81 |
|
$this->postotalht=173; |
82 |
|
|
83 |
} |
} |
84 |
|
|
85 |
|
|
135 |
$pdf->Open(); |
$pdf->Open(); |
136 |
$pdf->AddPage(); |
$pdf->AddPage(); |
137 |
|
|
138 |
$this->_pagehead($pdf, $fac); |
$pdf->SetDrawColor(128,128,128); |
139 |
|
|
140 |
$pdf->SetTitle($fac->ref); |
$pdf->SetTitle($fac->ref); |
141 |
$pdf->SetSubject($langs->trans("Bill")); |
$pdf->SetSubject($langs->trans("Bill")); |
145 |
$pdf->SetMargins(10, 10, 10); |
$pdf->SetMargins(10, 10, 10); |
146 |
$pdf->SetAutoPageBreak(1,0); |
$pdf->SetAutoPageBreak(1,0); |
147 |
|
|
148 |
|
$this->_pagehead($pdf, $fac); |
149 |
|
|
150 |
$tab_top = 96; |
$tab_top = 96; |
151 |
$tab_height = 110; |
$tab_height = 110; |
152 |
|
|
153 |
$pdf->SetFillColor(220,220,220); |
//$pdf->SetFillColor(220,220,220); |
154 |
$pdf->SetFont('Arial','', 9); |
$pdf->SetFont('Arial','', 9); |
|
$pdf->SetXY (10, $tab_top + 10 ); |
|
155 |
|
|
156 |
$iniY = $pdf->GetY(); |
$iniY = $tab_top + 8; |
157 |
$curY = $pdf->GetY(); |
$curY = $tab_top + 8; |
158 |
$nexY = $pdf->GetY(); |
$nexY = $tab_top + 8; |
159 |
$nblignes = sizeof($fac->lignes); |
$nblignes = sizeof($fac->lignes); |
160 |
|
|
|
$posxdesc=11; |
|
|
$posxtva=121; |
|
|
$posxup=133; |
|
|
$posxqty=151; |
|
|
$posxdiscount=163; |
|
|
$postotttc=173; |
|
|
|
|
161 |
// Boucle sur les lignes |
// Boucle sur les lignes |
162 |
for ($i = 0 ; $i < $nblignes ; $i++) |
for ($i = 0 ; $i < $nblignes ; $i++) |
163 |
{ |
{ |
170 |
if ($libelleproduitservice) $libelleproduitservice.="\n"; |
if ($libelleproduitservice) $libelleproduitservice.="\n"; |
171 |
$libelleproduitservice.=$fac->lignes[$i]->desc; |
$libelleproduitservice.=$fac->lignes[$i]->desc; |
172 |
} |
} |
173 |
$pdf->SetXY ($posxdesc, $curY ); |
$pdf->SetXY ($this->posxdesc-1, $curY); |
174 |
|
|
175 |
if ($conf->global->FACTURE_CODEPRODUITSERVICE && $fac->lignes[$i]->produit_id) |
if ($fac->lignes[$i]->produit_id) |
176 |
{ |
{ |
177 |
// Affiche code produit si ligne associée à un code produit |
// Affiche code produit si ligne associée à un code produit |
178 |
$prodser = new Product($this->db); |
$prodser = new Product($this->db); |
179 |
|
|
180 |
$prodser->fetch($fac->lignes[$i]->produit_id); |
$prodser->fetch($fac->lignes[$i]->produit_id); |
181 |
if ($prodser->ref) { |
if ($prodser->ref) { |
182 |
$libelleproduitservice=$langs->trans("ProductCode")." ".$prodser->ref." - ".$libelleproduitservice; |
$libelleproduitservice=$langs->trans("Product")." ".$prodser->ref." - ".$libelleproduitservice; |
183 |
} |
} |
184 |
} |
} |
185 |
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) { |
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) { |
191 |
$nexY = $pdf->GetY(); |
$nexY = $pdf->GetY(); |
192 |
|
|
193 |
// TVA |
// TVA |
194 |
$pdf->SetXY ($posxtva, $curY); |
$pdf->SetXY ($this->posxtva, $curY); |
195 |
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C'); |
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'R'); |
196 |
|
|
197 |
// Prix unitaire HT avant remise |
// Prix unitaire HT avant remise |
198 |
$pdf->SetXY ($posxup, $curY); |
$pdf->SetXY ($this->posxup, $curY); |
199 |
$pdf->MultiCell(17, 5, price($fac->lignes[$i]->subprice), 0, 'R', 0); |
$pdf->MultiCell(17, 5, price($fac->lignes[$i]->subprice), 0, 'R', 0); |
200 |
|
|
201 |
// Quantité |
// Quantité |
202 |
$pdf->SetXY ($posxqty, $curY); |
$pdf->SetXY ($this->posxqty, $curY); |
203 |
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'R'); |
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'R'); |
204 |
|
|
205 |
// Remise sur ligne |
// Remise sur ligne |
206 |
$pdf->SetXY ($posxdiscount, $curY); |
$pdf->SetXY ($this->posxdiscount, $curY); |
207 |
if ($fac->lignes[$i]->remise_percent) { |
if ($fac->lignes[$i]->remise_percent) { |
208 |
$pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R'); |
$pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R'); |
209 |
} |
} |
210 |
|
|
211 |
// Total TVA |
// Total TVA |
212 |
$pdf->SetXY ($postotttc, $curY); |
$pdf->SetXY ($this->postotalht, $curY); |
|
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); |
|
|
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); |
|
|
|
|
|
// Total HT |
|
|
$pdf->SetXY ($postotttc, $curY); |
|
213 |
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); |
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); |
214 |
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); |
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); |
215 |
|
|
216 |
|
// Collecte des totaux par valeur de tva |
217 |
|
// dans le tableau tva["taux"]=total_tva |
218 |
|
$tvaligne=$fac->lignes[$i]->price * $fac->lignes[$i]->qty; |
219 |
|
if ($fac->remise_percent) $tvaligne-=($tvaligne*$fac->remise_percent)/100; |
220 |
|
$this->tva[ (string)$fac->lignes[$i]->tva_taux ] += $tvaligne; |
221 |
|
|
222 |
if ($nexY > 200 && $i < $nblignes - 1) |
if ($nexY > 200 && $i < $nblignes - 1) |
223 |
{ |
{ |
234 |
|
|
235 |
$deja_regle = $fac->getSommePaiement(); |
$deja_regle = $fac->getSommePaiement(); |
236 |
|
|
237 |
$this->_tableau_tot($pdf, $fac, $deja_regle); |
$posy=$this->_tableau_tot($pdf, $fac, $deja_regle); |
238 |
|
|
239 |
if ($deja_regle) { |
if ($deja_regle) { |
240 |
$this->_tableau_versements($pdf, $fac); |
$this->_tableau_versements($pdf, $fac, $posy); |
241 |
} |
} |
242 |
|
|
243 |
/* |
/* |
244 |
* Mode de règlement |
* Mode de règlement |
245 |
*/ |
*/ |
246 |
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)) { |
247 |
$pdf->SetXY (10, 228); |
$pdf->SetXY (10, 228); |
248 |
$pdf->SetTextColor(200,0,0); |
$pdf->SetTextColor(200,0,0); |
253 |
} |
} |
254 |
|
|
255 |
/* |
/* |
256 |
* Propose mode règlement par CHQ |
* Propose mode règlement par CHQ |
257 |
*/ |
*/ |
258 |
if (defined("FACTURE_CHQ_NUMBER")) |
if (defined("FACTURE_CHQ_NUMBER")) |
259 |
{ |
{ |
260 |
if (FACTURE_CHQ_NUMBER > 0) |
if (FACTURE_CHQ_NUMBER > 0) |
272 |
} |
} |
273 |
|
|
274 |
/* |
/* |
275 |
* Propose mode règlement par RIB |
* Propose mode règlement par RIB |
276 |
*/ |
*/ |
277 |
if (defined("FACTURE_RIB_NUMBER")) |
if (defined("FACTURE_RIB_NUMBER")) |
278 |
{ |
{ |
279 |
if (FACTURE_RIB_NUMBER > 0) |
if (FACTURE_RIB_NUMBER > 0) |
324 |
} |
} |
325 |
|
|
326 |
/* |
/* |
327 |
* Conditions de règlements |
* Conditions de règlements |
328 |
*/ |
*/ |
329 |
$pdf->SetFont('Arial','B',10); |
$pdf->SetFont('Arial','B',10); |
330 |
$pdf->SetXY(10, 217); |
$pdf->SetXY(10, 217); |
331 |
$titre = "Conditions de réglement:"; |
$titre = "Conditions de réglement:"; |
368 |
* \param pdf objet PDF |
* \param pdf objet PDF |
369 |
* \param fac objet facture |
* \param fac objet facture |
370 |
*/ |
*/ |
371 |
function _tableau_versements(&$pdf, $fac) |
function _tableau_versements(&$pdf, $fac, $posy) |
372 |
{ |
{ |
373 |
global $langs; |
global $langs; |
374 |
$langs->load("main"); |
$langs->load("main"); |
375 |
$langs->load("bills"); |
$langs->load("bills"); |
376 |
|
|
377 |
$tab3_posx = 120; |
$tab3_posx = 120; |
378 |
$tab3_top = 250; |
$tab3_top = $posy + 6; |
379 |
$tab3_width = 80; |
$tab3_width = 80; |
380 |
$tab3_height = 4; |
$tab3_height = 4; |
381 |
|
|
455 |
|
|
456 |
/* |
/* |
457 |
* \brief Affiche le total à payer |
* \brief Affiche le total à payer |
458 |
* \param pdf objet PDF |
* \param pdf Objet PDF |
459 |
* \param fac objet facture |
* \param fac Objet facture |
460 |
* \param deja_regle montant deja regle |
* \param deja_regle Montant deja regle |
461 |
|
* \return y Position pour suite |
462 |
*/ |
*/ |
463 |
function _tableau_tot(&$pdf, $fac, $deja_regle) |
function _tableau_tot(&$pdf, $fac, $deja_regle) |
464 |
{ |
{ |
480 |
|
|
481 |
// Tableau total |
// Tableau total |
482 |
$col1x=120; $col2x=174; |
$col1x=120; $col2x=174; |
483 |
|
|
484 |
|
// Total HT |
485 |
|
$pdf->SetFillColor(256,256,256); |
486 |
$pdf->SetXY ($col1x, $tab2_top + 0); |
$pdf->SetXY ($col1x, $tab2_top + 0); |
487 |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalHT"), 0, 'L', 0); |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalHT"), 0, 'L', 1); |
488 |
|
|
489 |
$pdf->SetXY ($col2x, $tab2_top + 0); |
$pdf->SetXY ($col2x, $tab2_top + 0); |
490 |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0); |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 1); |
491 |
|
|
492 |
|
// Remise global |
493 |
if ($fac->remise > 0) |
if ($fac->remise > 0) |
494 |
{ |
{ |
495 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl); |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl); |
496 |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("GlobalDiscount"), 0, 'L', 0); |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("GlobalDiscount"), 0, 'L', 1); |
497 |
|
|
498 |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl); |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl); |
499 |
$pdf->MultiCell(26, $tab2_hl, "-".$fac->remise_percent."%", 0, 'R', 0); |
$pdf->MultiCell(26, $tab2_hl, "-".$fac->remise_percent."%", 0, 'R', 1); |
500 |
|
|
501 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * 2); |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * 2); |
502 |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, "Total HT après remise", 0, 'L', 0); |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, "Total HT après remise", 0, 'L', 1); |
503 |
|
|
504 |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2); |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2); |
505 |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 0); |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 1); |
506 |
|
|
507 |
$index = 3; |
$index = 2; |
508 |
} |
} |
509 |
else |
else |
510 |
{ |
{ |
511 |
$index = 1; |
$index = 0; |
512 |
} |
} |
513 |
|
|
514 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
// Affichage des totaux de TVA par taux (conformément à réglementation) |
515 |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT"), 0, 'L', 0); |
$atleastoneratenotnull=0; |
516 |
|
$pdf->SetFillColor(248,248,248); |
517 |
|
foreach( $this->tva as $tvakey => $tvaval ) |
518 |
|
{ |
519 |
|
if ($tvakey) // On affiche pas taux 0 |
520 |
|
{ |
521 |
|
$atleastoneratenotnull++; |
522 |
|
|
523 |
|
$index++; |
524 |
|
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
525 |
|
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT").' '.$tvakey.'%', 0, 'L', 1); |
526 |
|
|
527 |
|
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); |
528 |
|
$pdf->MultiCell(26, $tab2_hl, price($tvaval * (float)$tvakey / 100 ), 0, 'R', 1); |
529 |
|
} |
530 |
|
} |
531 |
|
if (! $atleastoneratenotnull) |
532 |
|
{ |
533 |
|
$index++; |
534 |
|
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
535 |
|
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT"), 0, 'L', 1); |
536 |
|
|
537 |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); |
538 |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0); |
$pdf->MultiCell(26, $tab2_hl, price(0), 0, 'R', 1); |
539 |
|
} |
540 |
|
|
541 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+1)); |
// $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); |
542 |
|
// $pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0); |
543 |
|
$useborder=0; |
544 |
|
|
545 |
|
$index++; |
546 |
|
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
547 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
548 |
$pdf->SetFont('Arial','B', 9); |
// $pdf->SetFont('Arial','B', 9); |
549 |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalTTC"), 0, 'L', 1); |
$pdf->SetFillColor(224,224,224); |
550 |
|
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalTTC"), $useborder, 'L', 1); |
551 |
|
|
552 |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+1)); |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); |
553 |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1); |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), $useborder, 'R', 1); |
554 |
$pdf->SetFont('Arial','', 9); |
$pdf->SetFont('Arial','', 9); |
555 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
556 |
|
|
557 |
if ($deja_regle > 0) |
if ($deja_regle > 0) |
558 |
{ |
{ |
559 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+2)); |
$index++; |
560 |
|
|
561 |
|
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
562 |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'L', 0); |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'L', 0); |
563 |
|
|
564 |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+2)); |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); |
565 |
$pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0); |
$pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0); |
566 |
|
|
567 |
|
$index++; |
568 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
569 |
$pdf->SetFont('Arial','B', 9); |
//$pdf->SetFont('Arial','B', 9); |
570 |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+3)); |
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); |
571 |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("RemainderToPay"), 0, 'L', 1); |
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("RemainderToPay"), $useborder, 'L', 1); |
572 |
|
|
573 |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+3)); |
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); |
574 |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 1); |
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), $useborder, 'R', 1); |
575 |
$pdf->SetFont('Arial','', 9); |
$pdf->SetFont('Arial','', 9); |
576 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
577 |
} |
} |
578 |
|
|
579 |
|
$index++; |
580 |
|
return ($tab2_top + ($tab2_hl * $index)); |
581 |
} |
} |
582 |
|
|
583 |
/* |
/* |
584 |
* \brief Affiche la grille des lignes de factures |
* \brief Affiche la grille des lignes de factures |
585 |
* \param pdf objet PDF |
* \param pdf objet PDF |
586 |
*/ |
*/ |
587 |
function _tableau(&$pdf, $tab_top, $tab_height, $nexY) |
function _tableau(&$pdf, $tab_top, $tab_height, $nexY) |
588 |
{ |
{ |
589 |
global $langs; |
global $langs; |
591 |
$langs->load("bills"); |
$langs->load("bills"); |
592 |
|
|
593 |
$pdf->Rect( 10, $tab_top, 190, $tab_height); |
$pdf->Rect( 10, $tab_top, 190, $tab_height); |
594 |
$pdf->line( 10, $tab_top+8, 200, $tab_top+8 ); |
$pdf->line( 10, $tab_top+6, 200, $tab_top+6 ); |
595 |
|
|
596 |
$pdf->SetFont('Arial','',10); |
$pdf->SetFont('Arial','',10); |
597 |
|
|
598 |
$pdf->Text(12,$tab_top + 5, $langs->trans("Designation")); |
$pdf->SetXY (10, $tab_top+2); |
599 |
|
$pdf->MultiCell(40,2, $langs->trans("Designation"),'','L'); |
600 |
|
|
601 |
$pdf->line(120, $tab_top, 120, $tab_top + $tab_height); |
$pdf->line(120, $tab_top, 120, $tab_top + $tab_height); |
602 |
$pdf->Text(122, $tab_top + 5, $langs->trans("VAT")); |
$pdf->SetXY (120, $tab_top+2); |
603 |
|
$pdf->MultiCell(12,2, $langs->trans("VAT"),'','C'); |
604 |
|
|
605 |
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); |
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); |
606 |
$pdf->Text(135, $tab_top + 5,$langs->trans("PriceUHT")); |
$pdf->SetXY (132, $tab_top+2); |
607 |
|
$pdf->MultiCell(18,2, $langs->trans("PriceUHT"),'','C'); |
608 |
|
|
609 |
$pdf->line(150, $tab_top, 150, $tab_top + $tab_height); |
$pdf->line(150, $tab_top, 150, $tab_top + $tab_height); |
610 |
$pdf->Text(153, $tab_top + 5, $langs->trans("Qty")); |
$pdf->SetXY (150, $tab_top+2); |
611 |
|
$pdf->MultiCell(12,2, $langs->trans("Qty"),'','C'); |
612 |
|
|
613 |
$pdf->line(162, $tab_top, 162, $tab_top + $tab_height); |
$pdf->line(162, $tab_top, 162, $tab_top + $tab_height); |
614 |
$pdf->Text(163, $tab_top + 5,$langs->trans("Discount")); |
$pdf->SetXY (162, $tab_top+2); |
615 |
|
$pdf->MultiCell(15,2, $langs->trans("Discount"),'','C'); |
616 |
|
|
617 |
$pdf->line(177, $tab_top, 177, $tab_top + $tab_height); |
$pdf->line(177, $tab_top, 177, $tab_top + $tab_height); |
618 |
$pdf->Text(185, $tab_top + 5, $langs->trans("TotalHT")); |
$pdf->SetXY (177, $tab_top+2); |
619 |
|
$pdf->MultiCell(23,2, $langs->trans("TotalHT"),'','C'); |
620 |
|
|
621 |
} |
} |
622 |
|
|
623 |
/* |
/* |
624 |
* \brief Affiche en-tête facture |
* \brief Affiche en-tête facture |
625 |
* \param pdf objet PDF |
* \param pdf objet PDF |
626 |
* \param fac objet facture |
* \param fac objet facture |
627 |
*/ |
*/ |
628 |
function _pagehead(&$pdf, $fac) |
function _pagehead(&$pdf, $fac) |
629 |
{ |
{ |
630 |
global $langs,$conf; |
global $langs,$conf; |
665 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
666 |
$pdf->MultiCell(100, 10, $langs->trans("Date")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); |
$pdf->MultiCell(100, 10, $langs->trans("Date")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); |
667 |
|
|
668 |
/* |
// Emetteur |
|
* Emetteur |
|
|
*/ |
|
669 |
$posy=42; |
$posy=42; |
670 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
671 |
$pdf->SetFont('Arial','',8); |
$pdf->SetFont('Arial','',8); |
726 |
} |
} |
727 |
|
|
728 |
|
|
729 |
/* |
// Client destinataire |
|
* Client |
|
|
*/ |
|
730 |
$posy=42; |
$posy=42; |
731 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
732 |
$pdf->SetFont('Arial','',8); |
$pdf->SetFont('Arial','',8); |
743 |
$pdf->SetFont('Arial','B',9); |
$pdf->SetFont('Arial','B',9); |
744 |
$pdf->SetXY(102,$posy+12); |
$pdf->SetXY(102,$posy+12); |
745 |
$pdf->MultiCell(86,4, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville); |
$pdf->MultiCell(86,4, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville); |
746 |
|
|
747 |
|
// Cadre client destinataire |
748 |
$pdf->rect(100, $posy, 100, 34); |
$pdf->rect(100, $posy, 100, 34); |
749 |
|
|
750 |
/* |
// Montants exprimés en |
|
* |
|
|
*/ |
|
751 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
752 |
$pdf->SetFont('Arial','',10); |
$pdf->SetFont('Arial','',10); |
753 |
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie)); |
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie)); |
754 |
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre); |
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre); |
|
/* |
|
|
*/ |
|
755 |
|
|
756 |
} |
} |
757 |
|
|
767 |
$langs->load("bills"); |
$langs->load("bills"); |
768 |
$langs->load("companies"); |
$langs->load("companies"); |
769 |
|
|
770 |
|
$html=new Form($this->db); |
771 |
|
|
772 |
|
$footy=14; |
773 |
|
$pdf->SetY(-$footy); |
774 |
|
$pdf->SetDrawColor(224,224,224); |
775 |
|
$pdf->line(10, 282, 200, 282); |
776 |
|
|
777 |
$footy=13; |
$footy=13; |
778 |
$pdf->SetFont('Arial','',8); |
$pdf->SetFont('Arial','',8); |
779 |
|
|
780 |
$ligne=""; |
$ligne=""; |
781 |
if (defined('MAIN_INFO_CAPITAL') && MAIN_INFO_CAPITAL) { |
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) |
782 |
$ligne="SARL au Capital de " . MAIN_INFO_CAPITAL." ".$langs->trans("Currency".$conf->monnaie); |
{ |
783 |
|
$ligne=($ligne?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); |
784 |
|
} |
785 |
|
if ($conf->global->MAIN_INFO_CAPITAL) |
786 |
|
{ |
787 |
|
$ligne=($ligne?" - ":"")."Capital de " . MAIN_INFO_CAPITAL." ".$langs->trans("Currency".$conf->monnaie); |
788 |
} |
} |
789 |
if (defined('MAIN_INFO_SIREN') && MAIN_INFO_SIREN) { |
if ($conf->global->MAIN_INFO_SIREN) |
790 |
|
{ |
791 |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->code_pays).": ".MAIN_INFO_SIREN; |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->code_pays).": ".MAIN_INFO_SIREN; |
792 |
} |
} |
793 |
if (defined('MAIN_INFO_SIRET') && MAIN_INFO_SIRET) { |
if ($conf->global->MAIN_INFO_SIRET) |
794 |
|
{ |
795 |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->code_pays).": ".MAIN_INFO_SIRET; |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->code_pays).": ".MAIN_INFO_SIRET; |
796 |
} |
} |
797 |
if (defined('MAIN_INFO_RCS') && MAIN_INFO_RCS) { |
if ($conf->global->MAIN_INFO_RCS) |
798 |
|
{ |
799 |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->code_pays).": ".MAIN_INFO_RCS; |
$ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->code_pays).": ".MAIN_INFO_RCS; |
800 |
} |
} |
801 |
if ($ligne) { |
if ($ligne) |
802 |
|
{ |
803 |
$pdf->SetY(-$footy); |
$pdf->SetY(-$footy); |
804 |
$pdf->MultiCell(190, 3, $ligne, 0, 'C'); |
$pdf->MultiCell(190, 3, $ligne, 0, 'C'); |
|
$footy-=3; |
|
805 |
} |
} |
806 |
|
|
807 |
// Affiche le numéro de TVA intracommunautaire |
// Affiche le numéro de TVA intracommunautaire |
808 |
if (MAIN_INFO_TVAINTRA == 'MAIN_INFO_TVAINTRA') { |
if ($conf->global->MAIN_INFO_TVAINTRA == 'MAIN_INFO_TVAINTRA') { |
809 |
|
$footy-=3; |
810 |
$pdf->SetY(-$footy); |
$pdf->SetY(-$footy); |
811 |
$pdf->SetTextColor(200,0,0); |
$pdf->SetTextColor(200,0,0); |
812 |
$pdf->SetFont('Arial','B',8); |
$pdf->SetFont('Arial','B',8); |
814 |
$pdf->MultiCell(190, 3, $langs->trans("ErrorGoToGlobalSetup"),0,'L',0); |
$pdf->MultiCell(190, 3, $langs->trans("ErrorGoToGlobalSetup"),0,'L',0); |
815 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
816 |
} |
} |
817 |
elseif (MAIN_INFO_TVAINTRA != '') { |
elseif ($conf->global->MAIN_INFO_TVAINTRA != '') { |
818 |
|
$footy-=3; |
819 |
$pdf->SetY(-$footy); |
$pdf->SetY(-$footy); |
820 |
$pdf->MultiCell(190, 3, $langs->trans("TVAIntra").": ".MAIN_INFO_TVAINTRA, 0, 'C'); |
$pdf->MultiCell(190, 3, $langs->trans("TVAIntra").": ".MAIN_INFO_TVAINTRA, 0, 'C'); |
821 |
} |
} |
822 |
|
|
823 |
$pdf->SetXY(-10,-10); |
$pdf->SetXY(-20,-$footy); |
824 |
$pdf->MultiCell(10, 3, $pdf->PageNo().'/{nb}', 0, 'R'); |
$pdf->MultiCell(10, 3, $pdf->PageNo().'/{nb}', 0, 'R'); |
825 |
} |
} |
826 |
|
|