AnonSec Team
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/TMCPRO/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/TMCPRO/paye182.php
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// ini_set('display_errors','on');
// error_reporting(E_ALL);

// exit() ; 

// $checkTime = strtotime('09:00:59');
// echo 'Check Time : '.date('H:i:s', $checkTime);
// echo '<hr>';

// $loginTime = strtotime('08:01:00');
// $diff = $checkTime - $loginTime;
// echo 'Login Time : '.date('H:i:s', $loginTime).'<br>';
// echo ($diff < 0)? 'Late!' : 'Right time!'; echo '<br>';
// echo 'Time diff in sec: '.abs($diff);




// exit() ; 


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;

    }

$ecartt = diff_time("91:00:00" , "111:10:01") ;

echo "$ecartt" ; 

function AddTime(Array $durations)  // la somme de tableau des durees
{
    $total_time    = 0;
    foreach($durations as $duration) {  
        sscanf($duration, "%d:%d:%d", $hours, $minutes, $seconds);
        $total_time += isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes;
    }    
    return sprintf('%02d:%02d:%02d', ($total_time/3600),($total_time/60%60), $total_time%60);;
 }
 

 
 
function convertToHoursMins($time, $format = '%02d:%02d') {
    if ($time < 1) {
        return;
    }
    $hours = floor($time / 60);
    $minutes = ($time % 60);
    return sprintf($format, $hours, $minutes);
}

$ferier = array('0101','0501','0508','0515','0714','1111','1101','1225');


if(isset($_POST['salarie_ids']) && !empty($_POST['salarie_ids']) && !empty($_POST['du']) && !empty($_POST['au'])){

$du = dateformaint($_POST['du']);
$au = dateformaint($_POST['au']);

}
else {
$du = date('Ym01');
$au = date('Ymt');
}
$du = dateformaint($_POST['du']);
$au = dateformaint($_POST['au']);

// $du = int2date_autre_format($du) ;
// $au = int2date_autre_format($au) ;


// echo "kkkkk==>".$du."<br/>" ;
// echo "pmmmmm==>".$au."<br/>" ;


// if(!empty($_POST)){
	// echo "<pre>" ;
	// print_r($_POST) ; 
	// echo "</pre>" ;
// }
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>MC PRO | Paye</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- daterange picker -->
  <link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="../plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="../plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
  <!-- Tempusdominus Bbootstrap 4 -->
  <link rel="stylesheet" href="../plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../plugins/select2/css/select2.min.css">
  <link rel="stylesheet" href="../plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
  <!-- Bootstrap4 Duallistbox -->
  <link rel="stylesheet" href="../plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../../dist/css/adminlte.min.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  
  <link rel="stylesheet" href="listing.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
<!-- TOP MENU -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
 <!-- Menu extensible -->
    <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>

 <!-- liens TOP MENU DROITE -->
    <ul class="navbar-nav ml-auto">
     <!-- Placer ici l'élément à positionner à droite du TOP MENU -->
    </ul>
  
  </nav>  <!-- fin du TOP MENU -->

<?php include('menu.php'); ?>
<div  class="modal fade" id="PrestUpt" 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="jalil" ></div>
							
							   
							</div>
						</div>
</div>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
   


    <!-- Main content -->
    <section class="content">
		<div class="container-fluid">
			
			<div class="row">
				<!-- /.col -->
				<div class="col-md-12">
					<div class="card" >
						<div class="card-header">
							<h5 class="card-title"><i class="nav-icon fas fa-cash-register"></i>  Préparation de la Paye</h5>
						</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 -->
						<!-- form start -->
						<form role="form" method='POST' action=''>	  
							<!-- /.card-header -->
							<div class="card-body" >
								<div class="row">
								
									<div class="col-12">
										<div class="form-group">
											<select class="duallistbox" multiple="multiple" style="height: 150px;" name="salarie_ids[]" id="salarie_ids[]">
														<?php   $req =dbi_query("SELECT * FROM salarie WHERE salarie_statut = '1' ORDER BY salarie_nom,salarie_prenom ASC") ;
																while(  $sal=dbi_fetch_row($req)) { ?>
																<option value="<?php echo $sal['salarie_id'] ; ?>" <?php if( isset($_POST['salarie_ids']) && in_array($sal['salarie_id'] , $_POST['salarie_ids'])) echo 'selected';?>><?php echo $sal['salarie_nom'].' '.$sal['salarie_prenom']; ?></option>
														<?php   }	?>
											</select>
										</div>
									</div>
									<div class="form-group col-md-3">
											<label>Du</label>
											<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="du" name="du" placeholder="jj/mm/aaaa" value='<?php echo $du;?>' />
											</div>
									</div>
									<div class="form-group col-md-3">
											<label>Du</label>
											<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="au" name="au" placeholder="jj/mm/aaaa" value='<?php echo $au;?>' />
											</div>
									</div>
									<div class="col-sm-3">
									  <div class="form-group"><label><br/></label>
										<button type="submit" class="btn btn-block bg-primary">Valider</button>
									  </div>
									</div>	
								</div>
							</div>
						</form>
					</div>
				</div> <!-- /.col -->
			</div><!-- /.row -->







		<?php
		define ('GOOD', '#2DCD0C');
		define ('BAD', '#FD0005');
		$mois=array('01'	=>'janvier','02'	=>'fevrier','03'	=>'mars','04'	=>'avril','05'	=>'mai','06'	=>'juin','07'	=>'juillet','08' =>'aout','09'	=> 'septembre','10'	=> 'octobre','11'	=> 'novembre','12'	=> 'decembre');
		if(isset($_POST['salarie_ids']) && !empty($_POST['salarie_ids']) && !empty($_POST['du']) && !empty($_POST['au'])){
			$from = dateformaint($_POST['du']);
			$to = dateformaint($_POST['au']);;
			$liste = array() ;		
			$hb_gtot = 0;
			$hcomp_gtot = 0;
			$hsup_gtot = 0;
			$delta_gtot = 0;
			
			$_SESSION['du'] = $du ; 
			$_SESSION['au'] = $au ;
			foreach($_POST['salarie_ids'] as $interv)
			{
				$req_principale = dbi_query("SELECT DISTINCT(client_id) FROM `pointage_rapport` WHERE `salarie_id` = ".$interv." and date_pointage BETWEEN $du and $au ") ; 
				
				
				
				// $intervenant = dbi_fetch_row(dbi_query("select CONCAT( salarie_genre, ' ' ,salarie_nom, ' ' ,salarie_prenom ) as nom from salarie where salarie_id = $interv LIMIT 1")) ;
				$inter = dbi_fetch_row(dbi_query("SELECT * FROM salarie WHERE salarie_id = $interv ")) ; 
				$eche= dbi_fetch_row(dbi_query("SELECT Echelon FROM echelon where echelon  =  '".$inter['salarie_echelon']."'"));
				// $inti= dbi_fetch_row(dbi_query("SELECT intitule FROM poste_intitule where poste_intitule_ID =  ".$inter['salarie_position']));
				$po= dbi_fetch_row(dbi_query("SELECT Position FROM position where position =  '".$inter['salarie_position']."'"));
						if($inter['salarie_situation_paiement']==0)
				{
				 $inter_paiement= "mensuel" ; 
				}
				else
				{
				 $inter_paiement= "hebdomadaire" ; 
				}		
		?>			
				<div class="row">
					<div class="card col-md-12">
						<div class="card-header">
							<div class="user-block">
							  <span class="username" ><a href="#"><?php echo $inter['salarie_nom'].' '.$inter['salarie_prenom']; ?></a></span>
							  <span class="description"><?php echo "   Position : ".$po['Position']." -  Echelon : ".$eche['Echelon']." - paiement : $inter_paiement "?></span>
							</div>
							<!-- /.user-block -->
							<div class="card-tools">
							  <button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-minus"></i>
							  </button>
							  <button type="button" class="btn btn-tool" data-card-widget="remove"><i class="fas fa-times"></i>
							  </button>
							</div>
							<!-- /.card-tools -->
						 </div>

					  <!-- /.card-header -->
					  <div class="card-body p-0">
						<div class="table-responsive">
						  <table class="table m-0" style="width:100%">
							<thead>
							<tr>
							  <th style='text-align:left;width:260px;'>Client</th>
							  <th style='text-align:center;width:80px;'>Duree prestation</th>
							  <th style='text-align:center;width:80px;'>Duree pointage</th>
							  <th style='text-align:center;width:80px;'>Ecart</th>
							  
							</tr>
							</thead>
							<tbody>
							<?	
							            $total_pointage_positif =  [] ; 
                                        $total_pointage_negatif =  [] ; 										
                                        $total_prestation =  [] ; 
										$total_pointage =  [] ;

                                			 while($res_client = dbi_fetch_row($req_principale)){
												 
												 
										// echo "==>".$res_client['client_id']."<br/>"  ; 	
										
										$req_heure=dbi_query("SELECT * , TIMEDIFF(pres_heure_fin, pres_heure_debut) as duree_prest , TIMEDIFF(point_heure_fin, point_heure_debut) as duree_pointage  FROM `pointage_rapport` WHERE `client_id` = ".$res_client['client_id']." and salarie_id = ".$interv." and date_pointage BETWEEN $du and $au") ;
                                        $durations_prestation =  [] ; 
                                        $durations_pointage =  [] ; 
                                        										
									   while($res_heure=dbi_fetch_row($req_heure)){
											
											list($client_nom) = dbi_fetch_row(dbi_query("SELECT client_nom  FROM `client` WHERE `client_id` = ".$res_client['client_id'])) ;
											
											// echo " prestation==>> ".$res_heure['duree_prest']."<br/>" ;
											// echo "pointage ==>> ".$res_heure['duree_pointage']."<br/>" ;
											
											 $durations_prestation[] = $res_heure['duree_prest'] ; 
											 $durations_pointage[] =   $res_heure['duree_pointage'] ;
											 
										}
										// ********** la ligne **********

                                    $somme_durations_prestation = AddTime($durations_prestation) ;
									$somme_durations_pointage = AddTime($durations_pointage) ;
									$total_prestation[] = $somme_durations_prestation ;
									$total_pointage[]= $somme_durations_pointage ;
									
									// $time = '21:30:10';
// $seconds = strtotime("1970-01-01 $time UTC");
// echo $seconds;
									$somme_durations_prestation_second = strtotime("1970-01-01 $somme_durations_prestation UTC"); 
									$somme_durations_pointage__second =  strtotime("1970-01-01 $somme_durations_pointage UTC");    
									
									echo "$somme_durations_prestation_second   ===  $somme_durations_pointage__second <br/> " ; 
									if($somme_durations_prestation >= $somme_durations_pointage){
									$ecartt = diff_time($somme_durations_prestation , $somme_durations_pointage) ; $chain_ecat = "<td style='color:red;' >".$ecartt."</td>"  ; }
								    else{
									$ecartt = diff_time($somme_durations_pointage , $somme_durations_prestation) ;$chain_ecat = "<td style='color:green;' >".$ecartt."</td>"  ;}
									echo "<tr>"	 ; 
									echo "<td>".$client_nom."</td>" ; 
									echo "<td>".$somme_durations_prestation."</td>" ; 
									echo "<td>".$somme_durations_pointage."</td>" ; 
									echo $chain_ecat ; 
									echo '<td><a class="btn btn-info btn-sm" href="#myModal"  id="custId" data-toggle="modal" data-debut="'.$res_client['client_id'].'"    data-fin="'.$interv.'">   Voir  </a> </td>';
																									 
									echo "</tr>"	 ; 
									// ************* fin ligne ************
									
									}  	
                                    $total_p=AddTime($total_prestation) ; 
                                    $total_pntg=AddTime($total_pointage) ;
									if($total_p >= $total_pntg){
									$ecartt_total = diff_time($total_p , $total_pntg) ; $chain_ecat_tot = "<td style='color:red;' > <strong> ".$ecartt_total."</strong> </td>"  ; }
								    else{
									$ecartt_total = diff_time($total_pntg , $total_p) ;$chain_ecat_tot = "<td style='color:green;' ><strong> ".$ecartt_total."</strong> </td>"  ;} 									
								    echo "<tr>"	 ; 
									echo "<td><strong> TOTAL </strong> </td>" ; 
									echo "<td> <strong> ".$total_p."</strong> </td>" ; 
									echo "<td> <strong> ".$total_pntg."</strong> </td>" ; 
									echo "<strong>".$chain_ecat_tot."</strong> " ; 
									echo "</tr>"
								

		
		
							?>
							</tbody>
						  </table>
						</div>
						<!-- /.table-responsive -->
					  </div>
					  <!-- /.card-body -->
					  <!-- /.card-footer -->
					</div>
				</div>	
		<?php
			}
		}
		?>			
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		
			
			

        <!-- /.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.0.2
    </div>
    <strong>Copyright &copy; 2014-2019 <a href="http://adminlte.io">AdminLTE.io</a>.</strong> All rights
    reserved.
  </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>
<!-- Select2 -->
<script src="../plugins/select2/js/select2.full.min.js"></script>
<!-- Bootstrap4 Duallistbox -->
<script src="../plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.js"></script>
<!-- InputMask -->
<script src="../plugins/moment/moment.min.js"></script>
<script src="../plugins/inputmask/min/jquery.inputmask.bundle.min.js"></script>
<!-- date-range-picker -->
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="../plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Bootstrap Switch -->
<script src="../plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>
<!-- Page script -->


<script type="text/javascript">
$(document).ready(function(){
    $('#myModal').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('debut');
		var indice = $(e.relatedTarget).data('fin');
		// var data = 'param1='+param1+'&param2='+param2;
		
        $.ajax({
            type : 'post',
            url : 'detail_rapport.php', //Here you will fetch records 
            data :  'client_id='+rowid+'&salarie_id='+indice, //Pass $id
            success : function(data){
            $('#fetch').html(data);//Show fetched data from database
            }
        });
     });
});

    
</script>

<script>
  $(function () {
$("#allcheck").click(function(){
    $('input:checkbox').not(this).prop('checked', this.checked);
});
	 var TOTALCA ="<?php echo number_format( $CATTC, 2, ',', ' ').'<sup> € </sup>';?>";
	$('#TOTALCA').html(TOTALCA);
	 var TOTALCAHT ="<?php echo number_format( $CAHT, 2, ',', ' ').'<sup> € </sup>';?>";
	$('#TOTALCAHT').html(TOTALCAHT); 	
    //Initialize Select2 Elements
    $('.select2').select2()

    //Initialize Select2 Elements
    $('.select2bs4').select2({
      theme: 'bootstrap4'
    })

    //Datemask dd/mm/yyyy
    $('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })
    //Datemask2 mm/dd/yyyy
    $('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })
    //Money Euro
    $('[data-mask]').inputmask()

    //Date range picker
    $('#reservation').daterangepicker()
    //Date range picker with time picker
    $('#reservationtime').daterangepicker({
      timePicker: true,
      timePickerIncrement: 30,
      locale: {
        format: 'MM/DD/YYYY hh:mm A'
      }
    })
    //Date range as a button
    $('#daterange-btn').daterangepicker(
      {
        ranges   : {
          'Today'       : [moment(), moment()],
          'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
          'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
          'Last 30 Days': [moment().subtract(29, 'days'), moment()],
          'This Month'  : [moment().startOf('month'), moment().endOf('month')],
          'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
        startDate: moment().subtract(29, 'days'),
        endDate  : moment()
      },
      function (start, end) {
        $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
      }
    )

    //Timepicker
    $('#timepicker').datetimepicker({
      format: 'LT'
    })
    
    //Bootstrap Duallistbox
    $('.duallistbox').bootstrapDualListbox()

    //Colorpicker
    $('.my-colorpicker1').colorpicker()
    //color picker with addon
    $('.my-colorpicker2').colorpicker()

    $('.my-colorpicker2').on('colorpickerChange', function(event) {
      $('.my-colorpicker2 .fa-square').css('color', event.color.toString());
    });

    $("input[data-bootstrap-switch]").each(function(){
      $(this).bootstrapSwitch('state', $(this).prop('checked'));
    });

  })
</script>
</body>
</html>

AnonSec - 2021