<?php 
class eventclass_Informe_de_Movimientos_de_Cajas  extends eventsBase
{ 
	function eventclass_Informe_de_Movimientos_de_Cajas()
	{
	// fill list of events
		$this->events["BeforeQueryList"]=true;

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

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

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


//	onscreen events


	}
// Captchas functions	

//	handlers

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

		$usuario = $_SESSION["UserName"];
//**********  Check if specific record exists  ************
global $conn;
$strSQLExists = "select * from usuario where nick='$usuario'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
//=============================
$idusuario = $data['idusuario'];
$strWhereClause = "idusuario=$idusuario";
// Place event code here.
// Use "Add Action" button to add code snippets.
;		
} // function BeforeQueryList

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
				// After record added
function AfterAdd(&$values,&$keys,$inline,&$pageObject)
{

		//**********  Redirect to another page  ************
header("Location: movimiento_caja_list.php?status=success");
exit();

// Place event code here.
// Use "Add Action" button to add code snippets.
;		
} // function AfterAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
				// Add page: Before process
function BeforeProcessAdd(&$conn,&$pageObject)
{

		$usuario = $_SESSION["UserName"];
//**********  Check if specific record exists  ************
global $conn;
$strSQLExists = "select * from usuario where nick='$usuario'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
//=============================
$idusuario = $data['idusuario'];
//echo $idusuario;exit();
$sql_movimiento = "select * from movimiento_caja where idusuario=$idusuario and estado = 'ABIERTO'";
$result = db_query($sql_movimiento,$conn);
$linea=db_fetch_array($result);
if($linea){
	header("Location: movimiento_caja_list.php?status=info");
	exit();
}

// Place event code here.
// Use "Add Action" button to add code snippets.
;		
} // function BeforeProcessAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// After record updated
function AfterEdit(&$values,$where,&$oldvalues,&$keys,$inline,&$pageObject)
{

		
//**********  Redirect to another page  ************
header("Location: movimiento_caja_list.php?status=success2");
exit();




// Place event code here.
// Use "Add Action" button to add code snippets.
;		
} // function AfterEdit

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
//	onscreen events

} 
?>
