144 lines
6.9 KiB
PHP
144 lines
6.9 KiB
PHP
<?php
|
|
require_once('php/inc_start_time.php');
|
|
|
|
$strLangue = 'fr';
|
|
$strPage = 'check_qte_produits.php';
|
|
|
|
require_once('php/inc_functions.php');
|
|
require_once('php/inc_fx_messages.php');
|
|
|
|
global $db;
|
|
|
|
include('inc_header.php');
|
|
?>
|
|
<div class="container-fluid" id="main">
|
|
<div class="row">
|
|
<div class="col-md-9 col-lg-10 order-first order-md-last">
|
|
<?php
|
|
if (!empty($_GET['eve_id'])) {
|
|
$intEvenement = intval($_GET['eve_id']);
|
|
} else {
|
|
$intEvenement = 0;
|
|
}
|
|
|
|
$sqlEvenements = "SELECT eve_id, eve_nom_fr FROM inscriptions_evenements WHERE DATE_SUB(CURDATE(),INTERVAL 3 MONTH) <= eve_date_fin ORDER BY eve_nom_fr";
|
|
$recEvenements = $db->fxGetResults($sqlEvenements);
|
|
|
|
/*$sqlProduits = "
|
|
SELECT p.pro_id, p.pro_nom_fr, p.pro_qte AS dispo,
|
|
(SELECT COUNT(ppn_id) FROM resultats_produits_new WHERE pro_id = p.pro_id) AS vendus,
|
|
(SELECT COUNT(p.ppn_id) FROM inscriptions_panier_produits_new p, inscriptions_panier_acheteurs a WHERE a.no_panier = p.no_panier AND a.sta_id = 1 AND p.pro_id = p.pro_id) AS panier
|
|
FROM inscriptions_produits_new p
|
|
WHERE p.eve_id = " . intval($intEvenement) . "
|
|
ORDER BY p.pro_nom_fr
|
|
";*/
|
|
$sqlProduits = "
|
|
SELECT p1.pro_id, p1.pro_nom_fr, p1.pro_qte AS dispo,
|
|
(SELECT COUNT(p2.pro_id) FROM resultats_produits_new p2, resultats_epreuves_commandees c WHERE c.pec_id_original = p2.pec_id AND c.is_cancelled = 0 AND p2.pro_id = p1.pro_id) AS vendus,
|
|
(SELECT COUNT(p3.ppn_id) FROM inscriptions_panier_produits_new p3, inscriptions_panier_acheteurs a WHERE a.no_panier = p3.no_panier AND a.sta_id = 1 AND p3.pro_id = p1.pro_id) AS panier
|
|
FROM inscriptions_produits_new p1
|
|
WHERE p1.eve_id = " . intval($intEvenement) . "
|
|
ORDER BY p1.pro_nom_fr
|
|
";#
|
|
$recProduits = $db->fxGetResults($sqlProduits);
|
|
?>
|
|
<h1>Vérification de l'inventaire des produits</h1>
|
|
<div class="card m-3" id="recherche">
|
|
<div class="card-header">
|
|
<h4>Rechercher des produits</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<form action="check_qte_produits.php?<?php echo $strQuery; ?>" class="form-horizontal" method="get" id="frm_search" name="frm_search">
|
|
<div class="form-group row">
|
|
<label class="control-label col-sm-3" for="eve_id">Événement :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select id="eve_id" name="eve_id" class="form-control rounded-0">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['eve_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>Tous les événements</option>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($recEvenements); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo fxUnescape($recEvenements[$intCtr]['eve_id']); ?>"<?php if (isset($_GET['btn_search']) && isset($_GET['eve_id']) && $_GET['eve_id'] === $recEvenements[$intCtr]['eve_id']) { ?> selected="selected"<?php } ?>><?php echo fxUnescape($recEvenements[$intCtr]['eve_nom_fr']); ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-sm-9 col-lg-7 offset-sm-3">
|
|
<button class="btn btn-primary rounded-0" type="submit" id="btn_search" name="btn_search"><i class="fa fa-search" aria-hidden="true"></i> Rechercher</button>
|
|
<?php
|
|
if (isset($_GET['btn_search'])) {
|
|
?>
|
|
<a class="btn btn-danger rounded-0" href="check_qte_produits.php"><i class="fa fa-times" aria-hidden="true"></i> <?php if ($strLangue == 'fr') { ?>Effacer rechercher<?php } else { ?>Remove search<?php } ?></a>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<?php
|
|
if (count($recProduits) > 0) {
|
|
?>
|
|
<thead>
|
|
<tr>
|
|
<th style="text-align: center;">#</th>
|
|
<th style="text-align: left;">pro_id</th>
|
|
<th style="text-align: left;">Produit</th>
|
|
<th style="text-align: right;">Total</th>
|
|
<th style="text-align: right;">Vendus</th>
|
|
<th style="text-align: right;">Panier (incomplet)</th>
|
|
<th style="text-align: right;">Restant</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($recProduits); $intCtr++) {
|
|
?>
|
|
<tr <?php if ($intCtr % 2) { ?>class="ligne_paire"<?php } ?>>
|
|
<td style="text-align: center;"><?php echo $intCtr; ?></td>
|
|
<td style="text-align: left;"><?php echo intval($recProduits[$intCtr]['pro_id']); ?></td>
|
|
<td style="text-align: left;"><?php echo fxUnescape($recProduits[$intCtr]['pro_nom_fr']); ?></td>
|
|
<td style="text-align: right;"><?php echo intval($recProduits[$intCtr]['dispo']); ?></td>
|
|
<td style="text-align: right;"><?php echo intval($recProduits[$intCtr]['vendus']); ?></td>
|
|
<td style="text-align: right;"><?php echo intval($recProduits[$intCtr]['panier']); ?></td>
|
|
<td style="text-align: right;"><?php echo abs(intval($recProduits[$intCtr]['dispo']) - (intval($recProduits[$intCtr]['vendus']) + intval($recProduits[$intCtr]['panier']))); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<tr>
|
|
<td style="text-align: center;">
|
|
<p> </p>
|
|
<strong>
|
|
<?php
|
|
if (intval($intEvenement) == 0) {
|
|
?>Veuillez choisir un évenement.<?php
|
|
} else {
|
|
?>Il n'y a aucun produit pour cet évenement.<?php
|
|
}
|
|
?>
|
|
</strong>
|
|
<p> </p>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</div>
|
|
<p> </p>
|
|
<p> </p>
|
|
</div>
|
|
<?php require_once('inc_droite.php'); ?>
|
|
</div>
|
|
</div>
|
|
<?php require_once('inc_footer.php');
|