} } if ($_GET[s1] == NULL) { $s1 = 0; } else { $s1 = $_GET[s1]; } if ($_GET[s2] == NULL) { $s2 = 1; } else { $s2 = $_GET[s2]; } $s1 = intval($s1); $s2 = intval($s2); echo "<h1>Quality Management System</h1>"; $beginweek = BeginWeek(time()); echo "<form action=\"index2.php\" method=\"get\">"; echo "<p><input type=\"hidden\" name=\"page\" value=\"qms_view\" />"; $sql = "SELECT * FROM intranet_qms WHERE qms_toc1 > 0 AND qms_toc2 = 0 AND qms_toc3 = 0 AND qms_toc4 = 0 ORDER BY qms_toc1"; $result = mysql_query($sql, $conn) or die(mysql_error()); echo "<select name=\"s1\" onchange=\"this.form.submit()\">"; if ($s1 == 0) { $selected = " selected=\"selected\" "; } else { unset($selected); } echo "<option value=\"0\" {$selected} >Contents</option>"; while ($array = mysql_fetch_array($result)) { $qms_toc1 = $array['qms_toc1']; $qms_text = $array['qms_text']; if ($s1 == $qms_toc1) {
function HolidayCalendar($year) { global $pdf; global $conn; $pdf->addPage(); // New page with upcoming holidays, etc. $page_title = "Holidays " . $year; $pdf->SetFont('Helvetica', 'b', 24); $pdf->SetTextColor($format_bg_r, $format_bg_g, $format_bg_b); $pdf->MultiCell(0, 8, $page_title, 0, 1, L); $pdf->Cell(0, 2, '', 0, 1); $pdf->SetFont('Helvetica', 'b', 18); // $beginweek = BeginWeek(time()) + 43200 - 2419200; $beginweek = BeginWeek(mktime(0, 0, 0, 1, 1, $year)); $daycounter = 0; $coord_x = $pdf->GetX(); $coord_y = $pdf->GetY(); $days_to_show = 264; // Must be a multiple of 7 $days_to_show = 406; // Must be a multiple of 7 while ($daycounter < $days_to_show) { $today = $daycounter * 86400 + $beginweek; $date = date("j", $today); $this_day = date("w", $today); $day = date("j", $today); $month = substr(date("M", $today), 0, 2); $week = date("W", $today); // Add a square showing the month if this is the first... if (date("j", $today) == 1) { $pdf->SetTextColor(255); $pdf->SetFont('Helvetica', 'b', 6); SetBarPurple(); $pdf->Cell(5, 4.5, $month, TBL, 0, L, 1); $month_begin = 1; } if (date("n", time()) == date("n", $today) && date("j", time()) == date("j", $today) && date("Y", time()) == date("Y", $today)) { SetBarDBlue(); } elseif (date("W", time()) == date("W", $today) && date("Y", time()) == date("Y", $today)) { SetBarLBlue(); } elseif (date("n", time()) == date("n", $today)) { $pdf->SetFillColor(160); } elseif (date("n", $today) == 2 or date("n", $today) == 4 or date("n", $today) == 6 or date("n", $today) == 8 or date("n", $today) == 10 or date("n", $today) == 12) { $pdf->SetFillColor(190); } else { $pdf->SetFillColor(220); } unset($holiday_list); $sql_holidays = "SELECT user_initials, holiday_length, holiday_paid, holiday_approved FROM intranet_user_holidays, intranet_user_details WHERE user_id = holiday_user AND holiday_date = " . date("j", $today) . " AND holiday_month = " . date("n", $today) . " AND holiday_year = " . date("Y", $today) . " ORDER BY user_initials DESC"; $result_holidays = mysql_query($sql_holidays, $conn) or die(mysql_error()); while ($array_holidays = mysql_fetch_array($result_holidays)) { if ($array_holidays['holiday_length'] == 0.5) { $holiday_length = " (Half day)"; } else { unset($holiday_length); } if ($array_holidays['holiday_approved'] == NULL) { $holiday_approved = "*"; } else { unset($holiday_approved); } if ($array_holidays['holiday_paid'] != 1) { $holiday_paid_1 = "["; $holiday_paid_2 = "]"; } else { unset($holiday_paid_1); unset($holiday_paid_2); } $holiday_list = $holiday_paid_1 . $array_holidays['user_initials'] . $holiday_approved . $holiday_paid_2 . $holiday_length . ", " . $holiday_list; } $holiday_list = rtrim($holiday_list, ", "); $sql_bankholidays = "SELECT bankholiday_timestamp FROM intranet_user_holidays_bank WHERE bankholidays_day = " . date("j", $today) . " AND bankholidays_month = " . date("n", $today) . " AND bankholidays_year = " . date("Y", $today) . " LIMIT 1"; $result_bankholidays = mysql_query($sql_bankholidays, $conn); if (mysql_num_rows($result_bankholidays) > 0) { SetBarOrange(); } if ($daycounter == 0) { $pdf->SetTextColor(0); $pdf->SetFont('Helvetica', '', 6); $pdf->Cell(6, 4.5, $week - 1, TRB, 0, L, 0); } if ($this_day > 0 and $this_day <= 5) { $pdf->SetTextColor(255); $pdf->SetFont('Helvetica', 'b', 9); $pdf->Cell(5, 4.5, $day, LTB, 0, L, 1); $pdf->SetTextColor(0); $pdf->SetFont('Helvetica', '', 5); } if ($this_day > 0 and $this_day < 5) { if ($month_begin == 1) { $cell_width = 26; unset($month_begin); } else { $cell_width = 31; } $pdf->Cell($cell_width, 4.5, $holiday_list, TRB, 0, L, 1); } elseif ($this_day == 5) { if ($month_begin == 1) { $cell_width = 26; unset($month_begin); } else { $cell_width = 31; } $pdf->Cell($cell_width, 4.5, $holiday_list, TRB, 1, L, 1); if ($daycounter < $days_to_show - 6) { $pdf->Cell(6, 4.5, $week, TRB, 0, L, 0); } } // $pdf->MultiCell(0,5,$sql_holidays); $daycounter++; } $pdf->SetTextColor(0); $pdf->SetFont('Helvetica', '', 7); $holiday_notes = "* Pending Approval.\nInitials shown in square brackets indicate non-paid holiday."; $pdf->MultiCell(0, 4, $holiday_notes, 0, L); }
$line_cost = "= £" . number_format($entry_cost * $ts_hours, 2); $entry_cost_print = "£" . number_format($entry_cost, 2); $ts_cost_nf_print = "(£" . number_format($ts_cost_nf, 2) . ")"; $view_hours = $ts_hours; // . ","; $running_cost = $running_cost + $ts_cost_factored; $running_cost_nf = $running_cost_nf + $ts_cost_nf; $total_cost_nf = $total_cost_nf + $ts_cost_nf; $stage_total = $stage_total + $ts_cost_factored; $running_cost_print = "£" . number_format($stage_total, 2); $running_cost_nf_print = "(£" . number_format($running_cost_nf, 2) . ")"; $pdf->SetFont($format_font, '', 8); $pdf->SetTextColor(0, 0, 0); $pdf->SetDrawColor(220, 220, 220); $pdf->Cell(0, 1, '', T, 1); $ts_link = $pref_location . "popup_timesheet.php?week=" . BeginWeek($ts_entry) . "&ts_id=" . $ts_id . "&user_view=" . $user_id; $pdf->Cell(20, 4, $entry_day, 0, 0, L, 0, $ts_link); $pdf->Cell(8, 4, $view_hours, 0, 0, R, 0); if ($_POST[separate_pages] != 1) { $pdf->Cell(5, 4, 'hrs', 0, 0, C, 0); $pdf->Cell(15, 4, $entry_cost_print, 0, 0, R, 0); $pdf->Cell(15, 4, $ts_cost_nf_print, 0, 0, R, 0); $pdf->Cell(8, 4, $user_initials, 0, 0, C, 0); $pdf->Cell(20, 4, $running_cost_print, 0, 0, R, 0); $pdf->Cell(20, 4, $running_cost_nf_print, 0, 0, R, 0); } else { if ($view_hours <= 1) { $print_hours = "hour"; } else { $print_hours = "hours"; }
<?php unset($alertmessage); // Begin to clean up the $_POST submissions $ts_fee_id = CleanNumber($_POST[ts_fee_id]); $ts_fee_project = CleanNumber($_POST[ts_fee_project]); $ts_fee_text = addslashes($_POST[ts_fee_text]); $ts_fee_stage = addslashes($_POST[ts_fee_stage]); $ts_fee_target = CleanNumber($_POST[ts_fee_target]); $ts_fee_comment = addslashes($_POST[ts_fee_comment]); $ts_fee_commence = $_POST[ts_fee_commence]; $ts_fee_prospect = $_POST[ts_fee_prospect]; $ts_fee_proj_change = $_POST[ts_fee_proj_change]; if ($ts_fee_commence == 0) { $ts_fee_commence = BeginWeek(time()); } $choose = CleanNumber($_POST[choose]); if ($choose == "value") { $ts_fee_value = CleanNumber($_POST[ts_fee_value]); $ts_fee_percentage = ""; } else { $ts_fee_percentage = CleanNumber($_POST[ts_fee_percentage]); $ts_fee_value = ""; } $ts_fee_duration = CleanNumber($_POST[ts_fee_duration]); $ts_fee_pre = CleanNumber($_POST[ts_fee_pre]); $ts_fee_pre_lag = 604800 * $_POST[ts_fee_pre_lag]; $ts_fee_duration = $ts_fee_duration * 604800; // Calculate the revised date of commencement if previous stage provided if ($ts_fee_pre > 0) { $sql_pre = "SELECT ts_fee_commence, ts_fee_time_end FROM intranet_timesheet_fees WHERE ts_fee_id = {$ts_fee_pre} LIMIT 1";
print "<h2>Week Beginning ".TimeFormat($ts_weekbegin) . " (" . $timesheetcomplete . "% complete)"; if ($_GET[user_view] > 0) { echo " for $user_name"; } echo " - Week " . $week_number . "</h2>"; print "<p class=\"menu_bar\">"; if ($user_view != NULL) { $user_filter = "&user_view=" . $user_view; } else { $user_filter = NULL; } if ($link_lastmonth > $user_user_added) { echo "<a href=\"popup_timesheet.php?user_view=$viewuser&week=$link_lastmonth".$user_filter."\" class=\"menu_tab\"><< w/b <strong>".date("j M Y",$link_lastmonth)."</strong></a>"; } if (($user_user_added - $link_lastweek) < 604800) { echo "<a href=\"popup_timesheet.php?user_view=$viewuser&week=$link_lastweek".$user_filter."\" class=\"menu_tab\">< w/b <strong>".date("j M Y",$link_lastweek)."</strong></a>"; } echo "<a href=\"popup_timesheet.php?user_view=$viewuser&week=".BeginWeek(time()) . $user_filter."\" class=\"menu_tab\"><strong>This Week</strong></a>"; if ($link_nextweek < time() AND $link_nextweek < $user_user_ended) { echo "<a href=\"popup_timesheet.php?user_view=$viewuser&week=$link_nextweek".$user_filter."\" class=\"menu_tab\">w/b <strong>".date("j M Y",$link_nextweek)." ></strong></a>"; } if ($link_nextmonth < time() AND $link_nextmonth < $user_user_ended) { echo "<a href=\"popup_timesheet.php?user_view=$viewuser&week=$link_nextmonth".$user_filter."\" class=\"menu_tab\">w/b <strong>".date("j M Y",$link_nextmonth)."</strong> >></a>"; } echo "</p>"; if ($_GET[user_view] == $_COOKIE[user] OR $_GET[ts_id] > 0 OR $_GET[user_view] == NULL OR $user_usertype_current > 3 ) { include("inc_files/inc_data_timesheet_edit.php"); } include("inc_files/inc_data_timesheet_list.php");
// Titles $week_begin = date("l, jS F Y",$ts_weekbegin); $time_week_end = $ts_weekbegin + 345600; $week_end = date("l, jS F Y",$time_week_end); $link_lastmonth = $ts_weekbegin - 3024000; $link_lastweek = $ts_weekbegin - 604800; $link_nextweek = $ts_weekbegin + 604800; $link_nextmonth = $ts_weekbegin + 3024000; print " <h2><a href=\"popup_timesheet_mobile.php?week=$link_lastweek".$user_filter."\">< w/b ".date("j M Y",$link_lastweek)."</a></h2>"; if (BeginWeek(time()) != $_GET[week]) { echo "<h2><a href=\"popup_timesheet_mobile.php?week=".BeginWeek(time()) . $user_filter."\">This Week</a></h2>"; } if ($link_nextweek < time()) { echo "<h2><a href=\"popup_timesheet_mobile.php?week=$link_nextweek".$user_filter."\" >w/b ".date("j M Y",$link_nextweek)." ></a>"; } print "<h1>Timesheet, w/b ".TimeFormat($ts_weekbegin); if ($_GET[user_view] > 0) { echo " for $user_name"; } echo "</h1>"; if ($_GET[user_view] == $_COOKIE[user] OR $_GET[ts_id] > 0 OR $_GET[user_view] == NULL) { include("inc_files/inc_data_timesheet_edit.php"); } include("inc_files/inc_data_timesheet_list.php"); print "</div>"; print "</body>";
$beginnning_of_next_year = mktime(12, 0, 0, 1, 1, $year + 1); $beginnning_of_next_year = BeginWeek($beginnning_of_this_year + 60 * 60 * 24 * 7 * 53); $monday = BeginWeek($beginnning_of_this_year) - 43200; $counter_time = $monday; $this_year = $year; if ($user_usertype_current > 3) { echo "<form method=\"post\" action=\"index2.php?page=holiday_approval&year={$year}\"><input type=\"hidden\" value=\"{$_COOKIE['user']}\" name=\"holiday_approved\" /><input type=\"hidden\" value=\"holiday_approve\" name=\"action\" />"; } echo "<table>"; $background = " style=\"background: rgba(200,200,200,0); height: 40px; color: #999\""; echo "<tr><td style=\"width: 10%;\">Week</td><td style=\"width: 18%;\">Monday</td><td style=\"width: 18%;\">Tuesday</td><td style=\"width: 18%;\">Wednesday</td><td style=\"width: 18%;\">Thursday</td><td style=\"width: 18%;\">Friday</td></tr><tr><td {$background}>1</td>"; while ($counter_time < $beginnning_of_next_year) { $counter_date = date("j", $counter_time); $counter_month = date("n", $counter_time); $counter_year = date("Y", $counter_time); $this_week_begin = BeginWeek(time()); $this_week_end = $this_week_begin + 60 * 60 * 24 * 7; $sql_bankholidays = "SELECT bankholidays_description FROM intranet_user_holidays_bank WHERE bankholidays_day = {$counter_date} AND bankholidays_month = {$counter_month} AND bankholidays_year = {$counter_year} LIMIT 1"; $result_bankholidays = mysql_query($sql_bankholidays, $conn); $array_bankholidays = mysql_fetch_array($result_bankholidays); $bankholidays_description = $array_bankholidays['bankholidays_description']; if (date("z", $counter_time) == date("z", time()) && date("Y", $counter_time) == date("Y", time())) { $background = " style=\"background: rgba(200,200,0,1); height: 40px; color: #999\""; } elseif ($counter_year != $this_year) { $background = " style=\"background: rgba(200,200,200,0); height: 40px; color: #999\""; } elseif ($bankholidays_description != NULL) { $background = " style=\"background: rgba(200,200,200,0.5); height: 40px; color: #999\""; } elseif ($counter_time > $this_week_begin && $counter_time < $this_week_end) { $background = " style=\"background: rgba(200,200,0,0.7); height: 40px; color: #999\""; } elseif ($counter_month == 1 or $counter_month == 3 or $counter_month == 5 or $counter_month == 7 or $counter_month == 9 or $counter_month == 11) { $background = " style=\"background: rgba(200,0,200,0.25); height: 40px; color: #999\"";
function TimeSheetListIncomplete($user_id) { global $database_location; global $database_username; global $database_password; global $database_name; global $settings_timesheetstart; global $user_user_added; if ($user_user_added > $settings_timesheetstart) { $timesheet_datum = $user_user_added; } else { $timesheet_datum = $settings_timesheetstart; } $conn = mysql_connect("{$database_location}", "{$database_username}", "{$database_password}"); mysql_select_db("{$database_name}", $conn); $startweek = BeginWeek($timesheet_datum); $this_week = BeginWeek(time()); $sql4 = " SELECT ts_id, ts_user, ts_day, ts_month, ts_year, ts_entry FROM intranet_timesheet WHERE ts_entry > {$startweek} AND ts_entry < {$this_week} AND ts_day_complete != 1 AND ts_user = {$user_id} ORDER BY ts_entry"; $current_day_check = 0; if ($display == "list") { echo "<ul>"; } $result4 = mysql_query($sql4, $conn) or die(mysql_error()); while ($array4 = mysql_fetch_array($result4)) { $ts_hours = $array4['ts_hours']; $ts_entry = BeginWeek($array4['ts_entry']); $ts_check = $array4['ts_day'] . "-" . $array4['ts_month'] . "-" . $array4['ts_year']; $ts_id = $array4['ts_id']; $dayofweek = date("w", $array4['ts_entry']); if ($ts_check != $current_day_check and $dayofweek > 0 and $dayofweek < 6) { echo "<li><a href=\"popup_timesheet.php?week={$ts_entry}&user_view={$user_id}\">" . TimeFormat($array4['ts_entry']) . "</li>"; $current_day_check = $ts_check; } } echo "</ul>"; }
function Datum($start, $duration, $color_array) { global $current_time; global $pdf; global $colwidth; global $rowheight; $y = $pdf->GetY(); $y = $y - $rowheight; $pdf->SetY($y); $pdf->SetX(50); $pdf->SetLineWidth(0.3); $datum_start = BeginWeek(AssessDays($start)); if ($datum_start < $current_time) { $duration = $duration - ($current_time - $datum_start); } $duration = round($duration / 604800, 0) * $colwidth; if ($datum_start < $current_time) { $datum_start = 0; } else { $datum_start = $datum_start - $current_time; } $datum_start = round($datum_start / 604800, 0); $datum_start = $datum_start * $colwidth; if ($datum_start + $duration > 230) { $duration = 230 - $datum_start; } if ($datum_start > 0 && $datum_start < 230) { $pdf->Cell($datum_start, $rowheight, '', 0, 0, L, FALSE); } if ($color_array == NULL) { $pdf->SetDrawColor(100); } else { $pdf->SetDrawColor($color_array[0], $color_array[1], $color_array[2]); } if ($datum_start < 230 && $datum_start + $duration > 0) { $pdf->Cell($duration, $rowheight, '', T, 1, L, FALSE); } else { $pdf->Cell(0, $rowheight, '', 0, 1, L, FALSE); } $pdf->SetLineWidth(0.2); $pdf->SetX(10); }
// Set the week beginning variable from either POST or GET if ($_POST[ts_weekbegin] != NULL) { $ts_weekbegin = $_POST[ts_weekbegin]; } elseif ($_GET[week] != NULL) { $ts_weekbegin = $_GET[week]; } else { $ts_weekbegin = BeginWeek(time()); } // Titles $week_begin = date("l, jS F Y", $ts_weekbegin); $time_week_end = $ts_weekbegin + 345600; $week_end = date("l, jS F Y", $time_week_end); $link_lastmonth = $ts_weekbegin - 3024000; $link_lastweek = $ts_weekbegin - 604800; $link_nextweek = $ts_weekbegin + 604800; $link_nextmonth = $ts_weekbegin + 3024000; print "<h1>Week Beginning " . TimeFormat($ts_weekbegin) . "</h1>"; print "<p class=\"menu_bar\">"; print "\n<a href=\"index2.php?page=timesheet_edit&week={$link_lastmonth}\" class=\"menu_tab\"><< w/b " . date("j/n/y", $link_lastmonth) . "</a>\n<a href=\"index2.php?page=timesheet_edit&week={$link_lastweek}\" class=\"menu_tab\">< w/b " . date("j/n/y", $link_lastweek) . "</a>\n<a href=\"index2.php?page=timesheet_edit&week=" . BeginWeek(time()) . "\" class=\"menu_tab\">This Week</a>\n<a href=\"index2.php?page=timesheet_edit&week={$link_nextweek}\" class=\"menu_tab\">w/b " . date("j/n/y", $link_nextweek) . " ></a>\n<a href=\"index2.php?page=timesheet_edit&week={$link_nextmonth}\" class=\"menu_tab\">w/b " . date("j/n/y", $link_nextmonth) . " >></a>\n</p>"; print "<p>Entries can be edited for up to 2 hours. After this period has expired, entries can only be edited by an administrator. After 4 weeks have expired, timesheet entries to the system cannot be made.</p>"; // Check the amount of time that has passed and print the entry form if it's less than 4 weeks. // if (time() - $ts_weekbegin < 2419200 OR $user_usertype_current > 3) { include "inc_files/inc_data_timesheet_edit.php"; // } // Begin the table entry system print "<h2>Entries for this week</h2>"; include "inc_files/inc_data_timesheet_list.php"; if ($ts_list_total >= 40) { print "<p><a href=\"timesheet_user_pdf.php?week={$ts_entry}\">[print completed timesheet]</a><p>"; }