X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fexcel_report.inc;h=3786a91aaf9d92bcba4522a2096473deac9dc390;hb=366a3ecbcd7841413f980f9e1d65895b77af1b82;hp=7d1379b43676d9bb45929b6173ac95cfed7ad060;hpb=1571869d54be48452fdbe08f25130972ff0a7b5a;p=fa-stable.git diff --git a/reporting/includes/excel_report.inc b/reporting/includes/excel_report.inc index 7d1379b4..3786a91a 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 { @@ -61,7 +62,8 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function FrontReport($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = 6.5) { - global $dateseps, $page_security; + global $SysPrefs, $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")); @@ -80,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); 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) @@ -99,7 +100,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $this->formatTitle->setTopColor('gray'); $how = user_date_format(); - $sep = $dateseps[user_date_sep()]; + $sep = $SysPrefs->dateseps[user_date_sep()]; if ($sep == '.') $sep = "\\."; if ($how == 0) @@ -197,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"; @@ -225,7 +223,6 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function Info($params, $cols, $headers, $aligns, $cols2 = null, $headers2 = null, $aligns2 = null) { - global $app_title, $version, $power_by, $power_url; $this->company = get_company_prefs(); $year = get_current_fiscalyear(); if ($year['closed'] == 0) @@ -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() @@ -695,6 +703,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook function End($email=0, $subject='') { + global $path_to_root; ++$this->y; for ($i = 0; $i < $this->numcols; $i++) $this->sheet->writeBlank($this->y, $i, $this->formatFooter); @@ -720,4 +729,3 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook } } -?> \ No newline at end of file