Sign in to follow this  
Followers 0

logo dans facture/bon de commande.

18 posts in this topic

Posted · Report post

Tu veux mettre le logo sur tes factures c'est ca ?

Ou tu veux que ca soit parametrable ?

Willy

Share this post


: post
Share on other sites

Posted · Report post

oui c'est ca, j'ai trouvé la variable, c'est dans variable du site.

Par contre apparement cela n'apparait pas dans le bon de commande, c'est lputot génant, en plus ya un souci c'est que les colonnes du pdf sont mal formé et la derniere est en dehors du cadre,

tu peux faire un test sur http://atila-diffusion.eu/boutique

Share this post


: post
Share on other sites

Posted · Report post

On peut faire des tests ?

Willy

Share this post


: post
Share on other sites

Posted · Report post

oui oui, c'est une partie pas encore accessible diretement depusi le site, donc les tests sont admis sans soucis.

Share this post


: post
Share on other sites

Posted · Report post

oui oui, c'est une partie pas encore accessible diretement depusi le site, donc les tests sont admis sans soucis.

Je n'arrive pas a commander :rolleyes:

je reviens sur l'affichage du caddie quand je clique sur commander

Share this post


: post
Share on other sites

Posted · Report post

faut que tu choississe un pays, et un type d'expedition, par exemple france et telecharment, pour les autres pays cela rique de ne pas marcher.

Share this post


: post
Share on other sites

Posted · Report post

faut que tu choississe un pays, et un type d'expedition, par exemple france et telecharment, pour les autres pays cela rique de ne pas marcher.

C ce que g fait mais ca ne marche pas;

Willy

Share this post


: post
Share on other sites

Posted · Report post

bon ben va falloir regarder ca aussi cte apres midi :rolleyes:

ah Boutique quand tu nous tiens (tu nous casse les c**** boutique de m****)

Share this post


: post
Share on other sites

Posted · Report post

bon ben va falloir regarder ca aussi cte apres midi :rolleyes:

ah Boutique quand tu nous tiens (tu nous casse les c**** boutique de m****)

Cette fois ca fonctionne et il y a bien le logo dans le bdc en html.

Par contre en PDF, pas d'image et dernière colonne décallée.

Willy

Share this post


: post
Share on other sites

Posted · Report post

wouaip, c'est bien là mon souci :rolleyes:

Share this post


: post
Share on other sites

Posted · Report post

Donne ton code de la facture_pdf.

Willy

Share this post


: post
Share on other sites

Posted · Report post

je te l'envoi tout de suite.

Share this post


: post
Share on other sites

Posted · Report post

Donne ton code de la facture_pdf.

Willy

Voici :rolleyes:

<?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.prix_ht AS purchase_prix_ht
,oi.quantite
,oi.tva
,oi.tva_percent
,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 = date("d-m-Y H:i:s",strtotime($commande->o_timestamp));
break;

case "invoice" :
$libelle = INVOICE;
$numero = $commande->numero;

if ($commande->a_timestamp != "0000-00-00") {

$pdf_date = date("d-m-Y H:i:s",strtotime($commande->a_timestamp));

} else {

$pdf_date = date("d-m-Y H:i:s",strtotime($commande->o_timestamp));

}

break;

}

$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 = $ligne->societe ;} else {$pdf_societe = "" ;}
if (!empty($ligne->adresse)) { $pdf_adresse = $ligne->adresse ;} else {$pdf_adresse = "" ;}
if (!empty($ligne->code_postal)) { $pdf_codepostal = $ligne->code_postal ;} else {$pdf_codepostal = "" ;}
if (!empty($ligne->ville)) { $pdf_ville = $ligne->ville ;} else {$pdf_ville = "" ;}
if (!empty($ligne->pays)) { $pdf_pays = $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_client1 = $commande->client_info1;

$pdf_client2 = $commande->client_info2;

$pdf_paiement = $commande->paiement;

$pdf_transport = $commande->transport;

$pdf_tarif_paiement = $commande->tarif_paiement;

$transport = $commande->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->addClientAdresseFacturation($pdf_client1);
$pdf->addClientAdresseExpedition($pdf_client2);
$pdf->addReglement($pdf_paiement);
$pdf->addNumTVA($pdf_tvaintra);

$cols=array( "REFERENCE" => 23,
"DESIGNATION" => 78,
"QUANTITE" => 22,
"PRIX HT" => 26,
"PRIX TTC" => 26,
"TOTAL TTC" => 30,
"TVA" => 11 );

$pdf->addCols( $cols);

$cols=array( "REFERENCE" => "L",
"DESIGNATION" => "L",
"QUANTITE" => "C",
"PRIX HT" => "R",
"PRIX TTC" => "R",
"TOTAL 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" => stripslashes($prod["nom_produit"]).vb($couleur).vb($taille).vb($delivery).vb($comment).vb($perso),
"QUANTITE" => $prod["quantite"],
"PRIX HT" => fprix($prod["purchase_prix_ht"]),
"PRIX TTC" => fprix($prod["purchase_prix"]),
"TOTAL TTC" => fprix($prod["total"]),
"TVA" => number_format($prod['tva_percent'],1)." % "

);

$size = $pdf->addLine( $y, $line );

$y += $size + 2;

}

}

}

$pdf_total_ht_avant_promo = $commande->total_produit_avant_promo_ht;

$pdf_total_ttc = $commande->montant;

$pdf_ecotaxe_ht = $commande->ecotaxe_ht;

$pdf_total_tva = $commande->total_tva;

$pdf_total_remise_ht = $commande->remise_produit_ht + $commande->remise_code_ht + $commande->remise_client_ht + $commande->remise_cheque_ht + $commande->remise_bon_ht;

$pdf_expedition_ht = $commande->cout_transport_ht;

$params = array(
"TotalHtAvantPromo" => $pdf_total_ht_avant_promo,
"EcoTaxeHt" => $pdf_ecotaxe_ht,
"Tva" => $pdf_total_tva,
"TotalRemiseHt" => $pdf_total_remise_ht,
"TotalTtc" => $pdf_total_ttc,
"PortHt" => $pdf_expedition_ht,
"TarifPaiement" => $pdf_tarif_paiement,
);

if ($_GET['mode'] == "proforma") {

$pdf->addCadreSignature();

}

$pdf->addTVAs($params);

/*$pdf->addCadreEurosFrancs(); */

$pdf->Output();

} else {

echo "NO HACKING (-:!";

}

} else {

echo "NO HACKING (-:!";

}
?>
[/codebox]

Share this post


: post
Share on other sites

Posted · Report post

Bon alors j'ai trouvé comment inclure le logo comme dans html, mon souci maintenant c'est le choix de la taille du logo .

En effet pour faire les facture pdf, on invoque la classe invoice qui comme chacun sait est une extension de la celebre fpdf.

Pour pouvoir envoyé l'adresse du logo à invoce, j'ai un tout petit peu modifier la fonction de construction du titre...

ca donne dans invoce ceci :


function addSociete( $adresse , $logo)
[/codebox]

et bien sur à l'appelle de la fonction dans facture_pdf.php; l'appel change et devient : (ligne 110)

[codebox]
$pdf->addSociete( $pdf_societe."\n" .$pdf_adresse."\n" .$pdf_codepostal." ".$pdf_ville."\n".$pdf_siret."\n",$logo);

Par contre il y a un souci avec la gestion de l'image car pour le moment cela redimensionne de maniere automatique l'image.

Moi j'aimerai au mieux lui redonner sa taille d'origine, au pire lui donner une taille plus lisible.

voici le code faisant appelle au censé faire afficher le logo dans invoice.php

=>


function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{
//Put an image on the page
if(!isset($this->images[$file]))
{
//First use of image, get info
if($type=='')
{
$pos=strrpos($file,'.');
if(!$pos)
$this->Error('Image file has no extension and no type was specified: '.$file);
$type=substr($file,$pos+1);
}
$type=strtolower($type);
$mqr=get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
if($type=='jpg' || $type=='jpeg')
$info=$this->_parsejpg($file);
elseif($type=='png')
$info=$this->_parsepng($file);
else
{
//Allow for additional formats
$mtd='_parse'.$type;
if(!method_exists($this,$mtd))
$this->Error('Unsupported image type: '.$type);
$info=$this->$mtd($file);
}
set_magic_quotes_runtime($mqr);
$info['i']=count($this->images)+1;
$this->images[$file]=$info;
}
else
$info=$this->images[$file];
//Automatic width and height calculation if needed
if($w==0 && $h==0)
{
//Put image at 72 dpi
$w=$info['w']/$this->k;
$h=$info['h']/$this->k;
}
if($w==0)
$w=$h*$info['w']/$info['h'];
if($h==0)
$h=$w*$info['h']/$info['w'];
$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
if($link)
$this->Link($x,$y,$w,$h,$link);
}[/codebox]

Donc à bien y regarder, je me suis dit qu'il suffisait d'outrepasser le forcement et j'en suis arrivé à ca, qui me permet bien d'afficher le logo.

[codebox]function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{
//Put an image on the page
if(!isset($this->images[$file]))
{
//First use of image, get info
if($type=='')
{
$pos=strrpos($file,'.');
if(!$pos)
$this->Error('Image file has no extension and no type was specified: '.$file);
$type=substr($file,$pos+1);
}
$type=strtolower($type);
$mqr=get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
if($type=='jpg' || $type=='jpeg')
$info=$this->_parsejpg($file);
elseif($type=='png')
$info=$this->_parsepng($file);
else
{
//Allow for additional formats
$mtd='_parse'.$type;
if(!method_exists($this,$mtd))
$this->Error('Unsupported image type: '.$type);
$info=$this->$mtd($file);
}
set_magic_quotes_runtime($mqr);
$info['i']=count($this->images)+1;
$this->images[$file]=$info;
}
else
$info=$this->images[$file];
//Automatic width and height calculation if needed
if($w==0 && $h==0)
{
//Put image at 72 dpi
$w=$info['w']/1;//$this->k;
$h=$info['h']/1;///$this->k;
}
if($w==0)
$w=$h*$info['w']/$info['h'];
if($h==0)
$h=$w*$info['h']/$info['w'];
$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*10,$h*10,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
if($link)
$this->Link($x,$y,$w,$h,$link);
}

Voilà, ca aidera peut etre les autres... Mais j'ai toujours un souci sur les colonnes.

Share this post


: post
Share on other sites

Posted · Report post

Bon alors j'ai trouvé comment inclure le logo comme dans html, mon souci maintenant c'est le choix de la taille du logo .

En effet pour faire les facture pdf, on invoque la classe invoice qui comme chacun sait est une extension de la celebre fpdf.

Pour pouvoir envoyé l'adresse du logo à invoce, j'ai un tout petit peu modifier la fonction de construction du titre...

ca donne dans invoce ceci :


function addSociete( $adresse , $logo)
[/codebox]

et bien sur à l'appelle de la fonction dans facture_pdf.php; l'appel change et devient : (ligne 110)

[codebox]
$pdf->addSociete( $pdf_societe."\n" .$pdf_adresse."\n" .$pdf_codepostal." ".$pdf_ville."\n".$pdf_siret."\n",$logo);

Par contre il y a un souci avec la gestion de l'image car pour le moment cela redimensionne de maniere automatique l'image.

Moi j'aimerai au mieux lui redonner sa taille d'origine, au pire lui donner une taille plus lisible.

voici le code faisant appelle au censé faire afficher le logo dans invoice.php

=>


function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{
//Put an image on the page
if(!isset($this->images[$file]))
{
//First use of image, get info
if($type=='')
{
$pos=strrpos($file,'.');
if(!$pos)
$this->Error('Image file has no extension and no type was specified: '.$file);
$type=substr($file,$pos+1);
}
$type=strtolower($type);
$mqr=get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
if($type=='jpg' || $type=='jpeg')
$info=$this->_parsejpg($file);
elseif($type=='png')
$info=$this->_parsepng($file);
else
{
//Allow for additional formats
$mtd='_parse'.$type;
if(!method_exists($this,$mtd))
$this->Error('Unsupported image type: '.$type);
$info=$this->$mtd($file);
}
set_magic_quotes_runtime($mqr);
$info['i']=count($this->images)+1;
$this->images[$file]=$info;
}
else
$info=$this->images[$file];
//Automatic width and height calculation if needed
if($w==0 && $h==0)
{
//Put image at 72 dpi
$w=$info['w']/$this->k;
$h=$info['h']/$this->k;
}
if($w==0)
$w=$h*$info['w']/$info['h'];
if($h==0)
$h=$w*$info['h']/$info['w'];
$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
if($link)
$this->Link($x,$y,$w,$h,$link);
}[/codebox]

Donc à bien y regarder, je me suis dit qu'il suffisait d'outrepasser le forcement et j'en suis arrivé à ca, qui me permet bien d'afficher le logo.

[codebox]function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{
//Put an image on the page
if(!isset($this->images[$file]))
{
//First use of image, get info
if($type=='')
{
$pos=strrpos($file,'.');
if(!$pos)
$this->Error('Image file has no extension and no type was specified: '.$file);
$type=substr($file,$pos+1);
}
$type=strtolower($type);
$mqr=get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
if($type=='jpg' || $type=='jpeg')
$info=$this->_parsejpg($file);
elseif($type=='png')
$info=$this->_parsepng($file);
else
{
//Allow for additional formats
$mtd='_parse'.$type;
if(!method_exists($this,$mtd))
$this->Error('Unsupported image type: '.$type);
$info=$this->$mtd($file);
}
set_magic_quotes_runtime($mqr);
$info['i']=count($this->images)+1;
$this->images[$file]=$info;
}
else
$info=$this->images[$file];
//Automatic width and height calculation if needed
if($w==0 && $h==0)
{
//Put image at 72 dpi
$w=$info['w']/1;//$this->k;
$h=$info['h']/1;///$this->k;
}
if($w==0)
$w=$h*$info['w']/$info['h'];
if($h==0)
$h=$w*$info['h']/$info['w'];
$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*10,$h*10,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
if($link)
$this->Link($x,$y,$w,$h,$link);
}

Voilà, ca aidera peut etre les autres... Mais j'ai toujours un souci sur les colonnes.

si vous souhaitez je vous envoie mes fichiers , c'est paulanna qui me les a modifier , je ne sait pas si vous en aurez besoin !!!

Share this post


: post
Share on other sites

Posted · Report post

si vous souhaitez je vous envoie mes fichiers , c'est paulanna qui me les a modifier , je ne sait pas si vous en aurez besoin !!!

Si elle a fait en sorte que la derniere colonne n'est plus décalée, je veux bien ;)

Share this post


: post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

Twitter Advisto ecommerce

Facebook PEEL Shopping