<?php
require('../fpdf181/fpdf.php');
define('EURO', chr(128) );
define('EURO_VAL', 6.55957 );
date_default_timezone_set('America/Lima');


//////////////////////////////////////
// Public functions                 //
//////////////////////////////////////
//  function sizeOfText( $texte, $larg )
//  function addSociete( $nom, $adresse )
//  function fact_dev( $libelle, $num )
//  function addDevis( $numdev )
//  function addFacture( $numfact )
//  function addDate( $date )
//  function addClient( $ref )
//  function addPageNumber( $page )
//  function addClientAdresse( $adresse )
//  function addReglement( $mode )
//  function addEcheance( $date )
//  function addNumTVA($tva)
//  function addReference($ref)
//  function addCols( $tab )
//  function addLineFormat( $tab )
//  function lineVert( $tab )
//  function addLine( $ligne, $tab )
//  function addRemarque($remarque)
//  function addCadreTVAs()
//  function addCadreEurosFrancs()
//  function addTVAs( $params, $tab_tva, $invoice )
//  function temporaire( $texte )

class PDF_Invoice extends FPDF
{
// private variables
var $colonnes;
var $format;
var $angle=0;

// private functions
function RoundedRect($x, $y, $w, $h, $r, $style = '')
{
	$k = $this->k;
	$hp = $this->h;
	if($style=='F')
		$op='f';
	elseif($style=='FD' || $style=='DF')
		$op='B';
	else
		$op='S';
	$MyArc = 4/3 * (sqrt(2) - 1);
	$this->_out(sprintf('%.2F %.2F m',($x+$r)*$k,($hp-$y)*$k ));
	$xc = $x+$w-$r ;
	$yc = $y+$r;
	$this->_out(sprintf('%.2F %.2F l', $xc*$k,($hp-$y)*$k ));

	$this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
	$xc = $x+$w-$r ;
	$yc = $y+$h-$r;
	$this->_out(sprintf('%.2F %.2F l',($x+$w)*$k,($hp-$yc)*$k));
	$this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
	$xc = $x+$r ;
	$yc = $y+$h-$r;
	$this->_out(sprintf('%.2F %.2F l',$xc*$k,($hp-($y+$h))*$k));
	$this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
	$xc = $x+$r ;
	$yc = $y+$r;
	$this->_out(sprintf('%.2F %.2F l',($x)*$k,($hp-$yc)*$k ));
	$this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
	$this->_out($op);
}

function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
{
	$h = $this->h;
	$this->_out(sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $x1*$this->k, ($h-$y1)*$this->k,
						$x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
}

function Rotate($angle, $x=-1, $y=-1)
{
	if($x==-1)
		$x=$this->x;
	if($y==-1)
		$y=$this->y;
	if($this->angle!=0)
		$this->_out('Q');
	$this->angle=$angle;
	if($angle!=0)
	{
		$angle*=M_PI/180;
		$c=cos($angle);
		$s=sin($angle);
		$cx=$x*$this->k;
		$cy=($this->h-$y)*$this->k;
		$this->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy));
	}
}

function _endpage()
{
	if($this->angle!=0)
	{
		$this->angle=0;
		$this->_out('Q');
	}
	parent::_endpage();
}

// public functions
function sizeOfText( $texte, $largeur )
{
	$index    = 0;
	$nb_lines = 0;
	$loop     = TRUE;
	while ( $loop )
	{
		$pos = strpos($texte, "\n");
		if (!$pos)
		{
			$loop  = FALSE;
			$ligne = $texte;
		}
		else
		{
			$ligne  = substr( $texte, $index, $pos);
			$texte = substr( $texte, $pos+1 );
		}
		$length = floor( $this->GetStringWidth( $ligne ) );
		$res = 1 + floor( $length / $largeur) ;
		$nb_lines += $res;
	}
	return $nb_lines;
}

// Contenido
function addSociete( $empresa,$documento,$logo,$ext_logo )
{
	$x1 = 15;
	$y1 = 25;
	$s1 = 103;
	$t1 = 30;
	//Positionnement en bas

	$this->Image($logo , 20 ,8, 20 , 20 , $ext_logo);
	$this->SetXY( $s1, $t1 );
	$this->SetFont('Arial','B',15);
	$length = $this->GetStringWidth( $empresa );
	$this->Cell( $length, 2, $empresa);
	$this->SetXY( $x1, $y1 + 13 );
	$this->SetFont('Arial','',11);
	$length = $this->GetStringWidth( $documento );
	//Coordonn�es de la soci�t�
	$lignes = $this->sizeOfText( $documento, $length) ;
	$this->MultiCell($length, 4.5, $documento);
}

// Label and number of invoice/estimate
function fact_dev( $libelle, $num )
{
    $r1  = $this->w - 170;
    $r2  = $r1 + 50;
    $y1  = 10;
    $y2  = $y1 + -1;
    $mid = ($r1 + $r2 ) / 2;
    
    $texte  = $libelle  . $num;    
    $szfont = 15;
    $loop   = 0;
    
    while ( $loop == 0 )
    {
       $this->SetFont( "Arial", "B", $szfont );
       $sz = $this->GetStringWidth( $texte );
       if ( ($r1+$sz) > $r2 )
          $szfont --;
       else
          $loop ++;
    }

    $this->SetLineWidth(0.1);
    $this->SetFillColor(255, 209, 51);
    $this->RoundedRect($r1, $y1, ($r2 - $r1), $y2, 2.5, 'DF');
    $this->SetXY( $r1+1, $y1+2);
    $this->Cell($r2-$r1 -1,5, $texte, 0, 0, "C" );
}

// Estimate
function addDevis( $numdev )
{
	$string = sprintf("DEV%04d",$numdev);
	$this->fact_dev( "Devis", $string );
}

// Invoice
function addFacture( $numfact )
{
	$string = sprintf("FA%04d",$numfact);
	$this->fact_dev( "Facture", $string );
}

function addDate( $date )
{
	$r1  = $this->w - 37;
	$r2  = $r1 + 25;
	$y1  = 12;
	$y2  = $y1 ;
	$mid = $y1 + ($y2 / 2);
	$this->RoundedRect($r1, $y1, ($r2 - $r1), $y2, 'D');
	$this->Line( $r1, $mid, $r2, $mid);
	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+1 );
	$this->SetFont( "Arial", "", 10);
	$this->Cell(10,5, date('d/m/Y'), 0, 0, "C");
	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+7 );
	$this->SetFont( "Arial", "", 10);
	$this->Cell(10,5,date('h:i:s'), 0,0, "C");
}




function addClient( $ref )
{
	$r1  = $this->w - 31;
	$r2  = $r1 + 19;
	$y1  = 17;
	$y2  = $y1;
	$mid = $y1 + ($y2 / 2);
	$this->RoundedRect($r1, $y1, ($r2 - $r1), $y2, 3.5, 'D');
	$this->Line( $r1, $mid, $r2, $mid);
	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+3 );
	$this->SetFont( "Arial", "B", 10);
	$this->Cell(10,5, "CLIENT", 0, 0, "C");
	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1 + 9 );
	$this->SetFont( "Arial", "", 10);
	$this->Cell(10,5,$ref, 0,0, "C");
}

function addPageNumber( $page )
{
	$r1  = $this->w - 80;
	$r2  = $r1 + 19;
	$y1  = 17;
	$y2  = $y1;
	$mid = $y1 + ($y2 / 2);
	$this->RoundedRect($r1, $y1, ($r2 - $r1), $y2, 3.5, 'D');
	$this->Line( $r1, $mid, $r2, $mid);
	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+3 );
	$this->SetFont( "Arial", "B", 10);
	$this->Cell(10,5, "PAGE", 0, 0, "C");
	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1 + 9 );
	$this->SetFont( "Arial", "", 10);
	$this->Cell(10,5,$page, 0,0, "C");
}

// Client address
function addClientAdresse( $cliente,$cargo,$num_documento,$email,$telefono,$fecha )
{
	$r1     = $this->w - 282;
	$r2     = $r1 + 68;
	$y1     = 62;
	$x1     = 35;
	$x2     = $this->w - 250;
	$t1     = $this->w - 282;
	$t2     = 68;
	$a1     = $this->w - 200;
	$a2     = 68;
	$n1     = $this->w - 186;
	$n2     = 68;
	$s1     = $this->w - 186;
	$s2     = 68;
	$i1     = $this->w - 118;
	$i2     = 68;
	$c1     = $this->w - 115;
	$c2     = 68;
	$b1     = $this->w - 82.5;
	$b2     = 68;
	$f1     = $this->w - 115;
	$f2     = 68;
	$e1     = $this->w - 100;
	$e2     = 68;
	$this->SetXY( $r1, $y1);
	$this->SetFont( "Arial", "B", 10);
	$this->MultiCell( 60, 4, "USUARIO :");
	$this->SetXY( $x1, $x2+15);
	$this->SetFont( "Arial", "", 10);
	$this->MultiCell( 150, 4, $cliente);
	$this->SetXY( $t1, $t2);
	$this->SetFont( "Arial", "B", 10);
	$this->MultiCell( 60, 4, "CARGO    :");
	$this->SetFont( "Arial", "", 10);
	$this->SetXY( $x1, $x2+21);
	$this->MultiCell( 150, 4, $cargo);
	$this->SetXY( $a1, $a2);
	$this->SetFont( "Arial", "B", 10);
	$this->MultiCell( 60, -8, "AREA  :");
	$this->SetFont( "Arial", "", 10);
	$this->SetXY( $n1, $n2+-6);
	$this->MultiCell( 150, 4, $num_documento);
	$this->SetXY( $a1, $a2);
	$this->SetFont( "Arial", "B", 10);
	$this->MultiCell( 60, 5, "SEDE  :");
	$this->SetFont( "Arial", "", 10);
	$this->SetXY( $s1, $s1+-42.5);
	$this->MultiCell( 150, 4, $email);
	$this->SetXY( $c1, $c2);
	$this->SetFont( "Arial", "B", 10);
	$this->MultiCell( 60, -8, "INVENTARIADOR :");
	$this->SetFont( "Arial", "", 10);
	$this->SetXY( $b1, $b2+-6);
	$this->MultiCell( 150, 4, $telefono);
	$this->SetXY( $f1, $f2);
	$this->SetFont( "Arial", "B", 10);
	$this->MultiCell( 60, 5, "FECHA :");
	$this->SetFont( "Arial", "", 10);
	$this->SetXY( $e1, $e2+0);
	$this->MultiCell( 150, 4, $fecha);
}


// Datos de documentación
function addDatosAdresse( $cliente,$domicilio,$num_documento,$email,$telefono)
{
	$r1     = $this->w - 180;
	$r2     = $r1 + 68;
	$y1     = 40;
	$this->SetXY( $r1, $y1);
	$this->SetFont( "Arial", "B", 10);
	$this->MultiCell( 60, 4, "CLIENTE");
	$this->SetXY( $r1, $y1+5);
	$this->SetFont( "Arial", "", 10);
	$this->MultiCell( 150, 4, $cliente);
	$this->SetXY( $r1, $y1+10);
	$this->MultiCell( 150, 4, $domicilio);
	$this->SetXY( $r1, $y1+15);
	$this->MultiCell( 150, 4, $num_documento);
	$this->SetXY( $r1, $y1+20);
	$this->MultiCell( 150, 4, $email);
	$this->SetXY( $r1, $y1+25);
	$this->MultiCell( 150, 4, $telefono);
}

// Mode of payment
function addReglement( $mode )
{
	$r1  = 10;
	$r2  = $r1 + 60;
	$y1  = 80;
	$y2  = $y1+10;
	$mid = $y1 + (($y2-$y1) / 2);
	$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
	$this->Line( $r1, $mid, $r2, $mid);
	$this->SetXY( $r1 + ($r2-$r1)/2 -5 , $y1+1 );
	$this->SetFont( "Arial", "B", 10);
	$this->Cell(10,4, "CLIENTE", 0, 0, "C");
	$this->SetXY( $r1 + ($r2-$r1)/2 -5 , $y1 + 5 );
	$this->SetFont( "Arial", "", 10);
	$this->Cell(10,5,$mode, 0,0, "C");
}

// Expiry date
function addEcheance( $documento,$numero )
{
	$r1  = 80;
	$r2  = $r1 + 40;
	$y1  = 80;
	$y2  = $y1+10;
	$mid = $y1 + (($y2-$y1) / 2);
	$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
	$this->Line( $r1, $mid, $r2, $mid);
	$this->SetXY( $r1 + ($r2 - $r1)/2 - 5 , $y1+1 );
	$this->SetFont( "Arial", "B", 30);
	$this->Cell(10,4, $documento, 0, 0, "C");
	$this->SetXY( $r1 + ($r2-$r1)/2 - 5 , $y1 + 5 );
	$this->SetFont( "Arial", "", 10);
	$this->Cell(10,5,$numero, 0,0, "C");
}

// VAT number
function addNumTVA($tva)
{
	$this->SetFont( "Arial", "B", 10);
	$r1  = $this->w - 80;
	$r2  = $r1 + 70;
	$y1  = 80;
	$y2  = $y1+10;
	$mid = $y1 + (($y2-$y1) / 2);
	$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
	$this->Line( $r1, $mid, $r2, $mid);
	$this->SetXY( $r1 + 16 , $y1+1 );
	$this->Cell(40, 4, "DIRECCI�N", '', '', "C");
	$this->SetFont( "Arial", "", 10);
	$this->SetXY( $r1 + 16 , $y1+5 );
	$this->Cell(40, 5, $tva, '', '', "C");
}

function addReference($ref)
{
	$this->SetFont( "Arial", "", 10);
	$length = $this->GetStringWidth( "R�f�rences : " . $ref );
	$r1  = 10;
	$r2  = $r1 + $length;
	$y1  = 92;
	$y2  = $y1+5;
	$this->SetXY( $r1 , $y1 );
	$this->Cell($length,4, "R�f�rences : " . $ref);
}

function addCols( $tab )
{
	global $colonnes;
	
	$r1  = 10;
	$r2  = $this->w - ($r1 * 2) ;
	$y1  = 79;
	$y2  = $this->h - 50 - $y1;
	$this->SetXY( $r1, $y1 );
	$this->Rect( $r1, $y1, $r2, $y2, "D");
	$this->Line( $r1, $y1+6, $r1+$r2, $y1+6);
	$colX = $r1;
	$colonnes = $tab;
	while ( list( $lib, $pos ) = each ($tab) )
	{
		$this->SetXY( $colX, $y1+2.5 );
		$this->Cell( $pos, 1, $lib, 0, 0, "C");
		$colX += $pos;
		$this->Line( $colX, $y1, $colX, $y1+$y2);
	}
}

function addLineFormat( $tab )
{
	global $format, $colonnes;
	
	while ( list( $lib, $pos ) = each ($colonnes) )
	{
		if ( isset( $tab["$lib"] ) )
			$format[ $lib ] = $tab["$lib"];
	}
}

function lineVert( $tab )
{
	global $colonnes;

	reset( $colonnes );
	$maxSize=0;
	while ( list( $lib, $pos ) = each ($colonnes) )
	{
		$texte = $tab[ $lib ];
		$longCell  = $pos -2;
		$size = $this->sizeOfText( $texte, $longCell );
		if ($size > $maxSize)
			$maxSize = $size;
	}
	return $maxSize;
}

// add a line to the invoice/estimate
/*    $ligne = array( "REFERENCE"    => $prod["ref"],
                      "DESIGNATION"  => $libelle,
                      "QUANTITE"     => sprintf( "%.2F", $prod["qte"]) ,
                      "P.U. HT"      => sprintf( "%.2F", $prod["px_unit"]),
                      "MONTANT H.T." => sprintf ( "%.2F", $prod["qte"] * $prod["px_unit"]) ,
                      "TVA"          => $prod["tva"] );
*/
function addLine( $ligne, $tab )
{
	global $colonnes, $format;

	$ordonnee     = 11;
	$maxSize      = $ligne;

	reset( $colonnes );
	while ( list( $lib, $pos ) = each ($colonnes) )
	{
		$longCell  = $pos -2;
		$texte     = $tab[ $lib ];
		$length    = $this->GetStringWidth( $texte );
		$tailleTexte = $this->sizeOfText( $texte, $length );
		$formText  = $format[ $lib ];
		$this->SetXY( $ordonnee, $ligne-1);
		$this->MultiCell( $longCell, 4 , $texte, 0, $formText);
		if ( $maxSize < ($this->GetY()  ) )
			$maxSize = $this->GetY() ;
		$ordonnee += $pos;
	}
	return ( $maxSize - $ligne );
}

function addRemarque($remarque)
{
	$this->SetFont( "Arial", "", 10);
	$length = $this->GetStringWidth( "Remarque : " . $remarque );
	$r1  = 10;
	$r2  = $r1 + $length;
	$y1  = $this->h - 45.5;
	$y2  = $y1+5;
	$this->SetXY( $r1 , $y1 );
	$this->Cell($length,4, "Remarque : " . $remarque);
}

function addCadreTVAs($monto)
{
	$this->SetFont( "Arial", "B", 10);
	$r1  = 10;
	$r2  = $r1 + 120;
	$y1  = $this->h - 40;
	$y2  = $y1+20;
	$s1  = 150;
	$s2  = $r1 + 120;
	$x1  = $this->h - 40;
	$x2  = $y1+20;
	$t1  = 90;
	$t2  = $r1 + 120;
	$u1  = $this->h - 40;
	$u2  = $y1+20;
	//$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
	//$this->Line( $r1, $y1+4, $r2, $y1+4);
	//$this->Line( $r1+5,  $y1+4, $r1+5, $y2); // avant BASES HT
	//$this->Line( $r1+27, $y1, $r1+27, $y2);  // avant REMISE
	//$this->Line( $r1+43, $y1, $r1+43, $y2);  // avant MT TVA
	//$this->Line( $r1+63, $y1, $r1+63, $y2);  // avant % TVA
	//$this->Line( $r1+75, $y1, $r1+75, $y2);  // avant PORT
	//$this->Line( $r1+91, $y1, $r1+91, $y2);  // avant TOTAUX
	$this->SetXY( $r1+55, $y1+15);
	$this->Cell(10,4, "INVENTARIADOR");
	$this->SetFont( "Arial", "", 8);
	$this->SetXY( $r1+50, $y1+12);
	$this->MultiCell(100,4, $monto);
	$this->SetFont( "Arial", "B", 10);
	$this->SetXY( $s1+60, $x1+15);
	$this->Cell(10,4, "USUARIO");
	$this->SetFont( "Arial", "", 8);
	$this->SetXY( $s1+50, $x1+12);
	$this->MultiCell(100,4, $monto);
	$this->SetFont( "Arial", "B", 10);
	$this->SetXY( $t1+57, $u1+15);
	$this->Cell(10,4, "V.B.");
	//$this->SetFont( "Arial", "", 8);
	//$this->SetXY( $s1+50, $x1+12);
	//$this->MultiCell(100,4, $monto);
	//$this->SetX( $r1+29 );
	//$this->Cell(10,4, "REMISE");
	//$this->SetX( $r1+48 );
	//$this->Cell(10,4, "MT TVA");
	//$this->SetX( $r1+63 );
	//$this->Cell(10,4, "% TVA");
	//$this->SetX( $r1+78 );
	//$this->Cell(10,4, "PORT");
	//$this->SetX( $r1+100 );
	//$this->Cell(10,4, "TOTAUX");
	//$this->SetFont( "Arial", "B", 6);
	//$this->SetXY( $r1+93, $y2 - 8 );
	//$this->Cell(6,0, "H.T.   :");
	//$this->SetXY( $r1+93, $y2 - 3 );
	//$this->Cell(6,0, "T.V.A. :");
}

function addCadreEurosFrancs($impuesto)
{
	$r1  = $this->w - 70;
	$r2  = $r1 + 60;
	$y1  = $this->h - 40;
	$y2  = $y1+20;
	//$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
	//$this->Line( $r1+20,  $y1, $r1+20, $y2); // avant EUROS
	//$this->Line( $r1+20, $y1+4, $r2, $y1+4); // Sous Euros & Francs
	//$this->Line( $r1+38,  $y1, $r1+38, $y2); // Entre Euros & Francs
	//$this->SetFont( "Arial", "B", 8);
	//$this->SetXY( $r1+22, $y1 );
	//$this->Cell(15,4, "TOTALES", 0, 0, "C");
	//$this->SetFont( "Arial", "", 8);
	//$this->SetXY( $r1+42, $y1 );
	//$this->Cell(15,4, "FRANCS", 0, 0, "C");
	//$this->SetFont( "Arial", "B", 6);
	//$this->SetXY( $r1, $y1+5 );
	//$this->Cell(20,4, "SUBTOTAL", 0, 0, "C");
	//$this->SetXY( $r1, $y1+10 );
	//$this->Cell(20,4, $impuesto, 0, 0, "C");
	//$this->SetXY( $r1, $y1+15 );
	//$this->Cell(20,4, "TOTAL A PAGAR", 0, 0, "C");
}

// remplit les cadres TVA / Totaux et la remarque
// params  = array( "RemiseGlobale" => [0|1],
//                      "remise_tva"     => [1|2...],  // {la remise s'applique sur ce code TVA}
//                      "remise"         => value,     // {montant de la remise}
//                      "remise_percent" => percent,   // {pourcentage de remise sur ce montant de TVA}
//                  "FraisPort"     => [0|1],
//                      "portTTC"        => value,     // montant des frais de ports TTC
//                                                     // par defaut la TVA = 19.6 %
//                      "portHT"         => value,     // montant des frais de ports HT
//                      "portTVA"        => tva_value, // valeur de la TVA a appliquer sur le montant HT
//                  "AccompteExige" => [0|1],
//                      "accompte"         => value    // montant de l'acompte (TTC)
//                      "accompte_percent" => percent  // pourcentage d'acompte (TTC)
//                  "Remarque" => "texte"              // texte
// tab_tva = array( "1"       => 19.6,
//                  "2"       => 5.5, ... );
// invoice = array( "px_unit" => value,
//                  "qte"     => qte,
//                  "tva"     => code_tva );
function addTVAs( $igv, $total,$moneda )
{
	$this->SetFont('Arial','',8);

	$re  = $this->w - 30;
	$rf  = $this->w - 29;
	$y1  = $this->h - 40;
	$this->SetFont( "Arial", "", 8);
	//$this->SetXY( $re, $y1+5 );
	//$this->Cell( 17,4, $moneda.sprintf("%0.2F", $total-($total*$igv/($igv+100))), '', '', 'R');
	//$this->SetXY( $re, $y1+10 );
	//$this->Cell( 17,4, $moneda.sprintf("%0.2F", ($total*$igv/($igv+100))), '', '', 'R');
	//$this->SetXY( $re, $y1+14.8 );
	//$this->Cell( 17,4, $moneda.sprintf("%0.2F", $total), '', '', 'R');
	
}

// add a watermark (temporary estimate, DUPLICATA...)
// call this method first
function temporaire( $texte )
{
	$this->SetFont('Arial','B',50);
	$this->SetTextColor(203,203,203);
	$this->Rotate(45,55,190);
	$this->Text(55,190,$texte);
	$this->Rotate(0);
	$this->SetTextColor(0,0,0);
}

}
?>
