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

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

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

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


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


//	onscreen events


	}
// Captchas functions	

//	handlers

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

		global $conn;
$strSQLExists = "select DATE(NOW()) as fecha";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
$values["fecha"] = $data["fecha"];

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

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

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

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




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

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

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

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




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

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

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

		global $conn;
//=============================================
$usuario = $_SESSION['UserName'];
//=============================================
$strSQLExists = "select * from usuario where nick='$usuario'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
//=============================================
$idusuario = $data['idusuario'];
$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)
{
	//siguiente paso
}else{
	header("Location: venta_list.php?status=warning");
	exit();
}

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

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

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

		//$values["total"] = str_replace(".", "", $values["total"]);

// Place event code here.
// Use "Add Action" button to add code snippets.
$values["total"] = 0;
return true;
;		
} // function BeforeAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
//	onscreen events

} 
?>
