</th> <th><?php echo trad('STATUT', 'admin'); ?> </th> <th></th> </tr> </thead> <tbody> <?php $commande = new Commande(); $query = "SELECT * FROM " . Commande::TABLE . " WHERE client='" . $client->id . "' ORDER BY date DESC"; $resul = $commande->query($query); while ($resul && ($cmd = $commande->fetch_object($resul, 'Commande'))) { $statutdesc = new Statutdesc(); $statutdesc->charger($cmd->statut); switch ($cmd->statut) { case '1': $trClass = 'warning'; break; case '4': $trClass = 'success'; break; case '5': $trClass = 'error'; break; default: $trClass = 'info'; break; } ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?> " name="formchange" method="post"> <input type="hidden" name="ref" value="<?php echo $ref; ?> " /> <select name="statutch" id="statutch" onchange="formchange.submit()" class="form"> <?php $statut = new Statut(); $query = "select * from {$statut->table}"; $resul = $statut->query($query); while ($resul && ($row = $statut->fetch_object($resul))) { $statutcurdes = new Statutdesc(); $statutcurdes->charger($row->id); if ($row->id == $statutdesc->statut) { $selected = "selected"; } else { $selected = ""; } ?> <option value="<?php echo $row->id; ?> " <?php echo $selected; ?> > <?php echo $statutcurdes->titre;
function boucleCommande($texte, $args) { $commande = new Commande(); // récupération des arguments $commande_id = lireTag($args, "id", "int"); $commande_ref = lireTag($args, "ref", "string"); $client_id = lireTag($args, "client", "int"); $statut = lireTag($args, "statut", "string"); $classement = lireTag($args, "classement", "string"); $statutexcl = lireTag($args, "statutexcl", "int_list"); $deb = lireTag($args, "deb", "int"); $num = lireTag($args, "num", "int"); if ($commande_ref == "" && $client_id == "") { return; } $search = ""; $order = ""; $limit = ""; $res = ""; // preparation de la requete if ($commande_id != "") { $search .= " and id=\"{$commande_id}\""; } if ($commande_ref != "") { $search .= " and ref=\"{$commande_ref}\""; } if ($client_id != "") { $search .= " and client=\"{$client_id}\""; } if ($statutexcl != "") { $search .= " and statut not in ({$statutexcl})"; } if ($statut != "" && $statut != "paye") { $search .= " and statut=\"{$statut}\""; } else { if ($statut == "paye") { $search .= " and statut>\"1\" and statut<>\"5\""; } } if ($deb == "") { $deb = 0; } if ($num != "") { $limit = "limit {$deb},{$num}"; } if ($classement == "inverse") { $order = "order by date"; } else { $order = "order by date desc"; } $query = "select * from {$commande->table} where 1 {$search} {$order} {$limit}"; $statutdesc = new Statutdesc(); $venteprod = new Venteprod(); $resul = CacheBase::getCache()->query($query); if (empty($resul)) { return ""; } foreach ($resul as $row) { $jour = substr($row->date, 8, 2); $mois = substr($row->date, 5, 2); $annee = substr($row->date, 0, 4); $heure = substr($row->date, 11, 2); $minute = substr($row->date, 14, 2); $seconde = substr($row->date, 17, 2); $jour_livraison = substr($row->datelivraison, 8, 2); $mois_livraison = substr($row->datelivraison, 5, 2); $annee_livraison = substr($row->datelivraison, 0, 4); $datelivraison = $jour_livraison . "/" . $mois_livraison . "/" . $annee_livraison; $datefacturation = $row->datefact == '0000-00-00' ? '' : substr($row->datefact, 8, 2) . "/" . substr($row->datefact, 5, 2) . "/" . substr($row->datefact, 0, 4); $query2 = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tsum(prixu*quantite) as totalttc,\n\t\t\t\t\t\tsum(prixu*quantite / (1 + tva / 100)) as totalht\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{$venteprod->table}\n\t\t\t\t\twhere\n\t\t\t\t\t\tcommande='{$row->id}'\n\t\t\t\t"; $resul2 = CacheBase::getCache()->query($query2); $totalarticlesttc = $resul2[0]->totalttc; $totalarticlesht = $resul2[0]->totalht; if ($totalarticlesttc != 0) { $pourcremise = $row->remise / $totalarticlesttc * 100; } else { $pourcremise = 0; } $total = $totalarticlesttc - $row->remise; $port = $row->port; $totcmdport = $row->port + $total; $statutdesc->charger($row->statut); $temp = str_replace("#ID", "{$row->id}", $texte); $temp = str_replace("#ADRESSE", "{$row->adrfact}", $temp); $temp = str_replace("#ADRFACT", "{$row->adrfact}", $temp); $temp = str_replace("#ADRLIVR", "{$row->adrlivr}", $temp); if ($jour_livraison != "00") { $temp = str_replace("#DATELIVRAISON", $jour_livraison . "/" . $mois_livraison . "/" . $annee_livraison, $temp); } else { $temp = str_replace("#DATELIVRAISON", "", $temp); } $temp = str_replace("#DATEFACTURATION", $datefacturation, $temp); $temp = str_replace("#DATE", $jour . "/" . $mois . "/" . $annee, $temp); $temp = str_replace("#REF", "{$row->ref}", $temp); $temp = str_replace("#ADRFACT", "{$row->adrfact}", $temp); $temp = str_replace("#ADRLIVR", "{$row->adrlivr}", $temp); $temp = str_replace("#FACTURE", "{$row->facture}", $temp); $temp = str_replace("#TRANSACTION", "{$row->transaction}", $temp); $temp = str_replace("#REMISE", formatter_somme($row->remise), $temp); $temp = str_replace("#STATUTID", "{$row->statut}", $temp); $temp = str_replace("#STATUT", "{$statutdesc->titre}", $temp); $temp = str_replace("#PORT", formatter_somme($port), $temp); $temp = str_replace("#COMDEVISE", "{$row->devise}", $temp); $temp = str_replace("#TAUX", "{$row->taux}", $temp); $temp = str_replace("#COLIS", "{$row->colis}", $temp); $temp = str_replace("#LIVRAISON", "{$row->livraison}", $temp); $temp = str_replace("#CLIENT", "{$row->client}", $temp); $temp = str_replace("#TOTALARTICLESTTC", formatter_somme($totalarticlesttc), $temp); $temp = str_replace("#TOTALARTICLESHT", formatter_somme($totalarticlesht), $temp); $temp = str_replace("#POURCEREMISE", $pourcremise, $temp); $temp = str_replace("#TOTALCMD", formatter_somme($total), $temp); $temp = str_replace("#TOTCMDPORT", formatter_somme($totcmdport), $temp); $module = new Modules(); $moduledesc = new Modulesdesc(); $module->charger_id($row->transport); $moduledesc->charger($module->nom); $temp = str_replace("#TRANSPORTTITRE", $moduledesc->titre, $temp); $module->charger_id($row->paiement); $moduledesc->charger($module->nom); $temp = str_replace("#PAIEMENTTITRE", $moduledesc->titre, $temp); $temp = str_replace("#PAIEMENT", "{$row->paiement}", $temp); $temp = str_replace("#TRANSPORT", "{$row->transport}", $temp); $res .= $temp; } return $res; }
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 } }
</li> <li style="height:25px; width:66px; border-left:1px solid #96A8B5;"><?php echo trad('Montant', 'admin'); ?> </li> <li style="height:25px; width:77px; border-left:1px solid #96A8B5; background-image: url(gfx/picto_menu_deroulant.gif); background-position:right bottom; background-repeat: no-repeat;"><?php echo trad('Statut', 'admin'); ?> <ul class="Menu"> <?php $statut = new Statut(); $query_stat = "select * from {$statut->table}"; $resul_stat = $statut->query($query_stat); while ($resul_stat && ($row_stat = $statut->fetch_object($resul_stat))) { $statutdesc = new Statutdesc(); $statutdesc->charger($row_stat->id); ?> <li style="width:84px;"><a href="commande.php?statut=<?php echo $row_stat->id; ?> " name="<?php echo $row_stat->id; ?> "><?php echo $statutdesc->titre; ?> </a></li> <?php } ?> <li style="width:84px;"><a href="commande.php">En cours</a></li>
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; }
$modules = new Modules(); $modules->charger_id($commande->paiement); $devise = new Devise(); $devise->charger($commande->devise); if ($statutch) { $commande->setStatutAndSave($statutch); } if (isset($colis) && $colis != "") { $commande->colis = $colis; $commande->maj(); ActionsModules::instance()->appel_module("statut", $commande, $commande->statut); } $client = new Client(); $client->charger_id($commande->client); $statutdesc = new Statutdesc(); $statutdesc->charger($commande->statut); $date = new DateTime($commande->date); $moduletransport = new Modules(); $moduletransport->charger_id($commande->transport); $moduletransportdesc = new Modulesdesc(); $moduletransportdesc->charger($moduletransport->nom); $promoutil = new Promoutil(); $promoutil->charger_commande($commande->id); $adrFacturation = new Venteadr($commande->adrfact); $adrLivraison = new Venteadr($commande->adrlivr); $paysFacturation = new Paysdesc($adrFacturation->pays); $paysLivraison = new Paysdesc($adrLivraison->pays); $raisonFacturation = new Raisondesc($adrFacturation->raison); $raisonLivraison = new Raisondesc($adrLivraison->raison); $statusArray = $commande->query_liste('SELECT * FROM ' . Statutdesc::TABLE . ' WHERE lang=' . ActionsLang::instance()->get_id_langue_courante()); try {
$commande = new Commande(); $i = 0; $jour = substr($motcle, 0, 2); $mois = substr($motcle, 3, 2); $annee = substr($motcle, 6); $ladate = "{$annee}-{$mois}-{$jour}"; $ladate = str_replace("??", "%", $ladate); $search .= " ref like '%{$motcle}%' or date like '{$ladate}'"; $query = "select * from {$commande->table} {$search}"; $resul = mysql_query($query, $commande->link); $venteprod = new Venteprod(); while ($row = mysql_fetch_object($resul)) { $client = new Client(); $client->charger_id($row->client); $statutdesc = new Statutdesc(); $statutdesc->charger($row->statut); $query2 = "SELECT sum(prixu*quantite) as total FROM {$venteprod->table} where commande='{$row->id}'"; $resul2 = mysql_query($query2, $venteprod->link); $total = round(mysql_result($resul2, 0, "total"), 2); $port = $row->port; $total -= $row->remise; $total += $port; if ($total < 0) { $total = 0; } $jour = substr($row->date, 8, 2); $mois = substr($row->date, 5, 2); $annee = substr($row->date, 0, 4); $heure = substr($row->date, 11, 2); $minute = substr($row->date, 14, 2); $seconde = substr($row->date, 17, 2);