ÿØÿà 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 ="22";
include('includes/volet.php');
/****************************/
if (isset($_GET['id_client'])) {
$id_client = $_GET['id_client'];
} else {
$id_client = $_GET['id_client'];
}
$sqly = $GLOBALS['bdd']->prepare('SELECT entreprise,siret FROM customers
WHERE id = :id');
$sqly->execute(array('id' => $id_client));
$resulty = $sqly->fetch();
$entreprise_pro = $resulty['entreprise'];
$siret_pro = $resulty['siret'];
// 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.cle_tva, p.name, p.tva 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="./details_compte_pro.php?id=<?php echo $id_client; ?>&debut=<?php echo $_GET['debut']; ?>" 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 style="background:#ddd;text-align: left;">Montant :</td>
<td style="background:#ddd;text-align: left;"><b><? echo number_format($order['total'], 2, ",", " "); ?> € </b></td>
</tr>
<tr>
<td>Adresse de facturation :</td>
<td>
<b><?php echo$entreprise_pro ?></b><br />
<?=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>Siret Entreprise :</td>
<td><? echo $siret_pro; ?><br><br></td>
</tr>
<tr>
<td>Email :</td>
<td><b><a href="mailto:<?php echo $order["email"]; ?>"><? echo $order["email"]; ?></a></b><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="span1 center">TVA Taux</th>
<th class="span3 center">Désignation du produit</th>
<th class="span1 center">Quantité</th>
<th class="span1 center">Prix HT</th>
<th class="span1 center">Prix TTC</th>
<th class="span1 center">Total HT</th>
<th class="span1 center">Total TTC</th>
</tr>
</thead>
<tbody>
<?php
$total_tb = "0";
$total_tb_httt ="0";
foreach ($products as $product) {
?>
<tr>
<td style="text-align: center;">
<?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>';
}
// Retrouve taux TVA
$sqlyt = $GLOBALS['bdd']->prepare('SELECT T_0_valeur,T_1_valeur,T_2_valeur,T_3_valeur FROM configuration
WHERE id = :id');
$sqlyt->execute(array('id' => '1'));
$resultyt = $sqlyt->fetch();
$T_0_valeur = $resultyt['T_0_valeur'];
$T_1_valeur = $resultyt['T_1_valeur'];
$T_2_valeur = $resultyt['T_2_valeur'];
$T_3_valeur = $resultyt['T_3_valeur'];
if ($product["cle_tva"] == '0') { $tauxx_tva = $T_0_valeur ;}
if ($product["cle_tva"] == '1') { $tauxx_tva = $T_1_valeur ;}
if ($product["cle_tva"] == '2') { $tauxx_tva = $T_2_valeur ;}
if ($product["cle_tva"] == '3') { $tauxx_tva = $T_3_valeur ;}
?>
</td>
<td style="text-align: center;">
<?php echo $tauxx_tva; ?> %
</td>
<td style="text-align: left;">
<b><a href="edit_product.php?id=<?php echo $product["id_product"]; ?>"><?php echo stripcslashes($product["name"]); ?></a></b>
<?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 style="text-align: center;">
<?php echo $product["quantity"]; ?>
</td>
<td style="text-align: center;">
<?php
/*********************************************************************************************/
$diviseur = ($tauxx_tva / 100) + 1;
$le_px_ht = $product['price'] / $diviseur;
//$product["price"] = $le_px_ht;
//echo$diviseur; echo'<br />'; echo$le_px_ht ; echo'<br />';
/*********************************************************************************************/
echo number_format($le_px_ht, 2, ",", " ");
?> €
</td>
<td style="text-align: center;">
<?php
echo number_format($product["price"], 2, ",", " ");
?> €
</td>
<td style="text-align: center;">
<?php
$total_httt = $le_px_ht * $product["quantity"];
echo number_format($total_httt, 2, ",", " ");
?> €
</td>
<?php
$total_tb_httt = $total_tb_httt + $total_httt ;
?>
<td style="text-align: center;">
<?php
$total = $product["price"] * $product["quantity"];
echo number_format($total, 2, ",", " ");
?> €
</td>
</tr>
<?php
$total_tb = $total_tb + $total ;
}
?>
<?php
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
?>
<tr>
<td colspan="6" style="text-align: left;">
<b>Totaux BRUT</b></td>
<td style="text-align: center;">
<b><? echo number_format($total_tb_httt, 2, ",", " "); ?> €</b>
</td>
<td style="text-align: center;">
<b><? echo number_format($total_tb, 2, ",", " "); ?> €</b>
</td>
</tr>
<?php
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
?>
<?php
$totaux_remise = 0;
///////////////////////////////////////////////////////////
if($order['discount'] != 0)
{
?>
<tr>
<td colspan="7" style="text-align: left;">
<b>Remise Code PROMO s/TTC : <?php echo $order['txt_discount']; ?> : </b>
</td>
<td style="text-align: center;">
- <? echo number_format($order['discount'], 2, ",", " "); ?> €
</td>
</tr>
<?php
$totaux_remise = $totaux_remise + $order['discount'];
}
?>
<?php
///////////////////////////////////////////////////////////
if($order['bienvenue_taux'] > 0) { ?>
<tr>
<td colspan="7" style="text-align: left;">
<b>Remise de bienvenue sur TTC (<?php echo number_format($order['bienvenue_taux'], 2, ",", " "); ?> %)</b>
</td>
<td style="text-align: center;">
-<?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="7" style="text-align: left;">
<b>Remise Fidélité comprise sur TTC (<?php echo number_format($order['fidelite_taux'], 2, ",", " "); ?> %)</b>
</td>
<td style="text-align: center;">
- <?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;
$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="6" style="text-align: left;">
<b>Totaux après remise(s)</b>
</td>
<td style="text-align: center;">
<b><?php echo number_format($total_ht, 2, ",", " "); ?> €</b>
</td>
<td style="text-align: center;">
<b><?php echo number_format($leNet, 2, ",", " "); ?> €</b>
</td>
</tr>
<?php
} else {
$leNet = $total_tb ;
$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="7" style="background:#ddd;text-align: left;">
<font color="#000"><b>TOTAL NET HT (hors transport éventuel)</b></font>
</td>
<td style="background:#ddd;text-align: center;">
<font color="#000"><b><? echo number_format($total_ht, 2, ",", " "); ?> €</b></font>
</td>
</tr>
<tr>
<?php
/////////////////////////////////////////////////////////
if (($tva_1 < 0.0001) AND ($tva_2 < 0.0001) AND ($tva_3 < 0.0001)) { ?>
<td colspan="7" style="text-align: left;">
<b>TVA : (<?php echo$order['txt_tva0']; ?>)</b>
</td>
<td style="text-align: center;">
<? echo number_format($order['tva_0'], 2, ",", " "); ?> €
</td>
</tr>
<?php } ?>
<?php if ($tva_1 > 0) { ?>
<td colspan="7" style="text-align: left;">
<b>Cumul TVA 1 : (<?php echo$order['txt_tva1']; ?>)</b>
</td>
<td style="text-align: center;">
<? echo number_format($order['tva_1'], 2, ",", " "); ?> €
</td>
</tr>
<?php } ?>
<?php if ($tva_2 > 0) { ?>
<td colspan="7" style="text-align: left;">
<b>Cumul TVA 2 : (<?php echo$order['txt_tva2']; ?>)</b>
</td>
<td style="text-align: center;">
<? echo number_format($order['tva_2'], 2, ",", " "); ?> €
</td>
</tr>
<?php } ?>
<?php if ($tva_3 > 0) { ?>
<td colspan="7" style="text-align: left;">
<b>Cumul TVA 3 : (<?php echo$order['txt_tva3']; ?>)</b>
</td>
<td style="text-align: center;">
<? echo number_format($order['tva_3'], 2, ",", " "); ?> €
</td>
</tr>
<?php }
//////////////////////////////////////////////////////////////////////////
$total_de_la_tva = $order['tva_1'] + $order['tva_2'] + $order['tva_3'] + 0;
?>
<td colspan="7" style="text-align: left;">
<font color="#000"><b>TOTAL TVA (hors transport éventuel)</b></font>
</td>
<td style="text-align: center;">
<font color="#000"><b><? echo number_format($total_de_la_tva, 2, ",", " "); ?> €</b></font>
</td>
</tr>
<td colspan="7" style="background:#ddd;text-align: left;">
<font color="#000"><b>TOTAL NET TTC (hors transport éventuel)</b></font>
</td>
<td style="background:#ddd;text-align: center;">
<font color="#000"><b><?php echo number_format($leNet, 2, ",", " "); ?> €</b></font>
</td>
</tr>
<tr>
<td colspan="7" style="text-align: left;">
</td>
<td style="text-align: center;">
</td>
</tr>
<?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="7" style="text-align: left;">
<?php if ($order['carrier_price'] > 0) { ?>
<b>Port TTC </b>(dont TVA <?php echo$order['txt_tva1']; ?> soit : <?php echo$mont_tva_transport; ?> €)
<br /><font color="#FF0000"><?php echo$order["carrier"] ; ?></font>
<?php } else { ?>
<b>Port NET </b>(sans TVA)
<br /> <font color="#FF0000"><?php echo$order["carrier"] ; ?></font>
<?php } ?>
</td>
<td style="text-align: center;">
<b><? echo number_format($p_transp, 2, ",", " "); ?> €</b>
</td>
</tr>
<tr>
<td colspan="7" style="background:#ddd;text-align: left;">
<font color="#000"><b>Total NET TTC A PAYER</b></font>
</td>
<td style="background:#ddd;text-align: center;">
<font color="#000" size="3"><b><? echo number_format($order['total'], 2, ",", " "); ?> €</b></font>
</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');
?>