X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fexcel_report.inc;h=7356da84c3188944cd321901d7a9f496ca59512c;hb=884c36eec7dbaae89e1f5532cc2c2f8033b010fd;hp=aca0e2c7bfa7f004ca4ff1c1e39619e75090091e;hpb=a92ebdde7985571d5ce5e9777b5b436ec3cec110;p=fa-stable.git diff --git a/reporting/includes/excel_report.inc b/reporting/includes/excel_report.inc index aca0e2c7..7356da84 100644 --- a/reporting/includes/excel_report.inc +++ b/reporting/includes/excel_report.inc @@ -53,12 +53,13 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook var $formatHeaderRight; var $formatFooter; var $formatAmount = array(); + var $headerFunc; var $sheet; function FrontReport($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = 6.5) { - global $comp_path, $dateseps, $page_security; + global $dateseps, $page_security; if (!$_SESSION["wa_current_user"]->can_access_page($page_security)) { display_error(_("The security settings on your account do not permit you to print this report")); @@ -71,14 +72,14 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $this->endLine = 760; $this->fontSize = $fontsize; $this->oldFontSize = 0; - $this->y = 1; + $this->y = 0; $this->currency = ''; $this->excelColWidthFactor = $excelColWidthFactor; $rtl = ($_SESSION['language']->dir == 'rtl'); $this->code = strtolower($_SESSION['language']->encoding); $this->filename = $filename.".xls"; $this->unique_name = uniqid('').".xls"; - $this->path = $comp_path.'/'.user_company(). '/pdf_files'; + $this->path = company_path(). '/pdf_files'; $this->Spreadsheet_Excel_Writer_Workbook($this->path."/".$this->unique_name); //$this->setCountry(48); if ($this->code != "iso-8859-1") @@ -166,9 +167,16 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $this->formatFooter =& $this->addFormat(); $this->formatFooter->setTop(2); $this->formatFooter->setTopColor('gray'); + $this->SetHeaderType("header"); } + /* + Set header handler + */ + function SetHeaderType($name) { + $this->headerFunc = $name; + } // Check a given name to see if it's a valid Excel worksheet name, // and fix if necessary function worksheetNameGenerator($name) @@ -237,7 +245,6 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function Header() { - $this->y = 0; $tcol = $this->numcols - 1; $this->sheet->setRow($this->y, 20); for ($i = 0; $i < $this->numcols; $i++) @@ -524,6 +531,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function TextCol($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0) { + $txt = html_entity_decode($txt); if ($this->aligns[$c] == 'right') $this->sheet->writeString($this->y, $c, $txt, $this->formatRight); else @@ -557,6 +565,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function TextCol2($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0) { + $txt = html_entity_decode($txt); $this->sheet->writeString($this->y, $c, $txt, $this->formatLeft); if ($n - $c > 1) $this->sheet->mergeCells($this->y, $c, $this->y, $n - 1); @@ -633,7 +642,8 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function NewPage() { - return; + if (method_exists($this, $this->headerFunc)) // draw predefined page layout if any + $this->{$this->headerFunc}(); } function ymd2Date($year, $mon, $day) // XLS internal date representation is a number between 1900-01-01 and 2078-12-31 @@ -678,6 +688,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function End($email=0, $subject=null, $myrow=null, $doctype = 0) { + ++$this->y; for ($i = 0; $i < $this->numcols; $i++) $this->sheet->writeBlank($this->y, $i, $this->formatFooter); $this->sheet->mergeCells($this->y, 0, $this->y, $this->numcols - 1);