Some additional changes in pdf_report.inc for supporting report extensions.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 22 Dec 2009 16:56:37 +0000 (16:56 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 22 Dec 2009 16:56:37 +0000 (16:56 +0000)
CHANGELOG.txt
reporting/includes/excel_report.inc
reporting/includes/pdf_report.inc

index fc24d63837364176d88071d49fa54e84bcc14c65..56cdaa87ad87afb3ce2422a5f8c1b217903d6cca 100644 (file)
@@ -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
index dde397bd8d9764bd64060c303fdd221220f26151..f9065cea67bfe0dca5b1d1bb5d25e98362619292 100644 (file)
@@ -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;
index 05942ecaeb22565450128e320b35ad707b40fa10..b17d5700d5407d7b651ce89cf9ce11330e1047e9 100644 (file)
@@ -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)