Utilisation de transnoentities au lieu de trans

This commit is contained in:
Rodolphe Quiedeville 2006-12-17 12:48:00 +00:00
parent 0237a5162e
commit 4cd3480b44
3 changed files with 1390 additions and 1393 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -21,440 +21,439 @@
* $Source$ * $Source$
*/ */
/** \file htdocs/includes/modules/facture/pdf_bulot.modules.php /**
\ingroup facture \file htdocs/includes/modules/facture/pdf_bulot.modules.php
\brief Fichier de la classe permettant de générer les factures au modèle Bulot \ingroup facture
\author Laurent Destailleur \brief Fichier de la classe permettant de générer les factures au modèle Bulot
\version $Revision$ \author Laurent Destailleur
\version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
/**
/** \class pdf_bulot \class pdf_bulot
\brief Classe permettant de générer les factures au modèle Bulot \brief Classe permettant de générer les factures au modèle Bulot
*/ */
class pdf_bulot extends ModelePDFFactures class pdf_bulot extends ModelePDFFactures
{ {
var $emetteur; // Objet societe qui emet var $emetteur; // Objet societe qui emet
/** \brief Constructeur /**
\param db handler accès base de donnée \brief Constructeur
*/ \param db handler accès base de donnée
function pdf_bulot($db) */
{ function pdf_bulot($db)
global $conf,$langs,$mysoc; {
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("bills");
$langs->load("products");
$this->db = $db;
$this->name = "bulot";
$this->description = $langs->transnoentities('PDFBulotDescription');
// Dimension page pour format A4
$this->type = 'pdf';
$this->page_largeur = 210;
$this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur);
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
}
/**
\brief Fonction générant la facture sur le disque
\param fac Objet facture à générer (ou id si ancienne methode)
\return int 1=ok, 0=ko
*/
function write_pdf_file($fac,$outputlangs='')
{
global $user,$langs,$conf;
if ($conf->facture->dir_output)
{
// Définition de l'objet $fac (pour compatibilite ascendante)
if (! is_object($fac))
{
$id = $fac;
$fac = new Facture($this->db,"",$id);
$ret=$fac->fetch($id);
}
// Définition de $dir et $file
if ($fac->specimen)
{
$dir = $conf->facture->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$facref = sanitize_string($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".pdf";
}
if (! file_exists($dir))
{
if (create_exdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
// Initialisation facture vierge
$pdf=new FPDF('P','mm','A4');
$pdf->Open();
$pdf->AddPage();
$this->_pagehead($pdf, $fac);
$pdf->SetTitle($fac->ref);
$pdf->SetSubject($langs->transnoentities("Bill"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname);
$tab_top = 100;
$tab_height = 110;
/*
*
*/
$pdf->SetFillColor(220,220,220);
$pdf->SetFont('Arial','', 9);
$pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY();
$curY = $pdf->GetY();
$nexY = $pdf->GetY();
$nblignes = sizeof($fac->lignes);
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$langs->load("main"); $pdf->SetXY (11, $curY );
$langs->load("bills"); $pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J');
$langs->load("products");
$this->db = $db; $nexY = $pdf->GetY();
$this->name = "bulot";
$this->description = $langs->trans('PDFBulotDescription');
// Dimension page pour format A4 $pdf->SetXY (133, $curY);
$this->type = 'pdf'; $pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_tx, 0, 'C');
$this->page_largeur = 210;
$this->page_hauteur = 297; $pdf->SetXY (145, $curY);
$this->format = array($this->page_largeur,$this->page_hauteur); $pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C');
// Recupere emmetteur $pdf->SetXY (156, $curY);
$this->emetteur=$mysoc; $pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0);
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
} $pdf->SetXY (174, $curY);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
/** $pdf->MultiCell(26, 5, $total, 0, 'R', 0);
* \brief Fonction générant la facture sur le disque
* \param fac Objet facture à générer (ou id si ancienne methode) if ($nexY > 200 && $i < $nblignes - 1)
* \return int 1=ok, 0=ko {
*/ $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
function write_pdf_file($fac,$outputlangs='') $pdf->AddPage();
{ $nexY = $iniY;
global $user,$langs,$conf; $this->_pagehead($pdf, $fac);
$pdf->SetTextColor(0,0,0);
if ($conf->facture->dir_output) $pdf->SetFont('Arial','', 10);
{ }
// Définition de l'objet $fac (pour compatibilite ascendante)
if (! is_object($fac)) }
{ $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
$id = $fac;
$fac = new Facture($this->db,"",$id); $this->_tableau_tot($pdf, $fac, $tab_top, $tab_height);
$ret=$fac->fetch($id);
} $this->_tableau_compl($pdf, $fac);
// Définition de $dir et $file /*
if ($fac->specimen) *
{ */
$dir = $conf->facture->dir_output; if (defined("FACTURE_RIB_NUMBER"))
$file = $dir . "/SPECIMEN.pdf"; {
} if (FACTURE_RIB_NUMBER > 0)
else {
{ $account = new Account($this->db);
$facref = sanitize_string($fac->ref); $account->fetch(FACTURE_RIB_NUMBER);
$dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".pdf"; $pdf->SetXY (10, 40);
} $pdf->SetFont('Arial','U',8);
$pdf->MultiCell(40, 4, $langs->transnoentities("BankDetails"), 0, 'L', 0);
if (! file_exists($dir)) $pdf->SetFont('Arial','',8);
{ $pdf->MultiCell(40, 4, $langs->transnoentities("BankCode").' : '. $account->code_banque, 0, 'L', 0);
if (create_exdir($dir) < 0) $pdf->MultiCell(40, 4, $langs->transnoentities("DeskCode").' : ' . $account->code_guichet, 0, 'L', 0);
{ $pdf->MultiCell(50, 4, $langs->transnoentities("BankAccountNumber").' : ' . $account->number, 0, 'L', 0);
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir); $pdf->MultiCell(40, 4, $langs->transnoentities("BankAccountNumberKey").' : ' . $account->cle_rib, 0, 'L', 0);
return 0; $pdf->MultiCell(40, 4, $langs->transnoentities("Residence").' : ' . $account->domiciliation, 0, 'L', 0);
} $pdf->MultiCell(40, 4, $langs->transnoentities("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0);
} $pdf->MultiCell(40, 4, $langs->transnoentities("BIC").' : ' . $account->bic, 0, 'L', 0);
}
if (file_exists($dir)) }
{
// Initialisation facture vierge /*
$pdf=new FPDF('P','mm','A4'); *
$pdf->Open(); *
$pdf->AddPage(); */
$this->_pagehead($pdf, $fac); $pdf->SetFont('Arial','U',12);
$pdf->SetXY(10, 220);
$pdf->SetTitle($fac->ref); $titre = $langs->transnoentities("PaymentConditions").' : '.$fac->cond_reglement_facture;
$pdf->SetSubject($langs->trans("Bill")); $pdf->MultiCell(190, 5, $titre, 0, 'J');
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetFont('Arial','',9);
$pdf->SetXY(10, 265);
$tab_top = 100; $pdf->MultiCell(190, 5, $langs->transnoentities("PrettyLittleSentence"), 0, 'J');
$tab_height = 110;
$pdf->Close();
/*
* $pdf->Output($file);
*/
return 1;
$pdf->SetFillColor(220,220,220); }
else
$pdf->SetFont('Arial','', 9); {
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
$pdf->SetXY (10, $tab_top + 10 ); return 0;
}
$iniY = $pdf->GetY(); }
$curY = $pdf->GetY(); else
$nexY = $pdf->GetY(); {
$nblignes = sizeof($fac->lignes); $this->error=$langs->transnoentities("ErrorConstantNotDefined","FAC_OUTPUTDIR");
return 0;
for ($i = 0 ; $i < $nblignes ; $i++) }
{ $this->error=$langs->transnoentities("ErrorUnknown");
$curY = $nexY; return 0; // Erreur par defaut
}
$pdf->SetXY (11, $curY );
$pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J'); /**
* \brief Affiche tableau des versement
$nexY = $pdf->GetY(); * \param pdf objet PDF
* \param fac objet facture
$pdf->SetXY (133, $curY); */
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_tx, 0, 'C'); function _tableau_compl(&$pdf, $fac)
{
$pdf->SetXY (145, $curY); global $langs;
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C');
$tab3_top = 240;
$pdf->SetXY (156, $curY); $tab3_height = 18;
$pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0); $tab3_width = 60;
$pdf->SetXY (174, $curY); $pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); $pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 );
$pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 );
if ($nexY > 200 && $i < $nblignes - 1)
{ $pdf->line(30, $tab3_top, 30, $tab3_top + $tab3_height );
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
$pdf->AddPage(); $pdf->SetFont('Arial','',8);
$nexY = $iniY; $pdf->SetXY (10, $tab3_top - 6);
$this->_pagehead($pdf, $fac); $pdf->MultiCell(60, 6, $langs->transnoentities("ExtraInfos"), 0, 'L', 0);
$pdf->SetTextColor(0,0,0); $pdf->SetXY (10, $tab3_top );
$pdf->SetFont('Arial','', 10); $pdf->MultiCell(20, 6, $langs->transnoentities("RegulatedOn"), 0, 'L', 0);
} $pdf->SetXY (10, $tab3_top + 6);
$pdf->MultiCell(20, 6, $langs->transnoentities("ChequeNumber"), 0, 'L', 0);
} $pdf->SetXY (10, $tab3_top + 12);
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $pdf->MultiCell(20, 6, $langs->transnoentities("Bank"), 0, 'L', 0);
}
$this->_tableau_tot($pdf, $fac, $tab_top, $tab_height);
/**
$this->_tableau_compl($pdf, $fac); \brief Affiche le total à payer
\param pdf objet PDF
/* \param fac objet facture
* \param deja_regle montant deja regle
*/ */
if (defined("FACTURE_RIB_NUMBER")) function _tableau_tot(&$pdf, $fac, $top, $height)
{ {
if (FACTURE_RIB_NUMBER > 0) global $langs;
{ $langs->load("main");
$account = new Account($this->db); $langs->load("bills");
$account->fetch(FACTURE_RIB_NUMBER);
$tab2_top = $top + $height;
$pdf->SetXY (10, 40); $tab2_hl = 5;
$pdf->SetFont('Arial','U',8); $tab2_height = $tab2_hl * 4;
$pdf->MultiCell(40, 4, $langs->trans("BankDetails"), 0, 'L', 0); $pdf->SetFont('Arial','', 9);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','', 9);
$pdf->MultiCell(40, 4, $langs->trans("BankCode").' : '. $account->code_banque, 0, 'L', 0);
$pdf->MultiCell(40, 4, $langs->trans("DeskCode").' : ' . $account->code_guichet, 0, 'L', 0); // $pdf->Rect(132, $tab2_top, 68, $tab2_height);
$pdf->MultiCell(50, 4, $langs->trans("BankAccountNumber").' : ' . $account->number, 0, 'L', 0); // $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
$pdf->MultiCell(40, 4, $langs->trans("BankAccountNumberKey").' : ' . $account->cle_rib, 0, 'L', 0);
$pdf->MultiCell(40, 4, $langs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0); // $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 );
$pdf->MultiCell(40, 4, $langs->trans("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0); // $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 );
$pdf->MultiCell(40, 4, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); // $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 );
}
} $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_hl, $langs->transnoentities("TotalHT"), 0, 'R', 0);
/*
* $pdf->SetXY (174, $tab2_top + 0);
* $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
*/
if ($fac->remise > 0)
$pdf->SetFont('Arial','U',12); {
$pdf->SetXY(10, 220); $pdf->SetXY (132, $tab2_top + $tab2_hl);
$titre = $langs->trans("PaymentConditions").' : '.$fac->cond_reglement_facture; $pdf->MultiCell(42, $tab2_hl, $langs->transnoentities("GlobalDiscount"), 0, 'R', 0);
$pdf->MultiCell(190, 5, $titre, 0, 'J');
$pdf->SetXY (174, $tab2_top + $tab2_hl);
$pdf->SetFont('Arial','',9); $pdf->MultiCell(26, $tab2_hl, price($fac->remise), 0, 'R', 0);
$pdf->SetXY(10, 265);
$pdf->MultiCell(190, 5, $langs->trans("PrettyLittleSentence"), 0, 'J'); $pdf->SetXY (132, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell(42, $tab2_hl, $langs->transnoentities("WithDiscountTotalHT"), 0, 'R', 0);
$pdf->Close();
$pdf->SetXY (174, $tab2_top + $tab2_hl * 2);
$pdf->Output($file); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 0);
return 1; $index = 3;
} }
else else
{ {
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir); $index = 1;
return 0; }
}
} $pdf->SetXY (132, $tab2_top + $tab2_hl * $index);
else $pdf->MultiCell(42, $tab2_hl, $langs->transnoentities("TotalVAT"), 0, 'R', 0);
{
$this->error=$langs->trans("ErrorConstantNotDefined","FAC_OUTPUTDIR"); $pdf->SetXY (174, $tab2_top + $tab2_hl * $index);
return 0; $pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
}
$this->error=$langs->trans("ErrorUnknown"); $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1));
return 0; // Erreur par defaut $pdf->MultiCell(42, $tab2_hl, $langs->transnoentities("TotalTTC"), 0, 'R', 1);
}
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1));
/** $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1);
* \brief Affiche tableau des versement
* \param pdf objet PDF $deja_regle = $fac->getSommePaiement();
* \param fac objet facture
*/ if ($deja_regle > 0)
function _tableau_compl(&$pdf, $fac) {
{ $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+2));
global $langs; $pdf->MultiCell(42, $tab2_hl, $langs->transnoentities("AlreadyPayed"), 0, 'R', 0);
$tab3_top = 240; $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+2));
$tab3_height = 18; $pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0);
$tab3_width = 60;
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+3));
$pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height); $pdf->MultiCell(42, $tab2_hl, $langs->transnoentities("RemainderToPay"), 0, 'R', 1);
$pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 ); $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+3));
$pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 ); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 1);
}
$pdf->line(30, $tab3_top, 30, $tab3_top + $tab3_height ); }
$pdf->SetFont('Arial','',8);
$pdf->SetXY (10, $tab3_top - 6); /**
$pdf->MultiCell(60, 6, $langs->trans("ExtraInfos"), 0, 'L', 0); \brief Affiche la grille des lignes de factures
$pdf->SetXY (10, $tab3_top ); \param pdf objet PDF
$pdf->MultiCell(20, 6, $langs->trans("RegulatedOn"), 0, 'L', 0); */
$pdf->SetXY (10, $tab3_top + 6); function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
$pdf->MultiCell(20, 6, $langs->trans("ChequeNumber"), 0, 'L', 0); {
$pdf->SetXY (10, $tab3_top + 12); global $langs;
$pdf->MultiCell(20, 6, $langs->trans("Bank"), 0, 'L', 0); $langs->load("main");
} $langs->load("bills");
/** $pdf->SetFont('Arial','',10);
* \brief Affiche le total à payer
* \param pdf objet PDF $pdf->Text(11,$tab_top + 5,$langs->transnoentities("Designation"));
* \param fac objet facture
* \param deja_regle montant deja regle $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->Text(134,$tab_top + 5,$langs->transnoentities("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->Text(147,$tab_top + 5,$langs->transnoentities("Qty"));
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
$pdf->Text(160,$tab_top + 5,$langs->transnoentities("PriceU"));
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
$pdf->Text(187,$tab_top + 5,$langs->transnoentities("Total"));
$pdf->Rect(10, $tab_top, 190, $tab_height);
$pdf->line(10, $tab_top + 10, 200, $tab_top + 10 );
}
/**
\brief Affiche en-tête facture
\param pdf objet PDF
\param fac objet facture
*/
function _pagehead(&$pdf, $fac)
{
global $langs,$conf;
$langs->load("main");
$langs->load("bills");
$pdf->SetXY(10,5);
if (defined("FAC_PDF_INTITULE"))
{
$pdf->SetTextColor(0,0,200);
$pdf->SetFont('Arial','B',14);
$pdf->MultiCell(60, 8, FAC_PDF_INTITULE, 0, 'L');
}
$pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE"))
{
$pdf->SetFont('Arial','',12);
$pdf->MultiCell(40, 5, FAC_PDF_ADRESSE);
}
if (defined("FAC_PDF_TEL"))
{
$pdf->SetFont('Arial','',10);
$pdf->MultiCell(40, 5, $langs->transnoentities('PhoneNumber').' : '.FAC_PDF_TEL);
}
if ($this->emetteur->profid1)
{
$pdf->SetFont('Arial','',10);
$pdf->MultiCell(40, 5, "SIREN : ".$this->emetteur->profid1);
}
if (defined("FAC_PDF_INTITULE2"))
{
$pdf->SetXY(100,5);
$pdf->SetFont('Arial','B',14);
$pdf->SetTextColor(0,0,200);
$pdf->MultiCell(100, 10, FAC_PDF_INTITULE2, '' , 'R');
}
/*
* Adresse Client
*/ */
function _tableau_tot(&$pdf, $fac, $top, $height) $pdf->SetTextColor(0,0,0);
{ $pdf->SetFont('Arial','B',12);
global $langs; $fac->fetch_client();
$langs->load("main"); $pdf->SetXY(102,42);
$langs->load("bills"); $pdf->MultiCell(66,5, $fac->client->nom);
$pdf->SetFont('Arial','B',11);
$tab2_top = $top + $height; $pdf->SetXY(102,$pdf->GetY());
$tab2_hl = 5; $pdf->MultiCell(66,5, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville);
$tab2_height = $tab2_hl * 4; $pdf->rect(100, 40, 100, 40);
$pdf->SetFont('Arial','', 9);
$pdf->SetFont('Arial','', 9); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',14);
// $pdf->Rect(132, $tab2_top, 68, $tab2_height); $pdf->Text(11, 88, $langs->transnoentities('Date').' : ' . strftime("%d %b %Y", $fac->date));
// $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height); $pdf->Text(11, 94, $langs->transnoentities('Invoice').' : '.$fac->ref);
// $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 ); /*
// $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 ); */
// $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 ); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10);
$pdf->SetXY (132, $tab2_top + 0); $titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalHT"), 0, 'R', 0); $pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre);
/*
$pdf->SetXY (174, $tab2_top + 0); */
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
}
if ($fac->remise > 0)
{
$pdf->SetXY (132, $tab2_top + $tab2_hl);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("GlobalDiscount"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl);
$pdf->MultiCell(26, $tab2_hl, price($fac->remise), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("WithDiscountTotalHT"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 0);
$index = 3;
}
else
{
$index = 1;
}
$pdf->SetXY (132, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalVAT"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalTTC"), 0, 'R', 1);
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1));
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1);
$deja_regle = $fac->getSommePaiement();
if ($deja_regle > 0)
{
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+2));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+2));
$pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+3));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("RemainderToPay"), 0, 'R', 1);
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+3));
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 1);
}
}
/*
* \brief Affiche la grille des lignes de factures
* \param pdf objet PDF
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
{
global $langs;
$langs->load("main");
$langs->load("bills");
$pdf->SetFont('Arial','',10);
$pdf->Text(11,$tab_top + 5,$langs->trans("Designation"));
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->Text(134,$tab_top + 5,$langs->trans("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->Text(147,$tab_top + 5,$langs->trans("Qty"));
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
$pdf->Text(160,$tab_top + 5,$langs->trans("PriceU"));
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
$pdf->Text(187,$tab_top + 5,$langs->trans("Total"));
$pdf->Rect(10, $tab_top, 190, $tab_height);
$pdf->line(10, $tab_top + 10, 200, $tab_top + 10 );
}
/*
* \brief Affiche en-tête facture
* \param pdf objet PDF
* \param fac objet facture
*/
function _pagehead(&$pdf, $fac)
{
global $langs,$conf;
$langs->load("main");
$langs->load("bills");
$pdf->SetXY(10,5);
if (defined("FAC_PDF_INTITULE"))
{
$pdf->SetTextColor(0,0,200);
$pdf->SetFont('Arial','B',14);
$pdf->MultiCell(60, 8, FAC_PDF_INTITULE, 0, 'L');
}
$pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE"))
{
$pdf->SetFont('Arial','',12);
$pdf->MultiCell(40, 5, FAC_PDF_ADRESSE);
}
if (defined("FAC_PDF_TEL"))
{
$pdf->SetFont('Arial','',10);
$pdf->MultiCell(40, 5, $langs->trans('PhoneNumber').' : '.FAC_PDF_TEL);
}
if ($this->emetteur->profid1)
{
$pdf->SetFont('Arial','',10);
$pdf->MultiCell(40, 5, "SIREN : ".$this->emetteur->profid1);
}
if (defined("FAC_PDF_INTITULE2"))
{
$pdf->SetXY(100,5);
$pdf->SetFont('Arial','B',14);
$pdf->SetTextColor(0,0,200);
$pdf->MultiCell(100, 10, FAC_PDF_INTITULE2, '' , 'R');
}
/*
* Adresse Client
*/
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','B',12);
$fac->fetch_client();
$pdf->SetXY(102,42);
$pdf->MultiCell(66,5, $fac->client->nom);
$pdf->SetFont('Arial','B',11);
$pdf->SetXY(102,$pdf->GetY());
$pdf->MultiCell(66,5, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville);
$pdf->rect(100, 40, 100, 40);
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',14);
$pdf->Text(11, 88, $langs->trans('Date').' : ' . strftime("%d %b %Y", $fac->date));
$pdf->Text(11, 94, $langs->trans('Invoice').' : '.$fac->ref);
/*
*/
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10);
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie));
$pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre);
/*
*/
}
} }
?> ?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff