|
From: <dai...@us...> - 2011-01-06 05:16:13
|
Revision: 4461
http://web-erp.svn.sourceforge.net/web-erp/?rev=4461&view=rev
Author: daintree
Date: 2011-01-06 05:16:06 +0000 (Thu, 06 Jan 2011)
Log Message:
-----------
report writer - changes
Modified Paths:
--------------
trunk/Z_PriceChanges.php
trunk/api/api_php.php
trunk/includes/ConnectDB.inc
trunk/reportwriter/FormMaker.php
trunk/reportwriter/ReportMaker.php
trunk/reportwriter/WriteReport.inc
trunk/sql/mysql/upgrade3.11.1-4.00.sql
Modified: trunk/Z_PriceChanges.php
===================================================================
--- trunk/Z_PriceChanges.php 2011-01-05 09:49:09 UTC (rev 4460)
+++ trunk/Z_PriceChanges.php 2011-01-06 05:16:06 UTC (rev 4461)
@@ -103,33 +103,33 @@
if ($_POST['WhichPrices'] == 'Only Non-customer special prices'){
$sql = 'UPDATE prices SET price=price*(1+' . $IncrementPercentage . ")
- WHERE typeabbrev='" . $_POST['PriceList'] . "'
- AND stockid='" . $myrow['stockid'] . "'
- AND typeabbrev='" . $_POST['PriceList'] . "'
- AND debtorno=''";
+ WHERE typeabbrev='" . $_POST['PriceList'] . "'
+ AND stockid='" . $myrow['stockid'] . "'
+ AND typeabbrev='" . $_POST['PriceList'] . "'
+ AND debtorno=''";
}else if ($_POST['WhichPrices'] == 'Only customer special prices'){
$sql = "UPDATE prices SET price=price*(1+" . $IncrementPercentage . ")
- WHERE typeabbrev='" . $_POST['PriceList'] . "'
- AND stockid='" . $myrow['stockid'] . "'
- AND typeabbrev='" . $_POST['PriceList'] . "'
- AND debtorno!=''";
+ WHERE typeabbrev='" . $_POST['PriceList'] . "'
+ AND stockid='" . $myrow['stockid'] . "'
+ AND typeabbrev='" . $_POST['PriceList'] . "'
+ AND debtorno!=''";
} else if ($_POST['WhichPrices'] == 'Both customer special prices and non-customer special prices'){
$sql = "UPDATE prices SET price=price*(1+" . $IncrementPercentage . ")
- WHERE typeabbrev='" . $_POST['PriceList'] . "'
- AND stockd='" . $myrow['stockid'] . "'
- AND typeabbrev='" . $_POST['PriceList'] . "'";
+ WHERE typeabbrev='" . $_POST['PriceList'] . "'
+ AND stockd='" . $myrow['stockid'] . "'
+ AND typeabbrev='" . $_POST['PriceList'] . "'";
} else if ($_POST['WhichPrices'] == 'Selected customer special prices only'){
$sql = 'UPDATE prices SET price=price*(1+' . $IncrementPercentage . ")
- WHERE typeabbrev='" . $_POST['PriceList'] . "'
- AND stockid='" . $myrow['stockid'] . "'
- AND typeabbrev='" . $_POST['PriceList'] . "'
- AND debtorno='" . $_SESSION['CustomerID'] . "'";
+ WHERE typeabbrev='" . $_POST['PriceList'] . "'
+ AND stockid='" . $myrow['stockid'] . "'
+ AND typeabbrev='" . $_POST['PriceList'] . "'
+ AND debtorno='" . $_SESSION['CustomerID'] . "'";
}
Modified: trunk/api/api_php.php
===================================================================
--- trunk/api/api_php.php 2011-01-05 09:49:09 UTC (rev 4460)
+++ trunk/api/api_php.php 2011-01-06 05:16:06 UTC (rev 4461)
@@ -10,7 +10,7 @@
$PathPrefix=dirname(__FILE__).'/../';
include('api_session.inc');
- include 'api_errorcodes.php';
+ include('api_errorcodes.php');
/* Include SQL_CommonFunctions.inc, to use GetNextTransNo().*/
include($PathPrefix.'includes/SQL_CommonFunctions.inc');
Modified: trunk/includes/ConnectDB.inc
===================================================================
--- trunk/includes/ConnectDB.inc 2011-01-05 09:49:09 UTC (rev 4460)
+++ trunk/includes/ConnectDB.inc 2011-01-06 05:16:06 UTC (rev 4461)
@@ -4,7 +4,7 @@
* this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run
* if VersionNumber is < $Version then the DB update script is run */
-$Version='3.12.1'; //must update manually every time there is a DB change
+$Version='3.12.2'; //must update manually every time there is a DB change
require_once ($PathPrefix .'includes/MiscFunctions.php');
Modified: trunk/reportwriter/FormMaker.php
===================================================================
--- trunk/reportwriter/FormMaker.php 2011-01-05 09:49:09 UTC (rev 4460)
+++ trunk/reportwriter/FormMaker.php 2011-01-06 05:16:06 UTC (rev 4461)
@@ -3,14 +3,14 @@
$DirectoryLevelsDeep = 1;
$PathPrefix = '../';
-$PageSecurity = 1; // set security level for webERP
+//$PageSecurity = 1; // set security level for webERP
require($PathPrefix . 'includes/session.inc');
// TBD The followiung line needs to be replace when more translations are available
$ReportLanguage = 'en_US'; // default language file
define('DBReports','reports'); // name of the databse holding the main report information (ReportID)
define('DBRptFields','reportfields'); // name of the database holding the report fields
-define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory
+//define('FPDF_FONTPATH','../fonts/'); FPDF path to fonts directory
define('DefRptPath',$PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/reportwriter/'); // path to default reports
// Fetch necessary include files - Host application specific (webERP)
require_once($PathPrefix . 'includes/DateFunctions.inc');
@@ -98,7 +98,7 @@
}
} // else use default settings, i.e. no overrides
// All done with setup, build the form
- require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports
+ require($PathPrefix . 'includes/tcpdf.php'); // TCPDF class to generate reports
require('WriteForm.inc');
// build the pdf pages (this function exits the script if successful; otherwise returns with error)
$success = BuildPDF($ReportID, $Prefs); // build and output form, should not return from this function
@@ -139,9 +139,14 @@
foreach ($ReportGroups as $key=>$GName) {
$OutputString .= '<tr bgcolor="#CCCCCC"><td colspan="3" align="center">'.$GName.'</td></tr>';
$OutputString .= '<tr><td colspan="3" width="250" valign="top">';
- $sql= "SELECT id, groupname, reportname FROM ".DBReports."
- WHERE defaultreport='1' AND reporttype='frm'
- ORDER BY groupname, reportname";
+ $sql= "SELECT id,
+ groupname,
+ reportname
+ FROM ".DBReports."
+ WHERE defaultreport='1'
+ AND reporttype='frm'
+ ORDER BY groupname,
+ reportname";
$Result=DB_query($sql,$db,'','',false,true);
$FormList = '';
while ($Temp = DB_fetch_array($Result)) $FormList[] = $Temp;
@@ -160,9 +165,11 @@
$OutputString .= '</td></tr>';
}
} else { // fetch the forms specific to a group GroupID
- $sql= "SELECT id, reportname FROM ".DBReports."
- WHERE defaultreport='1' AND groupname='".$GroupID."'
- ORDER BY reportname";
+ $sql= "SELECT id,
+ reportname
+ FROM ".DBReports."
+ WHERE defaultreport='1' AND groupname='".$GroupID."'
+ ORDER BY reportname";
$Result=DB_query($sql,$db,'','',false,true);
$OutputString .= '<tr><td colspan="3" width="250" valign="top">';
while ($Forms = DB_fetch_array($Result)) {
@@ -175,15 +182,33 @@
function FetchReportDetails($ReportID) {
global $db;
- $sql= "SELECT reportname, reporttype, groupname, papersize, paperorientation,
- margintop, marginbottom, marginleft, marginright,
- table1, table2, table2criteria, table3, table3criteria, table4, table4criteria,
- table5, table5criteria, table6, table6criteria
- FROM ".DBReports."
- WHERE id = ".$ReportID.";";
+ $sql= "SELECT reportname,
+ reporttype,
+ groupname,
+ papersize,
+ paperorientation,
+ margintop,
+ marginbottom,
+ marginleft,
+ marginright,
+ table1,
+ table2,
+ table2criteria,
+ table3,
+ table3criteria,
+ table4,
+ table4criteria,
+ table5,
+ table5criteria,
+ table6,
+ table6criteria
+ FROM " . DBReports . "
+ WHERE id = ".$ReportID.";";
$Result=DB_query($sql,$db,'','',false,true);
$myrow=DB_fetch_assoc($Result);
- foreach ($myrow as $key=>$value) $Prefs[$key]=$value;
+ foreach ($myrow as $key=>$value) {
+ $Prefs[$key]=$value;
+ }
// Build drop down menus for selectable criteria
$Temp = RetrieveFields($ReportID, 'dateselect');
$Prefs['DateListings'] = $Temp[0]; // only need the first field
@@ -196,8 +221,9 @@
global $db;
$FieldListings = '';
$sql= "SELECT * FROM ".DBRptFields."
- WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."'
- ORDER BY seqnum";
+ WHERE reportid = '".$ReportID."'
+ AND entrytype = '".$EntryType."'
+ ORDER BY seqnum";
$Result=DB_query($sql,$db,'','',false,true);
while ($FieldValues = DB_fetch_assoc($Result)) { $FieldListings[] = $FieldValues; }
return $FieldListings;
@@ -210,9 +236,15 @@
// retrieve the dropdown based on the params field (dropdown type)
$Params = explode(':',$FieldListings['params']); // the first value is the criteria type
$CritBlocks = explode(':',$CritChoices[array_shift($Params)]);
- if (!isset($Params[0])) $Params[0] = '-'; // default to no default if this parameter doesn't exist
- if (!isset($Params[1])) $Params[1] = ''; // default to no entry for default from box
- if (!isset($Params[2])) $Params[2] = ''; // default to no entry for default to box
+ if (!isset($Params[0])) {
+ $Params[0] = '-'; // default to no default if this parameter doesn't exist
+ }
+ if (!isset($Params[1])) {
+ $Params[1] = ''; // default to no entry for default from box
+ }
+ if (!isset($Params[2])) {
+ $Params[2] = ''; // default to no entry for default to box
+ }
switch (array_shift($CritBlocks)) { // determine how many text boxes to build
default:
case 0: $EndString = '<td> </td><td> </td>';
@@ -225,7 +257,11 @@
} // end switch array_shift($CritBlocks)
$CriteriaString .= '<td><select name="defcritsel'.$SeqNum.'">';
foreach ($CritBlocks as $value) {
- if ($Params[0]==$value) $Selected = ' selected'; else $Selected = ''; // find the default
+ if ($Params[0]==$value) {
+ $Selected = ' selected';
+ } else {
+ $Selected = ''; // find the default
+ }
$CriteriaString .= '<option value="'.$value.'"'.$Selected.'>'.$value.'</option>';
}
$CriteriaString .= '</select></td>';
Modified: trunk/reportwriter/ReportMaker.php
===================================================================
--- trunk/reportwriter/ReportMaker.php 2011-01-05 09:49:09 UTC (rev 4460)
+++ trunk/reportwriter/ReportMaker.php 2011-01-06 05:16:06 UTC (rev 4461)
@@ -2,14 +2,14 @@
/* $Revision: 1.7 $ */
$DirectoryLevelsDeep =1;
$PathPrefix = '../';
-$PageSecurity = 1; // set security level for webERP
+//$PageSecurity = 1; // set security level for webERP
// TBD The followiung line needs to be replace when more translations are available
$ReportLanguage = 'en_US'; // default language file
-define('DBReports','reports'); // name of the databse holding the main report information (ReportID)
-define('DBRptFields','reportfields'); // name of the database holding the report fields
-define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory
+define('DBReports','reports'); // name of the databse table holding the main report information (ReportID)
+define('DBRptFields','reportfields'); // name of the database table holding the report fields
+//define('FPDF_FONTPATH','../fonts/'); FPDF path to fonts directory
// Fetch necessary include files - Host application specific (webERP)
require($PathPrefix . 'includes/session.inc');
@@ -49,7 +49,7 @@
if ($SeqNum<>1) $success = ChangeSequence($ReportID, $SeqNum, 'fieldlist', 'up');
} elseif (isset($_POST['dn'.$SeqNum.'_x'])) { // the shift down button was pushed
$sql = "SELECT seqnum FROM ".DBRptFields."
- WHERE reportid = ".$ReportID." AND entrytype = 'fieldlist';";
+ WHERE reportid = ".$ReportID." AND entrytype = 'fieldlist';";
$Result=DB_query($sql,$db,'','',false,true);
if ($SeqNum<DB_num_rows($Result)) {
$success = ChangeSequence($ReportID, $SeqNum, 'fieldlist', 'down');
@@ -131,7 +131,7 @@
case RPT_BTN_EXPPDF:
$Prefs = ReadPostData($ReportID, $Prefs);
// include the necessary files to build report
- require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports
+ require($PathPrefix . 'includes/tcpdf/tcpdf.php'); // TCPDF class to generate reports
require('WriteReport.inc');
$ReportData = '';
$success = BuildSQL($Prefs);
Modified: trunk/reportwriter/WriteReport.inc
===================================================================
--- trunk/reportwriter/WriteReport.inc 2011-01-05 09:49:09 UTC (rev 4460)
+++ trunk/reportwriter/WriteReport.inc 2011-01-06 05:16:06 UTC (rev 4461)
@@ -1,278 +1,267 @@
-<?PHP
-// for compatability with extended char sets
-if ($_SESSION['Language']=='zh_CN'){
- include($PathPrefix . 'includes/FPDF_Chinese.php');
-} elseif ($_SESSION['Language']=='ja_JP'){
- include($PathPrefix . 'includes/FPDF_Japanese.php');
-} elseif ($_SESSION['Language']=='ko_KR'){
- include($PathPrefix . 'includes/FPDF_Korean.php');
-} else {
- class PDF_Language extends FPDF { }
-}
+<?php
+require_once($PathPrefix .'/includes/class.pdf.php');
-class PDF extends PDF_Language {
+class PDF extends Cpdf {
var $y0; // current y position
var $x0; // current x position
var $pageY; // y value of bottom of page less bottom margin
-
-function PDF() {
- global $Prefs;
- $PaperSize = explode(':',$Prefs['papersize']);
- $this->PDF_Language($Prefs['paperorientation'], 'mm', $PaperSize[0]);
- if ($Prefs['paperorientation']=='P') { // Portrait - calculate max page height
- $this->pageY = $PaperSize[2]-$Prefs['marginbottom'];
- } else { // Landscape
- $this->pageY = $PaperSize[1]-$Prefs['marginbottom'];
+
+ function PDF() {
+ global $Prefs;
+ $PaperSize = explode(':',$Prefs['papersize']);
+ $this->Cpdf($Prefs['paperorientation'], 'mm', $PaperSize[0]);
+ if ($Prefs['paperorientation']=='P') { // Portrait - calculate max page height
+ $this->pageY = $PaperSize[2]-$Prefs['marginbottom'];
+ } else { // Landscape
+ $this->pageY = $PaperSize[1]-$Prefs['marginbottom'];
+ }
+ $this->SetMargins($Prefs['marginleft'], $Prefs['margintop'], $Prefs['marginright']);
+ $this->SetAutoPageBreak(0, $Prefs['marginbottom']);
+
+ $this->SetDrawColor(128,0,0);
+ $this->SetLineWidth(.35); // 1 point
+ $this->AliasNbPages();
+ $this->AddPage();
+
}
- $this->SetMargins($Prefs['marginleft'], $Prefs['margintop'], $Prefs['marginright']);
- $this->SetAutoPageBreak(0, $Prefs['marginbottom']);
- $this->SetFont($Prefs['coynamefont']);
- $this->SetDrawColor(128,0,0);
- $this->SetLineWidth(.35); // 1 point
- $this->AliasNbPages();
- $this->AddPage();
-
- if ($_SESSION['Language']=='zh_CN'){
- $this->AddBig5Font();
- } elseif ($_SESSION['Language']=='zh_HK'){
- $this->AddCIDFont();
- } elseif ($_SESSION['Language']=='ja_JP'){
- $this->AddSJISFont();
- } elseif ($_SESSION['Language']=='ko_KR'){
- $this->AddUHCFont();
- }
-}
-
-function Header() {
- global $Prefs, $Heading, $Seq;
- define(RowSpace,2); // define separation between the heading rows
- if ($Prefs['coynameshow']) { // Show the company name
- $this->SetFont($Prefs['coynamefont'],'B',$Prefs['coynamefontsize']);
- $Colors = explode(':',$Prefs['coynamefontcolor']);
+
+ function Header() {
+ global $Prefs, $Heading, $Seq;
+ define(RowSpace,2); // define separation between the heading rows
+ if ($Prefs['coynameshow']) { // Show the company name
+ $Colors = explode(':',$Prefs['coynamefontcolor']);
+ $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
+ $CellHeight = ($Prefs['coynamefontsize']+RowSpace)*0.35;
+ $this->Cell(0,$CellHeight,$_SESSION['CompanyRecord']['coyname'],0,1,$Prefs['coynamealign']);
+ }
+ if ($Prefs['title1show']) { // Set title 1 heading
+ $Colors = explode(':',$Prefs['title1fontcolor']);
+ $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
+ $CellHeight = ($Prefs['title1fontsize']+RowSpace)*0.35;
+ $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title1desc']),0,1,$Prefs['title1fontalign']);
+ }
+ if ($Prefs['title2show']) { // Set Title 2 heading
+ $Colors = explode(':',$Prefs['title2fontcolor']);
+ $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
+ $CellHeight = ($Prefs['title2fontsize']+RowSpace)*0.35;
+ $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title2desc']),0,1,$Prefs['title2fontalign']);
+ }
+ // Set the filter heading
+ $Colors = explode(':',$Prefs['filterfontcolor']);
$this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
- $CellHeight = ($Prefs['coynamefontsize']+RowSpace)*0.35;
- $this->Cell(0,$CellHeight,$_SESSION['CompanyRecord']['coyname'],0,1,$Prefs['coynamealign']);
- }
- if ($Prefs['title1show']) { // Set title 1 heading
- $this->SetFont($Prefs['title1font'],'',$Prefs['title1fontsize']);
- $Colors = explode(':',$Prefs['title1fontcolor']);
+ $CellHeight = ($Prefs['filterfontsize']+RowSpace)*0.35; // convert points to mm
+ $this->MultiCell(0,$CellHeight,$Prefs['filterdesc'],'B',1,$Prefs['filterfontalign']);
+ $this->y0=$this->GetY(); // set y position after report headings before column titles
+ // Set the table header
+ $Colors = explode(':',$Prefs['datafontcolor']);
$this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
- $CellHeight = ($Prefs['title1fontsize']+RowSpace)*0.35;
- $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title1desc']),0,1,$Prefs['title1fontalign']);
+ $this->SetDrawColor(128,0,0);
+ $this->SetLineWidth(.35); // 1 point
+ $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35;
+ // fetch the column widths and put into array to match the columns of data
+ $CellXPos[0] = $Prefs['marginleft'];
+ for ($x=1; $x<=20; $x++) {
+ $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width'];
+ }
+ // Fetch the column break array
+ foreach ($Seq as $Temp) {
+ if ($Temp['break']) {
+ $ColBreak[] = true;
+ } else {
+ $ColBreak[] = false;
+ }
+ }
+ // See if we need to truncate the data
+ if ($Prefs['TruncListings']['params']=='1') {
+ $trunc=true;
+ } else {
+ $trunc=false;
+ }
+ // Ready to draw the column titles in the header
+ $maxY = $this->y0; // set to track the tallest column
+ $col = 1;
+ $LastY = $this->y0;
+ foreach ($Heading as $key=>$value) {
+ $this->SetLeftMargin($CellXPos[$col-1]);
+ $this->SetX($CellXPos[$col-1]);
+ $this->SetY($LastY);
+ // truncate data if selected
+ if ($trunc) {
+ $value=$this->TruncData($value, $Prefs['col'.$col.'width']);
+ }
+ $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value);
+ if ($ColBreak[$key]) {
+ $col++;
+ $LastY = $this->y0;
+ } else $LastY = $this->GetY();
+ if ($this->GetY()>$maxY) $maxY = $this->GetY(); // check for new col max height
+ }
+ // Draw a bottom line for the end of the heading
+ $this->SetLeftMargin($CellXPos[0]);
+ $this->SetX($CellXPos[0]);
+ $this->SetY($this->y0);
+ $this->Cell(0,$maxY-$this->y0,' ','B');
+ $this->y0=$maxY+0.35;
}
- if ($Prefs['title2show']) { // Set Title 2 heading
- $this->SetFont($Prefs['title2font'],'',$Prefs['title2fontsize']);
- $Colors = explode(':',$Prefs['title2fontcolor']);
- $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
- $CellHeight = ($Prefs['title2fontsize']+RowSpace)*0.35;
- $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title2desc']),0,1,$Prefs['title2fontalign']);
+
+ function SubTitle($Title) {
+ global $Prefs;
+ // substitutes a command string with current information
+ $Title=preg_replace('/%date%/', date('Y-m-d',time()), $Title);
+ $Title=preg_replace('/%reportname%/', $Prefs['reportname'], $Title);
+ return $Title;
}
- // Set the filter heading
- $this->SetFont($Prefs['filterfont'],'',$Prefs['filterfontsize']);
- $Colors = explode(':',$Prefs['filterfontcolor']);
- $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
- $CellHeight = ($Prefs['filterfontsize']+RowSpace)*0.35; // convert points to mm
- $this->MultiCell(0,$CellHeight,$Prefs['filterdesc'],'B',1,$Prefs['filterfontalign']);
- $this->y0=$this->GetY(); // set y position after report headings before column titles
- // Set the table header
- $this->SetFont($Prefs['datafont'],'',$Prefs['datafontsize']);
- $Colors = explode(':',$Prefs['datafontcolor']);
- $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
- $this->SetDrawColor(128,0,0);
- $this->SetLineWidth(.35); // 1 point
- $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35;
- // fetch the column widths and put into array to match the columns of data
- $CellXPos[0] = $Prefs['marginleft'];
- for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width'];
- // Fetch the column break array
- foreach ($Seq as $Temp) if ($Temp['break']) $ColBreak[] = true; else $ColBreak[] = false;
- // See if we need to truncate the data
- if ($Prefs['TruncListings']['params']=='1') $trunc=true; else $trunc=false;
- // Ready to draw the column titles in the header
- $maxY = $this->y0; // set to track the tallest column
- $col = 1;
- $LastY = $this->y0;
- foreach ($Heading as $key=>$value) {
- $this->SetLeftMargin($CellXPos[$col-1]);
- $this->SetX($CellXPos[$col-1]);
- $this->SetY($LastY);
- // truncate data if selected
- if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']);
- $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value);
- if ($ColBreak[$key]) {
- $col++;
- $LastY = $this->y0;
- } else $LastY = $this->GetY();
- if ($this->GetY()>$maxY) $maxY = $this->GetY(); // check for new col max height
+
+ function Footer() {
+ //Position at 1.5 cm from bottom
+ $this->SetY(-15);
+ //Arial italic 8
+ $this->SetTextColor(0);
+ //Page number
+ $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
- // Draw a bottom line for the end of the heading
- $this->SetLeftMargin($CellXPos[0]);
- $this->SetX($CellXPos[0]);
- $this->SetY($this->y0);
- $this->Cell(0,$maxY-$this->y0,' ','B');
- $this->y0=$maxY+0.35;
-}
-
-function SubTitle($Title) {
- global $Prefs;
- // substitutes a command string with current information
- $Title=preg_replace('/%date%/', date('Y-m-d',time()), $Title);
- $Title=preg_replace('/%reportname%/', $Prefs['reportname'], $Title);
- return $Title;
-}
-
-function Footer() {
- //Position at 1.5 cm from bottom
- $this->SetY(-15);
- //Arial italic 8
- $this->SetFont('Helvetica','',8);
- $this->SetTextColor(0);
- //Page number
- $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
-}
-
-function ReportTable($Data) {
- global $Prefs, $Seq;
-
- $FillColor = array(224, 235, 255);
- $this->SetFont($Prefs['datafont'],'',$Prefs['datafontsize']);
- $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]);
- $Colors = explode(':',$Prefs['datafontcolor']);
- $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
- $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35;
- // Fetch the column widths and put into array to match the columns of data
- $CellXPos[0] = $Prefs['marginleft'];
- for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width'];
- // Fetch the column break array
- foreach ($Seq as $Temp) {
- if ($Temp['break']){
- $ColBreak[] = true;
+
+ function ReportTable($Data) {
+ global $Prefs, $Seq;
+
+ $FillColor = array(224, 235, 255);
+ $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]);
+ $Colors = explode(':',$Prefs['datafontcolor']);
+ $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
+ $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35;
+ // Fetch the column widths and put into array to match the columns of data
+ $CellXPos[0] = $Prefs['marginleft'];
+ for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width'];
+ // Fetch the column break array
+ foreach ($Seq as $Temp) {
+ if ($Temp['break']){
+ $ColBreak[] = true;
+ } else {
+ $ColBreak[] = false;
+ }
+ }
+ // See if we need to truncate the data
+ if ($Prefs['TruncListings']['params']=='1') {
+ $trunc=true;
} else {
- $ColBreak[] = false;
+ $trunc=false;
}
- }
- // See if we need to truncate the data
- if ($Prefs['TruncListings']['params']=='1') {
- $trunc=true;
- } else {
- $trunc=false;
- }
- // Ready to draw the column data
- $fill=false;
- $NeedTop='No';
- $MaxRowHt = 0; //track the tallest row to estimate page breaks
- foreach($Data as $myrow) {
- $Action = array_shift($myrow);
- $todo = explode(':',$Action); // contains a letter of the date type and title/groupname
- switch ($todo[0]) {
- case "r": // Report Total
- case "g": // Group Total
- // Draw a fill box
- if ($this->y0+(2*$MaxRowHt)>$this->pageY) {
- // Fill the end of the report with white space
+ // Ready to draw the column data
+ $fill=false;
+ $NeedTop='No';
+ $MaxRowHt = 0; //track the tallest row to estimate page breaks
+ foreach($Data as $myrow) {
+ $Action = array_shift($myrow);
+ $todo = explode(':',$Action); // contains a letter of the date type and title/groupname
+ switch ($todo[0]) {
+ case "r": // Report Total
+ case "g": // Group Total
+ // Draw a fill box
+ if ($this->y0+(2*$MaxRowHt)>$this->pageY) {
+ // Fill the end of the report with white space
+ $this->SetLeftMargin($CellXPos[0]);
+ $this->SetX($CellXPos[0]);
+ $this->SetY($this->y0);
+ $this->SetFillColor(255);
+ $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1);
+ $this->AddPage();
+ $MaxRowHt=0;
+ }
$this->SetLeftMargin($CellXPos[0]);
$this->SetX($CellXPos[0]);
$this->SetY($this->y0);
- $this->SetFillColor(255);
- $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1);
- $this->AddPage();
- $MaxRowHt=0;
- }
- $this->SetLeftMargin($CellXPos[0]);
- $this->SetX($CellXPos[0]);
- $this->SetY($this->y0);
- $this->SetFillColor(240);
- $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1);
- // Add total heading
- $this->SetLeftMargin($CellXPos[0]);
- $this->SetX($CellXPos[0]);
- $this->SetY($this->y0);
- if ($todo[0]=='g') $Desc = 'Group'; else $Desc = 'Report';
- $this->Cell(0,$CellHeight,$Desc.' Total For: '.$todo[1],1,1,'C');
- $this->y0=$this->GetY()+0.35;
- $NeedTop = 'Next';
- $fill=false; // set so totals data will not be filled
- // now fall into the 'd' case to show the data
- case "d": // data element
- default:
- // figure out if a border needs to be drawn for total separation
- // and fill color (draws an empty box over the row just written with the fill color)
- $brdr = 0;
- if ($NeedTop=='Yes') {
- $brdr='T';
- $fill=false; // set so first data after total will not be filled
- $NeedTop='No';
- } elseif ($NeedTop=='Next') {
- $brdr='LR';
- $NeedTop='Yes';
- }
- // Draw a fill box
- if (($this->y0+$MaxRowHt)>$this->pageY) {
- // Fill the end of the report with white space
+ $this->SetFillColor(240);
+ $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1);
+ // Add total heading
$this->SetLeftMargin($CellXPos[0]);
$this->SetX($CellXPos[0]);
$this->SetY($this->y0);
- $this->SetFillColor(255);
- $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1);
- $this->AddPage();
- $MaxRowHt=0;
- }
- $this->SetLeftMargin($CellXPos[0]);
- $this->SetX($CellXPos[0]);
- $this->SetY($this->y0);
- if ($fill) $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); else $this->SetFillColor(255);
- $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1);
- // fill in the data
- $maxY = $this->y0; // set to current top of row
- $col = 1;
- $LastY = $this->y0;
- foreach ($myrow as $key=>$value) {
- $this->SetLeftMargin($CellXPos[$col-1]);
- $this->SetX($CellXPos[$col-1]);
- $this->SetY($LastY);
- // truncate data if necessary
- if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']);
- $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value,0);
- if ($ColBreak[$key]) {
- $col++;
- $LastY = $this->y0;
- } else $LastY = $this->GetY();
- if ($this->GetY()>$maxY) $maxY = $this->GetY();
- }
- $this->SetLeftMargin($CellXPos[0]); // restore left margin
- break;
+ if ($todo[0]=='g') $Desc = 'Group'; else $Desc = 'Report';
+ $this->Cell(0,$CellHeight,$Desc.' Total For: '.$todo[1],1,1,'C');
+ $this->y0=$this->GetY()+0.35;
+ $NeedTop = 'Next';
+ $fill=false; // set so totals data will not be filled
+ // now fall into the 'd' case to show the data
+ case "d": // data element
+ default:
+ // figure out if a border needs to be drawn for total separation
+ // and fill color (draws an empty box over the row just written with the fill color)
+ $brdr = 0;
+ if ($NeedTop=='Yes') {
+ $brdr='T';
+ $fill=false; // set so first data after total will not be filled
+ $NeedTop='No';
+ } elseif ($NeedTop=='Next') {
+ $brdr='LR';
+ $NeedTop='Yes';
+ }
+ // Draw a fill box
+ if (($this->y0+$MaxRowHt)>$this->pageY) {
+ // Fill the end of the report with white space
+ $this->SetLeftMargin($CellXPos[0]);
+ $this->SetX($CellXPos[0]);
+ $this->SetY($this->y0);
+ $this->SetFillColor(255);
+ $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1);
+ $this->AddPage();
+ $MaxRowHt=0;
+ }
+ $this->SetLeftMargin($CellXPos[0]);
+ $this->SetX($CellXPos[0]);
+ $this->SetY($this->y0);
+ if ($fill) $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); else $this->SetFillColor(255);
+ $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1);
+ // fill in the data
+ $maxY = $this->y0; // set to current top of row
+ $col = 1;
+ $LastY = $this->y0;
+ foreach ($myrow as $key=>$value) {
+ $this->SetLeftMargin($CellXPos[$col-1]);
+ $this->SetX($CellXPos[$col-1]);
+ $this->SetY($LastY);
+ // truncate data if necessary
+ if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']);
+ $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value,0);
+ if ($ColBreak[$key]) {
+ $col++;
+ $LastY = $this->y0;
+ } else $LastY = $this->GetY();
+ if ($this->GetY()>$maxY) $maxY = $this->GetY();
+ }
+ $this->SetLeftMargin($CellXPos[0]); // restore left margin
+ break;
+ }
+ $ThisRowHt=$maxY-$this->y0; // seee how tall this row was
+ if ($ThisRowHt>$MaxRowHt) $MaxRowHt = $ThisRowHt; // keep that largest row so far to track pagination
+ $this->y0=$maxY; // set y position to largest value for next row
+ $fill=!$fill;
+ }
+ // Fill the end of the report with white space
+ $this->SetLeftMargin($CellXPos[0]);
+ $this->SetX($CellXPos[0]);
+ $this->SetY($this->y0);
+ $this->SetFillColor(255);
+ $this->Cell(0,$this->pageY-$this->y0,'','T',0,'L',1);
+ }
+
+ function TruncData($strData, $ColWidth) {
+ $percent=0.90; //percent to truncate from max to account for proportional spacing
+ $CurWidth = $this->GetStringWidth($strData);
+ if ($CurWidth>($ColWidth*.90)) { // then it needs to be truncated
+ // for now we'll do an approximation based on averages and scale to 90% of the width to allow for variance
+ // A better aproach would be an recursive call to this function until the string just fits.
+ $NumChars = strlen($strData);
+ // Reduce the string by 1-$percent and retest
+ $strData = $this->TruncData(substr($strData, 0, ($ColWidth/$CurWidth)*$NumChars*$percent), $ColWidth);
}
- $ThisRowHt=$maxY-$this->y0; // seee how tall this row was
- if ($ThisRowHt>$MaxRowHt) $MaxRowHt = $ThisRowHt; // keep that largest row so far to track pagination
- $this->y0=$maxY; // set y position to largest value for next row
- $fill=!$fill;
- }
- // Fill the end of the report with white space
- $this->SetLeftMargin($CellXPos[0]);
- $this->SetX($CellXPos[0]);
- $this->SetY($this->y0);
- $this->SetFillColor(255);
- $this->Cell(0,$this->pageY-$this->y0,'','T',0,'L',1);
-}
-
-function TruncData($strData, $ColWidth) {
- $percent=0.90; //percent to truncate from max to account for proportional spacing
- $CurWidth = $this->GetStringWidth($strData);
- if ($CurWidth>($ColWidth*.90)) { // then it needs to be truncated
- // for now we'll do an approximation based on averages and scale to 90% of the width to allow for variance
- // A better aproach would be an recursive call to this function until the string just fits.
- $NumChars = strlen($strData);
- // Reduce the string by 1-$percent and retest
- $strData = $this->TruncData(substr($strData, 0, ($ColWidth/$CurWidth)*$NumChars*$percent), $ColWidth);
+ return $strData;
}
- return $strData;
-}
+
+ function Stream($FileName) {
+ $this->Output($FileName,'D');
+ }
-function Stream($FileName) {
- $this->Output($FileName,'D');
-}
-
} // end class
function BuildSQL($Prefs) {
Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql
===================================================================
--- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-05 09:49:09 UTC (rev 4460)
+++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-06 05:16:06 UTC (rev 4461)
@@ -804,4 +804,10 @@
('Z_UploadResult.php', 15, 'Utility to upload a file to a remote server');
INSERT INTO config (confname, confvalue) VALUES ('VersionNumber', '3.12.0');
-UPDATE config SET confvalue='3.12.1' WHERE confname='VersionNumber';
\ No newline at end of file
+UPDATE config SET confvalue='3.12.1' WHERE confname='VersionNumber';
+
+INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES
+('FormMaker.php', 1, 'Allows running user defined Forms'),
+('ReportMaker.php', 1, 'Produces reports from the report writer templates created'),
+('ReportCreator.php', 13, 'Report Writer and Form Creator script that creates templates for user defined reports and forms');
+UPDATE config SET confvalue='3.12.2' WHERE confname='VersionNumber';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|