$format_ln_r = "220"; $format_ln_g = "220"; $format_ln_b = "220"; $current_date = TimeFormat(time()); $proj_id = CleanUp($_GET[proj_id]); // Begin creating the page //Page Title $sql_proj = "SELECT * FROM intranet_projects WHERE proj_id = {$proj_id} LIMIT 1"; $result_proj = mysql_query($sql_proj, $conn) or die(mysql_error()); $array_proj = mysql_fetch_array($result_proj); $proj_num = $array_proj['proj_num']; $proj_name = $array_proj['proj_name']; $sheet_title = "Project Checklist"; $pdf->SetXY(10, 45); $pdf->SetFont($format_font, '', 24); $pdf->SetTextColor(0, 0, 0); $pdf->SetDrawColor(0, 0, 0); $pdf->Cell(0, 10, $sheet_title); $pdf->SetXY(10, 55); $pdf->SetFont($format_font, '', 14); $sheet_subtitle = $proj_num . " " . $proj_name; $sheet_date = "Current at " . $current_date; $pdf->Cell(0, 7.5, $sheet_subtitle, 0, 1, L, 0); $pdf->Cell(0, 7.5, $sheet_date, 0, 1, L, 0); $pdf->SetXY(10, 70); $pdf->SetLineWidth(0.5); $sql_checklist = "SELECT * FROM intranet_project_checklist_items LEFT JOIN intranet_project_checklist ON checklist_item = item_id AND checklist_project = {$proj_id} WHERE checklist_required != 1 ORDER BY item_group, item_order, checklist_date DESC, item_name"; $result_checklist = mysql_query($sql_checklist, $conn) or die(mysql_error()); $y = $pdf->GetY() + 10; $pdf->SetY($y); $pdf->SetTextColor(0, 0, 0);
$nowtime = time(); $sql_complete = "SELECT invoice_id FROM intranet_timesheet_invoice WHERE invoice_date < {$nowtime} {$account_test} ORDER BY {$order_by}"; $result_complete = mysql_query($sql_complete, $conn) or die(mysql_error()); } else { $nowtime = time(); $sql_complete = "SELECT invoice_id FROM intranet_timesheet_invoice WHERE invoice_id = {$invoice_id} LIMIT 1"; $result_complete = mysql_query($sql_complete, $conn) or die(mysql_error()); } while ($array_complete = mysql_fetch_array($result_complete)) { $invoice_id = $array_complete['invoice_id']; $pdf->addPage(); $pdf->useTemplate($tplidx, 0, 0, 210, 297); // Begin creating the page $project_counter = 1; $page_count = 1; $pdf->SetTextColor($format_bg_r, $format_bg_g, $format_bg_b); // Get the relevant infomation from the Invoice Database $sql_invoice = "SELECT * FROM intranet_timesheet_invoice WHERE invoice_id = '{$invoice_id}' LIMIT 1"; $result_invoice = mysql_query($sql_invoice, $conn) or die(mysql_error()); $array_invoice = mysql_fetch_array($result_invoice); $invoice_ref = $array_invoice['invoice_ref']; $invoice_date = $array_invoice['invoice_date']; $invoice_due = $array_invoice['invoice_due']; $invoice_project = $array_invoice['invoice_project']; $invoice_paid = $array_invoice['invoice_paid']; $invoice_notes = $array_invoice['invoice_notes']; $invoice_account = $array_invoice['invoice_account']; $invoice_client = $array_invoice['invoice_client']; $invoice_purchase_order = $array_invoice['invoice_purchase_order']; $invoice_text = InvoiceDueDays($array_invoice['invoice_text'], $invoice_due, $invoice_date); $invoice_due_days = $invoice_due - $invoice_date;
} // Use FDPI to get the template define('FPDF_FONTPATH', 'fpdf/font/'); require 'fpdf/fpdi.php'; $pdf = new fpdi(); $pagecount = $pdf->setSourceFile("pdf/template.pdf"); $tplidx = $pdf->ImportPage(1); $pdf->addPage(); $pdf->useTemplate($tplidx, 0, 0, 210, 297); $pdf->AddFont($format_font, '', $format_font_2); // Begin creating the page //Page Title $sheet_title = "Verified Expenses, " . date("j F Y, g:i a", $ts_expense_verified); $pdf->SetXY(10, 45); $pdf->SetFont($format_font, '', 26); $pdf->SetTextColor(200, 200, 200); $pdf->Cell(0, 10, $sheet_title); $pdf->SetXY(10, 55); $pdf->SetFont($format_font, '', 12); // Columnn Headings $pdf->SetTextColor(220, 220, 220); $pdf->SetFont($format_font, '', 8); $pdf->Cell(10, 4, "ID", 0, 0, L, 0); $pdf->Cell(20, 4, "Date", 0, 0, L, 0); $pdf->Cell(15, 4, "Project", 0, 0, L, 0); $pdf->Cell(55, 4, "Description", 0, 0, L, 0); $pdf->Cell(20, 4, "Date Verified", 0, 0, L, 0); $pdf->Cell(25, 4, "Invoice (ID)", 0, 0, L, 0); $pdf->Cell(15, 4, "Net.", 0, 0, R, 0); $pdf->Cell(15, 4, "VAT", 0, 0, R, 0); $pdf->Cell(15, 4, "Gross.", 0, 1, R, 0);
// Use FDPI to get the template define('FPDF_FONTPATH', 'fpdf/font/'); require 'fpdf/fpdi.php'; $pdf = new fpdi(); $pagecount = $pdf->setSourceFile("pdf/template.pdf"); $tplidx = $pdf->ImportPage(1); $pdf->addPage(); $pdf->useTemplate($tplidx); $pdf->SetAutoPageBreak(0, 1.5); $pdf->AddFont($format_font, '', $format_font_2); // Page headers $project_counter = 1; $page_count = 1; $pdf->SetY(35); $pdf->SetFont('Helvetica', 'b', 24); $pdf->SetTextColor($format_bg_r, $format_bg_g, $format_bg_b); $pdf->Cell(0, 10, "Timesheet Analysis"); $pdf->SetTextColor(0, 0, 0); $pdf->SetY(50); $pdf->SetFont('Helvetica', 'b', 18); $print_title = "Generated " . TimeFormatDetailed(time()); $print_envelope = "Timesheet Datum: " . TimeFormat($settings_timesheetstart); $pdf->SetFillColor(220, 220, 220); $pdf->MultiCell(0, 8, $print_title, 0, L, 0); $pdf->SetFont('Helvetica', 'b', 12); $pdf->MultiCell(0, 5, $print_envelope, 0, L, 0); $pdf->MultiCell(0, 5, $print_profit_text, 0, L, 0); $pdf->Cell(0, 5, '', 0, 2); $pdf->SetFont($format_font, '', 10); $pdf->SetTextColor(0, 0, 0); // Array through the projects and fee stages
$user_name_first = $array_project['user_name_first']; $user_name_second = $array_project['user_name_second']; if ($blog_type == "phone") { $blog_type_view = "Telephone Call"; } elseif ($blog_type == "filenote") { $blog_type_view = "File Note"; } elseif ($blog_type == "meeting") { $blog_type_view = "Meeting Note"; } elseif ($blog_type == "email") { $blog_type_view = "Email Message"; } else { $blog_type_view = NULL; $type = 0; } $blog_type_view = $blog_type_view . " - " . $user_name_first . " " . $user_name_second; $pdf->SetXY(10, 45); $pdf->SetFont($format_font, '', 14); $pdf->SetTextColor(200, 200, 200); $sheet_subtitle = $proj_num . " " . $proj_name . ", " . TimeFormat($blog_date); $pdf->Cell(0, 7.5, $sheet_subtitle, 0, 1, L, 0); $pdf->Cell(0, 7.5, $blog_type_view, 0, 1, L, 0); $pdf->SetFont($format_font, '', 24); $pdf->SetTextColor(150, 150, 150); $pdf->MultiCell(0, 8, $blog_title, 0, L); $pdf->SetXY(40, 85); $pdf->SetFont($format_font, '', 11); $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(0, 5, $blog_text, 0, L); // and send to output $file_name = $proj_num . "_" . Date("Y", $blog_date) . "-" . Date("m", $blog_date) . "-" . Date("d", $blog_date) . "_" . $blog_type . ".pdf"; $pdf->Output($file_name, I);
// Now add the first page $pdf->addPage(); if ($import_template == "1") { $pdf->useTemplate($tplidx, 0, 0, 210, 297); } $pdf->AddFont('century', '', 'Century.php'); $pdf->AddFont('franklingothicbook', '', 'franklingothicbook.php'); $pdf->AddFont('gillsans', '', 'gillsans.php'); $pdf->SetMargins(0, 0); $pdf->SetAutoPageBreak("no"); // Create the sheet header $pdf->SetFont("arial", '', $label_j); $label_print_date = $label_title . ", created " . date("jS M y", time()); $label_url = "http://labelstudio.redcitrus.com"; $pdf->SetFontSize(8); $pdf->SetTextColor(190, 190, 190); $pdf->Cell(0, 5, $label_print_date, 0, 1, L, 0, $label_url); $pdf->SetFont($font, '', $label_j); $pdf->SetTextColor(0, 0, 0); $pdf->SetFontSize($label_j); if ($_GET[labeltype] != NULL) { $labeltype = $_GET[labeltype]; } else { $labeltype = 1; } // Begin the array $count_cells = 0; $count_rows = 1; $count_columns = 1; $total_cells = $label_g * $label_h; $count = 1;
// Reset all the counters $invoice_value_novat_month_all = 0; $invoice_value_vat_month_all = 0; $invoice_value_novat_total_all = 0; $invoice_value_vat_total_all = 0; $thismonth = 0; $thisyear = 0; $invoice_year_novat = 0; $invoice_year_vat = 0; $total_12month_novat = array("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"); $total_12month_vat = array("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"); //Page Title $sheet_title = "Invoice Summary, " . date("j F Y", time()); $pdf->SetXY(10, 45); $pdf->SetFont($format_font, '', 26); $pdf->SetTextColor(200, 200, 200); $pdf->Cell(0, 10, $sheet_title); $pdf->SetXY(10, 60); // Get the relevant infomation from the Invoice Database $sql_invoice = "SELECT * FROM intranet_timesheet_invoice ORDER BY {$date_type}, invoice_ref"; $result_invoice = mysql_query($sql_invoice, $conn) or die(mysql_error()); while ($array_invoice = mysql_fetch_array($result_invoice)) { $invoice_id = $array_invoice['invoice_id']; $invoice_ref = $array_invoice['invoice_ref']; $invoice_date = $array_invoice['invoice_date']; $invoice_due = $array_invoice['invoice_due']; $invoice_project = $array_invoice['invoice_project']; $invoice_paid = $array_invoice['invoice_paid']; $invoice_account = $array_invoice['invoice_account']; $invoice_month = date("n", $invoice_date); $invoice_year = date("Y", $invoice_date);
$format_font = "franklingothicbook"; $format_font_2 = "franklingothicbook.php"; } // Use FDPI to get the template define('FPDF_FONTPATH', 'fpdf/font/'); require 'fpdf/fpdi.php'; $pdf = new fpdi(); $pagecount = $pdf->setSourceFile("pdf/template.pdf"); $tplidx = $pdf->ImportPage(1); $pdf->addPage(); $pdf->useTemplate($tplidx, 0, 0, 210, 297); $pdf->AddFont($format_font, '', $format_font_2); $pdf->SetY(50); $pdf->SetFont($format_font, '', 16); // Printed by, and on... $pdf->SetTextColor(180, 180, 180); $ts_print_title = "Timesheets"; $pdf->MultiCell(0, 6, $ts_print_title, 0, L, 0); $sql = "SELECT user_name_first, user_name_second FROM intranet_user_details WHERE user_id = {$user_id}"; $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, '', 10); $printed_on = "Generated " . date("r") . " by " . $user_name_first . " " . $user_name_second; $pdf->Cell(0, 10, $printed_on, 0, 1, L, 0); $pdf->SetFillColor(220, 220, 220); $pdf->SetTextColor(0, 0, 0); // Begin the array through all users $sql = "SELECT * FROM intranet_projects, intranet_timesheet LEFT JOIN intranet_timesheet_fees ON ts_fee_id = ts_stage_fee WHERE ts_project = proj_id AND ts_user = {$user_id} ORDER BY ts_entry, proj_num, ts_fee_stage "; $result = mysql_query($sql, $conn) or die(mysql_error());
$set_format = $array_set['set_format']; $set_comment = $array_set['set_comment']; $set_checked = $array_set['set_checked']; if ($set_checked > 0) { $sql_set_checked = "SELECT user_initials FROM intranet_user_details WHERE user_id = {$set_checked} LIMIT 1"; $result_set_checked = mysql_query($sql_set_checked, $conn) or die(mysql_error()); $array_set_checked = mysql_fetch_array($result_set_checked); $user_checked_initials = $array_set_checked['user_initials']; } else { $user_checked_initials = "None"; } $user_name = $array_set['user_initials']; $sheet_title = "Drawing Issue Sheet"; $pdf->SetXY(10, 45); $pdf->SetFont($format_font, '', 24); $pdf->SetTextColor(0, 0, 0); $pdf->SetDrawColor(0, 0, 0); $pdf->Cell(0, 10, $sheet_title); $pdf->SetXY(10, 55); $pdf->SetFont($format_font, '', 14); $sheet_subtitle = $proj_num . " " . $proj_name . ", " . $set_date; $pdf->Cell(0, 10, $sheet_subtitle, 0, 1, L, 0); $pdf->SetXY(10, 70); $pdf->SetDrawColor(0, 0, 0); $pdf->SetFont("Helvetica", 'B', 8); $pdf->Cell(40, 5, "Purpose of Issue", 0, 0, L, 0); $pdf->Cell(30, 5, "Method of Issue", 0, 0, L, 0); $pdf->Cell(30, 5, "Format", 0, 0, L, 0); $pdf->Cell(30, 5, "Issued By", 0, 0, L, 0); $pdf->Cell(30, 5, "Checked By", 0, 0, L, 0); $pdf->Cell(30, 5, "ID", 0, 1, L, 0);
$pdf->addPage(); $pdf->useTemplate($tplidx, 0, 0, 210, 297); $pdf->AddFont($format_font, '', $format_font_2); // Begin creating the page //Page Title $sql_name = "SELECT user_name_first, user_name_second, user_initials FROM intranet_user_details WHERE user_id = {$user_id} LIMIT 1"; $result_name = mysql_query($sql_name, $conn) or die(mysql_error()); $array_name = mysql_fetch_array($result_name); $user_name_first = $array_name['user_name_first']; $user_name_second = $array_name['user_name_second']; $user_initials = $array_name['user_initials']; $sheet_title = "Expenses Claim, " . date("j F Y", time()); $user_name = $user_name_first . " " . $user_name_second . " (" . $user_initials . ")"; $pdf->SetXY(10, 45); $pdf->SetFont($format_font, '', 16); $pdf->SetTextColor(0); $pdf->Cell(0, 7, $sheet_title, 0, 1); $pdf->Cell(0, 6, $user_name, 0, 1); $pdf->SetFont($format_font, '', 12); $pdf->Cell(0, 6, '', 0, 1); // Columnn Headings $pdf->SetTextColor(150); $pdf->SetFont($format_font, '', 8); $pdf->Cell(10, 4, "ID", 0, 0, L, 0); $pdf->Cell(20, 4, "Date", 0, 0, L, 0); $pdf->Cell(15, 4, "Project", 0, 0, L, 0); $pdf->Cell(100, 4, "Description", 0, 0, L, 0); $pdf->Cell(15, 4, "Net.", 0, 0, R, 0); $pdf->Cell(15, 4, "VAT", 0, 0, R, 0); $pdf->Cell(15, 4, "Gross.", 0, 1, R, 0); $pdf->SetTextColor(0, 0, 0);