X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fexcel_report.inc;h=1ee91c703076d348a48c0b99ba502bb0fbd45898;hb=a2bd6e80fbe669ca10c3936bb5373994fe8e4918;hp=f139ba836465caa053f39ee787d1316b95341c25;hpb=5e63c6ace55729bbb5ee3b060035a25a4426eb0a;p=fa-stable.git diff --git a/reporting/includes/excel_report.inc b/reporting/includes/excel_report.inc index f139ba83..1ee91c70 100644 --- a/reporting/includes/excel_report.inc +++ b/reporting/includes/excel_report.inc @@ -13,6 +13,7 @@ include_once($path_to_root . "/reporting/includes/Workbook.php"); include_once($path_to_root . "/admin/db/company_db.inc"); include_once($path_to_root . "/admin/db/fiscalyears_db.inc"); include_once($path_to_root . "/config.php"); +define('MAX_ROW_SHEET', 65530); // xls version class FrontReport extends Spreadsheet_Excel_Writer_Workbook { @@ -59,7 +60,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook var $sheet; - function FrontReport($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = 6.5) + function __construct($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = 6.5) { global $SysPrefs, $page_security; @@ -81,13 +82,12 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $rtl = ($_SESSION['language']->dir == 'rtl'); $this->code = strtolower($_SESSION['language']->encoding); $this->filename = $filename.".xls"; - $this->unique_name = uniqid('').".xls"; + $this->unique_name = random_id().".xls"; $this->path = company_path(). '/pdf_files'; - $this->Spreadsheet_Excel_Writer_Workbook($this->path."/".$this->unique_name); - //$this->setCountry(48); + parent::__construct($this->path."/".$this->unique_name); if ($this->code != "iso-8859-1") $this->setVersion(8); // set biff version to 8 (0x0006 internal) - $this->sheet =& $this->addWorksheet($this->worksheetNameGenerator($this->title)); + $this->sheet = $this->addWorksheet($this->worksheetNameGenerator($this->title)); if ($this->code != "iso-8859-1") $this->sheet->setInputEncoding($this->code); // set sheet encoding if ($rtl) @@ -198,10 +198,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook { if (!isset($this->formatAmount[$dec])) { - //global $thoseps,$decseps; $dec = (int)$dec; - //$tsep = $thoseps[user_tho_sep()]; - //$dsep = $decseps[user_dec_sep()]; $tsep = ','; $dsep = '.'; $format = "###{$tsep}###{$tsep}###{$tsep}##0"; @@ -243,7 +240,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $this->headers2 = $headers2; $this->aligns2 = $aligns2; $this->numcols = count($this->headers); - $tcols = count($this->headers2); + $tcols = count_array($this->headers2); if ($tcols > $this->numcols) $this->numcols = $tcols; for ($i = 0; $i < $this->numcols; $i++) @@ -645,6 +642,17 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function NewLine($l=1, $np=0, $h=NULL) { $this->y += $l; + if ($this->y > MAX_ROW_SHEET) + { + $this->y = 0; + $this->sheet = $this->addWorksheet(); + if ($this->code != "iso-8859-1") + $this->sheet->setInputEncoding($this->code); // set sheet encoding + if ($_SESSION['language']->dir == 'rtl') + $this->sheet->setRTL(); + for ($i = 0; $i < $this->numcols; $i++) + $this->sheet->setColumn($i, $i, $this->px2units($this->cols[$i + 1] - $this->cols[$i])); + } } function NewPage()