<?php

/**
 * 	Dear developer!
 *	Never modify events.php file, it is autogenerated.
 *  Modify PHP/EventTemplates/events.txt instead.
 *
 */

 class eventclass_ac  extends eventsBase
{
	function __construct()
	{
	// fill list of events
		$this->events["BeforeQueryList"]=true;

		$this->events["BeforeProcessRowList"]=true;

		$this->events["BeforeShowView"]=true;

		$this->events["BeforeShowList"]=true;

		$this->events["BeforeAdd"]=true;

		$this->events["BeforeEdit"]=true;

		$this->events["BeforeShowExport"]=true;

		$this->events["BeforeProcessRowPrint"]=true;

		$this->events["BeforeOut"]=true;

		$this->events["ProcessValuesView"]=true;


	}

//	handlers

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// List page: Before SQL query
function BeforeQueryList(&$strSQL, &$strWhereClause, &$strOrderBy, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.


if ($_SESSION["user_role"]<>"ADMIN")
{

   $condition = " VISIBLE = 'YES' ";
	 $strWhereClause = whereAdd($strWhereClause, $condition);
}

else
{
	if( $pageObject->pageName == "list1" ) {
			$condition = " VISIBLE = 'NO' ";
	}
	else
	{
			$condition = " VISIBLE = 'YES' ";
	}

  $strWhereClause = whereAdd($strWhereClause, $condition);
  
}



;		
} // function BeforeQueryList

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// List page: Before record processed
function BeforeProcessRowList(&$data, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.


//  HOW  TO  WRITE  INTO  TXT  FILE
//$myfile = fopen("1  log_file ac before.txt", "w") or die("Unable to open file!");
//fwrite($myfile, "name = ".$_SESSION["user_name"]." \n");
//fwrite($myfile, "BEFORE discount = ".$_SESSION["disc"]." \n");


if ($_SESSION["user_name"]!="")
{
    $data["PRICE"] = round($data["PRICE"] * $_SESSION["disc"]);
  // fwrite($myfile, "BEFORE discount IF  = ".$_SESSION["disc"]." \n");
}

//fwrite($myfile, "DONE  \n");
//fclose($myfile);

return true;
;		
} // function BeforeProcessRowList

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before display
function BeforeShowView(&$xt, &$templatefile, &$values, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.

$_SESSION["SPECS"]=$values["SPECS"] ;



;		
} // function BeforeShowView

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before display
function BeforeShowList(&$xt, &$templatefile, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.

//if ($_SESSION["user_role"]<>"ADMIN")
//{
   //$pageObject->hideItem("filter_visible");    //  DON'T WORK  IT'S A BUG
   //$xt.assign("filter_visible",false);
//}
;		
} // function BeforeShowList

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before record added
function BeforeAdd(&$values, &$message, $inline, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.


$values['BTU/HR'] = trim($values['BTU/HR']);

return true;
;		
} // function BeforeAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before record updated
function BeforeEdit(&$values, $where, &$oldvalues, &$keys, &$message, $inline, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.

$values['BTU/HR'] = trim($values['BTU/HR']);

return true;
;		
} // function BeforeEdit

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before display
function BeforeShowExport(&$xt, &$templatefile, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.


;		
} // function BeforeShowExport

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Print page: Before record processed
function BeforeProcessRowPrint(&$data, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.



if ($_SESSION["user_name"]!="")
{
    $data["PRICE"] = round($data["PRICE"] * $_SESSION["disc"]);

}

return true;
;		
} // function BeforeProcessRowPrint

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before Export Record
function BeforeOut(&$data, &$values, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.


if ($_SESSION["user_name"]!="")
{
    $data["PRICE"] = round($data["PRICE"] * $_SESSION["disc"]);

}

return true;
;		
} // function BeforeOut

		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Process record values
function ProcessValuesView(&$values, &$pageObject)
{

		

// Place event code here.
// Use "Add Action" button to add code snippets.

if ($_SESSION["user_name"]!="")
{
    $values["PRICE"] = round($values["PRICE"] * $_SESSION["disc"]);

}
;		
} // function ProcessValuesView

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		



}
?>
