Flux d’activité

Flux d’activité de Messages

  1. La fleur


    Pour répondre à LaFleur

    factures_pdf.php

    <?php
    
    
    // © PEEL.FR
    
    define('FPDF_FONTPATH','../lib/class/pdf/font/');
    
    include("../configuration.inc.php");
    
    require("invoice.php");
    
    	if (!empty($_GET['timestamp']) && !empty($_GET['id']) && !empty($_GET['mode'])) {
    
    // Chargement des variables pour afficher facture ou bons de commande
    
    
    	$timestamp = urldecode(htmlspecialchars($_GET['timestamp']));
    
    
    
    
    	$id = intval($_GET['id']);
    
    
    
    
    	$mode = htmlspecialchars($_GET['mode']);
    
    
    
    
    	$qid_commande = mysql_query("SELECT * FROM peel_commandes WHERE id = '$id' AND o_timestamp = '$timestamp'");
    
    
    
    
    	if (mysql_num_rows($qid_commande) > 0) {
    
    
    
    
    	$commande = mysql_fetch_object($qid_commande);
    
    
    
    
    	$qid_items = mysql_query("
    
    
    	SELECT
    
    
    		 p.reference
    
    
    		,oi.nom_produit
    
    
    		,p.prix AS curr_prix
    
    
    		,oi.prix AS purchase_prix
    
    
    		,oi.quantite
    
    
    		,oi.tva
    
    
    		,oi.promotion
    
    
    		,oi.prix * oi.quantite AS total
    
    
    		,oi.comment
    
    
    		,oi.couleur
    
    
    		,oi.taille
    
    
    		,oi.option_prix
    
    
    		,oi.delivery_stock
    
    
    	FROM peel_commandes_articles oi
    
    
    		LEFT JOIN peel_produits p ON (oi.produit_id = p.id)
    
    
    	WHERE commande_id = '$id'
    
    
    	");
    
    
    
    
    	switch ($_GET['mode']) {
    
    
    
    
    	case "proforma" :
    
    
    	$libelle = PROFORMA;
    
    
    	$numero = $id;
    
    
    	$pdf_date = return_date_fr($commande->o_timestamp);
    
    
    	break;
    
    
    
    
    	case "invoice" :
    
    
    	$libelle = INVOICE;
    
    
    	$numero = $commande->numero;
    
    
    	if ($commande->a_timestamp != "" && $commande->a_timestamp != "0000-00-00" ) {$pdf_date = return_date_fr($commande->a_timestamp);} else {$pdf_date = date("d-m-Y");}
    
    
    	break;
    
    
    
    
    	}
    
    
    
    
    	// $pdf_logo = "logopeel.jpg";
    
    
    
    
    	$qid = mysql_query("SELECT * FROM peel_societe");
    
    
    
    
    	if ($qid) {
    
    
    
    
    	if (mysql_num_rows($qid) > 0) { 
    
    
    
    
    		$ligne = mysql_fetch_object($qid); 
    
    
    
    
    			if (!empty($ligne->societe))		{	$pdf_societe 	= filtre_pdf($ligne->societe);} else {$pdf_societe 	= "";}
    
    
    			if (!empty($ligne->adresse))		{	$pdf_adresse 	= filtre_pdf($ligne->adresse);} else {$pdf_adresse 	= "";}
    
    
    			if (!empty($ligne->code_postal)) 	{	$pdf_codepostal = $ligne->code_postal;} else {$pdf_codepostal 	= "";}
    
    
    			if (!empty($ligne->ville))			{ 	$pdf_ville =  filtre_pdf($ligne->ville);} else {$pdf_ville 	= "";}
    
    
    			if (!empty($ligne->pays))			{ 	$pdf_pays = filtre_pdf($ligne->pays);} else {$pdf_pays 	= "";}
    
    
    			if (!empty($ligne->tel))			{	$pdf_tel = $ligne->tel;} else {$pdf_tel 	= "";}
    
    
    			if (!empty($ligne->fax))			{ 	$pdf_fax = $ligne->fax;} else {$pdf_fax 	= "";}
    
    
    			if (!empty($ligne->siren))			{	$pdf_siret = "R.C.S. : ".$ligne->siren;} else {$pdf_siret 	= "";}
    
    
    			if (!empty($ligne->tvaintra))		{	$pdf_tvaintra = $ligne->tvaintra;} else {$pdf_tvaintra 	= "";}
    
    
    		}
    
    
    	}	
    
    
    
    
    	$pdf_numerodevis = $numero;
    
    
    	$pdf_commentaires = filtre_pdf($commande->commentaires);
    
    
    	$pdf_client1 = filtre_pdf($commande->client_info1);
    
    
    
    
    	$pdf_client2 = filtre_pdf($commande->client_info2);
    
    
    
    
    	$pdf_paiement = filtre_pdf($commande->paiement);
    
    	$pdf_transport = filtre_pdf($commande->transport);
    
    
    
    
    	$pdf_tarif_paiement = $commande->tarif_paiement;
    
    	$transport = $commande->transport;
    
    
    	$pdf_commentaires = $commande->commentaires;
    
    
    	$pdf_expedition = $commande->cout_transport;
    
    
    
    
    $pdf = new INVOICE( 'P', 'mm', 'A4' );
    
    
    $pdf->Open();
    
    
    $pdf->AddPage();
    
    
    $pdf->addSociete( $pdf_societe."\n" .$pdf_adresse."\n" .$pdf_codepostal." ".$pdf_ville."\n".
    
    
    				  $pdf_siret."\n"
    
    
    				  );
    
    if ($_GET['mode'] == "proforma") {
    
    $pdf->fact_dev( "BDC ", $numero );
    
    
    $pdf->temporaire( "Bon de commande" );
    
    } else {
    
    $pdf->fact_dev( "FACTURE ", $numero );
    
    }
    
    $pdf->addDate( $pdf_date);
    
    $pdf->addClientCommentaires($pdf_commentaires);
    
    
    $pdf->addClientAdresseFacturation($pdf_client1);
    
    
    $pdf->addClientAdresseExpedition($pdf_client2);
    
    
    $pdf->addReglement($pdf_paiement);
    
    
    $pdf->addNumTVA($pdf_tvaintra);
    
    $cols=array( "REFERENCE"	=> 23,
    
    
    			 "DESIGNATION"  => 78,
    
    
    			 "QUANTITE"	 => 22,
    
    
    			 "PU_TTC"	  => 26,
    
    
    			 "MONTANT_TTC" => 30,
    
    
    			 "TVA"		  => 11 );
    
    $pdf->addCols( $cols);
    
    $cols=array( "REFERENCE"	=> "L",
    
    
    			 "DESIGNATION"  => "L",
    
    
    			 "QUANTITE"	 => "C",
    
    
    			 "PU_TTC"	  => "R",
    
    
    			 "MONTANT_TTC" => "R",
    
    
    			 "TVA"		  => "C" );
    
    
    
    
    $pdf->addLineFormat( $cols);
    
    $pdf->addLineFormat($cols);
    
    $y	= 109;
    
    $pdf_total_ttc  = 0;
    
    $pdf_total_ht = 0;
    
    if ($qid_items) {
    
    			if (mysql_num_rows($qid_items)) {
    
    
    
    
    			while ($prod = mysql_fetch_array($qid_items)) { 
    
    
    
    
    			if ($prod['couleur'] !='') {$couleur = "\n\r".COLOR." : ".stripslashes($prod['couleur']);} else {$couleur = "";}
    
    
    
    
    			if ($prod['taille'] !='') {$taille = "\n\r".SIZE." : ".stripslashes($prod['taille']);} else {$taille = "";}
    
    
    
    
    			if ($prod['delivery_stock'] !='') {$delivery = "\n\r".DELIVERY_STOCK." : ".stripslashes($prod['delivery_stock']);} else {$delivery = "";}
    
    
    
    
    			if ($prod['comment'] !='') {$comment = "\n\r".COMMENT." : ".stripslashes($prod['comment']);} else {$comment = "";}
    
    
    
    
    			if ($prod['option_prix'] !=0) {$perso = "\n\r".OPTION_PRIX." : ".$prod['option_prix']." EUR";} else {$perso = "";}
    
    
    
    
    
    
    
    			   $line = array( 
    
    
    
    
    			   "REFERENCE"		=> $prod["reference"],
    
    
    			   "DESIGNATION"	=> filtre_pdf($prod["nom_produit"]).vb($couleur).vb($taille).vb($delivery).vb($comment).vb($perso),
    
    
    			   "QUANTITE"		  => $prod["quantite"],
    
    
    			   "PU_TTC"	 	=> fprix($prod["purchase_prix"]),
    
    
    			   "MONTANT_TTC"   	=>  fprix($prod["total"]),
    
    
    			   "TVA"		   	=> number_format($prod["tva"],1) 
    
    
    
    
    			   );
    
    $size = $pdf->addLine( $y, $line );
    
    $pdf_total_ttc += $prod['total'];
    
    $pdf_total_ht += $prod['total'] / (1+$prod['tva']/100);
    
    $y   += $size + 2;
    
    		}
    
    	}
    
    }
    
    $pdf_tva = $pdf_total_ttc - $pdf_total_ht;
    
    $params  = array( 
    
    
    				"TotalHt" => $pdf_total_ht,
    
    
    				"TVA" => $pdf_tva,
    
    
    				"TotalTtc" => $pdf_total_ttc,
    
    
    				"portTTC"		=> $pdf_expedition,   
    
    
    				"tarifPaiement"		=> $pdf_tarif_paiement,  
    
    
    
    				"commentaires"		=> $pdf_commentaires,  
    
    
    
    
    
    
    
    				);
    
    if ($_GET['mode'] == "proforma") {
    
    
    
    
    $pdf->addCadreSignature();
    
    }
    
    $pdf->addTVAs($params);
    
    $pdf->addCadreEurosFrancs();
    
    $pdf->Output();
    
    } else {
    
    echo "NO HACKING (-:!";
    
    }
    
    } else {
    
    echo "NO HACKING (-:!";
    
    }
    
    ?>
    et invoice.php
    <?php
    
    
    define('EURO', chr(128) );
    
    
    define('EURO_VAL', 6.55957 );
    
    class INVOICE extends FPDF
    
    
    {
    
    
    // variables privées
    
    
    var $colonnes;
    
    
    var $format;
    
    
    var $angle=0;
    
    // fonctions privées
    
    
    function RoundedRect($x, $y, $w, $h, $r, $style = '')
    
    
    {
    
    
    	$k = $this->k;
    
    
    	$hp = $this->h;
    
    
    	if($style=='F')
    
    
    		$op='f';
    
    
    	elseif($style=='FD' or $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();
    
    
    }
    
    // fonctions publiques
    
    
    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 ) );
    
    
    		if ($largeur != 0) {$res = 1 + floor( $length / $largeur);} else {$res = 1 + floor( $length);}
    
    
    		$nb_lines += $res;
    
    
    	}
    
    
    	return $nb_lines;
    
    
    }
    
    // Cette fonction affiche en haut, a gauche,
    
    
    // le nom de la societe dans la police Arial-12-Bold
    
    
    // les coordonnees de la societe dans la police Arial-10
    
    
    function addSociete( $adresse )
    
    
    {
    
    
    	$x1 = 10;
    
    
    	$y1 = 8;
    
    
    	//Positionnement en bas
    
    
    	//$this->Image($logo,$x1,$y1,24);
    
    
    	//$this->SetXY( $x1, $y1 + 10);
    
    
    	$this->SetFont('Arial','B',12);
    
    
    	//$length = $this->GetStringWidth( $nom );
    
    
    	//$this->Cell( $length, 2, $nom);
    
    
    	$this->SetXY( $x1, $y1 + 12 );
    
    
    	$this->SetFont('Arial','',10);
    
    
    	$length = $this->GetStringWidth( $adresse );
    
    
    	//Coordonnées de la société
    
    
    	$lignes = $this->sizeOfText( $adresse, $length);
    
    
    	$this->MultiCell($length, 4, $adresse);
    
    
    }
    
    // Affiche en haut, a droite le libelle
    
    
    // (FACTURE, DEVIS, Bon de commande, etc...)
    
    
    // et son numero
    
    
    // La taille de la fonte est auto-adaptee au cadre
    
    
    function fact_dev( $libelle, $num )
    
    
    {
    
    
    	$r1  = $this->w - 80;
    
    
    	$r2  = $r1 + 68;
    
    
    	$y1  = 6;
    
    
    	$y2  = $y1 + 2;
    
    
    	$mid = ($r1 + $r2 ) / 2;
    
    
    
    
    	$texte  = $libelle . " N∞ : " . $num;	
    
    
    	$szfont = 12;
    
    
    	$loop   = 0;
    
    
    
    
    	while ( $loop == 0 )
    
    
    	{
    
    
    	   $this->SetFont( "Helvetica", "B", $szfont );
    
    
    	   $sz = $this->GetStringWidth( $texte );
    
    
    	   if ( ($r1+$sz) > $r2 )
    
    
    		  $szfont --;
    
    
    	   else
    
    
    		  $loop ++;
    
    
    	}
    
    	$this->SetLineWidth(0.1);
    
    
    	$this->SetFillColor(154, 154, 204);
    
    
    	$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" );
    
    
    }
    
    // Genere automatiquement un numero de devis
    
    
    function addDevis( $numdev )
    
    
    {
    
    
    	$string = sprintf("DEV%04d",$numdev);
    
    
    	$this->fact_dev( "Devis", $string );
    
    
    }
    
    // Genere automatiquement un numero de facture
    
    
    function addFacture( $numfact )
    
    
    {
    
    
    	$string = sprintf("FA%04d",$numfact);
    
    
    	$this->fact_dev( "Facture", $string );
    
    
    }
    
    // Affiche un cadre avec la date de la facture / devis
    
    
    // (en haut, a droite)
    
    
    function addDate( $date )
    
    
    {
    
    
    	$r1  = $this->w - 80;
    
    
    	$r2  = $r1 + 68;
    
    
    	$y1  = 17;
    
    
    	$y2  = $y1;
    
    
    	$mid = $y1 + ($y2 / 2);
    
    
    
    
    	$this->Rect($r1, $y1, ($r2 - $r1), $y2, 'D');
    
    
    
    
    	$this->Line( $r1, $mid, $r2, $mid);
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+3 );
    
    
    	$this->SetFont( "Helvetica", "B", 10);
    
    
    
    
    	$this->Cell(15,5, "DATE", 0, 0, "C");
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+9 );
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$this->Cell(15,5,$date, 0,0, "C");
    
    
    }
    
    // Affiche un cadre avec les references du client
    
    
    // (en haut, a droite)
    
    
    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( "Helvetica", "B", 10);
    
    
    	$this->Cell(10,5, "CLIENT", 0, 0, "C");
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1 + 9 );
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$this->Cell(10,5,$ref, 0,0, "C");
    
    
    }
    
    // Affiche un cadre avec un numero de page
    
    
    // (en haut, a droite)
    
    
    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( "Helvetica", "B", 10);
    
    
    	$this->Cell(10,5, "PAGE", 0, 0, "C");
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1 + 9 );
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$this->Cell(10,5,$page, 0,0, "C");
    
    
    }
    
    // Affiche l'adresse du client
    
    
    // (en haut, a droite)
    
    
    function addClientCommentaires( $pdf_commentaires )
    
    
    {
    
    
    	$this->SetFont( "Arial", "B", 8);
    
    
    	$r1  = 10;
    
    
    	$r2  = $r1 + 60;
    
    
    	$y1  = $this->h - 45;
    
    
    	$y2  = $y1+30;
    
    
    	$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
    
    
    	$this->Line( $r1, $y1+4, $r2, $y1+4);
    
    
    	$this->SetXY( $r1+5, $y1);
    
    
    	$this->Cell(10,4, "Commentaires");
    
    
    	$this->SetFont( "Arial", "", 9);
    
    
    	$this->SetXY( $r1+0, $y2 - 23 );
    
    
    	$this->Cell(6,0, "".$pdf_commentaires."");
    
    
    	$this->SetXY( $r1+5, $y2 - 18 );
    
    }
    
    function addClientAdresseFacturation( $pdf_facturation )
    
    
    {
    
    
    	$r1	 = $this->w - 200;
    
    
    	$r2  = $r1 + 68;
    
    
    	$y1	 = 40;
    
    
    	$y2  = $y1+38;
    
    
    	$this->Rect($r1, $y1, ($r2 - $r1), ($y2-$y1), 'D');
    
    
    	$this->SetXY( $r1, $y1);
    
    
    	$this->MultiCell( 60, 4, "Adresse de facturation :\n".$pdf_facturation);
    
    
    }
    
    function addClientAdresseExpedition( $pdf_facturation2 )
    
    
    {
    
    
    	$r1	 = $this->w - 80;
    
    
    	$r2  = $r1 + 68;
    
    
    	$y1	 = 40;
    
    
    	$y2  = $y1+38;
    
    
    	$this->Rect($r1, $y1, ($r2 - $r1), ($y2-$y1), 'D');
    
    
    	$this->SetXY( $r1, $y1);
    
    
    	$this->MultiCell( 60, 4, "Adresse d'expÈdition :\n".$pdf_facturation2);
    
    
    }
    
    // Affiche un cadre avec le règlement (chèque, etc...)
    
    
    // (en haut, a gauche)
    
    
    function addReglement( $mode )
    
    
    {
    
    
    	$r1  = 10;
    
    
    	$r2  = $r1 + 68;
    
    
    	$y1  = 80;
    
    
    	$y2  = $y1+10;
    
    
    	$mid = $y1 + (($y2-$y1) / 2);
    
    
    	$this->Rect($r1, $y1, ($r2 - $r1), ($y2-$y1), 'D');
    
    
    	$this->Line( $r1, $mid, $r2, $mid);
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 -5 , $y1+1 );
    
    
    	$this->SetFont( "Helvetica", "B", 10);
    
    
    	$this->Cell(10,4, "MODE DE REGLEMENT", 0, 0, "C");
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 -5 , $y1 + 5 );
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$this->Cell(10,5,$mode, 0,0, "C");
    
    
    }
    
    // Affiche un cadre avec la date d'echeance
    
    
    // (en haut, au centre)
    
    
    function addEcheance( $date )
    
    
    {
    
    
    	$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( "Helvetica", "B", 10);
    
    
    	$this->Cell(10,4, "DATE D'ECHEANCE", 0, 0, "C");
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 - 5 , $y1 + 5 );
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$this->Cell(10,5,$date, 0,0, "C");
    
    
    }
    
    // Affiche un cadre avec le numero de la TVA
    
    
    // (en haut, au droite)
    
    
    function addNumTVA($tva)
    
    
    {
    
    
    	$this->SetFont( "Helvetica", "B", 10);
    
    
    	$r1  = $this->w - 80;
    
    
    	$r2  = $r1 + 68;
    
    
    	$y1  = 80;
    
    
    	$y2  = $y1+10;
    
    
    	$mid = $y1 + (($y2-$y1) / 2);
    
    
    	$this->Rect($r1, $y1, ($r2 - $r1), ($y2-$y1), 'D');
    
    
    	$this->Line( $r1, $mid, $r2, $mid);
    
    
    	$this->SetXY( $r1 + 16 , $y1+1 );
    
    
    	$this->Cell(40, 4, "TVA Intracommunautaire", '', '', "C");
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$this->SetXY( $r1 + 16 , $y1+5 );
    
    
    	$this->Cell(40, 5, $tva, '', '', "C");
    
    
    }
    
    // Affiche une ligne avec des reference
    
    
    // (en haut, a gauche)
    
    
    function addReference($ref)
    
    
    {
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$length = $this->GetStringWidth( "References : " . $ref );
    
    
    	$r1  = 10;
    
    
    	$r2  = $r1 + $length;
    
    
    	$y1  = 92;
    
    
    	$y2  = $y1+5;
    
    
    	$this->SetXY( $r1 , $y1 );
    
    
    	$this->Cell($length,4, "Reference : " . $ref);
    
    
    }
    
    // trace le cadre des colonnes du devis/facture
    
    
    function addCols( $tab )
    
    
    {
    
    
    	global $colonnes;
    
    
    
    
    	$r1  = 10;
    
    
    	$r2  = $this->w - ($r1 * 2);
    
    
    	$y1  = 100;
    
    
    	$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 );
    
    
    		$this->Cell( $pos, 1, $lib, 0, 0, "C");
    
    
    		$colX += $pos;
    
    
    		$this->Line( $colX, $y1, $colX, $y1+$y2);
    
    
    	}
    
    
    }
    
    // mémorise le format (gauche, centre, droite) d'une colonne
    
    
    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;
    
    
    }
    
    function addLine( $ligne, $tab )
    
    
    {
    
    
    	global $colonnes, $format;
    
    
    	$ordonnee	 = 10;
    
    
    	$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 addTotalHt( $total_ht )
    
    
    {
    
    
    	$r1  = $this->w - 31;
    
    
    	$r2  = $r1 + 19;
    
    
    	$y1  = 100;
    
    
    	$y2  = $y1;
    
    
    	$mid = $y1 + ($y2 / 2);
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1+3 );
    
    
    	$this->SetFont( "Helvetica", "B", 10);
    
    
    	$this->Cell(10,5, "Total H.T.", 0, 0, "C");
    
    
    	$this->SetXY( $r1 + ($r2-$r1)/2 - 5, $y1 + 9 );
    
    
    	$this->SetFont( "Helvetica", "", 10);
    
    
    	$this->Cell(10,5,$total_ht."Ä H.T.", 0,0, "C");
    
    
    }
    
    // Ajoute une remarque (en bas, a gauche)
    
    
    function addRemarque($remarque)
    
    
    {
    
    
    	$this->SetFont( "Helvetica", "", 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);
    
    
    }
    
    // trace le cadre des TVAs
    
    
    function addCadreTVAs()
    
    
    {
    
    
    	$this->SetFont( "Arial", "B", 8);
    
    
    	$r1  = 10;
    
    
    	$r2  = $r1 + 20;
    
    
    	$y1  = $this->h;
    
    
    	$y2  = $y1+5;
    
    
    	$this->Line( $r1, $y1+4, $r2, $y1+4);
    
    
    	$this->Line( $r1+5,  $y1+4, $r1+5, $y2); // avant BASE HT
    
    
    	$this->Line( $r1+27, $y1, $r1+27, $y2);  // avant REMISE
    
    
    	$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+9, $y1);
    
    
    	$this->Cell(10,4, "TOTAL HT");
    
    
    	$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 - 13 );
    
    
    	$this->Cell(6,0, "T.T.C   :");
    
    
    	$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 addCadreSignature()
    
    
    {
    
    
    	$this->SetFont( "Arial", "B", 10);
    
    
    	$r1  = 10;
    
    
    	$r2  = $r1 + 60;
    
    
    	$y1  = $this->h - 45;
    
    
    	$y2  = $y1+30;
    
    
    	$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
    
    
    	$this->Line( $r1, $y1+4, $r2, $y1+4);
    
    
    	$this->SetXY( $r1+5, $y1);
    
    
    	$this->Cell(10,4, "ACCORD POUR COMMANDE");
    
    
    	$this->SetFont( "Arial", "B", 6);
    
    
    	$this->SetXY( $r1+5, $y2 - 23 );
    
    
    	$this->Cell(6,0, "Date   :");
    
    
    	$this->SetXY( $r1+5, $y2 - 18 );
    
    
    	$this->Cell(6,0, "Mention (Bon pour accord)   :");
    
    
    	$this->SetXY( $r1+5, $y2 - 13 );
    
    
    	$this->Cell(6,0, "Signature   :");
    
    
    }
    
    // trace le cadre des totaux
    
    
    function addCadreEurosFrancs()
    
    
    {
    
    
    	$r1  = $this->w - 60;
    
    
    	$r2  = $r1 + 50;
    
    
    	$y1  = $this->h - 45;
    
    
    	$y2  = $y1+30;
    
    
    	$this->RoundedRect($r1, $y1, ($r2 - $r1), ($y2-$y1), 2.5, 'D');
    
    
    
    
    }
    
    function addTVAs( $params )
    
    
    {
    
    
    	$this->SetFont('Arial','',6);
    
    
    
    
    	$prix	 = array();
    
    
    
    
    	$totalHT  = $params["TotalHt"];
    
    
    
    
    	$totalTVA = $params['TVA'];
    
    
    
    
    	$totalTTC = $params['TotalTtc'];
    
    
    
    
    	$tarifPaiement = $params['tarifPaiement'];
    
    
    
    
    	$y = 261;
    
    	$pTTC = sprintf("%0.2f", $params["portTTC"]);
    
    
    
    
    	$totalTTC = $totalHT + $totalTVA +$pTTC + $tarifPaiement;
    
    
    
    
    	$re  = $this->w - 52;
    
    
    	$rf  = $this->w - 26;
    
    
    	$y1  = $this->h - 40;
    
    
    	$this->SetFont( "Arial", "B", 6);
    
    
    	$this->SetXY( $re, $y1-5 );
    
    
    	$this->Cell( 17,4, "TOTAL HT :");
    
    
    	$this->Cell( 17,4, sprintf("%0.2f",$totalHT)." Ä", '', '', 'R');
    
    
    	$this->SetXY( $re, $y1 );
    
    
    	$this->Cell( 17,4, "TVA :");
    
    
    	$this->Cell( 17,4, sprintf("%0.2f", $totalTVA)." Ä", '', '', 'R');
    
    
    	$this->SetXY( $re, $y1+5 );
    
    
    	$this->Cell( 17,4, "Frais de port:");
    
    
    	$this->Cell( 17,4, sprintf("%0.2f", $pTTC)." Ä", '', '', 'R');
    
    
    	$this->SetXY( $re, $y1+10 );
    
    
    	$this->Cell( 17,4, "SupplÈment paiement:");
    
    
    	$this->Cell( 17,4, sprintf("%0.2f", $tarifPaiement)." Ä", '', '', 'R');
    
    
    	$this->SetXY( $re, $y1+15 );
    
    
    	$this->Cell( 17,4, "Net ‡ payer :");
    
    
    	$this->Cell( 17,4, sprintf("%0.2f", $totalTTC)." Ä", '', '', 'R');
    
    
    
    
    }
    
    // Permet de rajouter un commentaire (Devis temporaire, REGLE, DUPLICATA, ...)
    
    
    // en sous-impression
    
    
    // ATTENTION: APPELER CETTE FONCTION EN PREMIER
    
    
    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);
    
    
    }
    
    }
    
    
    ?>

    Merci bcp voici ce que j'obtiens

    Parse error: syntax error, unexpected $end, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home4/f/floraclic/www/factures/invoice.php on line 366

  2. tinty


    arf, c'est aussi moi qui est mal interprété ..

    le code vous le mettez par exemple en bas de page, où vous voulez

    Non décidément, ca ne veux pas faire. J'abandonne. C'est bcp trop compliqué pour un débutant de mon age.

    C'est un métier et moi, je ne sais pas faire.

    merci du temps que vous avez passé avec moi.

  3. tinty


    j'ai bien compris que ce sont dans les pages haut.php ou bas.php.

    Je suis excesivement débutant et j'avais osé demandé l'emplacement DANS LA PAGE où doit etre placée cette ligne de code.

    Mais surement que je m'exprime mal.

    Aussi, je vous remercie pour ces explications on ne peut plus claires, et vous souhaite une bonne nuit.

    A bientot, peut etre.

  4. safrakas


    wouarf, n'accepter les commandes que si les utilisateurs ont un code postal défini ?

    mais comment vas tu gèrer cela, je veux dire au niveau des clients ceux qui n'auront pas le "bon" code postal !

    Dans un premier temps, je ne veux vendre que sur les zones définies par le CP, ceci afin de faire des livraisons dans la demi journée suivant la commande. Ceux qui n'auront le bon CP ne pourront pas commander ou dans un second temps ils pourront le faire mais avec un mode de livraison classique (J+2)

  5. safrakas


    Bonsoir,

    Je suis un nouvel utilisateur de Peel Premium qui me parait être un produit facilement exploitable même pour qui ne manipule pas trop les lignes de programmes.

    Je souhaiterais savoir si il est possible, et comment, pouvoir filtrer les commandes en fonction du code postal. En effet, je ne veux vendre que sur des zones très définies ?

    Tant que j'y suis comment fait on pour changer la couleur des deux bandes (celle de gauche et celle de droite) ?

    Merci

Twitter Advisto ecommerce

Facebook PEEL Shopping