This topic is locked

Print Advanced Search Parameter in report and print page

9/15/2016 3:21:35 AM
PHPRunner Tips and Tricks
romaldus author

PHPRunner beginner.

PHPRunner manual/help covers many example of custom code. One of which is "Print search parameters on List, report and print page" .

The following custom code demonstrates how to print (echo) date range or specific date from advanced search parameter to report page.
https://xlinesoft.co...n_list_page.htm
Sample Output in Report Page:
search option:


search option:


In phprunner visual editor, insert PHP Code snippet wherever you want. As you see in screenshot, i insert PHP code snipped above the report data.

Add the following Code to php code snippet.

Do the same in Print Page



global $strTableName;

if (isset($_SESSION[$strTableName.'_advsearch']))

{

$searchClauseObj = unserialize($_SESSION[$strTableName.'_advsearch']);

}



$fieldSearchData = $searchClauseObj->_where[$strTableName."_srchFields"];


for($i=0; $i<count($fieldSearchData); $i++){

$fName = $fieldSearchData[$i]['fName'];

$val1 = $fieldSearchData[$i]['value1'];

$val2 = $fieldSearchData[$i]['value2'];

$srchCat = $fieldSearchData[$i]['opt'];

$srchNot = $fieldSearchData[$i]['not'];
//Restrict to "OrderDate" Field only, Ignore search parameters from other search field

//$val1 is variable for Start date in date range or specific date

//$val2 is variable for End date in date range
if ($fName=="OrderDate" && !empty($val1) && !empty($val2))

{

echo ("Sales Details From:"."&nbsp"."<b><FONT color='#ff0000'>"."$val1"."</font></b>"."&nbsp"."To:"."&nbsp"."<b><FONT color='#ff0000'>"."$val2"."</font></b>");

}
else

if ($fName=="OrderDate" && !empty($val1) && empty($val2))



echo ("Sales Details On: "."&nbsp"."<b><FONT color='#ff0000'>"."$val1"."</font></b>");

}