|
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_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
$salarie_id=$_SESSION['MCPRO_sal']['user_id'] ;
// $salarie_id= 2543 ;
if(!empty($_GET['client_id']))
{
echo "<pre>" ;
print_r($_GET) ;
echo "</pre>" ;
exit() ;
}
function convertToHoursMins($time, $format = '%02d:%02d') {
if ($time < 1) {
return;
}
$hours = floor($time / 60);
$minutes = ($time % 60);
return sprintf($format, $hours, $minutes);
}
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;
}
function type_pre_GET ($value =12)
{
$tab = array(10 => 'Viste medicale', 11 => 'Entretien', 12 => 'Autre ');
return $tab[$value] ;
}
// $R=dbi_query("SELECT client_id id, concat(client_nom, ' ', client_pnom) civ, client_prospect, IF(client_genre='SERENA',1,0) as serena, IF(client_genre='FORMATION',1,0) as formation FROM ".TABLE_CLIENT." where agence_id=$agence ".( $_SESSION['client_actif']=='off' ? "" : "AND client_actif='0'")." ");
// $R=dbi_query("SELECT client_id id, concat(client_nom, ' ', client_pnom) civ, client_prospect, IF(client_genre='SERENA',1,0) as serena, IF(client_genre='FORMATION',1,0) as formation FROM ".TABLE_CLIENT." where agence_id=$agence ".( $_SESSION['client_actif']=='off' ? "" : "AND client_actif='0'")." ");
// exit() ;
function daysfr ($value = 0)
{
$tab = array(0 => 'Dimanche', 1 => 'Lundi', 2 => 'Mardi', 3 => 'Mercredi', 4 => 'Jeudi', 5 => 'Vendredi', 6 => 'Samedi');
return $tab[$value];
}
if($_POST['rowid']>0)
{
$id_relance_programee =$_POST['rowid'] ;
}
function daysfr_new ($value = 0)
{
$tab = array('Sun' => 'Dimanche', 'Mon' => 'Lundi', 'Tue' => 'Mardi', 'Wed' => 'Mercredi', 'Thu' => 'Jeudi', 'Fri' => 'Vendredi', 'Sat' => 'Samedi');
return $tab[$value];
}
// $days = daysfr('Mon') ;
// echo $days."<br/>" ;
// exit() ;
function date_prestation_to_jour($dat)
{
$a=int2date_autre_format_deux($dat) ;
$dt = strtotime($a);
$day = date("D", $dt);
$jour=daysfr_new($day) ;
return $jour ;
// return $day ;
}
// echo "testddd <br/> " ;
// exit() ;
function get_prest_sem( $interdispo,$from ,$to,$agence,$CLIENTS)
{
$id=0;
$p=array();
// $week_end = $to ;
$salarie_id = $interdispo ;
$data = array();
$now = new DateTime();
$start = $from ;
$end = $to;
// $end = $now -> format('Ymt');
$date = $start ;
$i=0 ;
while ($date <= $end )
{
// $q = dbi_query("
// SELECT * FROM PRESTATIONS p where presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL)
// AND p.presta_id IN ( select presta_id FROM PRESTATIONS_MODIF WHERE salarie_id = $salarie_id )
// ");
$q = dbi_query("
SELECT * FROM PRESTATIONS p where presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL)
AND ( p.presta_id IN (select presta_id FROM PRESTATIONS WHERE salarie_id = $salarie_id ) OR p.presta_id IN ( select presta_id FROM PRESTATIONS_MODIF WHERE salarie_id = $salarie_id ) )
AND ( p.presta_recur IS NULL OR p.presta_recur NOT IN ( SELECT presta_id FROM PRESTATIONS where presta_date_fin < $date ) )
");
// echo "
// SELECT * FROM PRESTATIONS p where presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL)
// AND (p.presta_id IN (select presta_id FROM PRESTATIONS WHERE salarie_id = $salarie_id ) OR p.presta_id IN ( select presta_id FROM PRESTATIONS_MODIF WHERE salarie_id = $salarie_id ) )
// ".'<br>';
// exit() ;
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'];
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))));
}
}
$prest['client_id'] = $m['client_id'] === NULL ? $prest['client_id'] : $m['client_id'] ;
$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_date_debut'] = $m['presta_date_debut'] === NULL ? $prest['presta_date_debut'] : $m['presta_date_debut'] ;
$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 ) {
// if($date == '20200806')
// echo $prest["presta_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'] ) ){
// $istart = str_pad($prest['presta_Hdeb'] / 10000 , 2, '0', STR_PAD_LEFT) ;
$hstart = str_pad((int)($prest['presta_Hdeb'] / 10000) , 2, '0', STR_PAD_LEFT) ;
// $hstart = str_pad(round($prest['presta_Hdeb'] / 10000, 0) , 2, '0', STR_PAD_LEFT) ;
$mstart = str_pad(($prest['presta_Hdeb'] % 10000)/100 , 2, '0', STR_PAD_LEFT);
$hend = str_pad(round(addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']) / 10000, 0) , 2, '0', STR_PAD_LEFT) ;
$mend = str_pad((addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']) % 10000)/100 , 2, '0', STR_PAD_LEFT);
$istart = int2date_autre_format($date).' '.$hstart.':'.$mstart.':00';
$iend = int2date_autre_format($date).' '.$hend.':'.$mend.':00';
$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 )
{
$Clt = dbi_fetch_row(dbi_query("SELECT * FROM client WHERE client_id = ".$prest['client_id'] ." " )) ;
$data[$i]['presta_id'] = $prest["presta_id"];
$data[$i]['client_id'] = $prest["client_id"];
$data[$i]['presta_Hdeb'] = $prest["presta_Hdeb"];
$data[$i]['presta_Hduree'] = $prest["presta_Hduree"];
$data[$i]['presta_jour'] = $prest["presta_jour"];
$data[$i]['presta_date_debut'] = $prest["presta_date_debut"];
if($prest['client_id'] == $TMCPROCLIENTID)
$data[$i]['title'] = '('. convertToHoursMins($prest['presta_Hduree'], '%01dh%02d').") ".$prest['prestation_motif'];
else
$data[$i]['title'] = '('. convertToHoursMins($prest['presta_Hduree'], '%01dh%02d').") ".$Clt["client_nom"];
// $data[$i]['title'] = '('. convertToHoursMins($prest['presta_Hduree'], '%01dh%02d').") ".$Clt["client_nom"];
$data[$i]['start'] = $istart;
$data[$i]['end'] = $iend;
$data[$i]['date'] = $date;
++$i;
}
else
{
$nbre =count_week_days(strtotime(int2date_autre_format($date_presta_sem,'d.m.Y')), strtotime(int2date_autre_format($date,'d.m.Y')));
$modolo = $nbre % $prest['presta_sem'] ;
if( $modolo == 0) {
$Clt = dbi_fetch_row(dbi_query("SELECT * FROM client WHERE client_id = ".$prest['client_id'] ." " )) ;
$data[$i]['presta_id'] = $prest["presta_id"];
$data[$i]['client_id'] = $prest["client_id"];
$data[$i]['presta_Hdeb'] = $prest["presta_Hdeb"];
$data[$i]['presta_Hduree'] = $prest["presta_Hduree"];
$data[$i]['presta_jour'] = $prest["presta_jour"];
if($prest['client_id'] == $TMCPROCLIENTID)
$data[$i]['title'] = '('. convertToHoursMins($prest['presta_Hduree'], '%01dh%02d').") ".$prest['prestation_motif'];
else
$data[$i]['title'] = '('. convertToHoursMins($prest['presta_Hduree'], '%01dh%02d').") ".$Clt["client_nom"];
$data[$i]['start'] = $istart;
$data[$i]['end'] = $iend;
$data[$i]['date'] = $date;
++$i;
}
}
}
}
}
// echo date("Ymd", strtotime( int2date_autre_format($date))).' !! '.$prest['presta_id'].' $$ '.$prest['presta_jour'].'<br>';
}
// $date = time2int($time) ;
$date = date("Ymd", strtotime("+1 day", strtotime($date)));
}
return $data;
}
$salarie_contrat_date_debut = date('Ym01') ;
$salarie_contrat_date_fin = date('Ym31') ;
// $salarie_id = 2543 ;
$pre=get_prest_sem( $salarie_id ,$salarie_contrat_date_debut,$salarie_contrat_date_fin ,47,$CLIENTS);
for($i=0 ; $i < count($pre) ; $i++){
$tab_client[]=$pre[$i]['client_id'] ;
}
// echo "<pre>" ;
// print_r($tab_client) ;
// echo "</pre>" ;
// echo "<br/>" ;
$client_unique = array_unique($tab_client);
// print_r($client_unique);
if(!empty($_POST))
{
header('Location:congee_sal.php?msg=Demande d’absence prise en compte&color=success');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AdminLTE 3 | User Profile</title>
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="../../plugins/fontawesome-free/css/all.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="../../dist/css/adminlte.min.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
<!-- Navbar -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- Left navbar links -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
</li>
<li>
<a href="index_sal.php"><button type="button" class="btn btn-primary"> MENU PRINCIPAL</button>
</li>
</ul>
</nav>
<!-- /.navbar -->
<!-- Main Sidebar Container -->
<?php
include('aside.php');
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<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
}
?>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!-- Profile Image -->
<!-- /.card -->
<!-- About Me Box -->
<div class="card card-primary">
<!-- /.card-header -->
<div class="card-body">
<script language="Javascript">
function GetIdBureau()
{
var id_statu="";
id_statu = document.client_statu_form.client_id.value ;
if( id_statu > 0 || id_statu=="INDEFINI" )
window.location = "produit_client_sal.php?client_id="+id_statu;
else
window.location = "produit_client_sal.php";
}
</script>
<?php
// echo "<pre>" ;
// print_r($_GET) ;
// echo "</pre>" ;
?>
<form id="client_statu_form" name="client_statu_form" method="POST" action="">
<div class="form-row">
<div class="form-group col-md-3"><!-- Liste déroulante statut -->
<select class="form-control select" style="width: 100%;" id="client_statu" name="client_id" onchange="GetIdBureau()"; >
<option value="0" > ----- Selectionner un client -----</option>
<?php for($i=0 ; $i< count($client_unique) ; $i++){
list($client_nom, $client_id ) = dbi_fetch_row( dbi_query("SELECT client_nom , client_id FROM `client` WHERE `client_id` = ".$client_unique[$i])) ;
?>
<option value="<?=$client_id ?>" <?php if($_GET['client_id']==$client_id){echo "selected" ;} ?> > <?=$client_nom ?></option>
<?php }?>
</select>
</div>
</div>
</form>
<div class="modal-footer justify-content-between"> </div>
<?php if(!empty($_GET['client_id'])){ ?>
<table id="tables" class="table table-bordered table-striped" >
<thead>
<tr>
<th>Nom de Produits</th>
<th>Référence</th>
<th>Commander</th>
</tr>
</thead>
<tbody>
<?php
$res = dbi_query("SELECT * FROM Produits_livree_salar pl , produits p WHERE pl.Produit_ID = p.Produit_ID and client_id = ".$_GET['client_id']) ;
// echo "==>"."SELECT * FROM Produits_livree_salar pl , produits p WHERE pl.Produit_ID = p.Produit_ID and client_id = ".$_GET['client_id']."<br/>" ;
while($row = dbi_fetch_row($res)) {
?>
<tr>
<td><?=$row['Produit_Designation'] ; ?></td>
<td><?=$row['Produit_Reference'] ; ?></td>
<td>
<a href="produit_client_sal.php?Produit_ID=<?=$row['Produit_ID']?>&client_id=<?=$_GET['client_id']?>">
<button class='btn btn-outline-warning'>Contrôler</button>
</td>
<?php
// ";
// }else{
// echo "
// <td>
// <button class='btn btn-success'
// onfocus='change(this)'>
// contrôlé </button></td> ?>
</tr>
<?php } ?>
</tfoot>
</table><!-- /.table -->
<?php } ?>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
<!-- /.col -->
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 3.2.0
</div>
<strong>MC PRO 2022 </strong>
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="../../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>
</body>
</html>
