+ // Alternate header style - primary differences are for PDFs
+ function Header3()
+ {
+ // Flag to make sure we only print the company name once
+ $companyNamePrinted = false;
+
+ $this->y = 0;
+ $tcol = $this->numcols - 1;
+ $this->sheet->setRow($this->y, 20);
+ // Title
+ for ($i = 0; $i < $this->numcols; $i++)
+ $this->sheet->writeBlank($this->y, $i, $this->formatTitle);
+ $this->sheet->writeString($this->y, 0, $this->title, $this->formatTitle);
+ $this->sheet->mergeCells($this->y, 0, $this->y, $tcol);
+
+ // Dimension 1 - optional
+ // - only print if available and not blank
+ if (count($this->params) > 3)
+ if ($this->params[3]['from'] != '')
+ {
+ $this->NewLine();
+ $str = $this->params[3]['text'] . ':';
+ $this->sheet->writeString($this->y, 0, $str, $this->formatLeft);
+ $this->sheet->writeString($this->y, 1, $this->params[3]['from'], $this->formatLeft);
+ // Company Name - at end of this row
+ if (!$companyNamePrinted)
+ {
+ $this->sheet->writeString($this->y, $tcol-1, $this->company['coy_name'], $this->formatLeft);
+ $this->sheet->mergeCells($this->y, $tcol-1, $this->y, $tcol);
+ $companyNamePrinted = true;
+ }
+ }
+
+
+ // Dimension 2 - optional
+ // - only print if available and not blank
+ if (count($this->params) > 4)
+ if ($this->params[4]['from'] != '')
+ {
+ $this->NewLine();
+ $str = $this->params[4]['text'] . ':';
+ $this->sheet->writeString($this->y, 0, $str, $this->formatLeft);
+ $this->sheet->writeString($this->y, 1, $this->params[4]['from'], $this->formatLeft);
+ // Company Name - at end of this row
+ if (!$companyNamePrinted)
+ {
+ $this->sheet->writeString($this->y, $tcol-1, $this->company['coy_name'], $this->formatLeft);
+ $this->sheet->mergeCells($this->y, $tcol-1, $this->y, $tcol);
+ $companyNamePrinted = true;
+ }
+ }
+
+ // Tags - optional
+ // TBD!!!
+
+ // Report Date - time period covered
+ // - can specify a range, or just the end date (and the report contents
+ // should make it obvious what the beginning date is)
+ $this->NewLine();
+ $str = _("Report Date") . ':';
+ $this->sheet->writeString($this->y, 0, $str, $this->formatLeft);
+ $str = '';
+ if ($this->params[1]['from'] != '')
+ $str = $this->params[1]['from'] . ' - ';
+ $str .= $this->params[1]['to'];
+ $this->sheet->writeString($this->y, 1, $str, $this->formatLeft);
+ // Company Name - at end of this row
+ if (!$companyNamePrinted)
+ {
+ $this->sheet->writeString($this->y, $tcol-1, $this->company['coy_name'], $this->formatLeft);
+ $this->sheet->mergeCells($this->y, $tcol-1, $this->y, $tcol);
+ $companyNamePrinted = true;
+ }
+
+ // Timestamp of when this copy of the report was generated
+ $this->NewLine();
+ $str = _("Generated At") . ':';
+ $this->sheet->writeString($this->y, 0, $str, $this->formatLeft);
+ $this->sheet->writeString($this->y, 1, Today() . " ".Now(), $this->formatLeft);
+
+ // Name of the user that generated this copy of the report
+ $this->NewLine();
+ $str = _("Generated By") . ':';
+ $this->sheet->writeString($this->y, 0, $str, $this->formatLeft);
+ $str = $this->user;
+ $this->sheet->writeString($this->y, 1, $str, $this->formatLeft);
+
+ // Comments - display any user-generated comments for this copy of the report
+ if ($this->params[0] != '')
+ {
+ $this->NewLine();
+ $str = _("Comments") . ':';
+ $this->sheet->writeString($this->y, 0, $str, $this->formatLeft);
+ $this->sheet->writeString($this->y, 1, $this->params[0], $this->formatLeft);
+ }
+ $this->NewLine();
+
+ if ($this->headers2 != null)
+ {
+ for ($i = 0, $j = 0; $i < $this->numcols; $i++)
+ {
+ if ($this->cols2[$j] >= $this->cols[$i] && $this->cols2[$j] <= $this->cols[$i + 1])
+ {
+ if ($this->aligns2[$j] == "right")
+ $this->sheet->writeString($this->y, $i, $this->headers2[$j], $this->formatTopHeaderRight);
+ else
+ $this->sheet->writeString($this->y, $i, $this->headers2[$j], $this->formatTopHeaderLeft);
+ $j++;
+ }
+ else
+ $this->sheet->writeString($this->y, $i, "", $this->formatTopHeaderLeft);
+ }
+ $this->NewLine();
+ }
+
+ for ($i = 0; $i < $this->numcols; $i++)
+ {
+ if (!isset($this->headers[$i]))
+ $header = "";
+ else
+ $header = $this->headers[$i];
+ if ($this->aligns[$i] == "right")
+ if ($this->headers2 == null)
+ $this->sheet->writeString($this->y, $i, $header, $this->formatHeaderRight);
+ else
+ $this->sheet->writeString($this->y, $i, $header, $this->formatBottomHeaderRight);
+ else
+ if ($this->headers2 == null)
+ $this->sheet->writeString($this->y, $i, $header, $this->formatHeaderLeft);
+ else
+ $this->sheet->writeString($this->y, $i, $header, $this->formatBottomHeaderLeft);
+ }
+ $this->NewLine();
+ }
+
+ /**
+ * Format a numeric string date into something nicer looking.
+ *
+ * @param string $date Date string to be formatted.
+ * @param int $input_format Format of the input string. Possible values are:<ul><li>0: user's default (default)</li></ul>
+ * @param int $output_format Format of the output string. Possible values are:<ul><li>0: Month (word) Day (numeric), 4-digit Year - Example: January 1, 2000 (default)</li><li>1: Month 4-digit Year - Example: January 2000</li><li>2: Month Abbreviation 4-digit Year - Example: Jan 2000</li></ul>
+ * @access public
+ */
+ function DatePrettyPrint($date, $input_format = 0, $output_format = 0)
+ {
+ if ($date != '')
+ {
+ $date = date2sql($date);
+ $year = (int) (substr($date, 0, 4));
+ $month = (int) (substr($date, 5, 2));
+ $day = (int) (substr($date, 8, 2));
+ if ($output_format == 0)
+ return(date('F j, Y', mktime(12, 0, 0, $month, $day, $year)));
+ elseif ($output_format == 1)
+ return(date('F Y', mktime(12, 0, 0, $month, $day, $year)));
+ elseif ($output_format == 2)
+ return(date('M Y', mktime(12, 0, 0, $month, $day, $year)));
+ }
+ else
+ return $date;
+ }
+