|
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
require __DIR__ . '/vendor_sms_recu/autoload.php';
include 'includes_sms_recu/ovhhh.php';
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
session_start();
// $a= gmdate("01:00:00", s);
//l echo "==> $a <br/>" ;
// exit() ;
if(empty($_SESSION['datej'])){$_SESSION['datej'] = date('Ymd');}
// $date_jour = date('Ymd');
// echo int2date($date_jour );
if(isset($_POST['date_jour']))
{
$_SESSION['datej'] = dateformaint($_POST['date_jour']);
}
$date_jour = $_SESSION['datej'] ;
// echo "<pre>" ;
// print_r($_SESSION) ;
// echo "</pre>" ;
// echo "========> ".$date_jour."<br/>" ;
// Start the session
function diff_time($t1 , $t2){
//Heures au format (hh:mm:ss) la plus grande puis le plus petite
$tab=explode(":", $t1);
$tab2=explode(":", $t2);
$h=$tab[0];
$m=$tab[1];
$s=$tab[2];
$h2=$tab2[0];
$m2=$tab2[1];
$s2=$tab2[2];
if ($h2>$h) {
$h=$h+24;
}
if ($m2>$m) {
$m=$m+60;
$h2++;
}
if ($s2>$s) {
$s=$s+60;
$m2++;
}
$ht=$h-$h2;
$mt=$m-$m2;
$st=$s-$s2;
if (strlen($ht)==1) {
$ht="0".$ht;
}
if (strlen($mt)==1) {
$mt="0".$mt;
}
if (strlen($st)==1) {
$st="0".$st;
}
return $ht.":".$mt.":".$st;
}
// $uuu = diff_time('06:04:00' , '06:00:00') ;
// echo "$uuu<br/>" ;
// exit() ;
// mise a jour de la table télépoinatage ( ajout de id client pour chaqur pointage)
$qo =dbi_query("SELECT * FROM `telepointage` WHERE jour >= 20210801 AND (`client_id` IS NULL OR client_id = 0 )") ;
while($j= dbi_fetch_row($qo))
{
$telephone= $j['telephone'] ;
list($client_id) = dbi_fetch_row(dbi_query("SELECT client_id FROM `client` WHERE `tele1` LIKE '$telephone' or `tele2` LIKE '$telephone' or `tele3` LIKE '$telephone' or `tele4` LIKE '$telephone' or `tele5` LIKE '$telephone' ")) ;
// echo "$telephone ==> $client_id <br/>" ;
dbi_query("UPDATE `telepointage` SET `client_id` = '$client_id' WHERE `id_p` = ".$j['id_p'] );
}
// echo $date_jour ;
?>
<html>
<head>
<?php include('header.php'); ?>
</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>
<!-- BARRE DE NAVIGATION -->
<?php include('menu.php'); ?>
<!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="modal fade" id="myModal" role="dialog" class="modal fade task-modal-single in" tabindex="-1" aria-labelledby="myLargeModalLabel" >
<div class="modal-dialog modal-lg">
<div class="modal-content data">
<div id="fetch" >
</div>
</div>
</div>
</div>
</div><!-- /.row -->
</div>
</div>
<!-- /.content-header -->
<section class="content">
<div class="row">
<div class="col-12">
<div class="card card-primary card-outline">
<div class="card-header">
<div class="row">
<div class="col-sm-11">
<h3 class="card-title"> <i class="nav-icon fas fa-clock"></i> Télépointage Prestation </h3>
</div>
</div>
</div>
<div class="card-body">
<?php
// if(!empty($_POST))
// {
// echo "<pre>" ;
// print_r($_POST) ;
// echo "<pre>" ;
// }
if(!empty($_POST))
{
$an= $_POST['ans'] ;
$mois = $_POST['mois'] ;
// $ismai = $_POST['ans']."".$_POST['mois'] ;
$ismai = $an."".$mois ;
$salarie_id=$_POST['salarie_id'] ;
// $qa = dbi_query(" SELECT * FROM `telepointage` where matricule = $salarie_id and `jour` LIKE '$ismai%' ORDER BY `telepointage`.`jour` DESC ,heure DESC ") ;
}
// echo "ppp=> $an <br/>" ;
// $a = dbi_query("SELEC * FROM `etablissement` $where1")
function dateDifference($date1, $date2)
{
$first = DateTime::createFromFormat('m/d/Y', $date1);
$second = DateTime::createFromFormat('m/d/Y', $date2);
if($date1 > $date2) return week_between_two_dates($date2, $date1);
return floor($first->diff($second)->days/7);
}
?>
<form id="bureau_mois" name="mois_form" method="POST" action="">
<div class="form-row">
<div class="form-group col-md-4">
<div class="input-group">
<label>Selectionner Date Télépointage du Prestation</label>
</div>
</div>
<div class="form-group col-md-3">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text"><i class="far fa-calendar-alt"></i></span></div>
<input type="date" class="form-control" id="date_jour" name="date_jour" value='<?php echo int2date_autre_format($date_jour); ?>' placeholder="jj/mm/aaaa"/>
</div>
</div>
<div class="form-group col-md-2">
<div class="input-group">
<button type="submit" name="Afficher" class="btn btn-primary">Afficher </button>
</div>
</div>
</div>
</form>
<div class="onglet_dotted">
<div style="width:100%; float:left; vertical-align:top" class="header_ray">
<div id="tab">
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<TR>
<th align="center">NOM DU CLIENT</th>
<th align="center">HEURE DE DEBUT </th>
<th align="center"> HEURE DE FIN </th>
<th align="center">SALARIE </th>
<th align="center">Pointage début</th>
<th align="center">Pointage fin </th>
<th align="center"> Écart</th>
<th align="center"> SMS </th>
</TR>
</thead>
<tbody>
<?php
// $date_jour = "20200716" ;
// $ab = dbi_query(" SELECT * FROM telepointage WHERE jour LIKE $date_jour ") ;
// while($c=dbi_fetch_row($ab))
// {
// if($i<10)
// $date_jour= $ismai."0".$i ;
// else
// $date_jour= $ismai."".$i ;
// $chaine ='' ;
// $sqlah = " SELECT * FROM telepointage WHERE jour LIKE '".$date_jour."' and matricule = '".$c['matricule']."' ";
// $ah = dbi_query($sqlah) ;
// $salarie_id = $c['matricule'];
$date = $date_jour;
$i = 1;
$q = dbi_query("
SELECT * FROM PRESTATIONS p,client c where c.client_id=p.client_id AND client_statut = '1' AND client_acces_pointage ='2' AND presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL) ORDER BY presta_Hdeb ASC
");
$chaine ="" ;
while($prest = dbi_fetch_row($q))
{
$date_presta_sem = $prest['presta_date_debut'] ;
$q1 = dbi_query("SELECT * FROM PRESTATIONS_MODIF WHERE presta_id = ".$prest['presta_id']." order by start, modif_id ") ;
while (($m = dbi_fetch_row($q1)) && $date >= $m['start'])
{
if( $m['presta_sem'] != NULL ) $date_presta_sem = $m['start'];
$prest['salarie_id'] = $m['salarie_id'] === NULL ? $prest['salarie_id'] : $m['salarie_id'] ;
$prest['presta_sem'] = $m['presta_sem'] === NULL ? $prest['presta_sem'] : $m['presta_sem'] ;
$prest['presta_jour'] = $m['presta_jour'] === NULL ? $prest['presta_jour'] : $m['presta_jour'] ;
$prest['presta_Hdeb'] = $m['presta_Hdeb'] === NULL ? $prest['presta_Hdeb'] : $m['presta_Hdeb'] ;
$prest['presta_Hduree'] = $m['presta_Hduree'] === NULL ? $prest['presta_Hduree'] : $m['presta_Hduree'] ;
$prest['chantier_id'] = $m['chantier_id'] === NULL ? $prest['chantier_id'] : $m['chantier_id'] ;
$prest['presta_forfait'] = $m['presta_forfait'] === NULL ? $prest['presta_forfait'] : $m['presta_forfait'] ;
}
// if( $prest['salarie_id'] == $salarie_id ) {
$day = date("w", strtotime( int2date_autre_format($date)));
// if( $day == $prest['presta_jour']){
if( $day == $prest['presta_jour'] OR ( $date == $prest['presta_date_debut'] && $prest['presta_date_debut'] == $prest['presta_date_fin'] ) ){
$EXP = dbi_fetch_row(dbi_query("SELECT date_presta FROM EXCEPTIONS WHERE presta_id = ".$prest['presta_id']." AND date_presta = ".$date." " )) ; ;
if($EXP ){} else {
if( $prest['presta_sem'] == 1 )
{
$SAL = dbi_fetch_row(dbi_query("SELECT * FROM salarie WHERE salarie_id = ".$prest['salarie_id'] ." " )) ;
// $Clt = dbi_fetch_row(dbi_query("SELECT * FROM client WHERE client_id = ".$prest['client_id'] ." " )) ;
// $chaine = " $i".' -La prestation Débute avec <strong>'.$prest["client_nom"]."</strong> de <strong>".int2heure($prest['presta_Hdeb'])."</strong> à <strong>".int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']))."</strong> ** ".$SAL["salarie_nom"]." ** <br/>";
// echo "==> ".$prest['salarie_id']." ==> ".$prest['client_id']."<br/>" ;
list($heureD) = dbi_fetch_row(dbi_query("SELECT heure FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT' ")) ;
list($heureF) = dbi_fetch_row(dbi_query("SELECT heure FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'FIN' ")) ;
$durepointage = diff_time($heureF , $heureD)."<br/>";
$prestfin = int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree'])).":00" ;
$prestdebut= int2heure($prest['presta_Hdeb']).":00" ;
// echo "$prestfin <==> $prestdebut <br/>" ;
$durepresta = diff_time($prestfin , $prestdebut);
// echo "===> $heureD === $heureF <br/>" ;
$a=0 ;
if($heureD != "" AND $heureF != "" )
{
$dpoint= mktime($durepointage);
$dpre= mktime($durepresta);
// if($dpre > $dpoint)
// {
// $ecart = diff_time($durepresta , $durepointage) ;
// $a= 1 ;
// }
// else
// {
// $ecart = diff_time($durepointage,$durepresta) ;
// $a=2 ;
// }
if($durepresta >= $durepointage)
{
// echo "ooo <br/>" ;
$ecart = diff_time($durepresta , $durepointage) ;
$a= 1 ;
}
else
{
// echo "mmm <br/>" ;
$ecart = diff_time($durepointage,$durepresta) ;
$a=2 ;
}
}
else
{
$ecart ="NULL" ;
}
// echo ""
// echo diff_time($int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree'])), int2heure($prest['presta_Hdeb']))."<br/>";
++$i;
echo $chaine ;
$classe="btn btn-info btn-sm";
list($presta_id_sms)=dbi_fetch_row(dbi_query("SELECT presta_id FROM sms_salarie_avertissement WHERE presta_id = ".$prest["presta_id"])) ;
if($presta_id_sms!=""){ $classe="btn btn-block btn-default disabled"; ;}
?>
<tr>
<td> <?php echo $prest["client_nom"] ; ?> </td>
<td> <?php echo int2heure($prest['presta_Hdeb']) ; ?> </td>
<td> <?php echo int2heure(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree'])); ?> </td>
<td> <?php echo $SAL["salarie_nom"]." ".$SAL["salarie_prenom"] ; ?> </td>
<td> <?php echo $heureD ; ?> </td>
<td> <?php echo $heureF ; ?> </td>
<?php if($a==0){?><td> <?php echo $ecart ; ?> </td><?php }?>
<?php if($a==1){?><td style="color:red;"> <?php echo "<strong>".$ecart."</strong>" ; ?> </td><?php }?>
<?php if($a==2){?><td style="color:green;"> <?php echo "<strong>".$ecart."</strong>" ; ?> </td><?php }?>
<?php if($heureD=="" and $heureF=="" ){$prest['salarie_id']
?>
<TD align="center" nowrap>
<?php echo '<a class="'.$classe.'" href="#myModal" id="custId" data-toggle="modal" data-id="'.$prest['salarie_id'].'" data-type="1" data-presta_id="'.$prest['presta_id'].'" >sms</a>';?>
</TD>
<?php }
elseif(($heureD=="" and $heureF!="") OR (($heureD!="" and $heureF=="")) ){
?>
<TD align="center" nowrap>
<?php echo '<a class="'.$classe.'" href="#myModal" id="custId" data-toggle="modal" data-id="'.$prest['salarie_id'].'" data-type="2" data-presta_id="'.$prest['presta_id'].'" >sms</a>';?>
</TD>
<?php }else{?>
<TD></TD>
<?php }?>
</tr>
<?
}
}
}
// }
}
// echo $client_nom." --- ".$tel['heure']." --- ".$tel['action'];
// }
?>
</tbody>
</table><!-- /.table -->
</div><!-- /.box-body -->
</div><!-- /.tab -->
</div><!-- /.header_ray -->
</div><!-- /.onglet_dotted -->
</div><!-- /.card-body -->
</div><!-- /.card card-primary card-outline -->
</div> <!-- /.col-12 -->
</div> <!-- /.row -->
</section> <!-- /.section -->
</div>
<?php include('footerr.php'); ?>
<script type="text/javascript">
// $(document).ready(function(){
// $('#myModal').on('show.bs.modal', function (e) {
// var rowid = $(e.relatedTarget).data('id');
// $.ajax({
// type : 'post',
// url : 'ajaxAjoutMat.php', //Here you will fetch records
// data : 'rowid='+ rowid, //Pass $id
// success : function(data){
// $('#fetch').html(data);//Show fetched data from database
// }
// });
// });
// });
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#myModal').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).data('id');
var rowid_type = $(e.relatedTarget).data('type');
var rowid_presta_id = $(e.relatedTarget).data('presta_id');
$.ajax({
type : 'post',
url : 'envioi_SMS_sal.php', //Here you will fetch records
data : 'rowid='+ rowid +'&rowid_type='+ rowid_type +'&rowid_presta_id='+ rowid_presta_id, //Pass $id
success : function(data){
$('#fetch').html(data);//Show fetched data from database
}
});
});
});
</script>
</body>
</html>
