File "trace02.php"
Full Path: /home/analogde/www/MassageProd/trace02.php
File size: 45.12 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start ();
include('database.php');
include('fonctions.php');
include('generation_timing.php');
error_reporting(0);
DB_connexion();
//$_SESSION['table_gestion'] = "gestion_v3_test";
//$_SESSION['table_reservation']= "reservation2023_v3_test";
// echo '<p id="demo"></p>';
$array_horaire_court = generation_timing($_SESSION['debut_horaire_courte'], $_SESSION['temps_sceance_courte'], $_SESSION['temps_sanitaire']);
$array_horaire_long = generation_timing($_SESSION['debut_horaire_longue'], $_SESSION['temps_sceance_longue'], $_SESSION['temps_sanitaire']);
header( 'content-type: text/html; charset=utf-8' );
//header('Content-Type: text/html; charset=iso-8859-1');
$_SESSION['mode_debug'] = "yes";
if( $_SESSION['mode_debug'] == "yes" )
{
$debug = true;
echo " -----> Mode debug " ."<br>";
echo "----> " .$_SESSION['table_gestion'];
//echo "<pre>";
//print_r($_SESSION);
//echo "</pre>";
}
else
{
$debug = false;
}
if (!isset($_SESSION['nom']) && !isset($_SESSION['password']))
{
header("Location: login.php");
}
$mois = $_GET['mois'];
$utilisateur = $_SESSION['nom']; // .' ' .$_SESSION['prenom'];
$table = $_SESSION['table_gestion'];
if(isset($_GET['submit']))
{
$indice = $_GET['indice'];
$mois = $_GET['mois'];
//echo $_SERVER['QUERY_STRING'];
//echo htmlspecialchars($_SERVER['QUERY_STRING']);
//echo htmlentities($_SERVER['QUERY_STRING']);
//echo utf8_encode($_SERVER['QUERY_STRING']);
//echo mb_detect_encoding($_SERVER['QUERY_STRING']);
$url = urldecode($_SERVER['QUERY_STRING']);
$champs = explode('&',$url);
if($debug)
{
//echo $url;
echo "<pre>";
print_r($champs);
echo "</pre>";
echo "<br>";
}
for( $i=1; $i < count($champs)-2 ; $i++)
{
if($utilisateur == "admin")
{
// format
//DELPY+Patrice*05-01-2023*26-12-2022_11:09:32*4-5=Non encaissé
$tab = explode('*', $champs[$i]);
$client = str_replace('+', ' ', $tab[0]);
$jour = $tab[1];
$inscription = str_replace('_', ' ', $tab[2]);
if($debug)
{
echo " ---> " .$client ."<br>";
echo " ---> " .$jour ."<br>";
echo " ---> " .$inscription ."<br>";
echo " ---> " .$tab[3] ."<br>";
}
$tab02 = explode('=', $tab[3]);
//if( $tab02[1] == "Payé" || $tab02[1] == "Non encaissé")
//{
if($debug)
{
print_r($tab02);
echo " ---> " .$tab02[0] ."<br>";
}
$position = strpos($tab02[0], "-");
if ($position == true)
{
$tab_double = explode('-', $tab02[0]);
$seance1 = $tab_double[0];
$seance2 = $tab_double[1];
pppenregistre($client, $jour, $inscription , $seance1 , $tab02[1] );
pppenregistre($client, $jour, $inscription , $seance2 , $tab02[1] );
if($debug)
{
echo "Double ---> " .$seance1 ." + " .$seance2 ."<br>";
echo "Data enregistrées";
echo '<br><br>';
}
}
else
{
$seance_unique = $tab02[0];
pppenregistre($client, $jour, $inscription , $seance_unique , $tab02[1] );
if($debug)
{
echo " Unique ---> " .$seance_unique ."<br>";
echo "Data enregistrées";
echo '<br><br>';
}
}
//}
/*else
{
echo " Pas pris en compte car " .$tab02[1] ."<br>";
}*/
}
}
// https://www.oujood.com/how/systeme-paiement-PayPal.php
// https://contrib.spip.net/Transaction-creer-des-formulaires-avec-paiement-en
// MeyClub : solution de billetterie CSE
// https://www.paiementpro.net/api-java-script
// planificateur de rendez-vous
// https://phpsources.net/code/php/date-heure/1094_fractionner-un-creneau-horaire-entre-l-heure-de-debut-et-l-heure-de-fin
}
?>
<?php
function pppenregistre($client, $jour, $inscription , $seance , $statut)
{
$connexion = DB();
$table = $_SESSION['table_gestion'];
echo '<br>';
$sql = "UPDATE " .$table ." SET statut = '$statut' WHERE jour = '$jour' AND date_inscription = '$inscription' AND client = '$client' AND seance = '$seance' ";
//echo $sql;
//echo '<br>';
mysqli_query($connexion, "SET NAMES 'utf8'");
$result = mysqli_query($connexion, $sql );
if(!$result)
{
die('Impossible d\'exécuter la requête :' . mysql_error());
}
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Espace réservation</title>
<style>
.button {
background-color: #1c87c9;
border: none;
color: white;
padding: 10px 12px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 20px;
margin: 4px 2px;
cursor: pointer;
}
.button_disabled {
background-color: #1c87c9;
border: none;
color: white;
padding: 10px 12px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 20px;
margin: 4px 2px;
cursor: pointer;
}
.checkout-button {
width: 130px;
height: 35px;
background: #333;
border: none;
vertical-align: top;
margin-left: 35px;
cursor: pointer;
color: #fff;
}
.checkout-button:disabled {
background: #999;
color: #555;
cursor: not-allowed;
}
.disabled {
background-color: #1c87c9;
border: none;
color: white;
padding: 10px 12px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 20px;
margin: 4px 2px;
pointer-events: none;
.isDisabled {
color: currentColor;
cursor: not-allowed;
opacity: 0.5;
text-decoration: none;
}
<!-- pointer-events: none;
cursor: default;
text-decoration: none;
color: #000000; -->
}
<!--
.button {
background-color: #1c87c9;
border: none;
color: white;
padding: 20px 34px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 20px;
margin: 4px 2px;
cursor: pointer;
}
-->
</style>
<script>
// ne fait rien
function none()
{
}
function info(text, ctr)
{
//alert(ctr);
const myArray = text.split("*");
//document.getElementById("demo").innerHTML = text;
let val = ctr;
let client = myArray[0];
let jour = myArray[1];
let inscription = myArray[2];
let horaire = myArray[3];
let tarif = myArray[4];
/*
let mess = 'Info ' +' ' +val +' ' +client +' ' +jour +' ' +inscription +' ' +horaire +' ' +tarif );
*/
//alert('Info = '+val +' '+ client +' '+ jour +' '+ inscription +' '+ horaire +' '+ tarif);
//alert('Info = '+name +' '+ctr);
var xhr = getXhr();
xhr.onreadystatechange = function()
{
// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
if(xhr.readyState == 4 && xhr.status == 200)
{
//retour = xhr.responseText;
//alert(retour);
//event.preventDefault(); pour firefox ???
// https://jsfiddle.net/duzwo5bk/7/
window.open("https://www.cseonsemi.fr/com/page/-2?prest_id=68");
location.reload();
}
}
xhr.open("POST","ajax_update_statut.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
var the_data = 'val='+val+ '&client='+client+ '&jour='+jour+ '&inscription='+inscription + '&horaire='+horaire + '&tarif='+tarif ;
xhr.send(the_data);
}
function getXhr()
{
var xhr = null;
if(window.XMLHttpRequest) // Firefox et autres
xhr = new XMLHttpRequest();
else if(window.ActiveXObject)
{ // Internet Explorer
try
{
xhr = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else
{
// XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
xhr = false;
}
return xhr;
}
</script>
</head>
<link rel="stylesheet" href="menu_style.css" type="text/css">
<div id='cssmenu'>
<ul>
<li><a href='home.php'><span>Home</span></a></li>
<li><a href='selection_planning_mois.php'><span>Planning</span></a></li>
<li class='active'><a href='selection_gestion_mois.php'><span>Gestion</span></a></li>
<li><a href='selection_statistique_mois.php'><span>Statistiques</span></a></li>
<?php
if($_SESSION['nom'] == "admin")
{
echo '<li><a href="deplacer_un_rendezvous_admin.php"><span>Déplacer</span></a></li>';
echo '<li><a href="configuration.php"><span>Configuration</span></a></li>';
}
else
{
echo '<li><a href="deplacer_un_rendezvous_user.php"><span>Déplacer</span></a></li>';
}
?>
<li><a href='change_password.php'><span>Changer password</span></a></li>
<li><a href='logout.php'><span>Déconnexion</span></a></li>
<li><a href='#'><span><?php echo $_SESSION['nom'] .' ' .$_SESSION['prenom'] .' connecté' ?></span></a></li>
<li><a href='#'><span><?php echo $_SESSION['year']; ?></span></a></li>
</ul>
</div>
<br>
<br>
<br>
<body>
<style>
td {
padding: 8px;
height: 20px;
vertical-align: middle;
}
.titre {
margin-left:50px;
margin-top:50px;
font-size: 26px;
}
//#matable th:hover{
// background-color:red;
}
</style>
<?php
/*$tmp_table = $_SESSION['table_reservation'] = "reservation" .$_SESSION['year'] ."_v3";
echo $tmp_table;
if(!(mysql_query("SELECT * FROM $tmp_table")))
{
$str = " La database " .$_SESSION['year'] ." n'existe pas encors !";
die($str);
} */
/*
$sql = "SELECT * FROM " .$table;
$result = mysqli_query($connexion, $sql );
if($result == null)
{
$table_nom = substr( $table, 0, -3 );
$str = " La table " .$table_nom ." n'exite pas configurée!.";
echo "<p><font size='5'>";
die($str);
echo "</p>";
echo "<br>";
}
*/
$table = $_SESSION['table_reservation']; /// = "reservation" .$_SESSION['year'] ."_v3";
// echo $table;
if(!(mysqli_query($connexion, "SELECT * FROM $table")))
{
//$str = 'Arnold a dit : "I\'ll be back"';
echo "<div class ='titre' id ='titre'>";
$str = " La database " .$_SESSION['year'] ." n'existe pas encore !";
die($str);
echo "</div>";
}
$annee = $_SESSION['year'];
$actif = "actif";
//$sql = "SELECT * FROM gestion WHERE annee ='$annee' AND mois = '$mois' and mode = '$actif' ";
///// $sql = "SELECT * FROM gestion WHERE annee ='$annee' AND mois = '$mois' and mode = '$actif' order by client ASC ";
//$sql = "SELECT * FROM gestion_v6 WHERE annee ='$annee' AND mois = '$mois' and mode = '$actif' order by client ASC ";
$sql = "SELECT * FROM " .$_SESSION['table_gestion'] ." WHERE annee ='$annee' AND mois = '$mois' and mode = '$actif' order by client ASC ";
// $sql = "SELECT * FROM " .$_SESSION['table_gestion'] ." WHERE annee = " .$annee ." AND mois = " .$mois ." and mode = " .$actif ." order by client ASC ";
// echo $sql;
// echo "<br><br>";
//$sql = "SELECT * FROM " .$table ." annee ='$annee' AND mois = '$mois' and mode = '$actif' order by jour ASC ";
//SELECT * FROM ta_table ORDER BY champ ASC //ORDER BY moyenne ASC
//echo $sql;
mysqli_query($connexion, "SET NAMES 'utf8'");
$result = mysqli_query($connexion, $sql );
$nbre_enregistrements = mysqli_num_rows($result);
//echo $nbre_enregistrements;
if($nbre_enregistrements != 0)
{
echo ucfirst($mois) ." " .$annee;
echo '<br><br>';
if(!$result)
{ die('Impossible d\'exécuter la requête :' . mysql_error());
}
//$tarif_CE = 5.0;
//$tarif_plein = 12.67;
$i = 1;
$tab_retour_courte = statistiques($annee,$mois,"courte");
$tab_compteur_courte = $tab_retour_courte[0];
$tab_client_courte = $tab_retour_courte[1];
//echo '<pre>';
//print_r($tab_retour_courte);
//echo '</pre>';
//echo '<pre>';
//print_r($tab_compteur);
//echo '<pre>';
//print_r($tab_retour);
//echo '<pre>';
//print_r($tab_client); E6BA39 f1f3f5 d5d5d5 bgcolor="#1ddfff"
$tab_retour_longue = statistiques($annee,$mois,"longue");
$tab_compteur_longue = $tab_retour_longue[0];
$tab_client_longue = $tab_retour_longue[1];
$arrayClient = getClientByMonth($annee,$mois,"courte",$debug);
$arrayObjReservation = creation($annee, $mois, $array_horaire_court, $arrayClient, $debug );
?>
<!-- -->
<form action="#" name ="form_gestion" method="get">
<input type="hidden" name="mois" id="mois" value="<?php echo $mois; ?>">
<div id="list">
<table id="matable" align="left" border="0" cellpadding="5" cellspacing="1" width="100%">
<tbody>
<tr bgcolor="#f1f3f5">
<th class="center" width="1%">Id</th>
<th align="center" width="10%">Utilisateur</th>
<th align="center" width="6%">Jour</th>
<th align="center" width="4%">Inscription</th>
<th align="center" width="4%">Formule</th>
<th align="center" width="4%">Seance</th>
<!--<th align="center" width="8%">Compteur</th>-->
<th align="center" width="4%">Montant</th>
<th align="center" width="1%">Réglement</th>
<th align="center" width="2%">Etat</th>
<th align="center" width="2%">Payer par CB</th>
<th align="center" width="2%">Redirection CSE</th>
<!--
<th align="center" width="6%">Chéque</th>
<th align="center" width="6%">Banque</th>
-->
</tr>
<?php
$cpt = 1;
for ($i=0; $i < count($arrayObjReservation) ; $i++)
{
$jour = $arrayObjReservation[$i][0];
$inscription = $arrayObjReservation[$i][1];
$client = $arrayObjReservation[$i][2];
$type_seance = $arrayObjReservation[$i][3];
$seance = $arrayObjReservation[$i][4];
$horaire = $arrayObjReservation[$i][5];
$statut = $arrayObjReservation[$i][8];
$connexion_cse = $arrayObjReservation[$i][9];
$tarif = $arrayObjReservation[$i][10];
if($debug)
{
echo "Champs :" ."<br>";
echo $client ."<br>";
echo $jour ."<br>";
echo $inscription ."<br>";
echo $type_seance ."<br>";
echo $horaire ."<br>";
echo $seance ."<br>";
echo $tarif ."<br>";
echo $statut ."<br>";
echo $connexion_cse ."<br>";
echo "*************************************" ."<br>";
}
$client_format = str_replace(' ', '+', $client);
$inscription_format = str_replace(' ', '_', $inscription);
$tag = $client_format ."*" .$jour ."*" .$inscription_format ."*" .$seance;
if($utilisateur == "admin")
{
if ($i%2 == 1)
{
$propriete = "impair";
$prop = "#02E9FA";
}
else
{
$propriete = "impair";
$prop = "#0CC2F5";
}
echo '<tr>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$cpt .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$client .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$jour .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$inscription .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$type_seance .'</th>';
$id = $datas['id'];
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$horaire .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$tarif . '€' .'</th>';
$select_objet = 'select' .$id;
echo '<th align="center"' .'bgcolor=' .$prop .'>';
//echo '<select name=' .$select_objet .'>';
echo '<select name=' .$tag .'>';
//echo '<select disabled>';
//$_SESSION['nom'] .' ' .$_SESSION['prenom']
// https://www.geeksforgeeks.org/html-select-disabled-attribute/
//if($datas['statut'] == "Payé")
if( $statut == "Payé")
{
echo ' <option value="Payé" selected>Payé</option>
<option value="Non encaissé">Non encaissé</option></th>';
//echo ' </select><img src="yes.png" alt="Smiley face"></td></td> ';
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="yes.png" alt="Icone"></th>';
}
//if($datas['statut'] == "Non encaissé")
if( $statut == "Non encaissé")
{
echo ' <option value="Non encaissé" selected>Non encaissé</option>
<option value="Payé" >Payé</option></th>';
//echo ' </select><img src="no.png" alt="Smiley face"></td></td> ';
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="no.png" alt="Icone"></th>';
}
?>
<th align="center" bgcolor="<?php echo $prop; ?>">
<!--<button onclick="window.location.href='https://w3docs.com';"> -->
<!-- <input type="button" onclick="window.location.href='https://www.w3docs.com';" value="w3docs" />-->
<!--
OKKKKK
<a href="gatewayCB.php" class="button"><img src="euro.png" width="32" height="32" title= "Réglement CB"></a>
-->
<!--
<a href="gatewayCB.php?client=lulu" class="button"><img src="euro.png" width="32" height="32" title= "Réglement CB"></a>
-->
<?php
$double = explode('-', $horaire);
//echo "<a href=\"gatewayCB.php?client=$client&jour=$jour&horaire=$horaire&tarif=$tarif\" class=\"button\" \"> <img src=\"euro.png\" width=\"32\" height=\"32\" title= \"Réglement CB\"> </a>";
$element = $client ."*" .$jour ."*" .$inscription ."*" .$seance ."*" .$tarif;
//echo('<button type="button" id="button'.$ctr.'" onClick="info(\''.str_replace("'", "\\'", $maps_name).'\', \''.str_replace("'", "\\'", $ctr).'\');"><img src="euro.png"></button><br/>');
//echo('<button type="button" id="button'.$val.'" onClick="info(\''.str_replace("'", "\\'", $element).'\', \''.str_replace("'", "\\'", $val).'\');"><img src="euro.png"></button><br/>');
//echo('<button type="button" id="button'.$val.'" onClick="none();"><img src="euro.png"></button><br/>');
?>
<!-- -->
<a href="javascript:void(0)" ><img src="euro.png" width="32" height="32" title= "Non accessible"></a>
<!-- -->
<?php
// pour le debug, l'admin peut faire une redirection ....
//$element = $client ."*" .$jour ."*" .$inscription ."*" .$seance ."*" .$tarif;
//echo('<button type="button" title="Go" id="button'.$val.'" onClick="info(\''.str_replace("'", "\\'", $element).'\', \''.str_replace("'", "\\'", $val).'\');"><img src="euro.png"></button><br/>');
?>
<!--
<a href="gatewayCB.php?client="<?php $client ?>"&jour="<?php $jour ?>" class="button"><img src="euro.png" width="32" height="32" title= "Réglement CB"></a>
-->
<?php
//echo "<a href=\"gatewayCB.php/?client=$client&jour=$jour\"></a>";
?>
<!-- <input type="text" name="<?php echo "toto"; ?>" value="plouf"> -->
</th>
<?php
if($connexion_cse == "no")
{
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="pouce_no.png" id="myImage" width="32" height="32" ></th>';
}
else
{
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="pouce_yes.png" id="myImage" width="32" height="32" ></th>';
}
echo '</tr>';
$cpt++;
} // administrateur
else
{ // ghcgthcg
// Zy8kdP55
if ($i%2 == 1)
{
$propriete = "impair";
$prop = "#02E9FA";
}
else
{
$propriete = "impair";
$prop = "#0CC2F5";
}
$user = $_SESSION['nom'] .' ' .$_SESSION['prenom'] ;
/*if($client == $user)
{
$val = $cpt;
}
else
{
$val = $cpt;
}*/
echo '<tr>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$cpt .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$client .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$jour .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$inscription .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$formule .'</th>';
$id = $datas['id']; // ???
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$horaire .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$tarif . '€' .'</th>';
$select_objet = 'select' .$id;
echo '<th align="center"' .'bgcolor=' .$prop .'>';
//echo '<select name=' .$select_objet .'>';
/*echo '<tr>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$i .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$datas['client'] .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$datas['jour'] .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$datas['date_inscription'] .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$datas['formule'] .'</th>';
$id = $datas['id'];
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$val .'</th>';
echo '<th align="center"' .'bgcolor=' .$prop .'>' .$montant . '€' .'</th>';
$select_objet = 'select' .$id;
echo '<th align="center"' .'bgcolor=' .$prop .'>';*/
//echo '<select name=' .$select_objet .'>';
//$client
if( $client == $user )
{
//echo '<select name=' .$tag .'>';
echo '<select name=' .$tag .' disabled title="Non disponible">';
}
else
{
//echo '<select disabled>';
//echo '<select name=' .$tag .' disabled title="Reservé à l\'administrateur">';
echo '<select name=' .$tag .' disabled title="Non disponible">';
}
//if($datas['statut'] == "Payé")
if( $statut == "Payé")
{
echo ' <option value="Payé" selected>Payé</option>
<option value="Non encaissé">Non encaissé</option></th>';
//echo ' </select><img src="yes.png" alt="Smiley face"></td></td> ';
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="yes.png" alt="Icone"></th>';
}
//if($datas['statut'] == "Non encaissé")
if( $statut == "Non encaissé")
{
echo ' <option value="Non encaissé" selected>Non encaissé</option>
<option value="Payé" >Payé</option></th>';
//echo ' </select><img src="no.png" alt="Smiley face"></td></td> ';
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="no.png" alt="Icone"></th>';
}
//echo '<td><img src="yes.png" alt="Smiley face"></td>';
?>
<th align="center" bgcolor="<?php echo $prop; ?>">
<!--<button onclick="window.location.href='https://w3docs.com';"> -->
<!-- <input type="button" onclick="window.location.href='https://www.w3docs.com';" value="w3docs" />-->
<?php
if( $client == $user )
{
$element = $client ."*" .$jour ."*" .$inscription ."*" .$seance ."*" .$tarif;
echo('<button type="button" title="Go" id="button'.$val.'" onClick="info(\''.str_replace("'", "\\'", $element).'\', \''.str_replace("'", "\\'", $val).'\');"><img src="euro.png"></button><br/>');
?>
<!--
<a href="https://www.w3docs.com/" class="button"><img src="atm-card.png" width="32" height="32" title= "Réglement CB"></a>
-->
</th>
<?php }
else
{
?>
<!--
<a href="https://www.w3docs.com/" class="disabled"><img src="atm-card.png" width="32" height="32" title= "Réglement CB"></a>
-->
<!--
<a href="#" class="button"><img src="atm-card.png" width="32" height="32" title= "Réglement CB"></a>
-->
<!--
<a href="javascript:void(0)" class="button_disabled"><img src="atm-card.png" width="32" height="32" title= "Non disponible"></a>
-->
<?php
// echo('<button type="button" class="disabled title = "Non disponible" id="button'.$val.'" onClick="none();"><img src="euro.png"></button><br/>');
echo '<img src="euro.png" title ="Non accessible">';
?>
</th>
<?php
}
?>
<?php
if($connexion_cse == "no")
{
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="pouce_no.png" id="myImage" width="32" height="32" ></th>';
}
else
{
echo '<th align="center"' .'bgcolor=' .$prop .'>';
echo '<img src="pouce_yes.png" id="myImage" width="32" height="32" ></th>';
}
echo '</tr>';
$cpt++;
}
} // for
$indice = $i - 1;
?>
<tr bgcolor="#f1f3f5">
<td colspan="16" class="center"> </td>
</tr>
<?php
if($utilisateur == "admin")
{
echo '<tr bgcolor="#f1f3f5">
<td colspan="16" class="center"><input type="submit" name="submit" value="Enregistrer" /></td>
</tr>';
}
?>
<!--
<tr bgcolor="#f1f3f5">
<td colspan="16" class="center"><input type="submit" name="submit" value="Enregistrer" /></td>
</tr>
-->
</tbody>
</table>
</div>
<input type="hidden" name="indice" id="indice" value="<?php echo $indice; ?>">
<br>
<br>
<br>
</form>
<!-- -->
<?php
}
else
{
echo "Aucunes entrées en " .ucfirst($mois) ;
}
//echo '<br><br><br>';
//echo '<a href="selection_gestion_mois.php">Retour ... </a>';
?>
<?php
class Personne
{
private $jour;
private $inscription;
private $client;
private $formule;
private $seance;
private $type;
private $horaire;
//private $simple_debut;
//private $double_debut;
//private $double_fin;
private $tarif;
private $nom;
private $statut;
private $connexion_cse;
// default
private $simple_premiere = 0;
private $simple_autre = 0;
private $double_premiere = 0;
private $double_autre = 0;
public function __construct($client)
{
$this->client = $client;
}
/**/
public function setJour($val)
{
$this->jour = $val;
}
public function getJour()
{
return $this->jour;
}
/**/
public function setInscription($val)
{
$this->inscription = $val;
}
public function getInscription()
{
return $this->inscription;
}
/**/
public function setClient($val)
{
$this->client = $val;
}
public function getClient()
{
return $this->client;
}
/**/
public function setFormule($val)
{
$this->formule = $val;
}
public function getFormule()
{
return $this->formule;
}
/**/
public function setSeance($val)
{
$this->seance = $val;
}
public function getSeance()
{
return $this->seance;
}
/**/
/**/
public function setType($val)
{
$this->type = $val;
}
public function getType()
{
return $this->type;
}
/**/
public function setHoraire($val)
{
$this->horaire = $val;
}
public function getHoraire()
{
return $this->horaire;
}
/**/
/*public function setSimpleDebut($val)
{
$this->simple_debut = $val;
}
public function getSimpleDebut()
{
return $this->simple_debut;
}*/
/**/
/*public function setDoubleDebut($val)
{
$this->double_debut = $val;
}
public function getDoubleDebut()
{
return $this->double_debut;
}*/
/**/
/*public function setDoubleFin($val)
{
$this->double_fin = $val;
}
public function getDoubleFin()
{
return $this->double_fin;
}*/
/**/
public function setTarif($val)
{
$this->tarif = $val;
}
public function getTarif()
{
return $this->tarif;
}
/**/
public function setNom($val)
{
$this->nom = $val;
}
public function getNom()
{
return $this->nom;
}
/****/
public function setSimplePremiere($val)
{
$this->simple_premiere = $val;
}
public function getSimplePremiere()
{
return $this->simple_premiere;
}
/****/
public function setSimpleAutre($val)
{
$this->simple_autre = $val;
}
public function getSimpleAutre()
{
return $this->simple_autre;
}
/****/
public function incrementSimpleAutre()
{
$simple_autre++;
}
/****/
public function setDoublePremiere($val)
{
$this->double_premiere = $val;
}
public function getDoublePremiere()
{
return $this->double_premiere;
}
/*****/
public function setDoubleAutre($val)
{
$this->double_autre = $val;
}
public function getDoubleAutre()
{
return $this->double_autre;
}
/*****/
public function incrementDoubleAutre()
{
$double_autre++;
}
/****/
public function SetStatut($val)
{
$this->statut = $val;
}
/*****/
public function getStatut()
{
return $this->statut;
}
/****/
/****/
public function SetConnexionCse($val)
{
$this->connexion_cse = $val;
}
/*****/
public function getConnexionCse()
{
return $this->connexion_cse;
}
/****/
}
class tarification
{
// default
private $simple_premiere = 0;
private $simple_autre = 0;
private $double_premiere = 0;
private $double_autre = 0;
/*public function __construct($client)
{
$this->client = $client;
}*/
/****/
public function setSimplePremiere($val)
{
$this->simple_premiere = $val;
}
public function getSimplePremiere()
{
return $this->simple_premiere;
}
/****/
public function setSimpleAutre($val)
{
$this->simple_autre = $val;
}
public function getSimpleAutre()
{
return $this->simple_autre;
}
/****/
public function setDoublePremiere($val)
{
$this->double_premiere = $val;
}
public function getDoublePremiere()
{
return $this->double_premiere;
}
/*****/
public function setDoubleAutre($val)
{
$this->double_autre = $val;
}
public function getDoubleAutre()
{
return $this->double_autre;
}
}
?>
<?php
function getClientByMonth($annee,$mois,$formule, $debug)
{
$connexion = DB();
$table = $_SESSION['table_reservation'];
$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and mode = 'actif' and formule = '$formule' and mois = '$mois' ";
if($debug)
{
echo $sql;
echo "<br>";
echo "<br>";
}
mysqli_query($connexion, "SET NAMES 'utf8'");
$query = mysqli_query($connexion, $sql );
if(!$query)
{ die('Impossible d\'exécuter la requête :' . mysql_error());
}
$nbre_enregistrements = mysqli_num_rows($query);
$cpt = 0;
$record = array();
while ($datas = mysqli_fetch_assoc ($query))
{
$tab_client_record = array();
$annee = $datas['annee'];
$mois = $datas['mois'];
$rendezvous = $datas['rendezvous'];
$jour = $datas['jour'];
$seance1 = $datas['seance1'];
$seance2 = $datas['seance2'];
$seance3 = $datas['seance3'];
$seance4 = $datas['seance4'];
$seance5 = $datas['seance5'];
$seance6 = $datas['seance6'];
$seance7 = $datas['seance7'];
$seance8 = $datas['seance8'];
if(strlen($seance1) != 0 && $seance1 != "unselect")
{
$tab_client_record [] = $seance1;
}
if(strlen($seance2) != 0 && $seance2 != "unselect")
{
$tab_client_record [] = $seance2;
}
if(strlen($seance3) != 0 && $seance3 != "unselect")
{
$tab_client_record [] = $seance3;
}
if(strlen($seance4) != 0 && $seance4 != "unselect")
{
$tab_client_record [] = $seance4;
}
if(strlen($seance5) != 0 && $seance5 != "unselect")
{
$tab_client_record [] = $seance5;
}
if(strlen($seance6) != 0&& $seance6 != "unselect")
{
$tab_client_record [] = $seance6;
}
if(strlen($seance7) != 0 && $seance7 != "unselect")
{
$tab_client_record [] = $seance7;
}
if(strlen($seance8) != 0 && $seance8 != "unselect")
{
$tab_client_record [] = $seance8;
}
$record[$cpt] = $tab_client_record ;
$cpt++;
}
if($debug)
{
echo "Extraction des dates ouvertes sur le mois";
echo "<BR>";
echo "Nb de jours ouverts : " .$nbre_enregistrements;
echo "<br>";
echo "<pre>";
print_r($record);
echo "<BR>";
echo "<pre>";
echo "<BR>";
}
/*for( $i=0; $i < count($record) ; $i++)
{
$all_client_day = array();
$all_client_day = $record[$i];
for( $j=0; $j < count($all_client_day) ; $j++)
{
$all_client_month[] = $all_client_day[$j];
}
}*/
for( $i=0; $i < count($record) ; $i++)
{
$all_client_day = array();
$all_client_day = $record[$i];
for( $j=0; $j < count($record[$i]) ; $j++)
{
$all_client_month[] = $record[$i][$j];
}
}
if($debug)
{
echo "Concatenation des clients";
echo "<BR>";
echo "<pre>";
print_r($all_client_month);
echo "<BR>";
echo "<pre>";
echo "<BR>";
}
$all_client_month_clean = array();
for( $i=0; $i < count($all_client_month) ; $i++)
{
if (strcmp($all_client_month[$i], "creneau fermer") !== 0)
{
$all_client_month_clean[] = $all_client_month[$i];
}
}
if($debug)
{
echo "Nettoyage creneau fermer";
echo "<BR>";
echo "<pre>";
print_r($all_client_month_clean);
echo "<BR>";
echo "<pre>";
echo "<BR>";
}
/* supprimer les doublons */
$tmp_no_doublons = array();
for( $i=0; $i < count($all_client_month_clean) ; $i++)
{
if( !in_array($all_client_month_clean[$i], $tmp_no_doublons) )
{
$tmp_no_doublons[] = $all_client_month_clean[$i];
}
}
//$all_client_month_no_doublons = array_unique($all_client_month_clean);
$all_client_month_no_doublons = $tmp_no_doublons;
if($debug)
{
echo "Supprime les doublons";
echo "<BR>";
echo "<pre>";
print_r($all_client_month_no_doublons);
echo "<BR>";
echo "<pre>";
echo "<BR>";
}
return $all_client_month_no_doublons;
}
?>
<?php
function creation($annee, $mois , $array_horaire_court , $arrayClient, $debug)
{
$connexion = DB();
$table = $_SESSION['table_reservation'];
$formule = "courte";
$actif = "actif";
$arrayObjReservation = array();
if($debug)
{
echo "/////////////////////////////////////////////////////////////////////" ."<br>";
echo "<=== SCAN DE TOUTES LES RESERVATIONS ====>" ."<br>";
echo "/////////////////////////////////////////////////////////////////////" ."<br>";
}
$arrayBuild = array();
for( $i=0; $i < count($arrayClient) ; $i++)
{
if($debug)
{
echo "----> " .$arrayClient[$i] ."<br>";
}
//$sql = "SELECT * FROM gestion_v5 WHERE annee ='$annee' AND mois = '$mois' and formule = '$formule' and mode = '$actif' and client ='$arrayClient[$i]' order by seance ASC ";
$sql = "SELECT * FROM " .$_SESSION['table_gestion'] ." WHERE annee ='$annee' AND mois = '$mois' and formule = '$formule' and mode = '$actif' and client ='$arrayClient[$i]' order by seance ASC ";
if($debug)
{
echo $sql ."<br>";
}
mysqli_query($connexion, "SET NAMES 'utf8'");
$result = mysqli_query($connexion, $sql );
$nbre_enregistrements = mysqli_num_rows($result);
if($debug)
{
//echo "----> " .$nbre_enregistrements;
//echo "<br><br>";
}
$arrayDataClient = array();
$arrayTsSceance = array();
while ($datas = mysqli_fetch_assoc ($result))
{
$tmp = array();
$jour = $datas['jour'];
$date_inscription = $datas['date_inscription'];
$client = $datas['client'];
$formule = $datas['formule'];
$seance = $datas['seance'];
$statut = $datas['statut'];
$connexion_cse = $datas['connexion'];
$tmp[] = $jour;
$tmp[] = $date_inscription;
$tmp[] = $client;
$tmp[] = $formule;
$tmp[] = $seance;
$timestamp = strtotime($jour);
switch ($datas['seance'])
{
case "1":
$horaire = $array_horaire_court[0];
break;
case "2":
$horaire = $array_horaire_court[1];
break;
case "3":
$horaire = $array_horaire_court[2];
break;
case "4":
$horaire = $array_horaire_court[3];
break;
case "5":
$horaire = $array_horaire_court[4];
break;
case "6":
$horaire = $array_horaire_court[5];
break;
case "7":
$horaire = $array_horaire_court[6];
break;
case "8":
$horaire = $array_horaire_court[7];
break;
}
$hour = substr($horaire, 0, 2);;
$min = substr($horaire, -2);
$ts_hour = $hour * 3600 ;
$ts_min = $min * 60;
$ts_sceance = $timestamp + $ts_hour + $ts_min;
if($debug)
{
//echo "Jour : " .$jour ." seance : " .$horaire .' ' .$seance ."<br>";
//echo "Split horaire : " .$hour ." " .$min ."<br>";
//echo " **** " .$ts_hour . " " .$ts_min ."<br>";
//echo date('d/m/Y H:i:s', $ts_sceance) ."<br>";
//echo "-------------------------"."<br>";
}
$tmp[] = $hour;
$tmp[] = $min;
$tmp[] = $ts_sceance;
$tmp[] = $statut;
$tmp[] = $connexion_cse;
$tmp[] = 0;
$arrayDataClient[] = $tmp;
$arrayTsSceance[] = $ts_sceance;
}
if($debug)
{
//echo "DATA Client " ."<br>";
//print_r($arrayDataClient);
//echo "Classement " ."<br>";
}
sort($arrayTsSceance);
if($debug)
{
for( $j=0; $j < count($arrayTsSceance) ; $j++)
{
//echo date('d/m/Y H:i:s', $arrayTsSceance[$j]) ." " .$arrayTsSceance[$j] ."<br>";
}
}
$arrayOrderDataClient = array();
for( $j=0; $j < count($arrayTsSceance) ; $j++)
{
for( $k=0; $k < count($arrayDataClient) ; $k++)
{
if( $arrayTsSceance[$j] == $arrayDataClient[$k][7] )
{
$arrayOrderDataClient[] = $arrayDataClient[$k];
}
}
}
if($debug)
{
//echo "blabla " ."<br>";
//print_r($arrayOrderDataClient);
}
// re-affectation
unset($arrayDataClient);
$arrayDataClient = $arrayOrderDataClient;
if($debug)
{
echo "Timestamp sorted " ."<br>";
echo "<pre>";
print_r($arrayDataClient);
echo "</pre>";
echo "<br>";
echo "Listing des timestamp";
echo "<br>";
print_r($arrayTsSceance);
echo "<br>";
}
$ecart_seance = 25 * 60; // 1500
//$store = new Tarification();
$simple_premiere = 0;
$simple_autre = 0;
$double_premiere = 0;
$double_autre = 0;
$tarif = 0;
if( count($arrayDataClient) == 1 )
{
$provi = array();
$provi[] = $arrayDataClient[0][0]; // 10-01-2023
$provi[] = $arrayDataClient[0][1]; // 06-01-2023 11:33:29
$provi[] = $arrayDataClient[0][2]; // VOORWINDEN Cor
$provi[] = "x1";
$provi[] = $arrayDataClient[0][4]; // scrance
$provi[] = $arrayDataClient[0][5] .":" .$arrayDataClient[0][6]; // horaire
$provi[] = $arrayDataClient[0][7]; // timestamp
$provi[] = date('d/m/Y H:i', $arrayDataClient[0][7]);
$provi[] = $arrayDataClient[0][8]; // payé
$provi[] = $arrayDataClient[0][9]; // redirection cse
$provi[] = "8"; // tarif
$arrayBuild[] = $provi;
if($debug)
{
echo " ---------------------------------------------" ."<br>";
echo " Unique seance " ."<br>";
echo "<pre>";
print_r($arrayBuild);
echo "</pre>";
echo "<br>";
echo " ---------------------------------------------" ."<br>";
}
}
else
{
$detection = "";
$tag = "";
for ($j = 0; $j <= count($arrayDataClient)-1; $j++)
{
if($debug)
{
echo " RUN !" .$j ."<br>";
}
if( $j < count($arrayDataClient)-1)
{
if($debug)
{
echo "Compare " .$arrayDataClient[$j][7] ." & " .$arrayDataClient[$j+1][7] ."<br>";
}
// consécutif ?
$diffTS = $arrayDataClient[$j+1][7] - $arrayDataClient[$j][7];
if( $diffTS == $ecart_seance ) // $valeur[$i] == $valeur[$i+1]
{
$tag = "double";
$detection = $arrayDataClient[$j][7];
if($debug)
{
echo " ----------------> Double " .$arrayDataClient[$j][7] ." & " .$arrayDataClient[$j+1][7];
echo "<br>";
}
if( $double_premiere == 0 )
{
$double_premiere++;
if( $simple_premiere == 0 )
{
$tarif = "24";
}
else
{
$tarif = "32";
}
}
else
{
$double_autre++;
$tarif = "32";
}
$provi = array();
$provi[] = $arrayDataClient[$j][0]; // jour de la seance
$provi[] = $arrayDataClient[$j][1]; // date et heure d'inscription
$provi[] = $arrayDataClient[$j][2]; // client
$provi[] = "x2";
$provi[] = $arrayDataClient[$j][4] ."-" .$arrayDataClient[$j+1][4]; // seance
$provi[] = $arrayDataClient[$j][5] .":" .$arrayDataClient[$j][6] ." & " .$arrayDataClient[$j+1][5] .":" .$arrayDataClient[$j+1][6]; // horaire
$provi[] = $arrayDataClient[$j][7] ."-" .$arrayDataClient[$j+1][7]; // timestamp
$provi[] = date('d/m/Y H:i', $arrayDataClient[$j][7]) ." & " .date('d/m/Y H:i', $arrayDataClient[$j+1][7]);
$provi[] = $arrayDataClient[$j][8]; // payé
$provi[] = $arrayDataClient[$j][9]; // redirection cse
$provi[] = $tarif; // tarif
$arrayBuild[] = $provi;
}
// simple seance
else
{
if($debug)
{
echo "TRACE " .$arrayDataClient[$j][7] ." - " .$detection ."<br>";
}
if( $arrayDataClient[$j][7] != $detection && $tag != "double")
{
$tag = "simple";
if($debug)
{
echo " ----------------> Simple " .$arrayDataClient[$j][7];
echo "<br>";
}
if( $simple_premiere == 0 )
{
$simple_premiere++;
if( $double_premiere == 0 )
{
$tarif = "8";
}
else
{
$tarif = "16";
}
}
else
{
$simple_autre++;
$tarif = "16";
}
$provi = array();
$provi[] = $arrayDataClient[$j][0]; // jour de la seance
$provi[] = $arrayDataClient[$j][1]; // // date et heure d'inscription
$provi[] = $arrayDataClient[$j][2]; // client
$provi[] = "x1";
$provi[] = $arrayDataClient[$j][4]; // scrance
$provi[] = $arrayDataClient[$j][5] .":" .$arrayDataClient[$j][6]; // horaire
$provi[] = $arrayDataClient[$j][7]; // timestamp
$provi[] = date('d/m/Y H:i', $arrayDataClient[$j][7]);
$provi[] = $arrayDataClient[$j][8]; // payé
$provi[] = $arrayDataClient[$j][9]; // redirection cse
$provi[] = $tarif; // tarif
$arrayBuild[] = $provi;
}
$detection = "";
$tag = "";
}
}
// traitement du dernier element
if( $j == count($arrayDataClient)-1)
{
if($debug)
{
echo "Valeur tag " .$tag ."<br>";
}
if( $tag != "double")
{
if($debug)
{
echo " ----------------> Simple last " .$arrayDataClient[$j][7];
echo "<br>";
}
if( $simple_premiere == 0 )
{
$simple_premiere++;
if( $double_premiere == 0 )
{
$tarif = "8";
}
else
{
$tarif = "16";
}
}
else
{
$simple_autre++;
$tarif = "16";
}
$provi = array();
$provi[] = $arrayDataClient[$j][0]; // jour de la seance
$provi[] = $arrayDataClient[$j][1]; // // date et heure d'inscription
$provi[] = $arrayDataClient[$j][2]; // client
$provi[] = "x1";
$provi[] = $arrayDataClient[$j][4]; // scrance
$provi[] = $arrayDataClient[$j][5] .":" .$arrayDataClient[$j][6]; // horaire
$provi[] = $arrayDataClient[$j][7]; // timestamp
$provi[] = date('d/m/Y H:i', $arrayDataClient[$j][7]);
$provi[] = $arrayDataClient[$j][8]; // payé
$provi[] = $arrayDataClient[$j][9]; // redirection cse
$provi[] = $tarif; // tarif
$arrayBuild[] = $provi;
}
else
{
if($debug)
{
echo " ----------------> None ";
echo "<br>";
}
}
}
}
//echo "---------------------------------------------------------------------" ."<br>";
$detection = "";
$tag = "";
//if($debug)
//{
// echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" ."<br>";
//}
}
}
if($debug)
{
echo " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" ."<br>";
echo "<pre>";
print_r($arrayBuild);
echo "</pre>" ."<br>";
echo " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" ."<br>";
}
return $arrayBuild;
}
?>
</body>
</html>