$ts_print_title = "Schedule for " . $proj_num . " " . $proj_name . "," . $print_submit_begin . " to " . $print_submit_end; $pdf->SetFont($format_font, '', 12); $pdf->MultiCell(0, 6, $ts_print_title, 0, L, 0); // Printed by, and on... $pdf->SetFont($format_font, '', 12); $pdf->SetTextColor(0, 0, 0); $sql = "SELECT user_name_first, user_name_second FROM intranet_user_details WHERE user_id = {$_COOKIE['user']}"; $result = mysql_query($sql, $conn) or die(mysql_error()); $array = mysql_fetch_array($result); $user_name_first = $array['user_name_first']; $user_name_second = $array['user_name_second']; $pdf->SetFont($format_font, '', 8); $printed_on = "Generated " . date("r") . " by " . $user_name_first . " " . $user_name_second; $pdf->SetFont($format_font, '', 6); $pdf->Cell(0, 4, $printed_on, 0, 1, L, 0); $pdf->Ln(); $legend = "Cost (Fa) = Factored cost\nCost (Ho) = Hourly cost\nCost (Fa Acc) = Factored accumulative cost\nCost (Ho Acc) = Hourly accumulative cost\n"; $pdf->MultiCell(0, 3, $legend); $pdf->SetFillColor(220, 220, 220); // Begin the array through all users $sql = "SELECT * FROM intranet_user_details, intranet_timesheet LEFT JOIN intranet_timesheet_fees ON ts_project = ts_fee_stage WHERE ts_user = user_id AND ts_project = '{$proj_submit}' AND ts_entry BETWEEN '{$time_submit_begin}' AND '{$time_submit_end}' ORDER BY ts_stage_fee, ts_fee_time_begin"; $result = mysql_query($sql, $conn) or die(mysql_error()); $current_fee_stage = NULL; $running_cost = 0; $current_id = NULL; $stage_total = 0; $hours_total = 0; function StageTotal() { global $pdf; global $stage_total;