ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/litsolide.com/cp-admin/ |
Upload File : |
<?php
include_once('includes/header.php');
$id_volet ="2";
include('includes/volet.php');
/****************************/
// Commande
$sql = $bdd->prepare("SELECT o.*, os.status FROM orders o
INNER JOIN order_status os
ON os.id_order = o.id
WHERE os.date_status = (SELECT MAX(date_status) FROM order_status
WHERE id_order = o.id) AND o.id = :id");
$requete = $sql->execute(array('id' => $_GET['id']));
$order = $sql->fetch();
// Produits
$sql = $bdd->prepare('SELECT op.*, p.id AS id_product, p.reference, p.name FROM orders_products op
INNER JOIN products p
ON op.id_product = p.id
WHERE id_order = :id_order');
$sql->execute(array('id_order' => $_GET['id']));
$products = $sql->fetchAll();
// Adresse de facturation
$sql = $bdd->prepare('SELECT * FROM address
WHERE id = :invoice');
$sql->execute(array('invoice' => $order['invoice_address']));
$invoice = $sql->fetch();
// Adresse de livraison
$sql = $bdd->prepare('SELECT * FROM address
WHERE id = :delivery');
$sql->execute(array('delivery' => $order['delivery_address']));
$delivery = $sql->fetch();
// Informations de suivi
$sql = $GLOBALS['bdd']->prepare('SELECT * FROM order_status
WHERE id_order = :order
ORDER BY date_status');
$sql->execute(array('order' => $_GET['id']));
$order_status = $sql->fetchAll();
?>
<div class="container">
<div class="row">
<div class="span12">
<div class="page-header">
<h1>Details de la commande N.<?php echo $order["id"]; ?>
<div class="pull-right">
<a href="index.php" class="btn btn-primary"><i class="icon-arrow-left"></i> Retour</a>
</div>
</h1>
</div>
</div>
</div>
<table class="table table-bordered table-striped">
<tr>
<td>Numéro de la commande : </td>
<td><? echo $order["id"]; ?></td>
</tr>
<tr>
<td>Passée le :</td>
<td>
<?
setlocale (LC_TIME, 'fr_FR.utf8','fra');
echo utf8_encode(strftime("%A %d-%m-%Y", strtotime($order['date_insere'])));
?>
</td>
</tr>
<tr>
<td>Montant :</td>
<td><b><? echo number_format($order['total'], 2, ",", " "); ?> € </b></td>
</tr>
<tr>
<td>Adresse de facturation :</td>
<td>
<?=stripslashes($invoice["firstname"])?> <?=stripslashes($invoice["lastname"])?><br>
<?=stripslashes($invoice["address1"])?><br>
<?php
if ($invoice["address2"] > " ") {
echo stripslashes($invoice["address2"]);
echo '<br>';
}
?>
<?php
if ($delivery["company"] > " ") {
echo stripslashes($delivery["company"]);
echo '<br>';
}
?>
<?=stripslashes($invoice["zip_code"])?> <?=stripslashes($invoice["city"])?><br><?=stripslashes($invoice["country"])?><br>
<?php echo 'Tel. ' . $invoice["phone"]; ?>
</td>
</tr>
<?php
if ($order["invoice_address"] !== $order["delivery_address"]) {
?>
<tr>
<td>Adresse de livraison :</td>
<td>
<?=stripslashes($delivery["firstname"])?> <?=stripslashes($delivery["lastname"])?><br>
<?=stripslashes($delivery["address1"])?><br>
<?php
if ($delivery["address2"] > " ") {
echo stripslashes($delivery["address2"]);
echo '<br>';
}
?>
<?php
if ($delivery["company"] > " ") {
echo stripslashes($delivery["company"]);
echo '<br>';
}
?>
<?=stripslashes($delivery["zip_code"])?> <?=stripslashes($delivery["city"])?><br><?=stripslashes($delivery["country"])?><br>
<?php echo 'Tel. ' . $delivery["phone"]; ?>
</td>
</tr>
<?php
}
?>
<tr>
<td>Email :</td>
<td><a href="mailto:<?php echo $order["email"]; ?>"><? echo $order["email"]; ?></a><br><br></td>
</tr>
<tr>
<td>Modalité de paiement :</td>
<td><? echo $order["payment"]; ?></td>
</tr>
<tr>
<td>Etat de la commande :</td>
<td>
<?php
switch ($order['status']) {
case '1':
echo$comm_1;
break;
case '2':
echo$comm_2;
break;
case '3':
echo$comm_3;
break;
default:
echo$comm_4;
break;
}
?>
</td>
</tr>
</table>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span1 center">Référence</th>
<th class="span3 center">Désignation du produit</th>
<th class="span1 center">Quantité</th>
<th class="span1 center">Prix TTC</th>
<th class="span1 center">Totaux</th>
</tr>
</thead>
<tbody>
<?php
// debut roulette MISE A JOUR VENTE EN LOT
/*****************************************************************************************************************************************************************/
/*****************************************************************************************************************************************************************/
/*****************************************************************************************************************************************************************/
$total_tb = "0";
foreach ($products as $product) {
// Si groupage existant pour cet article prix par attribut unique
/*****************************************************************************************************************************************************************/
if ($agp >0){
// $agp= $config['agp']; dans webzone pour active vente groupee
/*************************************************************************/
// seconde roulette cherche le prix pour article idem sur plusieurs lignes
/*************************************************************************/
foreach ($products as $roulette_agp) {
$cherche = $product['id_product'];
$command = $_GET['id'];
$quantity_tot = 0;
$sqlaa = $bdd->prepare('SELECT quantity FROM orders_products
WHERE id_order = :id_order AND id_product = :id_product ');
$sqlaa->execute(array('id_order' => $_GET['id'], 'id_product' => $cherche));
$productsrr = $sqlaa->fetchAll();
for($i=0; $i<count($productsrr); $i++) {
$quantity_tot = $quantity_tot + $productsrr[$i]['quantity'];
}
$sql23 = $GLOBALS['bdd']->prepare('SELECT *, MIN(prix) AS pprix FROM lot_list
WHERE nombre <= :quantitee AND id_produit = :id_produit ORDER BY nombre ASC LIMIT 1');
$sql23->execute(array('id_produit' => $cherche, 'quantitee' => $quantity_tot));
$result23 = $sql23->fetch();
$tarif_lot = $result23['pprix'];
//echo'eeeeeeeeeee'.$tarif_lot;
if ($tarif_lot >0){ $product['price'] = $tarif_lot;} else { $product['price'] =$product['price'];}
}
/*************************************************************************/
// FIN roulette cherche le prix pour article idem sur plusieurs lignes
/*************************************************************************/
}
/*****************************************************************************************************************************************************************/
?>
<tr>
<td>
<?php if(isset($product["reference"])) echo $product["reference"]; ?>
<?php if($product["date_dispo"] !=="0000-00-00") {
$array_debut_us=explode("-", $product['date_dispo']);
$date_debut_fr=$array_debut_us[2]."-".$array_debut_us[1]."-".$array_debut_us[0];
$date_dispo_fr= str_replace('-','/', $date_debut_fr);
echo'<br /><span style="color:#cc3300">Livrer à partir du <br /> '.$date_dispo_fr.'</span>';
}
?>
</td>
<td>
<a href="edit_product.php?id=<?php echo $product["id_product"]; ?>"><?php echo stripcslashes($product["name"]); ?></a>
<?php if ($product['attributes'] !=='') { ?>
[<?php echo $product['attributes']; ?>]
<?php } ?>
<?php
if ($product['discount'] != 0)
{
?>
<br>
<span style="padding-left: 10px;">
Remise de <?php echo number_format($product['discount'], 2, ",", " "); ?> % incluse
</span>
<?php
}
?>
<br /> <span style="padding-left: 0;">
<?php echo $product['observations']; ?>
</span>
</td>
<td>
<?php echo $product["quantity"]; ?>
</td>
<td>
<?php echo number_format($product["price"], 2, ",", " "); ?> €
</td>
<td>
<?php
$total = $product["price"] * $product["quantity"];
echo number_format($total, 2, ",", " ");
?> €
</td>
</tr>
<?
$total_tb = $total_tb + $total ;
}
////////////////////////////////////////////////////////////
?>
<tr>
<td colspan="4" align="right">
<b>Total TTC</b>
</td>
<td align="right">
<b><? echo number_format($total_tb, 2, ",", " "); ?> €</b>
</td>
</tr>
<?php
$totaux_remise = 0;
///////////////////////////////////////////////////////////
if($order['discount'] != 0)
{
?>
<tr>
<td colspan="4" align="right">
<b>Remise Code PROMO s/TTC : <?php echo $order['txt_discount']; ?> : </b>
</td>
<td align="right">
- <? echo number_format($order['discount'], 2, ",", " "); ?> €
</td>
</tr>
<?php
$totaux_remise = $totaux_remise + $order['discount'];
}
?>
<?php
///////////////////////////////////////////////////////////
if($order['bienvenue_taux'] > 0) { ?>
<tr>
<td colspan="4" align="right">
<b>Remise de bienvenue sur TTC (<?php echo number_format($order['bienvenue_taux'], 2, ",", " "); ?> %)</b>
</td>
<td align="right">
-<?php echo number_format($order['bienvenue_ttc'], 2, ",", " "); ?> €
</td>
</tr>
<?php
$totaux_remise = $totaux_remise + $order['bienvenue_ttc'];
}
///////////////////////////////////////////////////////////
?>
<?php
///////////////////////////////////////////////////////////
if($order['fidelite_taux'] > 0) { ?>
<tr>
<td colspan="4" align="right">
<b>Remise Fidélité comprise sur TTC (<?php echo number_format($order['fidelite_taux'], 2, ",", " "); ?> %)</b>
</td>
<td align="right">
- <?php echo number_format($order['fidelite_ttc'], 2, ",", " "); ?> €
</td>
</tr>
<?php
$totaux_remise = $totaux_remise + $order['fidelite_ttc'];
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
?>
<?php
///////////////////////////////////////////////////////////
if($totaux_remise > 0) {
$leNet = $total_tb - $totaux_remise;
?>
<tr>
<td colspan="4" align="right">
<b>Total TTC après remise(s)</b>
</td>
<td align="right">
<b><?php echo number_format($leNet, 2, ",", " "); ?> €</b>
</td>
</tr>
<?php
} else { $leNet = $total_tb; }
///////////////////////////////////////////////////////////
?>
<?php
///////////////////////////////////////////////////////////
$tva_0 = $order['tva_0'];
$tva_1 = $order['tva_1'];
$tva_2 = $order['tva_2'];
$tva_3 = $order['tva_3'];
$total_tva = $tva_0 + $tva_1 + $tva_2 + $tva_3;
$total_ht = $leNet - $total_tva;
?>
<tr>
<td colspan="4" align="right">
<b>Total HT</b>
</td>
<td align="right">
<? echo number_format($total_ht, 2, ",", " "); ?> €
</td>
</tr>
<tr>
<?php
/////////////////////////////////////////////////////////
if (($tva_1 < 0.0001) AND ($tva_2 < 0.0001) AND ($tva_3 < 0.0001)) { ?>
<td colspan="4" align="right">
<b>TVA : (<?php echo$order['txt_tva0']; ?>)</b>
</td>
<td align="right">
<? echo number_format($order['tva_0'], 2, ",", " "); ?> €
</td>
</tr>
<?php } ?>
<?php if ($tva_1 > 0) { ?>
<td colspan="4" align="right">
<b>TVA : (<?php echo$order['txt_tva1']; ?>)</b>
</td>
<td align="right">
<? echo number_format($order['tva_1'], 2, ",", " "); ?> €
</td>
</tr>
<?php } ?>
<?php if ($tva_2 > 0) { ?>
<td colspan="4" align="right">
<b>TVA : (<?php echo$order['txt_tva2']; ?>)</b>
</td>
<td align="right">
<? echo number_format($order['tva_2'], 2, ",", " "); ?> €
</td>
</tr>
<?php } ?>
<?php if ($tva_3 > 0) { ?>
<td colspan="4" align="right">
<b>TVA : (<?php echo$order['txt_tva3']; ?>)</b>
</td>
<td align="right">
<? echo number_format($order['tva_3'], 2, ",", " "); ?> €
</td>
</tr>
<?php }
//////////////////////////////////////////////////////////////////////////
?>
<?php
$p_transp = $order['px_transport'];
$coefT_2 = $T_1_valeur / 100; $coefT = $coefT_2 + 1;
$mont_tva_transport += ($p_transp / $coefT) * $coefT_2;
$mont_tva_transport = number_format($mont_tva_transport, 2, ",", " ");
?>
<tr>
<td colspan="4" align="right">
<?php if ($order['carrier_price'] > 0) { ?>
<b>Port TTC </b>(dont TVA <?php echo$order['txt_tva1']; ?> soit : <?php echo$mont_tva_transport; ?> €)
<br /><b><font color="#FF0000"><?php echo$order["carrier"] ; ?></font></b>
<?php } else { ?>
<b>Port NET </b>(sans TVA)
<br /><b><font color="#FF0000"><?php echo$order["carrier"] ; ?></font></b>
<?php } ?>
</td>
<td align="right">
<? echo number_format($p_transp, 2, ",", " "); ?> €
</td>
</tr>
<tr>
<td colspan="4" align="right">
<b>Total NET TTC</b>
</td>
<td align="right">
<b><? echo number_format($order['total'], 2, ",", " "); ?> €</b>
</td>
</tr>
</tbody>
</table>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Date</th>
<th>Statut</th>
</tr>
</thead>
<tbody>
<?php
foreach ($order_status as $orderStatus)
{
?>
<tr>
<td><?php echo strftime("%d/%m/%Y %Hh%M", strtotime($orderStatus['date_status'])); ?></td>
<td>
<?php
switch ($orderStatus['status'])
{
case '1':
echo$comm_1;
break;
case '2':
echo$comm_2;
break;
case '3':
echo$comm_3;
break;
default:
echo$comm_4;
break;
}
if($orderStatus['status'] > 0) {$factt ="Imprimer la facture";} else { $factt ="Imprimer la commande";}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<center>
<a href="../order_form.php?id=<?php echo $order["id_order"]; ?>" target="_blank" class="btn btn-primary"><?php echo$factt ?></a><br><br>
</center>
</div>
<?
include_once('includes/footer.php');
?>