+ define('COMPANY_WIDTH', 150);
+ define('LOGO_HEIGHT', 50);
+ define('LOGO_Y_POS_ADJ_FACTOR', 0.74);
+ define('LABEL_WIDTH', 80);
+ define('PAGE_NUM_WIDTH', 60);
+ define('TITLE_FONT_SIZE', 14);
+ define('HEADER1_FONT_SIZE', 10);
+ define('HEADER2_FONT_SIZE', 9);
+ define('FOOTER_FONT_SIZE', 10);
+ define('FOOTER_MARGIN', 4);
+ }
+ // Set some variables which control header item layout
+ $companyCol = $this->endLine - COMPANY_WIDTH;
+ $headerFieldCol = $this->leftMargin + LABEL_WIDTH;
+ $pageNumCol = $this->endLine - PAGE_NUM_WIDTH;
+ $footerCol = $this->leftMargin + PAGE_NUM_WIDTH;
+ $footerRow = $this->bottomMargin - FOOTER_MARGIN;
+
+ // Calling this function generates a new PDF page after the first instance
+// {
+// // TODO: experimenting with line drawing to highlight current period
+// $this->SetLineWidth(1);
+// $this->LineTo($this->cols[3], 33, $this->cols[3], 534);
+// $this->LineTo($this->cols[4], 33, $this->cols[4], 534);
+// $this->SetLineWidth(0.1);
+
+// $this->newPage();
+// }
+ $this->row = $this->pageHeight - $this->topMargin;
+
+ // Set the color of dividing lines we'll draw
+ $oldDrawColor = $this->GetDrawColor();
+ $this->SetDrawColor(128, 128, 128);
+
+ // Tell TCPDF that we want to use its alias system to track the total number of pages
+ $this->AliasNbPages();
+
+ // Footer
+ if ($this->footerEnable)
+ {
+ $this->Line($footerRow, 1);
+ $prevFontSize = $this->fontSize;
+ $this->fontSize = FOOTER_FONT_SIZE;
+ $this->TextWrap($footerCol, $footerRow - ($this->fontSize + 1),
+ $pageNumCol - $footerCol, $this->footerText, $align = 'center',
+ $border = 0, $fill = 0, $link = NULL, $stretch = 1);
+ $this->TextWrap($pageNumCol, $footerRow - ($this->fontSize + 1),
+ PAGE_NUM_WIDTH, _("Page") . ' ' . $this->pageNumber . '/' . $this->getAliasNbPages(),
+ $align = 'right', $border = 0, $fill = 0, $link = NULL, $stretch = 1);
+ $this->fontSize = $prevFontSize;
+ }
+
+ //
+ // Header
+ //
+
+ // Print gray line across the page
+ $this->Line($this->row + 8, 1);
+
+ $this->NewLine();
+
+ // Print the report title nice and big
+ $oldFontSize = $this->fontSize;
+ $this->fontSize = TITLE_FONT_SIZE;
+ $this->Font('B');
+ $this->Text($this->leftMargin, $this->title, $companyCol);
+ $this->fontSize = HEADER1_FONT_SIZE;
+
+ // Print company logo if present and requested, or else just print company name
+ // Build a string specifying the location of the company logo file
+ $logo = company_path() . "/images/" . $this->company['coy_logo'];
+ if ($this->companyLogoEnable && ($this->company['coy_logo'] != '') && file_exists($logo))
+ {
+ // Width being zero means that the image will be scaled to the specified height
+ // keeping its aspect ratio intact.
+ if ($this->scaleLogoWidth)
+ $this->AddImage($logo, $companyCol, $this->row + 15, COMPANY_WIDTH, 0);
+ else
+ $this->AddImage($logo, $companyCol, $this->row - (LOGO_HEIGHT * LOGO_Y_POS_ADJ_FACTOR), 0, LOGO_HEIGHT);