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


//	onscreen events


	}
// Captchas functions	

//	handlers

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

		//**********  Check if specific record exists  ************
global $conn;
$strSQLExists = "select max(ult_cod_generado) as ult_codigo from articulo";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
$codigo = $data["ult_codigo"]+1; //se suma la unidad para genera el numero del codigo
$values["codigo"] = $values["prefijo_cod"].'00'.$codigo.$values["sufijo_cod"];
$values["ult_cod_generado"] = $data["ult_codigo"]+1;
return true;
;		
} // function BeforeAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
//	onscreen events

} 
?>
