<?php
function rapor_son_tarih_hesapla($gorevlendirme_tarihi, $teslimgunsayisi)
{
print_r($gorevlendirme_tarihi);
echo "\n";
if ($teslimgunsayisi < 1) {
$talep_tarihi__ = date("Y-m-d");
} else {
$ccc = 0;
$teslimgunsay = 0;
for ($a = 1; $a <= 20; $a++) {
if ($teslimgunsay < $teslimgunsayisi) {
$ccc++;
$gunn = strtotime($gorevlendirme_tarihi) + ($ccc * 86400);
$talep_tarihi__ = date("Y-m-d", $gunn);
$haftaningunu = date("N", strtotime($talep_tarihi__));
$tar = ($talep_tarihi__);
if ($haftaningunu < 6) {
$teslimgunsay++;
print_r("haftanın günü: ". $haftaningunu);
echo "\n";
print_r("haftanın günü tarih: ".$talep_tarihi__);
echo "\n";
}
}
}
}
if (strlen($talep_tarihi__) == 10) $talep_tarihi__ = $talep_tarihi__ . " 00:00:01";
return date("d.m.Y H:i:s", strtotime($talep_tarihi__));
}
function rapor_Son($teslimgunsayisi) {
$bugun = date("Y-m-d");
$ccc = 0;
$teslimgunsay = 0;
for ($a = 1; $a <= 20; $a++) {
if ($teslimgunsay < $teslimgunsayisi) {
$ccc++;
$gunn = time() + ($ccc * 86400);
$talep_tarihi__ = date("Y-m-d", $gunn);
$haftaningunu = date("N", strtotime($talep_tarihi__));
$tar = ($talep_tarihi__);
if ($haftaningunu < 6) {
$teslimgunsay++;
}
}
}
return $rapor_son_tarih = date("d-m-Y", strtotime($talep_tarihi__));
}
function teslimgunu_fark_bul($ilk, $son, $ayrac = '-')
{ // d-m-Y h:m:i gelmesi lazım
// echo $ilk="11-06-2013 09:00:00";
// echo "<br>";
// echo $son="14-06-2013 09:00:00";
// echo "<br>";
if ($ilk < $son) {
$ilk_ = date("d/m/Y", strtotime($ilk)) . " 09:00:00";
$son_ = date("d/m/Y", strtotime($son)) . " 09:00:00";
$n_p = "+";
}
if ($son < $ilk) {
$ilk_ = date("d/m/Y", strtotime($son)) . " 09:00:00";
$son_ = date("d/m/Y", strtotime($ilk)) . " 09:00:00";
$n_p = "-";
}
$ilk_time = strtotime(formatlitarihsaat_en($ilk_));
$son_time = strtotime(formatlitarihsaat_en($son_));
$ilk_gun = date("Ymd", $ilk_time);
$son_gun = date("Ymd", $son_time);
$gunfarki = (strtotime($son_gun) - strtotime($ilk_gun)) / 86400;
$gunfarki = round($gunfarki);
#Aynı Gün İse
if ($gunfarki == 0) {
return 0;
} else {
#Farklı Gün İse
$tatilgunumu = tatilgunumu($ilk_time);
if ($tatilgunumu <> "E") {
$ilk_gun_gece = date("Y/m/d", $ilk_time) . " 18:00:00";
$ilk_gun_gecensure = strtotime($ilk_gun_gece) - $ilk_time;
}
$tatilgunumu = tatilgunumu($son_time);
if ($tatilgunumu <> "E") {
$son_gun_sabah = date("Y/m/d", $son_time) . " 09:00:00";
$son_gun_gecensure = $son_time - strtotime($son_gun_sabah);
}
for ($gun = 1; $gun < $gunfarki; $gun++) {
$once_date_ = mktime(0, 0, 0, date("m", $ilk_time), date("d", $ilk_time) + $gun, date("Y", $ilk_time));
date("d-m-Y", $once_date_);
$tatilgunumu = tatilgunumu($once_date_);
if ($tatilgunumu <> "E") {
$arada_gecensure += 28800;
}
}
// echo $arada_gecensure;
$gecensure = $arada_gecensure + $ilk_gun_gecensure + $son_gun_gecensure;
}
//$kalangun=floor(($gecensure-0.001)/3600/8)+1;
$kalangun = round(($gecensure - 0.001) / 3600 / 8);
if ($n_p == "-") $kalangun = $kalangun * -1;
return $kalangun;
}
function tatilgunumu($tar)
{
global $tatilgunumudur;
$tatilgunumu = "E";
$haftaningunu = date("N", $tar) * 1;
$tar = date("Y-m-d", $tar);
if ($haftaningunu < 6) {
$tatilgunumu = "H";
}
return $tatilgunumu;
}
function formatlitarihsaat_en($tarih)
{
$tarih = (substr($tarih, 0, 20));
$tarih = substr($tarih, 6, 4) . "-" . substr($tarih, 3, 2) . "-" . substr($tarih, 0, 2) . " " . substr($tarih, 11, 2) . ":" . substr($tarih, 14, 2) . ":" . substr($tarih, 17, 2);
return $tarih;
}
$buguntarihsaat = "20240425";
$raporsontarih = "20240430";
echo teslimgunu_fark_bul($buguntarihsaat, $raporsontarih);
echo "\n\n";
echo rapor_Son("4");
echo "\n\n";
echo rapor_son_tarih_hesapla("27.04.2024 13:17", 2);
- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- Warning: Undefined variable $arada_gecensure in /in/G2bXh on line 103
3
14-05-2024
27.04.2024 13:17
haftanın günü: 1
haftanın günü tarih: 2024-04-29
haftanın günü: 2
haftanın günü tarih: 2024-04-30
30.04.2024 00:00:01
preferences:
57.75 ms | 402 KiB | 62 Q