| Current Path : /home/happyrenas/old/huissier-express.fr/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/old/huissier-express.fr/calcul2.php |
<?
$date_choix = $_REQUEST['date_choix'];
$heure_choix = $_REQUEST['heure_choix'];
$plage_urgence = $_REQUEST['plage_urgence'];
$estimation2 = $_REQUEST['estimation2'];
// CALCUL SI SEMAINE OU WEEK-END
$date_choix_timestamp = strtotime($date_choix);
$plage_jour=1;
if (date('D', $date_choix_timestamp)=="Sat" || date('D', $date_choix_timestamp)=="Sun") {$plage_jour=2;}
// CALCUL SI JOUR OU NUIT
$h1=strtotime("07:00");
$h2=strtotime("19:00");
$h3=strtotime($heure_choix);
$plage_heure=1;
if ($h1-$h3>0 && $h2-$h3>0) {$plage_heure=2;} //si positifs tous les deux => avant 7 heures
if ($h1-$h3<0 && $h2-$h3<0) {$plage_heure=2;} //si negatifs tous les deux => apres 19 heures
// CALCUL URGENCE
$fulldate=$date_choix." ".$heure_choix.":00";
//echo $fulldate."<br>";
$fulldate=strtotime($fulldate);
//$date = date_create();
//$actuel= date_timestamp_get($date);
$actuel= date("d-m-Y")." ".date("H:i:s");
//echo $actuel."<br>";
$actuel=strtotime($actuel);
$difference=$fulldate-$actuel;
//echo $difference;
if ($difference<14400) {$plage_urgence=1;} //Urgence 4 h
if ($difference>=14400 && $difference<86400) {$plage_urgence=2;} //Urgence 24 h
if ($difference>=86400 && $difference<172800) {$plage_urgence=3;} //Urgence 48 h
//echo $plage_urgence;
// CALCUL JOUR FERIES
if ($year === null){$year = intval(date('Y'));}
$easterDate = easter_date($year);
$easterDay = date('j', $easterDate);
$easterMonth = date('n', $easterDate);
$easterYear = date('Y', $easterDate);
$holidays = array
(
mktime(0, 0, 0, 1, 1, $year), // 1er janvier
mktime(0, 0, 0, 5, 1, $year), // Fête du travail
mktime(0, 0, 0, 5, 8, $year), // Victoire des alliés
mktime(0, 0, 0, 7, 14, $year), // Fête nationale
mktime(0, 0, 0, 8, 15, $year), // Assomption
mktime(0, 0, 0, 11, 1, $year), // Toussaint
mktime(0, 0, 0, 11, 11, $year), // Armistice
mktime(0, 0, 0, 12, 25, $year), // Noel
mktime(0, 0, 0, $easterMonth, $easterDay + 1, $easterYear),
mktime(0, 0, 0, $easterMonth, $easterDay + 39, $easterYear),
mktime(0, 0, 0, $easterMonth, $easterDay + 50, $easterYear),
);
sort($holidays);
foreach ($holidays as $key => $value)
{
if (strtotime($date_choix)==$value) {$plage_jour=4;}
}
$prix_base = 260;
$prix_origine = $prix_base;
// SEMAINE
if ($plage_jour==1)
{
if ($plage_heure==1) {$prix_base=$prix_base;}
if ($plage_heure==2) {$prix_base=$prix_base*1.9;}
}
// SAMEDI OU DIMANCHE OU JOUR FERIE
if ($plage_jour==2 || $plage_jour==3 || $plage_jour==4)
{
if ($plage_heure==1) {$prix_base=$prix_base*1.9;}
if ($plage_heure==2) {$prix_base=$prix_base*2.8;}
}
if ($plage_urgence==1) {$prix_base=$prix_base+250;}
if ($plage_urgence==2) {$prix_base=$prix_base+150;}
if ($plage_urgence==3) {$prix_base=$prix_base+100;}
$prix_base=$prix_base+($prix_origine*($estimation2-1));
$prix_base=round($prix_base*1.09,2);
?>
<button type="button" class="bouton_reponse">
<span class="editContent"><?echo $prix_base;?> €</span>
<input style="height: 30px;margin-left:0px;" type= "radio" id="choix2" name="choix" value="2"> Sélectionner
</button>
<input type="hidden" name="tarif2" value="<?echo $prix_base;?>">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
$("#choix2").prop("checked", true);
</script>