}
    ?>
                            <tr class="<?php 
    echo $trClass;
    ?>
">
                                <td><?php 
    echo $cmd->ref;
    ?>
</td>
                                <td><?php 
    echo date("d/m/Y H:i:s", strtotime($cmd->date));
    ?>
</td>
                                <td><?php 
    echo formatter_somme($cmd->total(true, true));
    ?>
</td>
                                <td><?php 
    echo $statutdesc->titre;
    ?>
</td>
                                <td>
                                    <div class="btn-group">
                                        <a class="btn btn-mini" title="<?php 
    echo trad('editer', 'admin');
    ?>
" href="commande_details.php?ref=<?php 
    echo $cmd->ref;
    ?>
"><i class="icon-edit"></i></a>
Beispiel #2
0
function liste_clients($order, $critere, $debut)
{
    $i = 0;
    $client = new Client();
    $query = "select * from {$client->table} order by {$critere} {$order} limit {$debut},20";
    $resul = $client->query($query);
    while ($resul && ($row = $client->fetch_object($resul))) {
        $fond = "ligne_" . ($i++ % 2 ? "claire" : "fonce") . "_rub";
        $commande = new Commande();
        $devise = new Devise();
        $querycom = "select id from {$commande->table} where client={$row->id} and statut not in(" . Commande::NONPAYE . "," . Commande::ANNULE . ") order by date DESC limit 0,1";
        $resulcom = $commande->query($querycom);
        $existe = 0;
        if ($commande->num_rows($resulcom) > 0) {
            $existe = 1;
            $idcom = $commande->get_result($resulcom, 0, "id");
            $commande->charger($idcom);
            $devise->charger($commande->devise);
            $date = strftime("%d/%m/%y %H:%M:%S", strtotime($commande->date));
        }
        $creation = strftime("%d/%m/%y %H:%M:%S", strtotime($row->datecrea));
        ?>
<ul class="<?php 
        echo $fond;
        ?>
">
	<li style="width:122px;"><?php 
        echo $row->ref;
        ?>
</li>
	<li style="width:110px;"><?php 
        echo $creation;
        ?>
</li>
	<li style="width:143px;"><?php 
        echo $row->entreprise;
        ?>
</li>
	<li style="width:243px;"><?php 
        echo $row->nom;
        ?>
 <?php 
        echo $row->prenom;
        ?>
</li>
	<li style="width:110px;"><?php 
        if ($existe) {
            echo $date;
        }
        ?>
</li>
	<li style="width:63px;"><?php 
        if ($existe) {
            echo formatter_somme($commande->total(true, true)) . ' ' . $devise->symbole;
        }
        ?>
</li>
	<li style="width:40px;"><a href="client_visualiser.php?ref=<?php 
        echo $row->ref;
        ?>
" class="txt_vert_11"><?php 
        echo trad('editer', 'admin');
        ?>
</a></li>
	<li style="width:25px; text-align:center;"><a href="#" onclick="confirmSupp('<?php 
        echo $row->ref;
        ?>
')"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li>
</ul>
<?php 
    }
}
    $total = $cmd->total(true, true);
    $date = strftime("%d/%m/%Y %H:%M:%S", strtotime($cmd->date));
    $fond = $i++ % 2 ? "claire" : "fonce";
    ?>

	<ul class="lignesimple">
		<li class="cellule" style="width:130px;"><?php 
    echo $cmd->ref;
    ?>
</li>
		<li class="cellule" style="width:130px;"><?php 
    echo $date;
    ?>
</li>
		<li class="cellule" style="width:120px;"><?php 
    echo formatter_somme($total);
    ?>
</li>
		<li class="cellule" style="width:90px;"><?php 
    echo $statutdesc->titre;
    ?>
</li>
		<li class="cellule" style="width:60px;"><a href="commande_details.php?ref=<?php 
    echo $cmd->ref;
    ?>
"><?php 
    echo trad('editer', 'admin');
    ?>
</a></li>
		<?php 
    if ($cmd->statut != Commande::ANNULE) {
Beispiel #4
0
function boucleTransport($texte, $args)
{
    // récupération des arguments
    $id = lireTag($args, "id", "int_list");
    $nom = lireTag($args, "nom", "string");
    $exclusion = lireTag($args, "exclusion", "string_list");
    $idpays = intval(lireTag($args, "pays", "int"));
    $cpostal = intval(lireTag($args, "cpostal", "string"));
    $montantmini = intval(lireTag($args, "montantmini", "float"));
    $search = "";
    $res = "";
    if ($id != "") {
        $search .= "and id in ({$id})";
    }
    if ($nom != "") {
        $search .= "and nom=\"{$nom}\"";
    }
    if ($exclusion != "") {
        $liste = "";
        $tabexcl = explode(",", $exclusion);
        for ($i = 0; $i < count($tabexcl); $i++) {
            $liste .= "'" . $tabexcl[$i] . "'" . ",";
        }
        $liste = rtrim($liste, ",");
        $search .= " and nom not in ({$liste})";
    }
    $modules = new Modules();
    $query = "select * from {$modules->table} where type='2' and actif='1' {$search} order by classement";
    $resul = CacheBase::getCache()->query($query);
    if (empty($resul)) {
        return "";
    }
    $pays = new Pays();
    if ($idpays > 0) {
        $pays->charger($idpays);
    } else {
        if ($_SESSION['navig']->adresse != "" && $_SESSION['navig']->adresse != 0) {
            $adr = new Adresse();
            $adr->charger($_SESSION['navig']->adresse);
            $pays->charger($adr->pays);
        } else {
            $pays->charger($_SESSION['navig']->client->pays);
        }
    }
    $transzone = new Transzone();
    $compt = 0;
    foreach ($resul as $row) {
        if (!$transzone->charger($row->id, $pays->zone)) {
            continue;
        }
        $compt++;
        $modules = new Modules();
        $modules->charger_id($row->id);
        try {
            $instance = ActionsModules::instance()->instancier($modules->nom);
            $port = round(port($row->id, $pays->id, $cpostal), 2);
            $titre = $instance->getTitre();
            $chapo = $instance->getChapo();
            $description = $instance->getDescription();
        } catch (Exception $ex) {
            $titre = $chapo = $description = '';
        }
        if ($port < $montantmini) {
            continue;
        }
        // Chercher le logo
        $exts = array('png', 'gif', 'jpeg', 'jpg');
        $logo = false;
        foreach ($exts as $ext) {
            $tmp = ActionsModules::instance()->lire_chemin_base() . "/{$row->nom}/logo.{$ext}";
            if (file_exists($tmp)) {
                $logo = ActionsModules::instance()->lire_url_base() . "/{$row->nom}/logo.{$ext}";
                break;
            }
        }
        $temp = str_replace("#NOM", $row->nom, $texte);
        $temp = str_replace("#TITRE", "{$titre}", $temp);
        $temp = str_replace("#CHAPO", "{$chapo}", $temp);
        $temp = str_replace("#DESCRIPTION", "{$description}", $temp);
        $temp = str_replace("#URLCMD", urlfond("commande", "action=transport&amp;id=" . $row->id, true), $temp);
        $temp = str_replace("#ID", "{$row->id}", $temp);
        $temp = str_replace("#LOGO", $logo, $temp);
        $temp = str_replace("#PORT", formatter_somme($port), $temp);
        $temp = str_replace("#COMPT", "{$compt}", $temp);
        $res .= $temp;
    }
    return $res;
}
Beispiel #5
0
function lister_commandes($critere, $order, $debut, $nbres, $search = '')
{
    $commande = new Commande();
    $i = 0;
    $query = "select * from {$commande->table} where 1 {$search} order by {$critere} {$order} limit {$debut},{$nbres}";
    $resul = $commande->query($query);
    while ($resul && ($row = $commande->fetch_object($resul, 'Commande'))) {
        $client = new Client();
        $client->charger_id($row->client);
        $statutdesc = new Statutdesc();
        $statutdesc->charger($row->statut);
        $devise = new Devise();
        $devise->charger($row->devise);
        $total = formatter_somme($row->total(true, true));
        $date = strftime("%d/%m/%y %H:%M:%S", strtotime($row->date));
        $fond = "ligne_" . ($i++ % 2 ? "claire" : "fonce") . "_rub";
        ?>

<ul class="<?php 
        echo $fond;
        ?>
">
	<li style="width:142px;"><?php 
        echo $row->ref;
        ?>
</li>
	<li style="width:104px;"><?php 
        echo $date;
        ?>
</li>
	<li style="width:200px;"><?php 
        echo $client->entreprise;
        ?>
</li>
	<li style="width:200px;"><a href="client_visualiser.php?ref=<?php 
        echo $client->ref;
        ?>
"><?php 
        echo $client->nom . " " . $client->prenom;
        ?>
</a></li>
	<li style="width:59px;"><?php 
        echo $total;
        ?>
 <?php 
        echo $devise->symbole;
        ?>
</li>
	<li style="width:70px;"><?php 
        echo $statutdesc->titre;
        ?>
</li>
	<li style="width:40px;"><a href="commande_details.php?ref=<?php 
        echo $row->ref;
        ?>
">éditer</a></li>
	<?php 
        if ($row->statut != Commande::ANNULE) {
            ?>
		<li style="width:35px; text-align:center;"><a href="#" onclick="supprimer('<?php 
            echo $row->id;
            ?>
'); return false;"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li>
	<?php 
        }
        ?>
</ul>
		<?php 
    }
}
Beispiel #6
0
                                            <td><?php 
    echo trad('Commandes_annulees', 'admin');
    ?>
</td>
                                            <td><?php 
    echo $stat->getNbCommandCanceled("year");
    ?>
</td>
                                        </tr>
                                        <tr>
                                            <td><?php 
    echo trad('Panier_moyen', 'admin');
    ?>
</td>
                                            <td><?php 
    echo formatter_somme($stat->getAverageCart("year"));
    ?>
 <?php 
    echo $devise->symbole;
    ?>
</td>
                                        </tr>
                                    </table>
                                    </div>
                                </div>
			</div>
		</div>
<?php 
}
?>
		<div class="span4">
 public function getList($order, $critere, $debut, $nbres)
 {
     $query = $this->getRequest('list', $order, $critere, $debut, $nbres);
     $resul = $this->query($query);
     $retour = array();
     while ($resul && ($row = $this->fetch_object($resul))) {
         $thisClient = array();
         $thisClient['ref'] = $row->ref;
         $thisClient['entreprise'] = $row->entreprise;
         $thisClient['nom'] = $row->nom;
         $thisClient['prenom'] = $row->prenom;
         $thisClient['email'] = $row->email;
         $commande = new Commande();
         $devise = new Devise();
         $querycom = "SELECT id FROM {$commande->table} WHERE client={$row->id} AND statut NOT IN(" . Commande::NONPAYE . "," . Commande::ANNULE . ") ORDER BY date DESC LIMIT 0,1";
         $resulcom = $commande->query($querycom);
         if ($commande->num_rows($resulcom) > 0) {
             $idcom = $commande->get_result($resulcom, 0, "id");
             $commande->charger($idcom);
             $devise->charger($commande->devise);
             $thisClient['date'] = strftime("%d/%m/%Y %H:%M:%S", strtotime($commande->date));
             $thisClient['somme'] = formatter_somme($commande->total(true, true)) . ' ' . $devise->symbole;
         } else {
             $thisClient['date'] = '';
             $thisClient['somme'] = '';
         }
         $retour[] = $thisClient;
     }
     return $retour;
 }
 public function getDetailTurnover($nbDays = 30)
 {
     $date = new DateTime();
     $date->setTime(0, 0, 0);
     $date->modify("-{$nbDays} day");
     $return = array();
     for ($i = 0; $i < $nbDays; $i++) {
         $date->modify("+1 day");
         $return[] = array("date" => $date->format('Y-m-d'), "ca" => formatter_somme($this->getTurnoverByDate($date->format('Y-m-d')) + $this->getChippingPrice(null, $date->format('Y-m-d')) - $this->getDiscount(null, $date->format('Y-m-d'))));
     }
     return $return;
 }
 public function getSearchList($searchTerm, $clientFoundList)
 {
     $searchTerm = $this->escape_string(trim($searchTerm));
     $return = array();
     if ($searchTerm === '' && count($clientFoundList) == 0) {
         return $return;
     }
     $qOrders = "SELECT * FROM " . self::TABLE . "\n            WHERE ref like '%{$searchTerm}%'\n                OR facture like '%{$searchTerm}%'\n                OR transaction like '%{$searchTerm}%'\n                " . (count($clientFoundList) > 0 ? " OR client IN (" . implode(',', $clientFoundList) . ")" : '') . "\n                " . (strtotime($searchTerm) ? " OR date LIKE '" . date('Y-m-d', strtotime($searchTerm)) . "%'" : '') . "\n            LIMIT 100";
     $rOrders = $this->query($qOrders);
     while ($rOrders && ($theOrder = $this->fetch_object($rOrders, 'Commande'))) {
         $thisOrderArray = array();
         $client = new Client();
         $client->charger_id($theOrder->client);
         $statutdesc = new Statutdesc();
         $statutdesc->charger($theOrder->statut);
         $devise = new Devise();
         $devise->charger($theOrder->devise);
         $total = formatter_somme($theOrder->total(true, true));
         $date = strftime("%d/%m/%y %H:%M:%S", strtotime($theOrder->date));
         $thisOrderArray['ref'] = $theOrder->ref;
         $thisOrderArray['transaction'] = $theOrder->transaction;
         $thisOrderArray['facture'] = $theOrder->facture;
         $thisOrderArray['date'] = $date;
         $thisOrderArray['client'] = array("entreprise" => $client->entreprise, "ref" => $client->ref, "nom" => $client->nom, "prenom" => $client->prenom);
         $thisOrderArray['total'] = $total;
         $thisOrderArray['devise'] = $devise->symbole;
         $thisOrderArray['titre'] = $statutdesc->titre;
         $thisOrderArray['statut'] = $theOrder->statut;
         $thisOrderArray['id'] = $theOrder->id;
         $return[] = $thisOrderArray;
     }
     return $return;
 }
function substitpanier($texte)
{
    $total = 0;
    $totalht = 0;
    $totaleco = 0;
    $totaltaxe = 0;
    $allItemCount = $nb_article = 0;
    if ($_SESSION['navig']->adresse) {
        $adr = new Adresse();
        $adr->charger($_SESSION['navig']->adresse);
        $idpays = $adr->pays;
    } else {
        $idpays = $_SESSION['navig']->client->pays;
    }
    $pays = new Pays();
    $pays->charger($idpays);
    $total = $_SESSION['navig']->panier->total();
    $totalht = $_SESSION['navig']->panier->total(0);
    $totaleco = $_SESSION['navig']->panier->totalecotaxe();
    $tva = $total - $totalht;
    $nb_article = $_SESSION['navig']->panier->nbart;
    foreach ($_SESSION['navig']->panier->tabarticle as $anItem) {
        $allItemCount += $anItem->quantite;
    }
    unset($anItem);
    $port = port();
    if ($port < 0) {
        $port = 0;
    }
    $totcmdport = $total + $port;
    $remise = $remise_client = $remise_promo = 0;
    if ($_SESSION['navig']->client->pourcentage > 0) {
        $remise_client = $total * $_SESSION['navig']->client->pourcentage / 100;
    }
    $remise_promo += calc_remise($total);
    $remise = $remise_promo + $remise_client;
    $totcmdport -= $remise;
    $totremise = $total - $remise;
    if ($totcmdport < $port) {
        $totcmdport = $port;
    }
    $totcmdportht = $totalht + $port;
    $totalht = formatter_somme($totalht);
    $total = formatter_somme($total);
    $totaleco = formatter_somme($totaleco);
    $totaltaxe = formatter_somme($totaltaxe);
    $port = formatter_somme($port);
    $totcmdport = formatter_somme($totcmdport);
    $remise = formatter_somme($remise);
    $totremise = formatter_somme($totremise);
    $totcmdportht = formatter_somme($totcmdportht);
    $tva = formatter_somme($tva, 2, ".", "");
    $remise_client = formatter_somme($remise_client);
    $remise_promo = formatter_somme($remise_promo);
    $totpoids = $_SESSION['navig']->panier->poids();
    $texte = str_replace("#PANIER_TOTALHT", "{$totalht}", $texte);
    $texte = str_replace("#PANIER_TOTALECO", "{$totaleco}", $texte);
    $texte = str_replace("#PANIER_TOTALTVA", "{$tva}", $texte);
    // total TVA du panier = #PANIER_TVA
    $texte = str_replace("#PANIER_TOTAL", "{$total}", $texte);
    $texte = str_replace("#PANIER_PORT", "{$port}", $texte);
    $texte = str_replace("#PANIER_TOTPORTHT", "{$totcmdportht}", $texte);
    $texte = str_replace("#PANIER_TOTPORT", "{$totcmdport}", $texte);
    $texte = str_replace("#PANIER_TOTREMISE", "{$totremise}", $texte);
    $texte = str_replace("#PANIER_REMISE_CLIENT", "{$remise_client}", $texte);
    $texte = str_replace("#PANIER_REMISE_PROMO", "{$remise_promo}", $texte);
    $texte = str_replace("#PANIER_REMISE", "{$remise}", $texte);
    $texte = str_replace("#PANIER_NBART_TOTAL", $allItemCount, $texte);
    $texte = str_replace("#PANIER_NBART", "" . $nb_article . "", $texte);
    $texte = str_replace("#PANIER_POIDS", "{$totpoids}", $texte);
    $texte = str_replace("#PANIER_TVA", "{$tva}", $texte);
    // total TVA du panier
    return $texte;
}
                                    <td><?php 
        echo formatter_somme($venteprod["total"]) . " " . $devise->symbole;
        ?>
</td>
                                </tr>
                                <?php 
    }
}
?>
                            <tr class="info">
                                <td colspan="3"><b><?php 
echo trad('Total', 'admin');
?>
</b></td>
                                <td><?php 
echo formatter_somme($commande->total()) . " " . $devise->symbole;
?>
</td>
                            </tr>
                    </tbody>
                </table>
                
                <table class="table table-striped">
                    <caption>
                        <h4><?php 
echo trad('INFO_FACTURE', 'admin');
?>
</h4>
                    </caption>
                    <thead>
                        <tr>