/
timesheet_pdf_2.php
77 lines (42 loc) · 1.86 KB
/
timesheet_pdf_2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
include_once "inc_files/inc_checkcookie.php";
$proj_id = intval($_POST['submit_project']);
if ($user_usertype_current <= 3) { header ("Location: index2.php"); } else {
include_once "inc_files/inc_action_functions_pdf.php";
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_font = "Helvetica";
// 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);
// Determine name of project
ProjectHeading($proj_id,"Timesheet Analysis");
// Printed by, and on...
if (intval($_POST['submit_begin']) > 0 OR (intval($_POST['submit_end']) > 0)) {
if (intval($_POST['submit_begin']) == 0) { $time_submit_begin = 0; } else { $time_submit_begin = DisplayDate($_POST['submit_begin']); }
if (intval($_POST['submit_end']) == 0) { $time_submit_end = time(); } else { $time_submit_end = DisplayDate($_POST['submit_end']); }
$date_period = "Between " . TimeFormat($time_submit_begin) . " and " . TimeFormat($time_submit_end) . ".";
$pdf->Multicell(0,4,$date_period);
}
$pdf->SetFont($format_font,'',12);
$pdf->SetTextColor(0,0,0);
$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 (not factored)\nCost (Fa Acc) = Factored accumulative cost\nCost (Ho Acc) = Hourly accumulative cost (not factored)\n";
if ($_POST['separate_pages'] != 1) {
$pdf->MultiCell(0,3,$legend);
}
$pdf->SetFillColor(220, 220, 220);
PDF_ArrayProjectStages($proj_id);
// and send to output
$file_date = time();
$file_name = GetProjectNum($proj_id) ."_" . DisplayDay(time()) . "_Timesheet_Analysis.pdf";
$pdf->Output($file_name,'I');
}