<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Tracmor Forum - New Report Type]]></title>
	<link rel="self" href="http://www.tracmor.com/forum/feed/atom/topic/202/"/>
	<updated>2009-10-30T05:57:37Z</updated>
	<generator>PunBB</generator>
	<id>http://www.tracmor.com/forum/topic/202/new-report-type/</id>
		<entry>
			<title type="html"><![CDATA[Re: New Report Type]]></title>
			<link rel="alternate" href="http://www.tracmor.com/forum/post/623/#p623"/>
			<content type="html"><![CDATA[<p>Edited 2009-11-17:<br />I have decided I will not need this report type anyway. What would be much better for our use is if we could enable the &quot;ShowColumnToggle&quot; and &quot;ShowExportCsv&quot; properties of the dtgChildAsset &quot;QDataGrid&quot; in asset_edit.php. Does anyone know a simple way to do this. I have tried this:<br /></p><div class="codebox"><pre><code>// Add the custom field columns with Display set to false. These can be shown by using the column toggle menu.
    $objCustomFieldArray = CustomField::LoadObjCustomFieldArray(1, false);
    if ($objCustomFieldArray) {
        foreach ($objCustomFieldArray as $objCustomField) {
            //Only add the custom field column if the role has authorization to view it.
            if($objCustomField-&gt;objRoleAuthView &amp;&amp; $objCustomField-&gt;objRoleAuthView-&gt;AuthorizedFlag){
                $this-&gt;dtgChildAssets-&gt;AddColumn(new QDataGridColumnExt($objCustomField-&gt;ShortDescription, &#039;&lt;?= $_ITEM-&gt;GetVirtualAttribute(\&#039;&#039;.$objCustomField-&gt;CustomFieldId.&#039;\&#039;) ?&gt;&#039;, &#039;SortByCommand=&quot;__&#039;.$objCustomField-&gt;CustomFieldId.&#039; ASC&quot;&#039;, &#039;ReverseSortByCommand=&quot;__&#039;.$objCustomField-&gt;CustomFieldId.&#039; DESC&quot;&#039;,&#039;HtmlEntities=&quot;false&quot;&#039;, &#039;CssClass=&quot;dtg_column&quot;&#039;));
            }
        }
    }</code></pre></div><p>It included the custom fields in the header of the datagrid, but now data is inserted in the table.</p><p>End Edit......</p><br /><p>If anyone plan to have a look at this, here is what I have so far. </p><p>To make this report a little more useful to others as well, I will try to add some checkboxes so that it is selectable what information gets included in the report (I realize that my particular scenario is not very useful to others).</p><br /><div class="codebox"><pre><code>Index: data_model/db_update-0.2.0.sql
===================================================================
--- data_model/db_update-0.2.0.sql    (revision 646)
+++ data_model/db_update-0.2.0.sql    (working copy)
@@ -197,6 +197,7 @@
 ON Delete CASCADE ON Update NO ACTION;
 
 INSERT INTO `shortcut` (`module_id`, `authorization_id`, `short_description`, `image_path`, `link`, `entity_qtype_id`, `create_flag`) VALUES (7, 1, &#039;Asset Transaction Report&#039;, &#039;asset.png&#039;,&#039;../reports/asset_transaction_report.php&#039;, 1, 0);
+INSERT INTO `shortcut` (`module_id`, `authorization_id`, `short_description`, `image_path`, `link`, `entity_qtype_id`, `create_flag`) VALUES (7, 1, &#039;Asset Child Report&#039;, &#039;asset.png&#039;,&#039;../reports/asset_child_report.php&#039;, 1, 0);
 
 ALTER TABLE `asset`
         ADD `parent_asset_id` INTEGER UNSIGNED DEFAULT NULL AFTER `asset_id`,
Index: reports/asset_child_report.tpl.php
===================================================================
--- reports/asset_child_report.tpl.php    (revision 0)
+++ reports/asset_child_report.tpl.php    (revision 0)
@@ -0,0 +1,71 @@
+&lt;?php
+/*
+ * Copyright (c)  2009, Tracmor, LLC 
+ *
+ * This file is part of Tracmor.  
+ *
+ * Tracmor is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version. 
+ *    
+ * Tracmor is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Tracmor; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+    include(&#039;../includes/header.inc.php&#039;);
+    $this-&gt;RenderBegin();
+?&gt;
+&lt;!-- Begin Header Menu --&gt;
+&lt;?php 
+    $this-&gt;ctlHeaderMenu-&gt;Render();
+?&gt;
+&lt;!-- End Header Menu --&gt;
+
+&lt;!-- Begin Shortcut Menu --&gt;
+&lt;?php
+    $this-&gt;ctlShortcutMenu-&gt;Render();
+?&gt;        
+&lt;!-- End Shortcut Menu --&gt;
+    &lt;/td&gt;
+    &lt;td&gt;&lt;img src=&quot;../images/empty.gif&quot; width=&quot;10&quot;&gt;&lt;/td&gt;
+    &lt;td width=&quot;100%&quot; valign=&quot;top&quot;&gt;
+        &lt;div class=&quot;title&quot;&gt;&amp;nbsp;Asset Child Report&lt;/div&gt;
+        &lt;table style=&quot;border:1px solid #AAAAAA;background-color:#EEEEEE;font-family:verdana;font-size:10;color:#444444;height:40&quot; width=&quot;100%&quot;&gt;
+            &lt;tr&gt;
+                &lt;td class=&quot;item_label&quot;&gt;Parent Asset:&lt;/td&gt;
+                &lt;td colspan=&quot;5&quot;&gt;&lt;?php $this-&gt;txtParentAsset-&gt;Render(&quot;Width=100&quot;) ?&gt;&lt;?php $this-&gt;lblIconParentAssetCode-&gt;Render() ?&gt;&lt;/td&gt;
+            &lt;/tr&gt;
+            &lt;tr&gt;
+                &lt;td class=&quot;item_label&quot;&gt;Asset Property:&lt;/span&gt;&lt;/td&gt;
+                &lt;td&gt;&lt;?php $this-&gt;chkCode-&gt;Render(); ?&gt;&lt;/td&gt;
+                &lt;td&gt;&lt;?php $this-&gt;chkModel-&gt;Render(); ?&gt;&lt;/td&gt;
+                &lt;td&gt;&lt;?php $this-&gt;chkCategory-&gt;Render(); ?&gt;&lt;/td&gt;
+                &lt;td&gt;&lt;?php $this-&gt;chkManufacturer-&gt;Render(); ?&gt;&lt;/td&gt;
+                &lt;td&gt;&lt;?php $this-&gt;chkLocation-&gt;Render(); ?&gt;&lt;/td&gt;
+            &lt;/tr&gt;
+            &lt;tr&gt;
+                &lt;td class=&quot;item_label&quot;&gt;Custom Fields:&lt;/span&gt;&lt;/td&gt;
+                &lt;td colspan=&quot;5&quot;&gt;&lt;?php $this-&gt;pnlCustomFields-&gt;Render(); ?&gt;&lt;/td&gt;
+            &lt;/tr&gt;
+            &lt;tr&gt;
+                &lt;td class=&quot;item_label&quot;&gt;Create Report:&lt;/span&gt;&lt;/td&gt;
+                &lt;td colspan=&quot;5&quot;&gt;&lt;?php $this-&gt;lstGenerateOptions-&gt;Render(&quot;Width=100&quot;); ?&gt;&lt;?php $this-&gt;btnGenerate-&gt;Render() ?&gt;&lt;?php $this-&gt;btnClear-&gt;Render() ?&gt;&lt;/td&gt;
+            &lt;/tr&gt;
+        &lt;/table&gt;
+    &lt;?php
+    if ($this-&gt;ctlAssetSearchTool) {
+        $this-&gt;ctlAssetSearchTool-&gt;Render();
+    }
+    ?&gt;
+
+    &lt;?php $this-&gt;lblReport-&gt;RenderWithError(); ?&gt;
+    &lt;br /&gt;
+&lt;?php $this-&gt;RenderEnd() ?&gt;        
+&lt;?php require_once(&#039;../includes/footer.inc.php&#039;); ?&gt;
Index: reports/asset_child_report.php
===================================================================
--- reports/asset_child_report.php    (revision 0)
+++ reports/asset_child_report.php    (revision 0)
@@ -0,0 +1,307 @@
+&lt;?php
+/*
+ * Copyright (c)  2009, Tracmor, LLC
+ *
+ * This file is part of Tracmor.
+ *
+ * Tracmor is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Tracmor is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Tracmor; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+    require_once(&#039;../includes/prepend.inc.php&#039;);
+    QApplication::Authenticate(7);
+    ini_set(&quot;include_path&quot;,ini_get(&quot;include_path&quot;). PATH_SEPARATOR . __INCLUDES__ . &quot;/php/PHPReports/&quot; . PATH_SEPARATOR);
+    require_once(&#039;PHPReportMaker.php&#039;);
+    $_SESSION[&quot;phpReportsLanguage&quot;] = null;
+
+    class SerialNumberListForm extends QForm {
+
+        // Header Tabs
+        protected $ctlHeaderMenu;
+
+        // Shortcut Menu
+        protected $ctlShortcutMenu;
+
+        protected $ctlAssetSearchTool;
+
+        // Labels
+        protected $lblIconParentAssetCode;
+
+        // Basic Inputs
+        protected $txtParentAsset;
+        protected $lstGenerateOptions;
+        protected $chkCode;
+        protected $chkModel;
+        protected $chkCategory;
+        protected $chkManufacturer;
+        protected $chkLocation;
+        protected $pnlCustomFields;
+        protected $arrCustomFields;
+        protected $chkCustomFieldArray;
+        protected $lblReport;
+
+        // Buttons
+        protected $btnGenerate;
+        protected $blnGenerate;
+        protected $btnClear;
+        
+        protected function Form_Create() {
+
+            $this-&gt;ctlHeaderMenu_Create();
+            $this-&gt;ctlShortcutMenu_Create();
+            $this-&gt;txtParentAsset_Create();
+            $this-&gt;chkAssetProperties_Create();
+            $this-&gt;lstGenerateOptions_Create();
+            $this-&gt;btnGenerate_Create();
+            $this-&gt;btnClear_Create();
+            $this-&gt;lblIconParentAssetCode_Create();
+            $this-&gt;ctlAssetSearchTool_Create();
+            $this-&gt;customFields_Create();
+            
+            // The report code will be render in a Qlabel
+            $this-&gt;lblReport = new QLabel($this);
+            // If don&#039;t put this you will see HTML code instead of a report
+            $this-&gt;lblReport-&gt;HtmlEntities = false;
+          }
+          
+
+          // Create and Setup the Header Composite Control
+          protected function ctlHeaderMenu_Create() {
+              $this-&gt;ctlHeaderMenu = new QHeaderMenu($this);
+          }
+
+          // Create and Setp the Shortcut Menu Composite Control
+        protected function ctlShortcutMenu_Create() {
+            $this-&gt;ctlShortcutMenu = new QShortcutMenu($this);
+        }
+
+        protected function txtParentAsset_Create() {
+            $this-&gt;txtParentAsset = new QTextBox($this);
+            $this-&gt;txtParentAsset-&gt;Name = &#039;Parent Asset&#039;;
+            $this-&gt;txtParentAsset-&gt;AddAction(new QEnterKeyEvent(), new QServerAction(&#039;btnGenerate_Click&#039;));
+            $this-&gt;txtParentAsset-&gt;AddAction(new QEnterKeyEvent(), new QTerminateAction());
+        }
+
+        protected function lstGenerateOptions_Create() {
+            $this-&gt;lstGenerateOptions = new QListBox($this);
+            $this-&gt;lstGenerateOptions-&gt;AddItem(&#039;Report&#039;, null);
+            $this-&gt;lstGenerateOptions-&gt;AddItem(&#039;Print View&#039;, &#039;print&#039;);
+            $this-&gt;lstGenerateOptions-&gt;AddItem(&#039;CSV Export&#039;, &#039;csv&#039;);
+        }
+
+        // Uncheck all items but SelectAll checkbox
+        public function UncheckAllItems() {
+            foreach ($this-&gt;GetAllControls() as $objControl) {
+                if (substr($objControl-&gt;ControlId, 0, 11) == &#039;chkSelected&#039;) {
+                    $objControl-&gt;Checked = false;
+                }
+            }
+        }
+        
+        protected function chkAssetProperties_Create() {
+            $this-&gt;chkCode = new QCheckBox($this);
+            $this-&gt;chkCode-&gt;Text = &#039;Code&#039;;
+            $this-&gt;chkCode-&gt;Checked = false;
+            $this-&gt;chkModel = new QCheckBox($this);
+            $this-&gt;chkModel-&gt;Text = &#039;Model&#039;;
+            $this-&gt;chkModel-&gt;Checked = false;
+            $this-&gt;chkCategory = new QCheckBox($this);
+            $this-&gt;chkCategory-&gt;Text = &#039;Category&#039;;
+            $this-&gt;chkCategory-&gt;Checked = false;
+            $this-&gt;chkManufacturer = new QCheckBox($this);
+            $this-&gt;chkManufacturer-&gt;Text = &#039;Manufacturer&#039;;
+            $this-&gt;chkManufacturer-&gt;Checked = false;
+            $this-&gt;chkLocation = new QCheckBox($this);
+            $this-&gt;chkLocation-&gt;Text = &#039;Location&#039;;
+            $this-&gt;chkLocation-&gt;Checked = false;
+        }
+
+        protected function customFields_Create() {
+            // Create QPanel with AutoRenderChildren to add cutom fields dynamically
+            $this-&gt;pnlCustomFields = new QPanel($this);
+            $this-&gt;pnlCustomFields-&gt;AutoRenderChildren = true;
+            // Load all custom fields and their values into an array objCustomFieldArray-&gt;CustomFieldSelection-&gt;CustomFieldValue
+            $this-&gt;arrCustomFields = CustomField::LoadObjCustomFieldArray(1, false, null);
+            $i = 0;
+            foreach ($this-&gt;arrCustomFields as $objCustomField) {
+                $this-&gt;chkCustomFieldArray[$i] = new QCheckBox($this-&gt;pnlCustomFields);
+                $this-&gt;chkCustomFieldArray[$i]-&gt;Text = $objCustomField-&gt;ShortDescription;
+                $this-&gt;chkCustomFieldArray[$i]-&gt;ActionParameter = $objCustomField-&gt;CustomFieldId;
+                $i++;
+            }
+        }
+
+
+        /**************************
+        *    CREATE BUTTON METHODS
+        **************************/
+
+        protected function btnGenerate_Create() {
+            $this-&gt;btnGenerate = new QButton($this);
+            $this-&gt;btnGenerate-&gt;Name = &#039;Generate&#039;;
+            $this-&gt;btnGenerate-&gt;Text = &#039;Generate&#039;;
+            $this-&gt;btnGenerate-&gt;AddAction(new QClickEvent(), new QServerAction(&#039;btnGenerate_Click&#039;));
+            $this-&gt;btnGenerate-&gt;AddAction(new QEnterKeyEvent(), new QServerAction(&#039;btnGenerate_Click&#039;));
+            $this-&gt;btnGenerate-&gt;AddAction(new QEnterKeyEvent(), new QTerminateAction());
+        }
+
+        protected function btnClear_Create() {
+            $this-&gt;btnClear = new QButton($this);
+            $this-&gt;btnClear-&gt;Name = &#039;clear&#039;;
+            $this-&gt;btnClear-&gt;Text = &#039;Clear&#039;;
+            $this-&gt;btnClear-&gt;AddAction(new QClickEvent(), new QServerAction(&#039;btnClear_Click&#039;));
+            $this-&gt;btnClear-&gt;AddAction(new QEnterKeyEvent(), new QServerAction(&#039;btnClear_Click&#039;));
+            $this-&gt;btnClear-&gt;AddAction(new QEnterKeyEvent(), new QTerminateAction());
+        }
+
+        // Create the clickable label
+        protected function lblIconParentAssetCode_Create() {
+            $this-&gt;lblIconParentAssetCode = new QLabel($this);
+            $this-&gt;lblIconParentAssetCode-&gt;HtmlEntities = false;
+            $this-&gt;lblIconParentAssetCode-&gt;Display = true;
+            $this-&gt;lblIconParentAssetCode-&gt;Text = &#039;&lt;img src=&quot;../images/icons/lookup.png&quot; border=&quot;0&quot; style=&quot;cursor:pointer;&quot;&gt;&#039;;
+            $this-&gt;lblIconParentAssetCode-&gt;AddAction(new QClickEvent(), new QAjaxAction(&#039;lblIconParentAssetCode_Click&#039;));
+            $this-&gt;lblIconParentAssetCode-&gt;AddAction(new QEnterKeyEvent(), new QAjaxAction(&#039;lblIconParentAssetCode_Click&#039;));
+            $this-&gt;lblIconParentAssetCode-&gt;AddAction(new QEnterKeyEvent(), new QTerminateAction());
+        }
+        
+        protected function ctlAssetSearchTool_Create() {
+            $this-&gt;ctlAssetSearchTool = new QAssetSearchToolComposite($this);
+        }
+
+        protected function btnClear_Click() {
+            // Reload the page fresh.
+            QApplication::Redirect(&#039;asset_child_report.php&#039;);
+        }
+
+        public function lblIconParentAssetCode_Click() {
+            // Uncheck all items but SelectAll checkbox
+            $this-&gt;UncheckAllItems();
+            $this-&gt;ctlAssetSearchTool-&gt;Refresh();
+            $this-&gt;ctlAssetSearchTool-&gt;btnAssetSearchToolAdd-&gt;Text = &quot;Add Parent Asset&quot;;
+            $this-&gt;ctlAssetSearchTool-&gt;dlgAssetSearchTool-&gt;ShowDialogBox();
+        }
+
+
+        public function btnAssetSearchToolAdd_Click() {
+            $this-&gt;ctlAssetSearchTool-&gt;lblWarning-&gt;Text = &quot;&quot;;
+            $intSelectedAssetId = $this-&gt;ctlAssetSearchTool-&gt;ctlAssetSearch-&gt;dtgAsset-&gt;GetSelected(&quot;AssetId&quot;);
+            if (count($intSelectedAssetId) &gt; 1) {
+                $this-&gt;ctlAssetSearchTool-&gt;lblWarning-&gt;Text = &quot;You must select only one asset.&quot;;
+            } elseif (count($intSelectedAssetId) != 1) {
+                $this-&gt;ctlAssetSearchTool-&gt;lblWarning-&gt;Text = &quot;No selected assets.&quot;;
+            } else {
+                if (!($objParentAsset = Asset::LoadByAssetId($intSelectedAssetId[0]))) {
+                    $this-&gt;ctlAssetSearchTool-&gt;lblWarning-&gt;Text = &quot;That asset code does not exist. Please try another.&quot;;
+                } else {
+                    $this-&gt;txtParentAsset-&gt;Text = $objParentAsset-&gt;AssetCode;
+                    $this-&gt;ctlAssetSearchTool-&gt;dlgAssetSearchTool-&gt;HideDialogBox();
+                }
+            }
+            // Uncheck all items but SelectAll checkbox
+            $this-&gt;UncheckAllItems();
+        }
+
+        protected function btnGenerate_Click($objCaller = null) {
+            $objExpansionMap[Asset::ExpandAssetModel][AssetModel::ExpandCategory] = true;
+            $objExpansionMap[Asset::ExpandAssetModel][AssetModel::ExpandManufacturer] = true;
+            $objExpansionMap[Asset::ExpandLocation] = true;
+
+            $objAsset = Asset::LoadByAssetCode($this-&gt;txtParentAsset-&gt;Text);
+            if ($objAsset) {
+                $oRpt = new PHPReportMaker();
+                $objChildAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objAsset-&gt;AssetId);
+                if ($objChildAssetArray) {
+                    $strXmlColNameByCustomField = &quot;&quot;;
+                    $strXmlFieldByCustomField = &quot;&quot;;
+                    if ($this-&gt;chkCode-&gt;Checked) {
+                        $strXmlColNameByCustomField .= &quot;&lt;COL CELLCLASS=&#039;report_column_header&#039;&gt;&quot;.$this-&gt;chkCode-&gt;Text.&quot;&lt;/COL&gt;&quot;;
+                        $strXmlFieldByCustomField .= &quot;&lt;COL TYPE=&#039;FIELD&#039; CELLCLASS=&#039;report_cell&#039;&gt;asset__asset_code&lt;/COL&gt;&quot;;
+                    }
+                    if ($this-&gt;chkModel-&gt;Checked) {
+                        $strXmlColNameByCustomField .= &quot;&lt;COL CELLCLASS=&#039;report_column_header&#039;&gt;&quot;.$this-&gt;chkModel-&gt;Text.&quot;&lt;/COL&gt;&quot;;
+                        $strXmlFieldByCustomField .= &quot;&lt;COL TYPE=&#039;FIELD&#039; CELLCLASS=&#039;report_cell&#039;&gt;asset__asset_model_id__short_description&lt;/COL&gt;&quot;;
+                    }
+                    if ($this-&gt;chkCategory-&gt;Checked) {
+                        $strXmlColNameByCustomField .= &quot;&lt;COL CELLCLASS=&#039;report_column_header&#039;&gt;&quot;.$this-&gt;chkCategory-&gt;Text.&quot;&lt;/COL&gt;&quot;;
+                        $strXmlFieldByCustomField .= &quot;&lt;COL TYPE=&#039;FIELD&#039; CELLCLASS=&#039;report_cell&#039;&gt;asset__asset_model_id__category_id__short_description&lt;/COL&gt;&quot;;
+                    }
+                    if ($this-&gt;chkManufacturer-&gt;Checked) {
+                        $strXmlColNameByCustomField .= &quot;&lt;COL CELLCLASS=&#039;report_column_header&#039;&gt;&quot;.$this-&gt;chkManufacturer-&gt;Text.&quot;&lt;/COL&gt;&quot;;
+                        $strXmlFieldByCustomField .= &quot;&lt;COL TYPE=&#039;FIELD&#039; CELLCLASS=&#039;report_cell&#039;&gt;asset__asset_model_id__manufacturer_id__short_description&lt;/COL&gt;&quot;;
+                    }
+                    if ($this-&gt;chkLocation-&gt;Checked) {
+                        $strXmlColNameByCustomField .= &quot;&lt;COL CELLCLASS=&#039;report_column_header&#039;&gt;&quot;.$this-&gt;chkLocation-&gt;Text.&quot;&lt;/COL&gt;&quot;;
+                        $strXmlFieldByCustomField .= &quot;&lt;COL TYPE=&#039;FIELD&#039; CELLCLASS=&#039;report_cell&#039;&gt;asset__location_id__short_description&lt;/COL&gt;&quot;;
+                    }
+                    foreach ($this-&gt;chkCustomFieldArray as $chkCustomField) {
+                        if ($chkCustomField-&gt;Checked) {
+                            $strXmlColNameByCustomField .= &quot;&lt;COL CELLCLASS=&#039;report_column_header&#039;&gt;&quot;.$chkCustomField-&gt;Text.&quot;&lt;/COL&gt;&quot;;
+                            $strXmlFieldByCustomField .= &quot;&lt;COL TYPE=&#039;FIELD&#039; CELLCLASS=&#039;report_cell&#039;&gt;__&quot;.$chkCustomField-&gt;ActionParameter.&quot;&lt;/COL&gt;&quot;;
+                        }
+                    }
+                    $oGroups = &quot;
+                        &lt;GROUP NAME=&#039;child_id&#039; EXPRESSION=&#039;child_id&#039; PAGEBREAK=&#039;FALSE&#039;&gt;
+                        &lt;HEADER&gt;
+                            &lt;ROW&gt;
+                            $strXmlColNameByCustomField
+                            &lt;/ROW&gt;
+                        &lt;/HEADER&gt;
+                        &lt;FIELDS&gt;
+                            &lt;ROW&gt;
+                            $strXmlFieldByCustomField
+                            &lt;/ROW&gt;
+                        &lt;/FIELDS&gt;
+                        &lt;/GROUP&gt;&quot;;
+
+                    $arrDBInfo = unserialize(DB_CONNECTION_1);
+                    $oRpt-&gt;setSQL($objAsset);
+                    $oRpt-&gt;setUser($arrDBInfo[&#039;username&#039;]);
+                    $oRpt-&gt;setPassword($arrDBInfo[&#039;password&#039;]);
+                    $oRpt-&gt;setConnection($arrDBInfo[&#039;server&#039;]);
+                    $oRpt-&gt;setDatabaseInterface(&#039;mysql&#039;);
+                    $oRpt-&gt;setDatabase($arrDBInfo[&#039;database&#039;]);
+                    $oRpt-&gt;setNoDataMsg(&quot;No data was found, check your query&quot;);
+                    $oRpt-&gt;setPageSize(200000000);
+
+                    $oRpt-&gt;setBody(false);
+                    $oRpt-&gt;createFromTemplate(&#039;Asset Child Report&#039;, __DOCROOT__ . __SUBDIRECTORY__ . &#039;/reports/asset_child_report.xml&#039;,null,null,$oGroups);
+
+    /* TODO
+                    $oRpt-&gt;run();
+    */
+
+                    // Start Debug
+                    $str = &quot;&quot;;
+                    $i=1;
+                    foreach ($objChildAssetArray as $objChild) {
+                        $str = $str . $objChild-&gt;__toString() . &quot;; &quot;;
+                        $i++;
+                    }
+                    $this-&gt;lblReport-&gt;Warning = $str;
+                    // End Debug
+                } else {
+                    $this-&gt;lblReport-&gt;Warning = &quot;Asset has no child assets.&quot;;
+                }
+            } else {
+                $this-&gt;lblReport-&gt;Warning = &quot;Not a valid asset!&quot;;
+            }
+        }
+
+    }
+
+    // Go ahead and run this form object to generate the page
+    SerialNumberListForm::Run(&#039;SerialNumberListForm&#039;, &#039;asset_child_report.tpl.php&#039;);
+?&gt;
+
Index: reports/asset_child_report.xml
===================================================================
--- reports/asset_child_report.xml    (revision 0)
+++ reports/asset_child_report.xml    (revision 0)
@@ -0,0 +1,29 @@
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; standalone=&quot;no&quot;?&gt;
+&lt;!DOCTYPE REPORT SYSTEM &quot;PHPReport.dtd&quot;&gt;
+&lt;REPORT MARGINWIDTH=&quot;5&quot; MARGINHEIGHT=&quot;5&quot;&gt;
+    &lt;TITLE&gt;&lt;REPLACE_WITH_TITLE/&gt;&lt;/TITLE&gt;
+   &lt;BACKGROUND_COLOR&gt;#FFFFFF&lt;/BACKGROUND_COLOR&gt;
+    &lt;NO_DATA_MSG&gt;No data was found, check your query&lt;/NO_DATA_MSG&gt;
+    &lt;REPLACE_WITH_DOCUMENT_INFO/&gt;
+   &lt;PAGE BORDER=&quot;0&quot; CELLSPACING=&quot;0&quot; CELLPADDING=&quot;3&quot;&gt;
+        &lt;HEADER&gt;
+            &lt;ROW&gt;
+                &lt;COL CELLCLASS=&quot;HEADER&quot; COLSPAN=&quot;50&quot;&gt;
+                    &lt;XHTML&gt;
+                        &lt;TABLE BORDER=&quot;0&quot; CELLPADDING=&quot;2&quot; CELLSPACING=&quot;0&quot;&gt;
+                            &lt;TR&gt;
+                                &lt;TD CLASS=&quot;report_title&quot; colspan=&quot;4&quot;&gt;
+                                    Asset Child Report
+                                &lt;/TD&gt;
+                            &lt;/TR&gt;
+                        &lt;/TABLE&gt;
+                    &lt;/XHTML&gt;
+                &lt;/COL&gt;
+            &lt;/ROW&gt;
+            &lt;REPLACE_WITH_PARAMETERS/&gt;
+        &lt;/HEADER&gt;
+    &lt;/PAGE&gt;
+    &lt;GROUPS&gt;
+    &lt;REPLACE_WITH_GROUP_INFO/&gt;
+    &lt;/GROUPS&gt;
+&lt;/REPORT&gt;</code></pre></div><p>Edited: <br />- Added my latest changes to the source.<br />- Added dynamically output based on which checkbox is checked.<br />- What remains are to generate a proper SQL statement. If somebody can help with that it would be great. I have never done any SQL before.</p>]]></content>
			<author>
				<name><![CDATA[olejl]]></name>
				<uri>http://www.tracmor.com/forum/user/187/</uri>
			</author>
			<updated>2009-10-30T05:57:37Z</updated>
			<id>http://www.tracmor.com/forum/post/623/#p623</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[New Report Type]]></title>
			<link rel="alternate" href="http://www.tracmor.com/forum/post/622/#p622"/>
			<content type="html"><![CDATA[<p>Hi<br />I have downloaded and installed Tracmor for evaluation. So far it seems to fit our need for the greater parts. There is one thing I need before we can start using the system. I have tried the whole day to do it myself, but there is so many things I have never done before, and I realized that I will not be able to do it.</p><p>I made an Asset Custom Field called &quot;Serial Number&quot;. Now I need to be able to print a report with the Asset Model and Serial Number for all child items for any given asset. Would that be possible?</p>]]></content>
			<author>
				<name><![CDATA[olejl]]></name>
				<uri>http://www.tracmor.com/forum/user/187/</uri>
			</author>
			<updated>2009-10-29T20:03:08Z</updated>
			<id>http://www.tracmor.com/forum/post/622/#p622</id>
		</entry>
</feed>

