175 |
|
|
176 |
$this->_pagehead($pdf, $fac); |
$this->_pagehead($pdf, $fac); |
177 |
|
|
178 |
$tab_top = 96; |
$pagenb = 1; |
179 |
|
$tab_top = 90; |
180 |
|
$tab_top_newpage = 50; |
181 |
$tab_height = 110; |
$tab_height = 110; |
182 |
|
|
|
$pdf->SetFont('Arial','', 9); |
|
|
|
|
183 |
$iniY = $tab_top + 8; |
$iniY = $tab_top + 8; |
184 |
$curY = $tab_top + 8; |
$curY = $tab_top + 8; |
185 |
$nexY = $tab_top + 8; |
$nexY = $tab_top + 8; |
212 |
$libelleproduitservice.="\n(".$langs->trans("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")"; |
$libelleproduitservice.="\n(".$langs->trans("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")"; |
213 |
} |
} |
214 |
|
|
215 |
|
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page |
216 |
|
|
217 |
$pdf->SetXY ($this->posxdesc-1, $curY); |
$pdf->SetXY ($this->posxdesc-1, $curY); |
218 |
$pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J'); |
$pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J'); |
219 |
|
|
251 |
|
|
252 |
$nexY+=2; // Passe espace entre les lignes |
$nexY+=2; // Passe espace entre les lignes |
253 |
|
|
254 |
if ($nexY > 200 && $i < $nblignes - 1) |
if ($nexY > 200 && $i < ($nblignes - 1)) |
255 |
{ |
{ |
256 |
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); |
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY); |
257 |
|
$this->_pagefoot($pdf); |
258 |
|
|
259 |
|
// Nouvelle page |
260 |
$pdf->AddPage(); |
$pdf->AddPage(); |
261 |
$nexY = $iniY; |
$pagenb++; |
262 |
$this->_pagehead($pdf, $fac); |
$this->_pagehead($pdf, $fac, 0); |
263 |
|
|
264 |
|
$nexY = $tab_top_newpage + 8; |
265 |
$pdf->SetTextColor(0,0,0); |
$pdf->SetTextColor(0,0,0); |
266 |
$pdf->SetFont('Arial','', 10); |
$pdf->SetFont('Arial','', 10); |
267 |
} |
} |
268 |
|
|
269 |
} |
} |
270 |
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); |
// Affiche cadre tableau |
271 |
|
if ($pagenb == 1) |
272 |
|
{ |
273 |
|
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); |
274 |
|
$bottomlasttab=$tab_top + $tab_height + 1; |
275 |
|
} |
276 |
|
else |
277 |
|
{ |
278 |
|
$this->_tableau($pdf, $tab_top_newpage, $tab_height, $nexY); |
279 |
|
$bottomlasttab=$tab_top_newpage + $tab_height + 1; |
280 |
|
} |
281 |
|
|
282 |
$deja_regle = $fac->getSommePaiement(); |
$deja_regle = $fac->getSommePaiement(); |
283 |
|
|
284 |
$posy=$this->_tableau_tot($pdf, $fac, $deja_regle); |
$posy=$this->_tableau_tot($pdf, $fac, $deja_regle, $bottomlasttab); |
285 |
|
|
286 |
if ($deja_regle) { |
if ($deja_regle) { |
287 |
$this->_tableau_versements($pdf, $fac, $posy); |
$this->_tableau_versements($pdf, $fac, $posy); |
423 |
$langs->load("bills"); |
$langs->load("bills"); |
424 |
|
|
425 |
$tab3_posx = 120; |
$tab3_posx = 120; |
426 |
$tab3_top = $posy + 6; |
$tab3_top = $posy + 8; |
427 |
$tab3_width = 80; |
$tab3_width = 80; |
428 |
$tab3_height = 4; |
$tab3_height = 4; |
429 |
|
|
508 |
* \param deja_regle Montant deja regle |
* \param deja_regle Montant deja regle |
509 |
* \return y Position pour suite |
* \return y Position pour suite |
510 |
*/ |
*/ |
511 |
function _tableau_tot(&$pdf, $fac, $deja_regle) |
function _tableau_tot(&$pdf, $fac, $deja_regle, $posy) |
512 |
{ |
{ |
513 |
global $langs; |
global $langs; |
514 |
$langs->load("main"); |
$langs->load("main"); |
515 |
$langs->load("bills"); |
$langs->load("bills"); |
516 |
|
|
517 |
$tab2_top = 207; |
$tab2_top = $posy; |
518 |
$tab2_hl = 5; |
$tab2_hl = 5; |
519 |
$tab2_height = $tab2_hl * 4; |
$tab2_height = $tab2_hl * 4; |
520 |
$pdf->SetFont('Arial','', 9); |
$pdf->SetFont('Arial','', 9); |
636 |
*/ |
*/ |
637 |
function _tableau(&$pdf, $tab_top, $tab_height, $nexY) |
function _tableau(&$pdf, $tab_top, $tab_height, $nexY) |
638 |
{ |
{ |
639 |
global $langs; |
global $langs,$conf; |
640 |
$langs->load("main"); |
$langs->load("main"); |
641 |
$langs->load("bills"); |
$langs->load("bills"); |
642 |
|
|
643 |
|
// Montants exprimés en (en tab_top - 1) |
644 |
|
$pdf->SetTextColor(0,0,0); |
645 |
|
$pdf->SetFont('Arial','',8); |
646 |
|
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie)); |
647 |
|
$pdf->Text($this->page_largeur - $this->marge_droite - $pdf->GetStringWidth($titre), $tab_top-1, $titre); |
648 |
|
|
649 |
|
$pdf->SetDrawColor(128,128,128); |
650 |
|
|
651 |
// Rect prend une longueur en 3eme param |
// Rect prend une longueur en 3eme param |
652 |
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); |
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); |
653 |
// line prend une position y en 3eme param |
// line prend une position y en 3eme param |
679 |
|
|
680 |
if ($this->atleastonediscount) |
if ($this->atleastonediscount) |
681 |
{ |
{ |
682 |
$pdf->line($this->postotalht-1, $tab_top, $this->postotalht-1, $tab_top + $tab_height); |
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); |
683 |
} |
} |
684 |
$pdf->SetXY ($this->postotalht-1, $tab_top+2); |
$pdf->SetXY ($this->postotalht-1, $tab_top+2); |
685 |
$pdf->MultiCell(23,2, $langs->trans("TotalHT"),'','C'); |
$pdf->MultiCell(23,2, $langs->trans("TotalHT"),'','C'); |
687 |
} |
} |
688 |
|
|
689 |
/* |
/* |
690 |
* \brief Affiche en-tête facture |
* \brief Affiche en-tête facture |
691 |
* \param pdf objet PDF |
* \param pdf Objet PDF |
692 |
* \param fac objet facture |
* \param fac Objet facture |
693 |
|
* \param showadress 0=non, 1=oui |
694 |
*/ |
*/ |
695 |
function _pagehead(&$pdf, $fac) |
function _pagehead(&$pdf, $fac, $showadress=1) |
696 |
{ |
{ |
697 |
global $langs,$conf,$mysoc; |
global $langs,$conf,$mysoc; |
698 |
|
|
735 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
736 |
$pdf->MultiCell(100, 4, $langs->trans("Bill")." ".$fac->ref, '' , 'R'); |
$pdf->MultiCell(100, 4, $langs->trans("Bill")." ".$fac->ref, '' , 'R'); |
737 |
$pdf->SetFont('Arial','',12); |
$pdf->SetFont('Arial','',12); |
738 |
$pdf->SetXY(100,$posy+6); |
|
739 |
|
$posy+=6; |
740 |
|
$pdf->SetXY(100,$posy); |
741 |
$pdf->SetTextColor(0,0,60); |
$pdf->SetTextColor(0,0,60); |
742 |
$pdf->MultiCell(100, 4, $langs->trans("Date")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); |
$pdf->MultiCell(100, 4, $langs->trans("Date")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); |
743 |
|
|
744 |
// Emetteur |
if ($showadress) |
745 |
$posy=42; |
{ |
746 |
$hautcadre=40; |
// Emetteur |
747 |
$pdf->SetTextColor(0,0,0); |
$posy=42; |
748 |
$pdf->SetFont('Arial','',8); |
$hautcadre=40; |
749 |
$pdf->SetXY($this->marge_gauche,$posy-5); |
$pdf->SetTextColor(0,0,0); |
750 |
$pdf->MultiCell(66,5, $langs->trans("BillFrom").":"); |
$pdf->SetFont('Arial','',8); |
751 |
|
$pdf->SetXY($this->marge_gauche,$posy-5); |
752 |
|
$pdf->MultiCell(66,5, $langs->trans("BillFrom").":"); |
753 |
$pdf->SetXY($this->marge_gauche,$posy); |
|
754 |
$pdf->SetFillColor(230,230,230); |
|
755 |
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
$pdf->SetXY($this->marge_gauche,$posy); |
756 |
|
$pdf->SetFillColor(230,230,230); |
757 |
|
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
758 |
$pdf->SetXY($this->marge_gauche+2,$posy+3); |
|
759 |
|
|
760 |
// Nom emetteur |
$pdf->SetXY($this->marge_gauche+2,$posy+3); |
761 |
$pdf->SetTextColor(0,0,60); |
|
762 |
$pdf->SetFont('Arial','B',11); |
// Nom emetteur |
763 |
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); |
$pdf->SetTextColor(0,0,60); |
764 |
else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L'); |
$pdf->SetFont('Arial','B',11); |
765 |
|
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); |
766 |
// Caractéristiques emetteur |
else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L'); |
767 |
$carac_emetteur = ''; |
|
768 |
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; |
// Caractéristiques emetteur |
769 |
else { |
$carac_emetteur = ''; |
770 |
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->adresse; |
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; |
771 |
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->cp.' '.$mysoc->ville; |
else { |
772 |
} |
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->adresse; |
773 |
$carac_emetteur .= "\n"; |
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->cp.' '.$mysoc->ville; |
774 |
// Tel |
} |
775 |
if (defined("FAC_PDF_TEL") && FAC_PDF_TEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Phone").": ".FAC_PDF_TEL; |
$carac_emetteur .= "\n"; |
776 |
elseif ($mysoc->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Phone").": ".$mysoc->tel; |
// Tel |
777 |
// Fax |
if (defined("FAC_PDF_TEL") && FAC_PDF_TEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Phone").": ".FAC_PDF_TEL; |
778 |
if (defined("FAC_PDF_FAX") && FAC_PDF_FAX) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Fax").": ".FAC_PDF_FAX; |
elseif ($mysoc->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Phone").": ".$mysoc->tel; |
779 |
elseif ($mysoc->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Fax").": ".$mysoc->fax; |
// Fax |
780 |
// EMail |
if (defined("FAC_PDF_FAX") && FAC_PDF_FAX) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Fax").": ".FAC_PDF_FAX; |
781 |
if (defined("FAC_PDF_MEL") && FAC_PDF_MEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Email").": ".FAC_PDF_MEL; |
elseif ($mysoc->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Fax").": ".$mysoc->fax; |
782 |
elseif ($mysoc->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Email").": ".$mysoc->email; |
// EMail |
783 |
// Web |
if (defined("FAC_PDF_MEL") && FAC_PDF_MEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Email").": ".FAC_PDF_MEL; |
784 |
if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW; |
elseif ($mysoc->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Email").": ".$mysoc->email; |
785 |
elseif ($mysoc->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".$mysoc->url; |
// Web |
786 |
|
if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW; |
787 |
$pdf->SetFont('Arial','',9); |
elseif ($mysoc->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".$mysoc->url; |
788 |
$pdf->SetXY($this->marge_gauche+2,$posy+8); |
|
789 |
$pdf->MultiCell(80,4, $carac_emetteur); |
$pdf->SetFont('Arial','',9); |
790 |
|
$pdf->SetXY($this->marge_gauche+2,$posy+8); |
791 |
// Client destinataire |
$pdf->MultiCell(80,4, $carac_emetteur); |
792 |
$posy=42; |
|
793 |
$pdf->SetTextColor(0,0,0); |
// Client destinataire |
794 |
$pdf->SetFont('Arial','',8); |
$posy=42; |
795 |
$pdf->SetXY(102,$posy-5); |
$pdf->SetTextColor(0,0,0); |
796 |
$pdf->MultiCell(80,5, $langs->trans("BillTo").":"); |
$pdf->SetFont('Arial','',8); |
797 |
$fac->fetch_client(); |
$pdf->SetXY(102,$posy-5); |
798 |
// Cadre client destinataire |
$pdf->MultiCell(80,5, $langs->trans("BillTo").":"); |
799 |
$pdf->rect(100, $posy, 100, $hautcadre); |
$fac->fetch_client(); |
800 |
|
// Cadre client destinataire |
801 |
// Nom client |
$pdf->rect(100, $posy, 100, $hautcadre); |
802 |
$pdf->SetXY(102,$posy+3); |
|
803 |
$pdf->SetFont('Arial','B',11); |
// Nom client |
804 |
$pdf->MultiCell(106,4, $fac->client->nom, 0, 'L'); |
$pdf->SetXY(102,$posy+3); |
805 |
|
$pdf->SetFont('Arial','B',11); |
806 |
// Caractéristiques client |
$pdf->MultiCell(106,4, $fac->client->nom, 0, 'L'); |
807 |
$carac_client=$fac->client->adresse; |
|
808 |
$carac_client.="\n".$fac->client->cp . " " . $fac->client->ville."\n"; |
// Caractéristiques client |
809 |
if ($fac->client->tva_intra) $carac_client.="\n".$langs->trans("VATIntraShort").': '.$fac->client->tva_intra; |
$carac_client=$fac->client->adresse; |
810 |
$pdf->SetFont('Arial','',9); |
$carac_client.="\n".$fac->client->cp . " " . $fac->client->ville."\n"; |
811 |
$pdf->SetXY(102,$posy+8); |
if ($fac->client->tva_intra) $carac_client.="\n".$langs->trans("VATIntraShort").': '.$fac->client->tva_intra; |
812 |
$pdf->MultiCell(86,4, $carac_client); |
$pdf->SetFont('Arial','',9); |
813 |
|
$pdf->SetXY(102,$posy+8); |
814 |
// Montants exprimés en |
$pdf->MultiCell(86,4, $carac_client); |
815 |
$pdf->SetTextColor(0,0,0); |
} |
816 |
$pdf->SetFont('Arial','',10); |
|
|
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie)); |
|
|
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre); |
|
|
|
|
817 |
} |
} |
818 |
|
|
819 |
/* |
/* |