From 347d7b0b441f39e0fd54bcdd9a355aad52322040 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 22 Dec 2009 16:56:37 +0000 Subject: [PATCH] Some additional changes in pdf_report.inc for supporting report extensions. --- CHANGELOG.txt | 1 + reporting/includes/excel_report.inc | 6 ++++-- reporting/includes/pdf_report.inc | 18 ++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index fc24d638..56cdaa87 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -22,6 +22,7 @@ $ -> Affected files 22-Dec-2009 Joe Hunt ! Some additional changes in pdf_report.inc for supporting report extensions. $ /reporting/includes/pdf_report.inc + /reporting/includes/excel_report.inc 21-Dec-2009 Chaitanya/Janusz Dobrowolski # [0000184] Bad source document quantities update and invalid qtys during diff --git a/reporting/includes/excel_report.inc b/reporting/includes/excel_report.inc index dde397bd..f9065cea 100644 --- a/reporting/includes/excel_report.inc +++ b/reporting/includes/excel_report.inc @@ -43,6 +43,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook var $y; var $numcols; var $excelColWidthFactor; + var $endLine; var $formatTitle; var $formatDateTime; @@ -66,6 +67,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $this->size = $size; $this->title = $title; $this->lineHeight = 12; + $this->endLine = 760; $this->fontSize = $fontsize; $this->oldFontSize = 0; $this->y = 1; @@ -529,14 +531,14 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $this->sheet->mergeCells($this->y, $c, $this->y, $n - 1); } - function AmountCol($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0) + function AmountCol($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $color_red=false) { if (!is_numeric($txt)) $txt = 0; $this->sheet->writeNumber($this->y, $c, $txt, $this->NumFormat($dec)); } - function AmountCol2($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $amount_locale = NULL, $amount_format = NULL) + function AmountCol2($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $color_red=false, $amount_locale = NULL, $amount_format = NULL) { if (!is_numeric($txt)) $txt = 0; diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 05942eca..b17d5700 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -716,15 +716,25 @@ class FrontReport extends Cpdf return $this->TextWrap($this->cols[$c], $this->row - $r, $this->cols[$n] - $this->cols[$c] + $corr, $txt, $this->aligns[$c], $border, $fill, $link, $stretch); } - function AmountCol($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0) + function AmountCol($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $color_red=false) { - return $this->TextCol($c, $n, number_format2($txt, $dec), $corr, $r, $border, $fill, $link, $stretch); + if ($color_red && $txt < 0) + $this->SetTextColor(255, 0, 0); + $ret = $this->TextCol($c, $n, number_format2($txt, $dec), $corr, $r, $border, $fill, $link, $stretch); + if ($color_red && $txt < 0) + $this->SetTextColor(0, 0, 0); + return $ret; } - function AmountCol2($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $amount_locale = 'en_US.UTF-8', $amount_format = '%(!.2n') + function AmountCol2($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $color_red=false, $amount_locale = 'en_US.UTF-8', $amount_format = '%(!.2n') { setlocale(LC_MONETARY, $amount_locale); - return $this->TextCol($c, $n, money_format($amount_format, $txt), $corr, $r, $border, $fill, $link, $stretch); + if ($color_red && $txt < 0) + $this->SetTextColor(255, 0, 0); + $ret = $this->TextCol($c, $n, money_format($amount_format, $txt), $corr, $r, $border, $fill, $link, $stretch); + if ($color_red && $txt < 0) + $this->SetTextColor(0, 0, 0); + return $ret; } function DateCol($c, $n, $txt, $conv=false, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0) -- 2.30.2