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

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


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

		$this->events["BeforeEdit"]=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"];
// ===========================================================
$usuario = $_SESSION["UserName"];
$sql_usuario = "select * from usuario where nick='$usuario'";
$result_usuario = db_query($sql_usuario,$conn);
$data_usuario=db_fetch_array($result_usuario);
//=============================
$idusuario = $data_usuario['idusuario'];
$sql_movimiento = "select * from movimiento_caja where idusuario=$idusuario and estado = 'ABIERTO'";
$result = db_query($sql_movimiento,$conn);
$linea=db_fetch_array($result);
$values["idmovimiento"] = $linea['idmovimiento'];
;		
} // function ProcessValuesAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// Before display
function BeforeShowList(&$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();
}
;		
} // function BeforeShowList

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

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

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

return true;
;		
} // function BeforeAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

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

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

return true;
;		
} // function BeforeEdit

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
//	onscreen events

} 
?>
