- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
if($_POST["gaap_month"])
{
$d_f = mktime(0,0,0,1,1,$_POST['f_year']);
$w_start = intval(date("W", $d_f));
$w_day = (intval(date("w", $d_f)) == 0) ? 6 : intval(date("w", $d_f)) - 1;
$d_f = ($w_start == 1) ? $d_f - $w_day*24*60*60 : $d_f + (7-$w_day)*24*60*60;
$d_f += (4*($_POST['gaap_month']-1) + intval(($_POST['gaap_month']-1)/3)) * 7*24*60*60;
$d_t = ($_POST['gaap_month'] % 3 == 0) ? $d_f + 5*7*24*60*60 : $d_f + 4*7*24*60*60;
$_POST["df"] = date("d.m.Y", $d_f);
$_POST["dt"] = date("d.m.Y", $d_t);
}
$date_from = mktime(0,0,0,substr($_POST["df"],3,2),substr($_POST["df"],0,2),substr($_POST["df"],6,4));
$date_to = mktime(23,59,59,substr($_POST["dt"],3,2),substr($_POST["dt"],0,2),substr($_POST["dt"],6,4));
// if time period more than 20 days
if ($date_to-$date_from > 61*24*60*60)
$_POST["df"] = date("d.m.Y", $date_to - 61*24*60*60);
if ($_GET['office'] && ($USER->isAdmin() || in_array("15", $USER->GetUserGroupArray())))
$_POST['t_office'] = $_GET['office'];