atila-diffusion

Utilisateur open source
  • Compteur de contenus

    1 036
  • Inscrit(e) le

  • Dernière visite


Messages posté(e)s par atila-diffusion


  1. en fait on va afficher dans la liste 1

    puis on va tester si dans le stock on en a au moins deux, alors j'affiche aussi deux et ainsi de suite.

    Si j'ai plus que cinq dans mon stock, pas grave, moi je n'en affiche quand meme que cinq.

    Par contre Negoce, peux tu me redonner en mp l'acces à ton serveur de test car je crois que j'avai plus avancé dessus que sur ma version.


  2. voilà tu vois déjà pour que l'utilisateur ne puisse pas mettre en meme temps plus de produit que possible on va ne lui afficher dans la liste déroulante 1 à stock avec ceci

    <option value="1">1</option>
    <?php if ($prod['stock']>=2) {echo "<option value='2'>2</option>";}?>
    <?php if ($prod['stock']>=3) {echo "<option value='3'>3</option>";}?>
    <?php if ($prod['stock']>=4) {echo "<option value='4'>4</option>";}?>
    <?php if ($prod['stock']>=5) {echo "<option value='5'>5</option>";}?>
    </select>
    [/codebox]

    Par contre faut regarder si dans la bdd du nouveau peel shopping le nom de stock dans la table produit est bien stock, sinon faudra remplacer $prod['stock'] par $prod['NomVeritableDuSTock']


  3. 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.


  4. 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]

Twitter Advisto ecommerce

Facebook PEEL Shopping