Пример #1
0
function liste_parent($parent, $niveau, $commande, $grandParent, $debutLie = 0)
{
    global $deco, $listePassee;
    $venteprod = new Venteprod();
    $query = "select * from {$venteprod->table} where commande='{$commande->id}' AND parent='{$parent}'";
    $resul = $venteprod->query($query);
    $memFin = "";
    while ($resul && ($row = $venteprod->fetch_object($resul))) {
        $venteprod->charger($row->id);
        $baseIndentation = 25;
        $paddingIndentation = 5;
        //base
        $largeurDesignation = 399;
        $indentation = "";
        if ($debutLie) {
            $indentation = "╓";
        } elseif ($grandParent != 0 && $grandParent == $venteprod->id) {
            $indentation = "╙";
        } elseif ($niveau > 0) {
            /*for($niv=0;$niv<$niveau;$niv++)
            		{
            			$indentation .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            		}*/
            $paddingIndentation += $baseIndentation * $niveau;
            $indentation .= "↳";
        }
        $largeurDesignation -= $paddingIndentation;
        $produit = new Produit();
        $produitdesc = new Produitdesc();
        $produit->charger($venteprod->ref);
        $produitdesc->charger($produit->id);
        $rubrique = new Rubrique();
        $rubrique->charger($produit->rubrique);
        $rubriquedesc = new Rubriquedesc();
        $rubriquedesc->charger($rubrique->id);
        if ($rubriquedesc->titre != "") {
            $titrerub = $rubriquedesc->titre;
        } else {
            $titrerub = "//";
        }
        if (!($deco % 2)) {
            $fond = "ligne_fonce_BlocDescription";
        } else {
            $fond = "ligne_claire_BlocDescription";
        }
        $listePassee[] = $venteprod->id;
        if ($grandParent != 0 && $grandParent == $venteprod->id) {
            $memFin = "<ul class=\"__COULEUR_FOND__\">\n\t\t\t\t<li style=\"width:" . $largeurDesignation . "px;padding-left:" . $paddingIndentation . "px\">{$indentation} {$venteprod->ref} - {$titrerub} - " . str_replace("\n", "<br />", $venteprod->titre) . "</li>\n\t\t\t\t<li style=\"width:73px;\">" . round($venteprod->prixu, 2) . "</li>\n\t\t\t\t<li style=\"width:23px;\">" . $venteprod->quantite . "</li>\n\t\t\t\t<li style=\"width:20px;\">" . round($venteprod->quantite * $venteprod->prixu, 2) . "</li>\n\t\t\t\t</ul>";
        } else {
            $deco++;
            ?>
				<ul class="<?php 
            echo $fond;
            ?>
">
				<li style="width:<?php 
            echo $largeurDesignation;
            ?>
px; padding-left:<?php 
            echo $paddingIndentation;
            ?>
px;"><?php 
            echo $indentation . " " . $venteprod->ref . " - " . $titrerub;
            ?>
 - <?php 
            echo str_replace("\n", "<br />", $venteprod->titre);
            ?>
</li>
				<li style="width:73px;"><?php 
            echo round($venteprod->prixu, 2);
            ?>
</li>
				<li style="width:23px;"><?php 
            echo $venteprod->quantite;
            ?>
</li>
				<li style="width:20px;"><?php 
            echo round($venteprod->quantite * $venteprod->prixu, 2);
            ?>
</li>
				</ul>

		<?php 
        }
        if ($grandParent != $venteprod->id) {
            liste_parent($venteprod->id, $niveau + 1, $commande, $parent);
        }
    }
    if ($memFin != "") {
        if (!($deco % 2)) {
            $fond = "ligne_fonce_BlocDescription";
        } else {
            $fond = "ligne_claire_BlocDescription";
        }
        $deco++;
        echo str_replace("__COULEUR_FOND__", $fond, $memFin);
    }
}
Пример #2
0
 public function defalquer_stock($retourenstock = false)
 {
     try {
         $modules = new Modules();
         if ($modules->charger_id($this->paiement)) {
             $modpaiement = ActionsModules::instance()->instancier($modules->nom);
             if ($retourenstock) {
                 $defalquer = $modpaiement->defalqcmd != 0 || $modpaiement->defalqcmd == 0 && $this->statut != self::NONPAYE;
             } else {
                 $defalquer = $modpaiement->defalqcmd == 0;
             }
             if ($defalquer) {
                 $delta = $retourenstock ? 1 : -1;
                 $venteprod = new Venteprod();
                 $query = "select * from {$venteprod->table} where commande='" . $this->id . "'";
                 $resul = $venteprod->query($query);
                 while ($resul && ($row = $venteprod->fetch_object($resul))) {
                     // Mise à jour du stock général
                     $produit = new Produit($row->ref);
                     $produit->stock += $delta * $row->quantite;
                     $produit->maj();
                     $vdec = new Ventedeclidisp();
                     $query2 = "select * from {$vdec->table} where venteprod='" . $row->id . "'";
                     $resul2 = $vdec->query($query2);
                     while ($resul2 && ($row2 = $vdec->fetch_object($resul2))) {
                         $stock = new Stock();
                         // Mise à jour du stock des declinaisons
                         if ($stock->charger($row2->declidisp, $produit->id)) {
                             $stock->valeur += $delta * $row->quantite;
                             $stock->maj();
                         }
                     }
                 }
             }
         }
     } catch (Exception $ex) {
         // Rien
     }
 }
 public function substitmail($corps, $commande)
 {
     ActionsModules::instance()->appel_module("preSubstitmail", $corps, $commande);
     $nomsite = Variable::lire("nomsite");
     $jour = substr($commande->date, 8, 2);
     $mois = substr($commande->date, 5, 2);
     $annee = substr($commande->date, 0, 4);
     $heure = substr($commande->date, 11, 2);
     $minute = substr($commande->date, 14, 2);
     $seconde = substr($commande->date, 17, 2);
     $client = new Client($commande->client);
     $paiement = new Modules($commande->paiement);
     $paiementdesc = new Modulesdesc($paiement->nom, $commande->lang);
     $transport = new Modules($commande->transport);
     $transportdesc = new Modulesdesc($transport->nom, $commande->lang);
     $total = $commande->total();
     $totcmdport = $commande->port + $total;
     $adresse = new Venteadr($commande->adrlivr);
     $raisondesc = new Raisondesc();
     $raisondesc->charger($adresse->raison, $commande->lang);
     $nom = $adresse->nom;
     $prenom = $adresse->prenom;
     $entreprise = $adresse->entreprise;
     $adresse1 = $adresse->adresse1;
     $adresse2 = $adresse->adresse2;
     $adresse3 = $adresse->adresse3;
     $cpostal = $adresse->cpostal;
     $ville = $adresse->ville;
     $pays = new Paysdesc($adresse->pays, $commande->lang);
     $corps = str_replace("__COMMANDE_REF__", $commande->ref, $corps);
     $corps = str_replace("__COMMANDE_DATE__", $jour . "/" . $mois . "/" . $annee, $corps);
     $corps = str_replace("__COMMANDE_HEURE__", $heure . ":" . $minute, $corps);
     $corps = str_replace("__COMMANDE_TRANSACTION__", $commande->transaction, $corps);
     $corps = str_replace("__COMMANDE_PAIEMENT__", $paiementdesc->titre, $corps);
     $corps = str_replace("__COMMANDE_TOTALPORT__", $totcmdport - $commande->remise, $corps);
     $corps = str_replace("__COMMANDE_TOTAL__", $total, $corps);
     $corps = str_replace("__COMMANDE_PORT__", $commande->port, $corps);
     $corps = str_replace("__COMMANDE_REMISE__", $commande->remise, $corps);
     $corps = str_replace("__COMMANDE_TRANSPORT__", $transportdesc->titre, $corps);
     $corps = str_replace("__COMMANDE_TRANSPORTCHAPO__", $transportdesc->chapo, $corps);
     $corps = str_replace("__COMMANDE_LIVRRAISON__", $raisondesc->court, $corps);
     $corps = str_replace("__COMMANDE_LIVRNOM__", $nom, $corps);
     $corps = str_replace("__COMMANDE_LIVRPRENOM__", $prenom, $corps);
     $corps = str_replace("__COMMANDE_LIVRENTREPRISE__", $entreprise, $corps);
     $corps = str_replace("__COMMANDE_LIVRADRESSE1__", $adresse1, $corps);
     $corps = str_replace("__COMMANDE_LIVRADRESSE2__", $adresse2, $corps);
     $corps = str_replace("__COMMANDE_LIVRADRESSE3__", $adresse3, $corps);
     $corps = str_replace("__COMMANDE_LIVRCPOSTAL__", $cpostal, $corps);
     $corps = str_replace("__COMMANDE_LIVRVILLE__", $ville, $corps);
     $corps = str_replace("__COMMANDE_LIVRPAYS__", $pays->titre, $corps);
     $corps = str_replace("__COMMANDE_LIVRTEL__", $adresse->tel, $corps);
     $corps = str_replace("__NOMSITE__", $nomsite, $corps);
     $corps = str_replace("__URLSITE__", urlfond(), $corps);
     $adresse = new Venteadr($commande->adrfact);
     $raisondesc = new Raisondesc();
     $raisondesc->charger($adresse->raison);
     $pays = new Paysdesc();
     $pays->charger($adresse->pays);
     $corps = str_replace("__CLIENT_REF__", $client->ref, $corps);
     $corps = str_replace("__CLIENT_RAISON__", $raisondesc->court, $corps);
     $corps = str_replace("__CLIENT_ENTREPRISE__", $client->entreprise, $corps);
     $corps = str_replace("__CLIENT_SIRET__", $client->siret, $corps);
     $corps = str_replace("__CLIENT_FACTNOM__", $adresse->nom, $corps);
     $corps = str_replace("__CLIENT_FACTPRENOM__", $adresse->prenom, $corps);
     $corps = str_replace("__CLIENT_ADRESSE1__", $adresse->adresse1, $corps);
     $corps = str_replace("__CLIENT_ADRESSE2__", $adresse->adresse2, $corps);
     $corps = str_replace("__CLIENT_ADRESSE3__", $adresse->adresse3, $corps);
     $corps = str_replace("__CLIENT_CPOSTAL__", $adresse->cpostal, $corps);
     $corps = str_replace("__CLIENT_VILLE__", $adresse->ville, $corps);
     $corps = str_replace("__CLIENT_PAYS__", $pays->titre, $corps);
     $corps = str_replace("__CLIENT_EMAIL__", $client->email, $corps);
     $corps = str_replace("__CLIENT_TELFIXE__", $client->telfixe, $corps);
     $corps = str_replace("__CLIENT_TELPORT__", $client->telport, $corps);
     $pattern = '{<VENTEPROD>((?:(?:(?!<VENTEPROD[^>]*>|</VENTEPROD>).)++|<VENTEPROD[^>]*>(?1)</VENTEPROD>)*)</VENTEPROD>}si';
     if (preg_match($pattern, $corps, $cut)) {
         $corps = str_replace("<VENTEPROD>", "", $corps);
         $corps = str_replace("</VENTEPROD>", "", $corps);
         $res = "";
         $venteprod = new Venteprod();
         $query = "select * from {$venteprod->table} where commande=\"" . $commande->id . "\"";
         $resul = $venteprod->query($query);
         while ($resul && ($row = $venteprod->fetch_object($resul))) {
             $temp = str_replace("__VENTEPROD_TITRE__", $row->titre, $cut[1]);
             $temp = str_replace("__VENTEPROD_REF__", $row->ref, $temp);
             $temp = str_replace("__VENTEPROD_CHAPO__", $row->chapo, $temp);
             $temp = str_replace("__VENTEPROD_QUANTITE__", $row->quantite, $temp);
             $temp = str_replace("__VENTEPROD_PRIXU__", $row->prixu, $temp);
             $temp = str_replace("__VENTEPROD_TOTAL__", $row->prixu * $row->quantite, $temp);
             ActionsModules::instance()->appel_module("substitutionsventeprodmailcommande", $temp, $row);
             $res .= $temp;
         }
         $corps = str_replace($cut[1], $res, $corps);
     }
     // Substitutions mail "devise"
     $devise = new Devise($commande->devise);
     ActionsDevises::instance()->subsititutions_mail($devise, $corps);
     ActionsModules::instance()->appel_module("substitutionsmailcommande", $corps, $commande);
     return $corps;
 }