|
Server IP : 10.128.40.6 / Your IP : 216.73.217.20 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 (0755) : /home/logmcpe/www/TEST/../TMCPRO/pages/feuillesroute/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// j'ai commenté ce code de sms car je pense on utilise pas les sms dans ces page .
// 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();
function count_week_days($__date_from, $__date_to, $__holidays_between=array(), $__weekend_days=array()) {
$total_days_count = $__date_to > $__date_from ? round(($__date_to - $__date_from)/(24*3600)) : 0;
$full_weeks_count = floor($total_days_count/7);
$weekend_days_count = $full_weeks_count*count($__weekend_days);
$days_left_uncovered = $total_days_count - $full_weeks_count*7;
for($i = 0; $i < $days_left_uncovered; $i++) {
$date_to_check = $i ? strtotime("+{$i} day", $__date_from) : $__date_from;
if(in_array(date('N', $date_to_check), $__weekend_days)) {
$weekend_days_count++;
}
}
$week_days_count = $total_days_count - $weekend_days_count - count($__holidays_between);
return $week_days_count;
}
if(!empty($_POST['date_pointage_deux'])){
echo "<pre>" ;
print_r($_POST) ;
echo "</pre>" ;
if(!empty($_POST['heure_deb_p'])){
dbi_query("INSERT INTO `telepointage` (`id_p`, `agence`, `jour`, `heure`, `telephone`, `matricule`, `action`, `test`, `test2`, `client_id`, `pointage_valider`, `presta_id`) VALUES
(NULL, '', '".dateformaint($_POST['date_pointage_deux'])."', '".$_POST['heure_deb_p']."', '', '".$_POST['matricule']."', 'DEBUT', NULL, NULL, '".$_POST['client_id']."', '0', '')") ;
}
if(!empty($_POST['heure_fin_p'])){
dbi_query("INSERT INTO `telepointage` (`id_p`, `agence`, `jour`, `heure`, `telephone`, `matricule`, `action`, `test`, `test2`, `client_id`, `pointage_valider`, `presta_id`) VALUES
(NULL, '', '".dateformaint($_POST['date_pointage_deux'])."', '".$_POST['heure_fin_p']."', '', '".$_POST['matricule']."', 'FIN', NULL, NULL, '".$_POST['client_id']."', '0', '')") ;
}
header('Location:Pres_jours2.php?msg=Pointage bien ajouté&color=success');
// exit() ;
}
if(!empty($_POST) and !empty($_POST['date_message_pointage']) ){
dbi_query("INSERT INTO `telepointage` (`id_p`, `agence`, `jour`, `heure`, `telephone`, `matricule`, `action`, `test`, `test2`, `client_id`, `pointage_valider`, `presta_id`) VALUES
(NULL, '', '".dateformaint($_POST['date_message_pointage'])."', '".$_POST['heure']."', '', '".$_POST['matricule']."', '".$_POST['action']."', NULL, NULL, '".$_POST['client_id']."', '0', '')") ;
// exit() ;
header('Location:Pres_jours2.php?msg=Pointage bien ajouté&color=success');
}
if(!empty($_POST['heure_debut_modale'] ) AND !empty($_POST['heure_fin_modale'] ) ){
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
dbi_query("UPDATE `telepointage` SET `heure` = '".$_POST['heure_debut_modale']."' WHERE `telepointage`.`id_p` =".$_POST['id_debut']) ;
dbi_query("UPDATE `telepointage` SET `heure` = '".$_POST['heure_fin_modale']."' WHERE `telepointage`.`id_p` =".$_POST['id_fin']) ;
header('Location:Pres_jours2.php?msg=Pointages bien modifié&color=success');
}
// $a= gmdate("01:00:00", s);
//l echo "==> $a <br/>" ;
// exit(l)l ;
$_SESSION["id_etab"]= 111 ;
if(!empty( $_GET["id_etab"]))
{
$_SESSION["id_etab"] = $_GET["id_etab"];
}
if($_SESSION["id_etab"]== 111){
$where_etablissement_id="" ;
}
else{
$where_etablissement_id = " AND c.etablissement_id = ".$_SESSION["id_etab"] ;
}
if(empty($_SESSION['datej'])){$_SESSION['datej'] = date('Ymd');}
// exit() ; // $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'); ?>
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
<script type='text/javascript' src='jquery-3.6.0.min.js'></script> -->
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<ul class="navbar-nav">
<li class="nav-item">
<h3><a href="#myModal_tache_all" id="custId" data-toggle="modal" > <button type="button" class="btn btn-primary" > <i class="fas fa-plus"></i> Nouveau Pointage</button> </a></h3>
</li>
</ul>
</nav>
<!-- BARRE DE NAVIGATION -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- Brand Logo -->
<a href="index3.html" class="brand-link">
<img src="dist/img/logomcpro.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
style="opacity: .8">
<span class="brand-text font-weight-light">MC PRO</span>
</a>
<!-- Sidebar -->
<div class="sidebar">
<!-- Sidebar user panel (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image">
<img src="dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image">
</div>
<div class="info">
<a href="#" class="d-block">Steeven ROBLOT</a>
</div>
</div>
<?php include('menu.php'); ?>
<!-- Sidebar Menu -->
</div>
<!-- /.sidebar -->
</aside>
<!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
<div class="content-wrapper">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Contrôle Quotidien</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="index.php">Accueil</a></li>
<li class="breadcrumb-item"><a href="fourinc.php">Pointages</a></li>
<li class="breadcrumb-item active">Contrôle Quotidien </li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Content Header (Page header) -->
<div class="modal fade" id="myModal_tache_all" 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_tache_all" ></div>
</div>
</div>
</div>
<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 class="row mb-2">
<div class="modal fade" id="myModal_anomalie" 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_anomalie" >
</div>
</div>
</div>
</div>
</div><!-- /.row -->
<div class="row mb-2">
<div class="modal fade" id="myModal_ajout_pointage" 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_ajout_pointage" >
</div>
</div>
</div>
</div>
</div><!-- /.row -->
<!-- /.content-header -->
<section class="content">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<?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
}
?>
<?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></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">Client</th>
<th align="center">Début</th>
<th align="center">Fin</th>
<th align="center">Salarié</th>
<th align="center">Arrivée</th>
<th align="center">Départ</th>
<th align="center"> Écart</th>
<th align="center"> SMS </th>
<th align="center"> Anomalie inverse </th>
<th align="center"> Nouveau Pointage </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;
// echo "===>".$date."<br/>" ;
$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) $where_etablissement_id ORDER BY presta_Hdeb ASC
");
$chaine ="" ;
// echo "
// 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) $where_etablissement_id ORDER BY presta_Hdeb ASC
// <br/>
// " ;
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( $prest['presta_sem'] > 1 ) {
if($m['presta_jour'] !== NULL && $date >= $m['start']) {
$date_presta_sem = $m['start'];
$date_presta_sem = date("Ymd", strtotime('monday this week', strtotime(int2date_autre_format($date_presta_sem))));
}
}
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'] ;
}
$nbre =count_week_days(strtotime(int2date_autre_format($date_presta_sem,'d.m.Y')), strtotime(int2date_autre_format($date,'d.m.Y')));
// 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 ,$id_pDD) = dbi_fetch_row(dbi_query("SELECT heure ,id_p FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT' ")) ;
list($heureF ,$id_pFF) = dbi_fetch_row(dbi_query("SELECT heure ,id_p 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($salarie_id_id_sms)=dbi_fetch_row(dbi_query("SELECT presta_id FROM sms_salarie_avertissement WHERE salarie_id = ".$prest["salarie_id"])) ;
// echo "==>SELECT presta_id FROM sms_salarie_avertissement WHERE presta_id = ".$prest["presta_id"]."<br/>" ;
// if($salarie_id_id_sms!=""){ $classe="btn btn-block btn-default disabled"; ;}
$heureD_format_int =heure2int(substr($heureD, 0, 5)) ;
$heureF_format_int =heure2int(substr($heureF, 0, 5)) ;
?>
<tr>
<td> <?php echo $prest["client_nom"]."( ".$prest["presta_id"].")" ; ?> </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'].'" data-fin="'.$prest["client_id"].'" data-date_prestaion="'.$date.'" data-non_point="'.$non_point.'" >sms</a>';?>
</TD>
<?php }
elseif(($heureD=="" and $heureF!="") OR (($heureD!="" and $heureF=="")) ){
if($heureD=="" )
{
$non_point = "DEBUT" ;
}
if($heureF=="" )
{
$non_point = "FIN" ;
}
?>
<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'].'" data-fin="'.$prest["client_id"].'" data-date_prestaion="'.$date.'" data-non_point="'.$non_point.'" >sms</a>';?>
</TD>
<?php }else{?>
<TD></TD>
<?php }
$value['id_table_1'] = $SAL["salarie_id"] ;
// echo "==>.". $value['id_table_1']."<br/>" ;
$id_table_one=$value['id_table_1'];
$select_table2_data=dbi_query("SELECT COUNT(*) FROM `controle_pointage` WHERE `salarie_id`= ".$SAL["salarie_id"]);
$ary_value=dbi_fetch_row($select_table2_data);
if( ($heureF_format_int < $heureD_format_int) AND ($heureF_format_int > 0 AND $heureD_format_int > 0 ) ){
echo '<td><a class="btn btn-info btn-sm" href="#myModal_anomalie" id="custId" data-toggle="modal" data-debut="'.$id_pDD.'" data-fin="'.$id_pFF.'"> <i class="fas fa-pencil-alt"></i> </a></td>';
}else{
echo "<td> pas d'anomalie </td>";
}
?>
<TD align="center" nowrap>
<?php
// $today = date('Ymd') ;
if(($heureD=="" and $heureF!="") OR (($heureD!="" and $heureF=="")) OR (($heureD=="" and $heureF=="")) ){
echo '<a class="btn btn-info btn-sm" href="#myModal_ajout_pointage" id="custId" data-toggle="modal" data-debut="'.$prest["salarie_id"].'" data-fin="'.$prest["client_id"].'" data-date_pointage="'.$date.'" data-pointage_debb="'.$heureD.'" data-pointage_finn="'.$heureF.'" > Nouveau Pointage </a>';
}
?>
</TD>
</tr>
<?
}else{
$modolo = $nbre % $prest['presta_sem'] ;
// ECHO $modolo.' ------> '.$date_presta_sem.' ****** '.$date.' $$$ '.$nbre.'-----'.$prest['presta_id'].'-----'.$prest['presta_sem'].'----'.$prest['client_id'].'<br/>' ;
if( $modolo == 0) {
$SAL = dbi_fetch_row(dbi_query("SELECT * FROM salarie WHERE salarie_id = ".$prest['salarie_id'] ." " )) ;
list($heureD ,$id_pDD) = dbi_fetch_row(dbi_query("SELECT heure ,id_p FROM `telepointage` WHERE `jour` LIKE '$date' AND `matricule` =".$prest['salarie_id']." AND `client_id` = ".$prest['client_id']." AND `action` LIKE 'DEBUT' ")) ;
list($heureF ,$id_pFF) = dbi_fetch_row(dbi_query("SELECT heure ,id_p 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" ;
$durepresta = diff_time($prestfin , $prestdebut);
$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" ;
}
++$i;
echo $chaine ;
$classe="btn btn-info btn-sm";
list($salarie_id_id_sms)=dbi_fetch_row(dbi_query("SELECT presta_id FROM sms_salarie_avertissement WHERE salarie_id = ".$prest["salarie_id"])) ;
$heureD_format_int =heure2int(substr($heureD, 0, 5)) ;
$heureF_format_int =heure2int(substr($heureF, 0, 5)) ;
?>
<tr>
<td> <?php echo $prest["client_nom"]."( ".$prest["presta_id"].")" ; ?> </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'].'" data-fin="'.$prest["client_id"].'" data-date_prestaion="'.$date.'" data-non_point="'.$non_point.'" >sms</a>';?>
</TD>
<?php }
elseif(($heureD=="" and $heureF!="") OR (($heureD!="" and $heureF=="")) ){
if($heureD=="" )
{
$non_point = "DEBUT" ;
}
if($heureF=="" )
{
$non_point = "FIN" ;
}
?>
<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'].'" data-fin="'.$prest["client_id"].'" data-date_prestaion="'.$date.'" data-non_point="'.$non_point.'" >sms</a>';?>
</TD>
<?php }else{?>
<TD></TD>
<?php }
$value['id_table_1'] = $SAL["salarie_id"] ;
// echo "==>.". $value['id_table_1']."<br/>" ;
$id_table_one=$value['id_table_1'];
$select_table2_data=dbi_query("SELECT COUNT(*) FROM `controle_pointage` WHERE `salarie_id`= ".$SAL["salarie_id"]);
$ary_value=dbi_fetch_row($select_table2_data);
if( ($heureF_format_int < $heureD_format_int) AND ($heureF_format_int > 0 AND $heureD_format_int > 0 ) ){
echo '<td><a class="btn btn-info btn-sm" href="#myModal_anomalie" id="custId" data-toggle="modal" data-debut="'.$id_pDD.'" data-fin="'.$id_pFF.'"> <i class="fas fa-pencil-alt"></i> </a></td>';
}else{
echo "<td> pas d'anomalie </td>";
}
?>
<TD align="center" nowrap>
<?php
// $today = date('Ymd') ;
if(($heureD=="" and $heureF!="") OR (($heureD!="" and $heureF=="")) OR (($heureD=="" and $heureF=="")) ){
echo '<a class="btn btn-info btn-sm" href="#myModal_ajout_pointage" id="custId" data-toggle="modal" data-debut="'.$prest["salarie_id"].'" data-fin="'.$prest["client_id"].'" data-date_pointage="'.$date.'" data-pointage_debb="'.$heureD.'" data-pointage_finn="'.$heureF.'" > Nouveau Pointage </a>';
}
?>
</TD>
</tr>
<?
// echo "dddd <br/>" ;
}
}
}
}
// }
}
// 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>
function insertdata(inid, element){
$.ajax({
url:"without_reloading.php",
type:"GET",
data:{
"inid":inid
},
success:function(data){
element.removeAttr('onclick');
}
});
}
function change(elements){
elements.style.backgroundColor="brown";
elements.style.color="white";
}
</script>
<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');
var rowid_client_id = $(e.relatedTarget).data('fin');
var rowid_date = $(e.relatedTarget).data('date_prestaion');
var no_point = $(e.relatedTarget).data('non_point');
$.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+'&rowid_client_id='+ rowid_client_id+'&rowid_date='+ rowid_date+'&no_point='+ no_point, //Pass $id
success : function(data){
$('#fetch').html(data);//Show fetched data from database
}
});
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#myModal_anomalie').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).data('debut');
var indice = $(e.relatedTarget).data('fin');
// var data = 'param1='+param1+'¶m2='+param2;
$.ajax({
type : 'post',
url : 'inverser_pointage.php', //Here you will fetch records
data : 'id_debut='+rowid+'&id_fin='+indice, //Pass $id
success : function(data){
$('#fetch_anomalie').html(data);//Show fetched data from database
}
});
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#myModal_tache_all').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).data('id');
$.ajax({
type : 'post',
url : 'nouveau_pointage_ajax', //Here you will fetch records
data : 'rowid='+ rowid, //Pass $id
success : function(data){
$('#fetch_tache_all').html(data);//Show fetched data from database
}
});
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#myModal_ajout_pointage').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).data('debut');
var indice = $(e.relatedTarget).data('fin');
var date_p = $(e.relatedTarget).data('date_pointage');
var p_debb = $(e.relatedTarget).data('pointage_debb');
var p_finn = $(e.relatedTarget).data('pointage_finn');
// var data = 'param1='+param1+'¶m2='+param2;
$.ajax({
type : 'post',
url : 'nouveau_pointage_ajax_Hdebut_Hfin.php', //Here you will fetch records
data : 'salarie_id='+rowid+'&client_id='+indice+'&date_pointage='+date_p+'&pointage_debt='+p_debb+'&pointage_fint='+p_finn , //Pass $id
success : function(data){
$('#fetch_ajout_pointage').html(data);//Show fetched data from database
}
});
});
});
</script>
</body>
</html>
