From: <dai...@us...> - 2011-03-08 07:38:52
|
Revision: 4504 http://web-erp.svn.sourceforge.net/web-erp/?rev=4504&view=rev Author: daintree Date: 2011-03-08 07:38:45 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Sales Analysis fix Modified Paths: -------------- trunk/SalesAnalysis_UserDefined.php trunk/doc/Change.log.html trunk/includes/PDFSalesAnalysis.inc Modified: trunk/SalesAnalysis_UserDefined.php =================================================================== --- trunk/SalesAnalysis_UserDefined.php 2011-03-04 19:40:47 UTC (rev 4503) +++ trunk/SalesAnalysis_UserDefined.php 2011-03-08 07:38:45 UTC (rev 4504) @@ -2,7 +2,7 @@ /* $Id$ */ -//$PageSecurity = 2; + include('includes/session.inc'); if (!in_array($PageSecurity,$_SESSION['AllowedPageSecurityTokens'])){ @@ -18,9 +18,9 @@ if ($Counter >0) { $pdf->OutputD('SalesAnalysis_' . date('Y-m-d') . '.pdf'); - $pdf-> __destruct(); + $pdf->__destruct(); } else { - $pdf-> __destruct(); + $pdf->__destruct(); $title = _('User Defined Sales Analysis Problem'); include('includes/header.inc'); echo '<p>' . _('The report did not have any none zero lines of information to show and so it has not been created'); @@ -46,5 +46,4 @@ echo '<p>' . _('You should automatically be forwarded to the CSV Sales Analysis file when it is ready') . '. ' . _('If this does not happen') . ' <a href="' . $rootpath . '/' . $_SESSION['reports_dir'] . '/SalesAnalysis.csv">' . _('click here') . '</a> ' . _('to continue') . '<br />'; include('includes/footer.inc'); } - -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-03-04 19:40:47 UTC (rev 4503) +++ trunk/doc/Change.log.html 2011-03-08 07:38:45 UTC (rev 4504) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>8/3/11:Phil fix SalesAnalysis reports for TCPDF as reported by Joe Zhou</p> <p>5/3/11: Kovács Attila fix to Stocks.php to use ANSI GROUP BY for aggregate functions SQL</p> <p>5/3/11: Kovács Attila fix to LanguageSetup.php to use utf-8 not ISO-8859-1. Phil hardcoded UTF- now as no dynamic changing of character set required all translations are utf-8</p> <p>3/3/11: Exson/Baran/Phil fix to customer login to ensure that other customers orders are not displayed when searching by customer ref or order no</p> Modified: trunk/includes/PDFSalesAnalysis.inc =================================================================== --- trunk/includes/PDFSalesAnalysis.inc 2011-03-04 19:40:47 UTC (rev 4503) +++ trunk/includes/PDFSalesAnalysis.inc 2011-03-08 07:38:45 UTC (rev 4504) @@ -4,23 +4,23 @@ include ('includes/class.pdf.php'); -/* A4_Landscape */ +/* A4_Landscape */ +$DocumentPaper = 'A4'; +$DocumentOrientation ='L'; $Page_Width=842; $Page_Height=595; -$Top_Margin=20; -$Bottom_Margin=20; -$Left_Margin=25; -$Right_Margin=22; +$Top_Margin=30; +$Bottom_Margin=30; +$Left_Margin=40; +$Right_Margin=30; -// Javier: now I use the native constructor -// $PageSize = array(0,0,$Page_Width,$Page_Height); +$pdf = new Cpdf($DocumentOrientation, 'pt', $DocumentPaper); +$pdf->SetAutoPageBreak(true, 0); +$pdf->SetPrintHeader(false); +$pdf->AddPage(); +$pdf->cMargin = 0; -// Javier: better to not use references -// $pdf = & new Cpdf($PageSize); - $pdf = new Cpdf('L', 'pt', 'A4'); - - /* Standard PDF file creation header stuff */ $pdf->addInfo('Author','webERP ' . $Version); @@ -41,278 +41,269 @@ /*Make an array to hold accumulators for */ $AccumLvl1 = array(); +$AccumLvl2 = array(); +$AccumLvl3 = array(); +$AccumLvl4 = array(); + for ($i=0;$i<=10;$i++){ -$AccumLvl1[$i]=0; + $AccumLvl1[$i]=0; + $AccumLvl2[$i]=0; + $AccumLvl3[$i]=0; + $AccumLvl4[$i]=0; } -$AccumLvl2= array(); -for ($i=0;$i<=10;$i++){ -$AccumLvl2[$i]=0; -} -$AccumLvl3=array(); -for ($i=0;$i<=10;$i++){ -$AccumLvl3[$i]=0; -} -$AccumLvl4=array(); -for ($i=0;$i<=10;$i++){ -$AccumLvl4[$i]=0; -} While ($myrow = DB_fetch_array($result)){ /*First off check that at least one of the columns of data has some none zero amounts */ -DB_data_seek($ColsResult,0); /*go back to the beginning */ -$ThisLineHasOutput=False; /*assume no output to start with */ -while ($Cols = DB_fetch_array($ColsResult)){ - $ColumnNo ='col' . ((int) $Cols['colno'] + 8); - if (abs($myrow[$ColumnNo])>0.5){ - $ThisLineHasOutput = True; + DB_data_seek($ColsResult,0); /*go back to the beginning */ + $ThisLineHasOutput=False; /*assume no output to start with */ + while ($Cols = DB_fetch_array($ColsResult)){ + $ColumnNo ='col' . ((int) $Cols['colno'] + 8); + if (abs($myrow[$ColumnNo])>0.5){ + $ThisLineHasOutput = True; + } } -} -if ($ThisLineHasOutput==True){ + if ($ThisLineHasOutput==True){ - if ($myrow['col5']!=$GrpData3 && $myrow['col5']!='0' && $myrow['col7']!='0'){ - /*Totals only relevant to GrpByLevel 3 if GrpByLevel 4 also used */ - if ($Counter > 0){ /*Dont want to print totals if this is the first record */ - $TotalText = substr(_('TOTAL') . ' ' . $LastLine['col5'] . ' - ' . $LastLine['col6'],0,33); - $LeftOvers = $pdf->addTextWrap(40,$Ypos,180,$FontSize,$TotalText); + if ($myrow['col5']!=$GrpData3 && $myrow['col5']!='0' && $myrow['col7']!='0'){ + /*Totals only relevant to GrpByLevel 3 if GrpByLevel 4 also used */ + if ($Counter > 0){ /*Dont want to print totals if this is the first record */ + $TotalText = substr(_('TOTAL') . ' ' . $LastLine['col5'] . ' - ' . $LastLine['col6'],0,33); + $LeftOvers = $pdf->addTextWrap(40,$Ypos,180,$FontSize,$TotalText); - DB_data_seek($ColsResult,0); - while ($Cols = DB_fetch_array($ColsResult)){ - $Xpos = 160 + $Cols['colno']*60; - if ($Cols['calculation']==0){ - $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, number_format($AccumLvl3[$Cols['colno']]),'right'); - } else { /* its a calculation need to re-perform on the totals*/ + DB_data_seek($ColsResult,0); + while ($Cols = DB_fetch_array($ColsResult)){ + $Xpos = 160 + $Cols['colno']*60; + if ($Cols['calculation']==0){ + $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, number_format($AccumLvl3[$Cols['colno']]),'right'); + } else { /* its a calculation need to re-perform on the totals*/ - switch ($Cols['calcoperator']) { - case '/': - if ($AccumLvl3[$Cols['coldenominator']]==0){ - $TotalCalculation = 0; + switch ($Cols['calcoperator']) { + case '/': + if ($AccumLvl3[$Cols['coldenominator']]==0){ + $TotalCalculation = 0; + } else { + $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] / $AccumLvl3[$Cols['coldenominator']]; + } + break; + case '+': + $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] + $AccumLvl3[$Cols['coldenominator']]; + break; + case '-': + $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] + $AccumLvl3[$Cols['coldenominator']]; + break; + case '*': + $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] * $Cols['constant']; + break; + case 'C': + if ($Cols['constant']==0){ + $TotalCalculation = 0; + } else { + $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] / $Cols['constant']; + } + break; + } /*end of switch stmt block*/ + if ($Cols['valformat']=='P'){ + $TotalCalculation = number_format($TotalCalculation * 100) . '%'; } else { - $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] / $AccumLvl3[$Cols['coldenominator']]; + $TotalCalculation = number_format($TotalCalculation); } - break; - case '+': - $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] + $AccumLvl3[$Cols['coldenominator']]; - break; - case '-': - $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] + $AccumLvl3[$Cols['coldenominator']]; - break; - case '*': - $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] * $Cols['constant']; - break; - case 'C': - if ($Cols['constant']==0){ - $TotalCalculation = 0; - } else { - $TotalCalculation = $AccumLvl3[$Cols['colnumerator']] / $Cols['constant']; - } - break; - } /*end of switch stmt block*/ - if ($Cols['valformat']=='P'){ - $TotalCalculation = number_format($TotalCalculation * 100) . '%'; - } else { - $TotalCalculation = number_format($TotalCalculation); + $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, $TotalCalculation,'right'); } - $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, $TotalCalculation,'right'); } + $Ypos -=(2*$line_height); + /*reset the accumulators to 0 */ + for ($i=0;$i<=10;$i++){ + $AccumLvl3[$i]=0; + } } - $Ypos -=(2*$line_height); - /*reset the accumulators to 0 */ - for ($i=0;$i<=10;$i++){ - $AccumLvl3[$i]=0; - } } - } - - if ($myrow['col3']!=$GrpData2 && $myrow['col3']!='0' && $myrow['col5']!='0'){ + if ($myrow['col3']!=$GrpData2 && $myrow['col3']!='0' && $myrow['col5']!='0'){ /*Totals only relevant to GrpByLevel 2 if GrpByLevel 3 also used */ - if ($Counter > 0){ /*Dont want to print totals if this is the first record */ - $TotalText = substr(_('TOTAL') . ' ' . $LastLine['col3'] . ' - ' . $LastLine['col4'],0,43); - $LeftOvers = $pdf->addTextWrap(30,$Ypos,190,$FontSize,$TotalText); - DB_data_seek($ColsResult,0); - while ($Cols = DB_fetch_array($ColsResult)){ - $Xpos = 160 + $Cols['colno']*60; - if ($Cols['calculation']==0){ - $LeftOvers = $pdf->addTextWrap($Xpos, $Ypos,60,$FontSize, number_format($AccumLvl2[$Cols['colno']]),'right'); - } else { /* its a calculation need to re-perform on the totals*/ + if ($Counter > 0){ /*Dont want to print totals if this is the first record */ + $TotalText = substr(_('TOTAL') . ' ' . $LastLine['col3'] . ' - ' . $LastLine['col4'],0,43); + $LeftOvers = $pdf->addTextWrap(30,$Ypos,190,$FontSize,$TotalText); + DB_data_seek($ColsResult,0); + while ($Cols = DB_fetch_array($ColsResult)){ + $Xpos = 160 + $Cols['colno']*60; + if ($Cols['calculation']==0){ + $LeftOvers = $pdf->addTextWrap($Xpos, $Ypos,60,$FontSize, number_format($AccumLvl2[$Cols['colno']]),'right'); + } else { /* its a calculation need to re-perform on the totals*/ - switch ($Cols['calcoperator']) { - case '/': - if ($AccumLvl2[$Cols['coldenominator']]==0){ - $TotalCalculation = 0; + switch ($Cols['calcoperator']) { + case '/': + if ($AccumLvl2[$Cols['coldenominator']]==0){ + $TotalCalculation = 0; + } else { + $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] / $AccumLvl2[$Cols['coldenominator']]; + } + break; + case '+': + $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] + $AccumLvl2[$Cols['coldenominator']]; + break; + case '-': + $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] + $AccumLvl2[$Cols['coldenominator']]; + break; + case '*': + $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] * $Cols['constant']; + break; + case 'C': + if ($Cols['constant']==0){ + $TotalCalculation = 0; + } else { + $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] / $Cols['constant']; + } + break; + } /*end of switch stmt block*/ + if ($Cols['valformat']=='P'){ + $TotalCalculation = number_format($TotalCalculation * 100) . '%'; } else { - $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] / $AccumLvl2[$Cols['coldenominator']]; + $TotalCalculation = number_format($TotalCalculation); } - break; - case '+': - $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] + $AccumLvl2[$Cols['coldenominator']]; - break; - case '-': - $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] + $AccumLvl2[$Cols['coldenominator']]; - break; - case '*': - $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] * $Cols['constant']; - break; - case 'C': - if ($Cols['constant']==0){ - $TotalCalculation = 0; - } else { - $TotalCalculation = $AccumLvl2[$Cols['colnumerator']] / $Cols['constant']; - } - break; - } /*end of switch stmt block*/ - if ($Cols['valformat']=='P'){ - $TotalCalculation = number_format($TotalCalculation * 100) . '%'; - } else { - $TotalCalculation = number_format($TotalCalculation); - } - $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, $TotalCalculation,'right'); + $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, $TotalCalculation,'right'); + }/*end if not a calculation column*/ + }/*end while loop through column definitions */ + $Ypos -=(2*$line_height); + /*reset the accumulators to 0 */ + for ($i=0;$i<=10;$i++){ + $AccumLvl2[$i]=0; } - - } - $Ypos -=(2*$line_height); - /*reset the accumulators to 0 */ - for ($i=0;$i<=10;$i++){ - $AccumLvl2[$i]=0; - } + }/*end if Counter > 0 */ } - } - if ($myrow['col1']!=$GrpData1 && $myrow['col3']!='0'){ - /*Totals only relevant to GrpByLevel 1 if GrpByLevel 2 also used */ - if ($Counter > 0){ /*Dont want to print totals if this is the first record */ - $TotalText = substr(_('TOTAL') . ' ' . $LastLine['col1'] . ' - ' . $LastLine['col2'],0,46); - $LeftOvers = $pdf->addTextWrap(15,$Ypos,205,$FontSize,$TotalText); - DB_data_seek($ColsResult,0); - while ($Cols = DB_fetch_array($ColsResult)){ - $Xpos = 160 + $Cols['colno']*60; - if ($Cols['calculation']==0){ - $LeftOvers = $pdf->addTextWrap($Xpos, $Ypos,60,$FontSize, number_format($AccumLvl1[$Cols['colno']]),'right'); - } else { /* its a calculation need to re-perform on the totals*/ - - switch ($Cols['calcoperator']) { - Case '/': - if ($AccumLvl1[$Cols['coldenominator']]==0){ - $TotalCalculation = 0; + if ($myrow['col1']!=$GrpData1 && $myrow['col3']!='0'){ + /*Totals only relevant to GrpByLevel 1 if GrpByLevel 2 also used */ + if ($Counter > 0){ /*Dont want to print totals if this is the first record */ + $TotalText = substr(_('TOTAL') . ' ' . $LastLine['col1'] . ' - ' . $LastLine['col2'],0,46); + $LeftOvers = $pdf->addTextWrap(15,$Ypos,205,$FontSize,$TotalText); + DB_data_seek($ColsResult,0); + while ($Cols = DB_fetch_array($ColsResult)){ + $Xpos = 160 + $Cols['colno']*60; + if ($Cols['calculation']==0){ + $LeftOvers = $pdf->addTextWrap($Xpos, $Ypos,60,$FontSize, number_format($AccumLvl1[$Cols['colno']]),'right'); + } else { /* its a calculation need to re-perform on the totals*/ + + switch ($Cols['calcoperator']) { + Case '/': + if ($AccumLvl1[$Cols['coldenominator']]==0){ + $TotalCalculation = 0; + } else { + $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] / $AccumLvl1[$Cols['coldenominator']]; + } + break; + Case '+': + $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] + $AccumLvl1[$Cols['coldenominator']]; + break; + Case '-': + $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] + $AccumLvl1[$Cols['coldenominator']]; + break; + Case '*': + $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] * $Cols['constant']; + break; + Case 'C': + if ($Cols['constant']==0){ + $TotalCalculation = 0; + } else { + $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] / $Cols['constant']; + } + break; + } /*end of switch stmt block*/ + if ($Cols['valformat']=='P'){ + $TotalCalculation = number_format($TotalCalculation * 100) . '%'; } else { - $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] / $AccumLvl1[$Cols['coldenominator']]; + $TotalCalculation = number_format($TotalCalculation); } - break; - Case '+': - $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] + $AccumLvl1[$Cols['coldenominator']]; - break; - Case '-': - $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] + $AccumLvl1[$Cols['coldenominator']]; - break; - Case '*': - $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] * $Cols['constant']; - break; - Case 'C': - if ($Cols['constant']==0){ - $TotalCalculation = 0; - } else { - $TotalCalculation = $AccumLvl1[$Cols['colnumerator']] / $Cols['constant']; - } - break; - } /*end of switch stmt block*/ - if ($Cols['valformat']=='P'){ - $TotalCalculation = number_format($TotalCalculation * 100) . '%'; - } else { - $TotalCalculation = number_format($TotalCalculation); - } - $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, $TotalCalculation,'right'); + $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize, $TotalCalculation,'right'); + }/*end if its not a calculation */ + } /* end loop around column defintions */ + $Ypos -=(2*$line_height); + + /*reset the accumulators to 0 */ + for ($i=0;$i<=10;$i++){ + $AccumLvl1[$i]=0; } + }/* end if counter>0 */ + } + + $NewHeading =0; + if ($myrow['col1']!=$GrpData1){ /*Need a new heading for Level 1 */ + $NewHeading = 1; + if ($ReportSpec['newpageafter1']==1){ + include ('includes/PDFSalesAnalPageHeader.inc'); } - $Ypos -=(2*$line_height); + $GroupHeadingText = substr($myrow['col1'] . ' - ' . $myrow['col2'],0,50); + $LeftOvers = $pdf->addTextWrap(15,$Ypos,205,$FontSize,$GroupHeadingText); - /*reset the accumulators to 0 */ - for ($i=0;$i<=10;$i++){ - $AccumLvl1[$i]=0; + if ($myrow['col3']!='0'){ + $Ypos-=$line_height; } } - } - $NewHeading =0; + if (($myrow['col3']!=$GrpData2 OR $NewHeading ==1) AND $myrow['col3']!='0'){ + /*Need a new heading for Level 2 */ + $NewHeading = 1; + if ($ReportSpec['newpageafter2']==1){ + include ('includes/PDFSalesAnalPageHeader.inc'); + } + $GroupHeadingText = substr($myrow['col3'] . ' - ' . $myrow['col4'],0,46); + $LeftOvers = $pdf->addTextWrap(30,$Ypos,190,$FontSize,$GroupHeadingText); - if ($myrow['col1']!=$GrpData1){ /*Need a new heading for Level 1 */ - $NewHeading = 1; - if ($ReportSpec['newpageafter1']==1){ - include ('includes/PDFSalesAnalPageHeader.inc'); - } - $GroupHeadingText = substr($myrow['col1'] . ' - ' . $myrow['col2'],0,50); - $LeftOvers = $pdf->addTextWrap(15,$Ypos,205,$FontSize,$GroupHeadingText); - - if ($myrow['col3']!='0'){ + if ($myrow['col5']!='0'){ $Ypos-=$line_height; + } } - } + if (($myrow['col5']!=$GrpData3 OR $NewHeading ==1) AND $myrow['col5']!='0'){ + /*Need a new heading for Level 3 */ - if (($myrow['col3']!=$GrpData2 OR $NewHeading ==1) AND $myrow['col3']!='0'){ - /*Need a new heading for Level 2 */ - $NewHeading = 1; - if ($ReportSpec['newpageafter2']==1){ - include ('includes/PDFSalesAnalPageHeader.inc'); - } - $GroupHeadingText = substr($myrow['col3'] . ' - ' . $myrow['col4'],0,46); - $LeftOvers = $pdf->addTextWrap(30,$Ypos,190,$FontSize,$GroupHeadingText); + if ($ReportSpec['newpageafter3']==1){ + include ('includes/PDFSalesAnalPageHeader.inc'); + } + $GroupHeadingText = substr($myrow['col5'] . ' - ' . $myrow['col6'],0,46); + $LeftOvers = $pdf->addTextWrap(30,$Ypos,190,$FontSize,$GroupHeadingText); - if ($myrow['col5']!='0'){ - $Ypos-=$line_height; + if ($myrow['col7']!='0'){ + $Ypos-=$line_height; + } } - } - if (($myrow['col5']!=$GrpData3 OR $NewHeading ==1) AND $myrow['col5']!='0'){ - /*Need a new heading for Level 3 */ - if ($ReportSpec['newpageafter3']==1){ - include ('includes/PDFSalesAnalPageHeader.inc'); - } - $GroupHeadingText = substr($myrow['col5'] . ' - ' . $myrow['col6'],0,46); - $LeftOvers = $pdf->addTextWrap(30,$Ypos,190,$FontSize,$GroupHeadingText); - if ($myrow['col7']!='0'){ - $Ypos-=$line_height; + /*show titles */ + $GroupHeadingText = substr($myrow['col7'] . ' - ' . $myrow['col8'], 0, 40); + $LeftOvers = $pdf->addTextWrap(55,$Ypos,135,$FontSize,$GroupHeadingText); + } - } - if ($myrow['col7']!='0'){ - /*show titles */ - $GroupHeadingText = substr($myrow['col7'] . ' - ' . $myrow['col8'], 0, 40); - $LeftOvers = $pdf->addTextWrap(55,$Ypos,135,$FontSize,$GroupHeadingText); + /*NOW SHOW THE LINE OF DATA */ + DB_data_seek($ColsResult,0); + while ($Cols = DB_fetch_array($ColsResult)){ + $Xpos = 160 + ($Cols['colno']*60); + $ColumnNo = 'col' . (string) (($Cols['colno']) +8); + if ($Cols['valformat']=='P'){ + $DisplayValue = number_format($myrow[$ColumnNo] *100) . '%'; + } else { + $DisplayValue = number_format($myrow[$ColumnNo]); + } + $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize,$DisplayValue, 'right'); - } - - /*NOW SHOW THE LINE OF DATA */ - DB_data_seek($ColsResult,0); - while ($Cols = DB_fetch_array($ColsResult)){ - $Xpos = 160 + ($Cols['colno']*60); - $ColumnNo = 'col' . (string) (($Cols['colno']) +8); - if ($Cols['valformat']=='P'){ - $DisplayValue = number_format($myrow[$ColumnNo] *100) . '%'; - } else { - $DisplayValue = number_format($myrow[$ColumnNo]); + $AccumLvl1[$Cols['colno']] += $myrow[$ColumnNo]; + $AccumLvl2[$Cols['colno']] += $myrow[$ColumnNo]; + $AccumLvl3[$Cols['colno']] += $myrow[$ColumnNo]; + $AccumLvl4[$Cols['colno']] += $myrow[$ColumnNo]; } - $LeftOvers = $pdf->addTextWrap($Xpos,$Ypos,60,$FontSize,$DisplayValue, 'right'); - $AccumLvl1[$Cols['colno']] += $myrow[$ColumnNo]; - $AccumLvl2[$Cols['colno']] += $myrow[$ColumnNo]; - $AccumLvl3[$Cols['colno']] += $myrow[$ColumnNo]; - $AccumLvl4[$Cols['colno']] += $myrow[$ColumnNo]; - } + $Ypos -=$line_height; - $Ypos -=$line_height; - - if ($Ypos - (2*$line_height) < $Bottom_Margin){ - include ('includes/PDFSalesAnalPageHeader.inc'); - }//end if need a new page headed up - $GrpData1 = $myrow['col1']; - $GrpData2 = $myrow['col3']; - $GrpData3 = $myrow['col5']; - $Counter++; - $LastLine = $myrow; /*remember the last line that had some output in an array called last line*/ + if ($Ypos - (2*$line_height) < $Bottom_Margin){ + include ('includes/PDFSalesAnalPageHeader.inc'); + }//end if need a new page headed up + $GrpData1 = $myrow['col1']; + $GrpData2 = $myrow['col3']; + $GrpData3 = $myrow['col5']; + $Counter++; + $LastLine = $myrow; /*remember the last line that had some output in an array called last line*/ } /*The line has some positive amount on it */ - } /*end of the data loop to print lines */ if ($LastLine['col5']!='0' && $LastLine['col7']!='0'){ @@ -514,8 +505,6 @@ } - - if ($_GET['ProduceCVSFile']==True){ function stripcomma($str) { //because we're using comma as a delimiter This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |