diff --git a/class/class.ajout.php b/class/class.ajout.php new file mode 100644 index 0000000..54f4410 --- /dev/null +++ b/class/class.ajout.php @@ -0,0 +1,29 @@ + +
+ + + + + +set_charset("utf8"); +$req = "INSERT INTO $table VALUES ('$datedebut','$datefin','$nbjours','$type');"; +$resultat = $mysqli->query($req); +if ($resultat) { + echo "La saisie a été ajoutée !
"; + header("refresh:2; url=index.php"); + }else{ + echo "Erreur
"; + }; +//header("refresh:2; url=form.html"); +?> diff --git a/class/class.functions.php b/class/class.functions.php new file mode 100644 index 0000000..28b7938 --- /dev/null +++ b/class/class.functions.php @@ -0,0 +1,90 @@ += 2){ + echo $nbjours . ' jours'; + } + } + + function soldecp($table, $cpparan, $conn){ + $resultcp = mysqli_query($conn, "SELECT SUM(nbjours) AS decomptecp FROM $table WHERE type='CP'"); + $rowcp = mysqli_fetch_assoc($resultcp); + $sumcp = $rowcp['decomptecp']; + $cp = ($cpparan - $sumcp); + echo round($cp,2); + } + + function annee(){ + if( (date('m') >= 06) && (date('m') <= 12) ){ + echo date("Y")+1; + } + if( (date('m') >= 01) && (date('m') < 06) ){ + echo date("Y"); + } + } + + function anneeplus(){ + echo date("Y")+1; + } + + function anneeencours(){ + echo date("Y"); + } + + function cumuln1rtt($rttparmois){ + $datertt = date('Y') . '-01-01'; + $date2 = date('y-m-d'); + + $ts1rtt = strtotime($datertt); + $ts2 = strtotime($date2); + + $year1rtt = date('Y', $ts1rtt); + $year2 = date('Y', $ts2); + + $month1rtt = date('m', $ts1rtt); + $month2 = date('m', $ts2); + + $diffrtt = (($year2 - $year1rtt) * 12) + ($month2 - $month1rtt); + $cumulrtt = ($rttparmois * $diffrtt); + echo round($cumulrtt, 2); + } + + function cumuln1cp($cpparmois){ + + if( (date('m') >= 06) && (date('m') <= 12) ){ + $anneecp = date("Y"); + } + if( (date('m') >= 01) && (date('m') < 06) ){ + $anneecp = date("Y")-1; + } + + $datecp = $anneecp . '-06-01'; + $date2 = date('y-m-d'); + + $ts1cp = strtotime($datecp); + $ts2 = strtotime($date2); + + $year1cp = date('Y', $ts1cp); + $year2 = date('Y', $ts2); + + $month1cp = date('m', $ts1cp); + $month2 = date('m', $ts2); + + $diffcp = (($year2 - $year1cp) * 12) + ($month2 - $month1cp); + $cumulcp = ($cpparmois * $diffcp); + echo round($cumulcp, 2); + } +?> diff --git a/class/class.remove.php b/class/class.remove.php new file mode 100644 index 0000000..5a3aaee --- /dev/null +++ b/class/class.remove.php @@ -0,0 +1,29 @@ + + + + + + + +query($req); +if ($resultat) { + echo "La saisie a été supprimée !
"; + header("refresh:2; url=index.php"); + }else{ + echo "Erreur
"; + }; + ?> diff --git a/class/class.sqlconnect.php b/class/class.sqlconnect.php new file mode 100755 index 0000000..50efca5 --- /dev/null +++ b/class/class.sqlconnect.php @@ -0,0 +1,15 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +?> diff --git a/config.php b/config.php new file mode 100644 index 0000000..470194c --- /dev/null +++ b/config.php @@ -0,0 +1,8 @@ + diff --git a/index.php b/index.php new file mode 100755 index 0000000..c88125d --- /dev/null +++ b/index.php @@ -0,0 +1,57 @@ + + + + + +Congés saisis | +||||
---|---|---|---|---|
Date début | +Date fin | +Durée | +Type de congé | +Suppression | +
" . $datedebut. " | " . $datefin. " | " . $nombrejours . " jour(s) | ". $row["type"]." | Supprimer la ligne |
Pas de résultat |