<?php
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg6.php" ?>
<?php include "ewmysql6.php" ?>
<?php include "phpfn6.php" ?>
<?php include "categoriainfo.php" ?>
<?php include "usuarioinfo.php" ?>
<?php include "userfn6.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Define page object
$categoria_add = new ccategoria_add();
$Page =& $categoria_add;

// Page init processing
$categoria_add->Page_Init();

// Page main processing
$categoria_add->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--

// Create page object
var categoria_add = new ew_Page("categoria_add");

// page properties
categoria_add.PageID = "add"; // page ID
var EW_PAGE_ID = categoria_add.PageID; // for backward compatibility

// extend page with ValidateForm function
categoria_add.ValidateForm = function(fobj) {
	if (!this.ValidateRequired)
		return true; // ignore validation
	if (fobj.a_confirm && fobj.a_confirm.value == "F")
		return true;
	var i, elm, aelm, infix;
	var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
	for (i=0; i<rowcnt; i++) {
		infix = (fobj.key_count) ? String(i+1) : "";
		elm = fobj.elements["x" + infix + "_cod_categoria"];
		if (elm && !ew_HasValue(elm))
			return ew_OnError(this, elm, "Ingresar campo obligatorio - cod.");
		elm = fobj.elements["x" + infix + "_des_categoria"];
		if (elm && !ew_HasValue(elm))
			return ew_OnError(this, elm, "Ingresar campo obligatorio - descripción");
		elm = fobj.elements["x" + infix + "_des_imagen"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, "File type is not allowed.");
		elm = fobj.elements["x" + infix + "_ind_activo"];
		if (elm && !ew_HasValue(elm))
			return ew_OnError(this, elm, "Ingresar campo obligatorio - ind activo");
		elm = fobj.elements["x" + infix + "_margen"];
		if (elm && !ew_CheckNumber(elm.value))
			return ew_OnError(this, elm, "Incorrect floating point number - margen");
		elm = fobj.elements["x" + infix + "_ind_cat"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "Incorrect integer - ind cat");
		elm = fobj.elements["x" + infix + "_orden"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "Incorrect integer - orden");
		elm = fobj.elements["x" + infix + "_cod_usuario_registro"];
		if (elm && !ew_HasValue(elm))
			return ew_OnError(this, elm, "Ingresar campo obligatorio - cod usuario registro");
		elm = fobj.elements["x" + infix + "_cod_usuario_registro"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "Incorrect integer - cod usuario registro");
		elm = fobj.elements["x" + infix + "_fec_registro"];
		if (elm && !ew_HasValue(elm))
			return ew_OnError(this, elm, "Ingresar campo obligatorio - fec registro");
		elm = fobj.elements["x" + infix + "_fec_registro"];
		if (elm && !ew_CheckDate(elm.value))
			return ew_OnError(this, elm, "Incorrect date, format = yyyy/mm/dd - fec registro");
		elm = fobj.elements["x" + infix + "_cod_usuario_modificacion"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "Incorrect integer - cod usuario modificacion");
		elm = fobj.elements["x" + infix + "_fec_ultima_modificacion"];
		if (elm && !ew_CheckDate(elm.value))
			return ew_OnError(this, elm, "Incorrect date, format = yyyy/mm/dd - fec ultima modificacion");

		// Call Form Custom Validate event
		if (!this.Form_CustomValidate(fobj)) return false;
	}
	return true;
}

// extend page with Form_CustomValidate function
categoria_add.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
<?php if (EW_CLIENT_VALIDATE) { ?>
categoria_add.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
categoria_add.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<p><span class="phpmaker">Agregar a TABLA: categorias<br><br>
<a href="<?php echo $categoria->getReturnUrl() ?>">Regresar</a></span></p>
<?php $categoria_add->ShowMessage() ?>
<form name="fcategoriaadd" id="fcategoriaadd" action="<?php echo ew_CurrentPage() ?>" method="post" enctype="multipart/form-data" onsubmit="return categoria_add.ValidateForm(this);">
<p>
<input type="hidden" name="t" id="t" value="categoria">
<input type="hidden" name="a_add" id="a_add" value="A">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($categoria->cod_categoria->Visible) { // cod_categoria ?>
	<tr<?php echo $categoria->cod_categoria->RowAttributes ?>>
		<td class="ewTableHeader">cod.<span class="ewRequired">&nbsp;*</span></td>
		<td<?php echo $categoria->cod_categoria->CellAttributes() ?>><span id="el_cod_categoria">
<input type="text" name="x_cod_categoria" id="x_cod_categoria" size="30" maxlength="2" value="<?php echo $categoria->cod_categoria->EditValue ?>"<?php echo $categoria->cod_categoria->EditAttributes() ?>>
</span><?php echo $categoria->cod_categoria->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->des_categoria->Visible) { // des_categoria ?>
	<tr<?php echo $categoria->des_categoria->RowAttributes ?>>
		<td class="ewTableHeader">descripción<span class="ewRequired">&nbsp;*</span></td>
		<td<?php echo $categoria->des_categoria->CellAttributes() ?>><span id="el_des_categoria">
<input type="text" name="x_des_categoria" id="x_des_categoria" size="30" maxlength="30" value="<?php echo $categoria->des_categoria->EditValue ?>"<?php echo $categoria->des_categoria->EditAttributes() ?>>
</span><?php echo $categoria->des_categoria->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->des_imagen->Visible) { // des_imagen ?>
	<tr<?php echo $categoria->des_imagen->RowAttributes ?>>
		<td class="ewTableHeader">imagen</td>
		<td<?php echo $categoria->des_imagen->CellAttributes() ?>><span id="el_des_imagen">
<input type="file" name="x_des_imagen" id="x_des_imagen" size="30"<?php echo $categoria->des_imagen->EditAttributes() ?>>
</div>
</span><?php echo $categoria->des_imagen->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->ind_activo->Visible) { // ind_activo ?>
	<tr<?php echo $categoria->ind_activo->RowAttributes ?>>
		<td class="ewTableHeader">ind activo<span class="ewRequired">&nbsp;*</span></td>
		<td<?php echo $categoria->ind_activo->CellAttributes() ?>><span id="el_ind_activo">
<input type="text" name="x_ind_activo" id="x_ind_activo" size="30" maxlength="1" value="<?php echo $categoria->ind_activo->EditValue ?>"<?php echo $categoria->ind_activo->EditAttributes() ?>>
</span><?php echo $categoria->ind_activo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->margen->Visible) { // margen ?>
	<tr<?php echo $categoria->margen->RowAttributes ?>>
		<td class="ewTableHeader">margen</td>
		<td<?php echo $categoria->margen->CellAttributes() ?>><span id="el_margen">
<input type="text" name="x_margen" id="x_margen" size="30" value="<?php echo $categoria->margen->EditValue ?>"<?php echo $categoria->margen->EditAttributes() ?>>
</span><?php echo $categoria->margen->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->displayConf->Visible) { // displayConf ?>
	<tr<?php echo $categoria->displayConf->RowAttributes ?>>
		<td class="ewTableHeader">display Conf</td>
		<td<?php echo $categoria->displayConf->CellAttributes() ?>><span id="el_displayConf">
<div id="tp_x_displayConf" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><input type="radio" name="x_displayConf" id="x_displayConf" value="{value}"<?php echo $categoria->displayConf->EditAttributes() ?>></div>
<div id="dsl_x_displayConf" repeatcolumn="5">
<?php
$arwrk = $categoria->displayConf->EditValue;
if (is_array($arwrk)) {
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($categoria->displayConf->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_displayConf" id="x_displayConf" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $categoria->displayConf->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
?>
</div>
</span><?php echo $categoria->displayConf->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->displayCat->Visible) { // displayCat ?>
	<tr<?php echo $categoria->displayCat->RowAttributes ?>>
		<td class="ewTableHeader">cat</td>
		<td<?php echo $categoria->displayCat->CellAttributes() ?>><span id="el_displayCat">
<div id="tp_x_displayCat" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><input type="radio" name="x_displayCat" id="x_displayCat" value="{value}"<?php echo $categoria->displayCat->EditAttributes() ?>></div>
<div id="dsl_x_displayCat" repeatcolumn="5">
<?php
$arwrk = $categoria->displayCat->EditValue;
if (is_array($arwrk)) {
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($categoria->displayCat->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_displayCat" id="x_displayCat" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $categoria->displayCat->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
?>
</div>
</span><?php echo $categoria->displayCat->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->ind_cat->Visible) { // ind_cat ?>
	<tr<?php echo $categoria->ind_cat->RowAttributes ?>>
		<td class="ewTableHeader">ind cat</td>
		<td<?php echo $categoria->ind_cat->CellAttributes() ?>><span id="el_ind_cat">
<input type="text" name="x_ind_cat" id="x_ind_cat" size="30" value="<?php echo $categoria->ind_cat->EditValue ?>"<?php echo $categoria->ind_cat->EditAttributes() ?>>
</span><?php echo $categoria->ind_cat->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->orden->Visible) { // orden ?>
	<tr<?php echo $categoria->orden->RowAttributes ?>>
		<td class="ewTableHeader">orden</td>
		<td<?php echo $categoria->orden->CellAttributes() ?>><span id="el_orden">
<input type="text" name="x_orden" id="x_orden" size="30" value="<?php echo $categoria->orden->EditValue ?>"<?php echo $categoria->orden->EditAttributes() ?>>
</span><?php echo $categoria->orden->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->cod_usuario_registro->Visible) { // cod_usuario_registro ?>
	<tr<?php echo $categoria->cod_usuario_registro->RowAttributes ?>>
		<td class="ewTableHeader">cod usuario registro<span class="ewRequired">&nbsp;*</span></td>
		<td<?php echo $categoria->cod_usuario_registro->CellAttributes() ?>><span id="el_cod_usuario_registro">
<input type="text" name="x_cod_usuario_registro" id="x_cod_usuario_registro" size="30" value="<?php echo $categoria->cod_usuario_registro->EditValue ?>"<?php echo $categoria->cod_usuario_registro->EditAttributes() ?>>
</span><?php echo $categoria->cod_usuario_registro->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->fec_registro->Visible) { // fec_registro ?>
	<tr<?php echo $categoria->fec_registro->RowAttributes ?>>
		<td class="ewTableHeader">fec registro<span class="ewRequired">&nbsp;*</span></td>
		<td<?php echo $categoria->fec_registro->CellAttributes() ?>><span id="el_fec_registro">
<input type="text" name="x_fec_registro" id="x_fec_registro" value="<?php echo $categoria->fec_registro->EditValue ?>"<?php echo $categoria->fec_registro->EditAttributes() ?>>
&nbsp;<img src="images/calendar.png" id="cal_x_fec_registro" name="cal_x_fec_registro" alt="Escoja una fecha" style="cursor:pointer;cursor:hand;">
<script type="text/javascript">
Calendar.setup({
	inputField : "x_fec_registro", // ID of the input field
	ifFormat : "%Y/%m/%d", // the date format
	button : "cal_x_fec_registro" // ID of the button
});
</script>
</span><?php echo $categoria->fec_registro->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->cod_usuario_modificacion->Visible) { // cod_usuario_modificacion ?>
	<tr<?php echo $categoria->cod_usuario_modificacion->RowAttributes ?>>
		<td class="ewTableHeader">cod usuario modificacion</td>
		<td<?php echo $categoria->cod_usuario_modificacion->CellAttributes() ?>><span id="el_cod_usuario_modificacion">
<input type="text" name="x_cod_usuario_modificacion" id="x_cod_usuario_modificacion" size="30" value="<?php echo $categoria->cod_usuario_modificacion->EditValue ?>"<?php echo $categoria->cod_usuario_modificacion->EditAttributes() ?>>
</span><?php echo $categoria->cod_usuario_modificacion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($categoria->fec_ultima_modificacion->Visible) { // fec_ultima_modificacion ?>
	<tr<?php echo $categoria->fec_ultima_modificacion->RowAttributes ?>>
		<td class="ewTableHeader">fec ultima modificacion</td>
		<td<?php echo $categoria->fec_ultima_modificacion->CellAttributes() ?>><span id="el_fec_ultima_modificacion">
<input type="text" name="x_fec_ultima_modificacion" id="x_fec_ultima_modificacion" value="<?php echo $categoria->fec_ultima_modificacion->EditValue ?>"<?php echo $categoria->fec_ultima_modificacion->EditAttributes() ?>>
&nbsp;<img src="images/calendar.png" id="cal_x_fec_ultima_modificacion" name="cal_x_fec_ultima_modificacion" alt="Escoja una fecha" style="cursor:pointer;cursor:hand;">
<script type="text/javascript">
Calendar.setup({
	inputField : "x_fec_ultima_modificacion", // ID of the input field
	ifFormat : "%Y/%m/%d", // the date format
	button : "cal_x_fec_ultima_modificacion" // ID of the button
});
</script>
</span><?php echo $categoria->fec_ultima_modificacion->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="  Agregar  ">
</form>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php include "footer.php" ?>
<?php

//
// Page Class
//
class ccategoria_add {

	// Page ID
	var $PageID = 'add';

	// Table Name
	var $TableName = 'categoria';

	// Page Object Name
	var $PageObjName = 'categoria_add';

	// Page Name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page Url
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $categoria;
		if ($categoria->UseTokenInUrl) $PageUrl .= "t=" . $categoria->TableVar . "&"; // add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
			$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
		} else {
			$_SESSION[EW_SESSION_MESSAGE] = $v;
		}
	}

	// Show Message
	function ShowMessage() {
		if ($this->getMessage() <> "") { // Message in Session, display
			echo "<p><span class=\"ewMessage\">" . $this->getMessage() . "</span></p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}
	}

	// Validate Page request
	function IsPageRequest() {
		global $objForm, $categoria;
		if ($categoria->UseTokenInUrl) {

			//IsPageRequest = False
			if ($objForm)
				return ($categoria->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($categoria->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	//  Class initialize
	//  - init objects
	//  - open connection
	//
	function ccategoria_add() {
		global $conn;

		// Initialize table object
		$GLOBALS["categoria"] = new ccategoria();

		// Initialize other table object
		$GLOBALS['usuario'] = new cusuario();

		// Intialize page id (for backward compatibility)
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'add', TRUE);

		// Initialize table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'categoria', TRUE);

		// Open connection to the database
		$conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $categoria;
		global $Security;
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Global page loading event (in userfn6.php)
		Page_Loading();

		// Page load event, used in current page
		$this->Page_Load();
	}

	//
	//  Page_Terminate
	//  - called when exit page
	//  - if URL specified, redirect to the URL
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page unload event, used in current page
		$this->Page_Unload();

		// Global page unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close Connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			ob_end_clean();
			header("Location: $url");
		}
		exit();
	}
	var $x_ewPriv = 0;

	// 
	// Page main processing
	//
	function Page_Main() {
		global $objForm, $gsFormError, $categoria;

		// Load key values from QueryString
		$bCopy = TRUE;
		if (@$_GET["cod_categoria"] != "") {
		  $categoria->cod_categoria->setQueryStringValue($_GET["cod_categoria"]);
		} else {
		  $bCopy = FALSE;
		}

		// Create form object
		$objForm = new cFormObj();

		// Process form if post back
		if (@$_POST["a_add"] <> "") {
		   $categoria->CurrentAction = $_POST["a_add"]; // Get form action
		  $this->GetUploadFiles(); // Get upload files
		  $this->LoadFormValues(); // Load form values

			// Validate Form
			if (!$this->ValidateForm()) {
				$categoria->CurrentAction = "I"; // Form error, reset action
				$this->setMessage($gsFormError);
			}
		} else { // Not post back
		  if ($bCopy) {
		    $categoria->CurrentAction = "C"; // Copy Record
		  } else {
		    $categoria->CurrentAction = "I"; // Display Blank Record
		    $this->LoadDefaultValues(); // Load default values
		  }
		}

		// Perform action based on action code
		switch ($categoria->CurrentAction) {
		  case "I": // Blank record, no action required
				break;
		  case "C": // Copy an existing record
		   if (!$this->LoadRow()) { // Load record based on key
		      $this->setMessage("No se encontraron registros"); // No record found
		      $this->Page_Terminate("categorialist.php"); // No matching record, return to list
		    }
				break;
		  case "A": // ' Add new record
				$categoria->SendEmail = TRUE; // Send email on add success
		    if ($this->AddRow()) { // Add successful
		      $this->setMessage("Agregado con exito"); // Set up success message
					$sReturnUrl = $categoria->getReturnUrl();
					$this->Page_Terminate($sReturnUrl); // Clean up and return
		    } else {
		      $this->RestoreFormValues(); // Add failed, restore form values
		    }
		}

		// Render row based on row type
		$categoria->RowType = EW_ROWTYPE_ADD;  // Render add type

		// Render row
		$this->RenderRow();
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm, $categoria;

		// Get upload data
			if ($categoria->des_imagen->Upload->UploadFile()) {

				// No action required
			} else {
				echo $categoria->des_imagen->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
	}

	// Load default values
	function LoadDefaultValues() {
		global $categoria;
		$categoria->des_imagen->CurrentValue = NULL; // Clear file related field
		$categoria->ind_activo->CurrentValue = "1";
		$categoria->margen->CurrentValue = 1.100;
		$categoria->displayConf->CurrentValue = 0;
		$categoria->displayCat->CurrentValue = 0;
		$categoria->ind_cat->CurrentValue = 1;
		$categoria->cod_usuario_registro->CurrentValue = 0;
		$categoria->fec_registro->CurrentValue = "0000-00-00 00:00:00";
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm, $categoria;
		$categoria->cod_categoria->setFormValue($objForm->GetValue("x_cod_categoria"));
		$categoria->des_categoria->setFormValue($objForm->GetValue("x_des_categoria"));
		$categoria->ind_activo->setFormValue($objForm->GetValue("x_ind_activo"));
		$categoria->margen->setFormValue($objForm->GetValue("x_margen"));
		$categoria->displayConf->setFormValue($objForm->GetValue("x_displayConf"));
		$categoria->displayCat->setFormValue($objForm->GetValue("x_displayCat"));
		$categoria->ind_cat->setFormValue($objForm->GetValue("x_ind_cat"));
		$categoria->orden->setFormValue($objForm->GetValue("x_orden"));
		$categoria->cod_usuario_registro->setFormValue($objForm->GetValue("x_cod_usuario_registro"));
		$categoria->fec_registro->setFormValue($objForm->GetValue("x_fec_registro"));
		$categoria->fec_registro->CurrentValue = ew_UnFormatDateTime($categoria->fec_registro->CurrentValue, 5);
		$categoria->cod_usuario_modificacion->setFormValue($objForm->GetValue("x_cod_usuario_modificacion"));
		$categoria->fec_ultima_modificacion->setFormValue($objForm->GetValue("x_fec_ultima_modificacion"));
		$categoria->fec_ultima_modificacion->CurrentValue = ew_UnFormatDateTime($categoria->fec_ultima_modificacion->CurrentValue, 5);
	}

	// Restore form values
	function RestoreFormValues() {
		global $categoria;
		$categoria->cod_categoria->CurrentValue = $categoria->cod_categoria->FormValue;
		$categoria->des_categoria->CurrentValue = $categoria->des_categoria->FormValue;
		$categoria->ind_activo->CurrentValue = $categoria->ind_activo->FormValue;
		$categoria->margen->CurrentValue = $categoria->margen->FormValue;
		$categoria->displayConf->CurrentValue = $categoria->displayConf->FormValue;
		$categoria->displayCat->CurrentValue = $categoria->displayCat->FormValue;
		$categoria->ind_cat->CurrentValue = $categoria->ind_cat->FormValue;
		$categoria->orden->CurrentValue = $categoria->orden->FormValue;
		$categoria->cod_usuario_registro->CurrentValue = $categoria->cod_usuario_registro->FormValue;
		$categoria->fec_registro->CurrentValue = $categoria->fec_registro->FormValue;
		$categoria->fec_registro->CurrentValue = ew_UnFormatDateTime($categoria->fec_registro->CurrentValue, 5);
		$categoria->cod_usuario_modificacion->CurrentValue = $categoria->cod_usuario_modificacion->FormValue;
		$categoria->fec_ultima_modificacion->CurrentValue = $categoria->fec_ultima_modificacion->FormValue;
		$categoria->fec_ultima_modificacion->CurrentValue = ew_UnFormatDateTime($categoria->fec_ultima_modificacion->CurrentValue, 5);
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $categoria;
		$sFilter = $categoria->KeyFilter();

		// Call Row Selecting event
		$categoria->Row_Selecting($sFilter);

		// Load sql based on filter
		$categoria->CurrentFilter = $sFilter;
		$sSql = $categoria->SQL();
		if ($rs = $conn->Execute($sSql)) {
			if ($rs->EOF) {
				$LoadRow = FALSE;
			} else {
				$LoadRow = TRUE;
				$rs->MoveFirst();
				$this->LoadRowValues($rs); // Load row values

				// Call Row Selected event
				$categoria->Row_Selected($rs);
			}
			$rs->Close();
		} else {
			$LoadRow = FALSE;
		}
		return $LoadRow;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $categoria;
		$categoria->cod_categoria->setDbValue($rs->fields('cod_categoria'));
		$categoria->des_categoria->setDbValue($rs->fields('des_categoria'));
		$categoria->des_imagen->Upload->DbValue = $rs->fields('des_imagen');
		$categoria->ind_activo->setDbValue($rs->fields('ind_activo'));
		$categoria->margen->setDbValue($rs->fields('margen'));
		$categoria->displayConf->setDbValue($rs->fields('displayConf'));
		$categoria->displayCat->setDbValue($rs->fields('displayCat'));
		$categoria->ind_cat->setDbValue($rs->fields('ind_cat'));
		$categoria->orden->setDbValue($rs->fields('orden'));
		$categoria->cod_usuario_registro->setDbValue($rs->fields('cod_usuario_registro'));
		$categoria->fec_registro->setDbValue($rs->fields('fec_registro'));
		$categoria->cod_usuario_modificacion->setDbValue($rs->fields('cod_usuario_modificacion'));
		$categoria->fec_ultima_modificacion->setDbValue($rs->fields('fec_ultima_modificacion'));
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $categoria;

		// Call Row_Rendering event
		$categoria->Row_Rendering();

		// Common render codes for all row types
		// cod_categoria

		$categoria->cod_categoria->CellCssStyle = "";
		$categoria->cod_categoria->CellCssClass = "";

		// des_categoria
		$categoria->des_categoria->CellCssStyle = "";
		$categoria->des_categoria->CellCssClass = "";

		// des_imagen
		$categoria->des_imagen->CellCssStyle = "";
		$categoria->des_imagen->CellCssClass = "";

		// ind_activo
		$categoria->ind_activo->CellCssStyle = "";
		$categoria->ind_activo->CellCssClass = "";

		// margen
		$categoria->margen->CellCssStyle = "";
		$categoria->margen->CellCssClass = "";

		// displayConf
		$categoria->displayConf->CellCssStyle = "";
		$categoria->displayConf->CellCssClass = "";

		// displayCat
		$categoria->displayCat->CellCssStyle = "";
		$categoria->displayCat->CellCssClass = "";

		// ind_cat
		$categoria->ind_cat->CellCssStyle = "";
		$categoria->ind_cat->CellCssClass = "";

		// orden
		$categoria->orden->CellCssStyle = "";
		$categoria->orden->CellCssClass = "";

		// cod_usuario_registro
		$categoria->cod_usuario_registro->CellCssStyle = "";
		$categoria->cod_usuario_registro->CellCssClass = "";

		// fec_registro
		$categoria->fec_registro->CellCssStyle = "";
		$categoria->fec_registro->CellCssClass = "";

		// cod_usuario_modificacion
		$categoria->cod_usuario_modificacion->CellCssStyle = "";
		$categoria->cod_usuario_modificacion->CellCssClass = "";

		// fec_ultima_modificacion
		$categoria->fec_ultima_modificacion->CellCssStyle = "";
		$categoria->fec_ultima_modificacion->CellCssClass = "";
		if ($categoria->RowType == EW_ROWTYPE_VIEW) { // View row

			// cod_categoria
			$categoria->cod_categoria->ViewValue = $categoria->cod_categoria->CurrentValue;
			$categoria->cod_categoria->CssStyle = "";
			$categoria->cod_categoria->CssClass = "";
			$categoria->cod_categoria->ViewCustomAttributes = "";

			// des_categoria
			$categoria->des_categoria->ViewValue = $categoria->des_categoria->CurrentValue;
			$categoria->des_categoria->CssStyle = "";
			$categoria->des_categoria->CssClass = "";
			$categoria->des_categoria->ViewCustomAttributes = "";

			// des_imagen
			if (!is_null($categoria->des_imagen->Upload->DbValue)) {
				$categoria->des_imagen->ViewValue = $categoria->des_imagen->Upload->DbValue;
				$categoria->des_imagen->ImageWidth = 120;
				$categoria->des_imagen->ImageHeight = 0;
				$categoria->des_imagen->ImageAlt = "";
			} else {
				$categoria->des_imagen->ViewValue = "";
			}
			$categoria->des_imagen->CssStyle = "";
			$categoria->des_imagen->CssClass = "";
			$categoria->des_imagen->ViewCustomAttributes = "";

			// ind_activo
			$categoria->ind_activo->ViewValue = $categoria->ind_activo->CurrentValue;
			$categoria->ind_activo->CssStyle = "";
			$categoria->ind_activo->CssClass = "";
			$categoria->ind_activo->ViewCustomAttributes = "";

			// margen
			$categoria->margen->ViewValue = $categoria->margen->CurrentValue;
			$categoria->margen->CssStyle = "";
			$categoria->margen->CssClass = "";
			$categoria->margen->ViewCustomAttributes = "";

			// displayConf
			if (strval($categoria->displayConf->CurrentValue) <> "") {
				switch ($categoria->displayConf->CurrentValue) {
					case "1":
						$categoria->displayConf->ViewValue = "Si";
						break;
					case "0":
						$categoria->displayConf->ViewValue = "No";
						break;
					default:
						$categoria->displayConf->ViewValue = $categoria->displayConf->CurrentValue;
				}
			} else {
				$categoria->displayConf->ViewValue = NULL;
			}
			$categoria->displayConf->CssStyle = "";
			$categoria->displayConf->CssClass = "";
			$categoria->displayConf->ViewCustomAttributes = "";

			// displayCat
			if (strval($categoria->displayCat->CurrentValue) <> "") {
				switch ($categoria->displayCat->CurrentValue) {
					case "1":
						$categoria->displayCat->ViewValue = "Si";
						break;
					case "0":
						$categoria->displayCat->ViewValue = "No";
						break;
					default:
						$categoria->displayCat->ViewValue = $categoria->displayCat->CurrentValue;
				}
			} else {
				$categoria->displayCat->ViewValue = NULL;
			}
			$categoria->displayCat->CssStyle = "";
			$categoria->displayCat->CssClass = "";
			$categoria->displayCat->ViewCustomAttributes = "";

			// ind_cat
			$categoria->ind_cat->ViewValue = $categoria->ind_cat->CurrentValue;
			$categoria->ind_cat->CssStyle = "";
			$categoria->ind_cat->CssClass = "";
			$categoria->ind_cat->ViewCustomAttributes = "";

			// orden
			$categoria->orden->ViewValue = $categoria->orden->CurrentValue;
			$categoria->orden->CssStyle = "";
			$categoria->orden->CssClass = "";
			$categoria->orden->ViewCustomAttributes = "";

			// cod_usuario_registro
			$categoria->cod_usuario_registro->ViewValue = $categoria->cod_usuario_registro->CurrentValue;
			$categoria->cod_usuario_registro->CssStyle = "";
			$categoria->cod_usuario_registro->CssClass = "";
			$categoria->cod_usuario_registro->ViewCustomAttributes = "";

			// fec_registro
			$categoria->fec_registro->ViewValue = $categoria->fec_registro->CurrentValue;
			$categoria->fec_registro->ViewValue = ew_FormatDateTime($categoria->fec_registro->ViewValue, 5);
			$categoria->fec_registro->CssStyle = "";
			$categoria->fec_registro->CssClass = "";
			$categoria->fec_registro->ViewCustomAttributes = "";

			// cod_usuario_modificacion
			$categoria->cod_usuario_modificacion->ViewValue = $categoria->cod_usuario_modificacion->CurrentValue;
			$categoria->cod_usuario_modificacion->CssStyle = "";
			$categoria->cod_usuario_modificacion->CssClass = "";
			$categoria->cod_usuario_modificacion->ViewCustomAttributes = "";

			// fec_ultima_modificacion
			$categoria->fec_ultima_modificacion->ViewValue = $categoria->fec_ultima_modificacion->CurrentValue;
			$categoria->fec_ultima_modificacion->ViewValue = ew_FormatDateTime($categoria->fec_ultima_modificacion->ViewValue, 5);
			$categoria->fec_ultima_modificacion->CssStyle = "";
			$categoria->fec_ultima_modificacion->CssClass = "";
			$categoria->fec_ultima_modificacion->ViewCustomAttributes = "";

			// cod_categoria
			$categoria->cod_categoria->HrefValue = "";

			// des_categoria
			$categoria->des_categoria->HrefValue = "";

			// des_imagen
			$categoria->des_imagen->HrefValue = "";

			// ind_activo
			$categoria->ind_activo->HrefValue = "";

			// margen
			$categoria->margen->HrefValue = "";

			// displayConf
			$categoria->displayConf->HrefValue = "";

			// displayCat
			$categoria->displayCat->HrefValue = "";

			// ind_cat
			$categoria->ind_cat->HrefValue = "";

			// orden
			$categoria->orden->HrefValue = "";

			// cod_usuario_registro
			$categoria->cod_usuario_registro->HrefValue = "";

			// fec_registro
			$categoria->fec_registro->HrefValue = "";

			// cod_usuario_modificacion
			$categoria->cod_usuario_modificacion->HrefValue = "";

			// fec_ultima_modificacion
			$categoria->fec_ultima_modificacion->HrefValue = "";
		} elseif ($categoria->RowType == EW_ROWTYPE_ADD) { // Add row

			// cod_categoria
			$categoria->cod_categoria->EditCustomAttributes = "";
			$categoria->cod_categoria->EditValue = ew_HtmlEncode($categoria->cod_categoria->CurrentValue);

			// des_categoria
			$categoria->des_categoria->EditCustomAttributes = "";
			$categoria->des_categoria->EditValue = ew_HtmlEncode($categoria->des_categoria->CurrentValue);

			// des_imagen
			$categoria->des_imagen->EditCustomAttributes = "";
			if (!is_null($categoria->des_imagen->Upload->DbValue)) {
				$categoria->des_imagen->EditValue = $categoria->des_imagen->Upload->DbValue;
				$categoria->des_imagen->ImageWidth = 120;
				$categoria->des_imagen->ImageHeight = 0;
				$categoria->des_imagen->ImageAlt = "";
			} else {
				$categoria->des_imagen->EditValue = "";
			}

			// ind_activo
			$categoria->ind_activo->EditCustomAttributes = "";
			$categoria->ind_activo->EditValue = ew_HtmlEncode($categoria->ind_activo->CurrentValue);

			// margen
			$categoria->margen->EditCustomAttributes = "";
			$categoria->margen->EditValue = ew_HtmlEncode($categoria->margen->CurrentValue);

			// displayConf
			$categoria->displayConf->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array("1", "Si");
			$arwrk[] = array("0", "No");
			$categoria->displayConf->EditValue = $arwrk;

			// displayCat
			$categoria->displayCat->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array("1", "Si");
			$arwrk[] = array("0", "No");
			$categoria->displayCat->EditValue = $arwrk;

			// ind_cat
			$categoria->ind_cat->EditCustomAttributes = "";
			$categoria->ind_cat->EditValue = ew_HtmlEncode($categoria->ind_cat->CurrentValue);

			// orden
			$categoria->orden->EditCustomAttributes = "";
			$categoria->orden->EditValue = ew_HtmlEncode($categoria->orden->CurrentValue);

			// cod_usuario_registro
			$categoria->cod_usuario_registro->EditCustomAttributes = "";
			$categoria->cod_usuario_registro->EditValue = ew_HtmlEncode($categoria->cod_usuario_registro->CurrentValue);

			// fec_registro
			$categoria->fec_registro->EditCustomAttributes = "";
			$categoria->fec_registro->EditValue = ew_HtmlEncode(ew_FormatDateTime($categoria->fec_registro->CurrentValue, 5));

			// cod_usuario_modificacion
			$categoria->cod_usuario_modificacion->EditCustomAttributes = "";
			$categoria->cod_usuario_modificacion->EditValue = ew_HtmlEncode($categoria->cod_usuario_modificacion->CurrentValue);

			// fec_ultima_modificacion
			$categoria->fec_ultima_modificacion->EditCustomAttributes = "";
			$categoria->fec_ultima_modificacion->EditValue = ew_HtmlEncode(ew_FormatDateTime($categoria->fec_ultima_modificacion->CurrentValue, 5));
		}

		// Call Row Rendered event
		$categoria->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $gsFormError, $categoria;

		// Initialize
		$gsFormError = "";
		if (!ew_CheckFileType($categoria->des_imagen->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= "File type is not allowed.";
		}
		if ($categoria->des_imagen->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0) {
			if ($categoria->des_imagen->Upload->FileSize > EW_MAX_FILE_SIZE)
				$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, "Max. tamaño de archivo (%s bytes) excedido.");
		}

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if ($categoria->cod_categoria->FormValue == "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= "Ingresar campo obligatorio - cod.";
		}
		if ($categoria->des_categoria->FormValue == "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= "Ingresar campo obligatorio - descripción";
		}
		if ($categoria->ind_activo->FormValue == "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= "Ingresar campo obligatorio - ind activo";
		}
		if (!ew_CheckNumber($categoria->margen->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= "Incorrect floating point number - margen";
		}
		if (!ew_CheckInteger($categoria->ind_cat->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= "Incorrect integer - ind cat";
		}
		if (!ew_CheckInteger($categoria->orden->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= "Incorrect integer - orden";
		}
		if ($categoria->cod_usuario_registro->FormValue == "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= "Ingresar campo obligatorio - cod usuario registro";
		}
		if (!ew_CheckInteger($categoria->cod_usuario_registro->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= "Incorrect integer - cod usuario registro";
		}
		if ($categoria->fec_registro->FormValue == "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= "Ingresar campo obligatorio - fec registro";
		}
		if (!ew_CheckDate($categoria->fec_registro->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= "Incorrect date, format = yyyy/mm/dd - fec registro";
		}
		if (!ew_CheckInteger($categoria->cod_usuario_modificacion->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= "Incorrect integer - cod usuario modificacion";
		}
		if (!ew_CheckDate($categoria->fec_ultima_modificacion->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= "Incorrect date, format = yyyy/mm/dd - fec ultima modificacion";
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $sFormCustomError;
		}
		return $ValidateForm;
	}

	// Add record
	function AddRow() {
		global $conn, $Security, $categoria;

		// Check if key value entered
		if ($categoria->cod_categoria->CurrentValue == "") {
			$this->setMessage("Clave valor invalido");
			return FALSE;
		}

		// Check for duplicate key
		$bCheckKey = TRUE;
		$sFilter = $categoria->KeyFilter();
		if ($bCheckKey) {
			$rsChk = $categoria->LoadRs($sFilter);
			if ($rsChk && !$rsChk->EOF) {
				$sKeyErrMsg = str_replace("%f", $sFilter, "Clave principal duplicada: '%f'");
				$this->setMessage($sKeyErrMsg);
				$rsChk->Close();
				return FALSE;
			}
		}
		$rsnew = array();

		// Field cod_categoria
		$categoria->cod_categoria->SetDbValueDef($categoria->cod_categoria->CurrentValue, "");
		$rsnew['cod_categoria'] =& $categoria->cod_categoria->DbValue;

		// Field des_categoria
		$categoria->des_categoria->SetDbValueDef($categoria->des_categoria->CurrentValue, "");
		$rsnew['des_categoria'] =& $categoria->des_categoria->DbValue;

		// Field des_imagen
		$categoria->des_imagen->Upload->SaveToSession(); // Save file value to Session
		if (is_null($categoria->des_imagen->Upload->Value)) {
			$rsnew['des_imagen'] = NULL;
		} else {
			$rsnew['des_imagen'] = ew_UploadFileNameEx(ew_UploadPathEx(True, EW_UPLOAD_DEST_PATH), $categoria->des_imagen->Upload->FileName);
		}

		// Field ind_activo
		$categoria->ind_activo->SetDbValueDef($categoria->ind_activo->CurrentValue, "");
		$rsnew['ind_activo'] =& $categoria->ind_activo->DbValue;

		// Field margen
		$categoria->margen->SetDbValueDef($categoria->margen->CurrentValue, NULL);
		$rsnew['margen'] =& $categoria->margen->DbValue;

		// Field displayConf
		$categoria->displayConf->SetDbValueDef($categoria->displayConf->CurrentValue, NULL);
		$rsnew['displayConf'] =& $categoria->displayConf->DbValue;

		// Field displayCat
		$categoria->displayCat->SetDbValueDef($categoria->displayCat->CurrentValue, NULL);
		$rsnew['displayCat'] =& $categoria->displayCat->DbValue;

		// Field ind_cat
		$categoria->ind_cat->SetDbValueDef($categoria->ind_cat->CurrentValue, NULL);
		$rsnew['ind_cat'] =& $categoria->ind_cat->DbValue;

		// Field orden
		$categoria->orden->SetDbValueDef($categoria->orden->CurrentValue, NULL);
		$rsnew['orden'] =& $categoria->orden->DbValue;

		// Field cod_usuario_registro
		$categoria->cod_usuario_registro->SetDbValueDef($categoria->cod_usuario_registro->CurrentValue, 0);
		$rsnew['cod_usuario_registro'] =& $categoria->cod_usuario_registro->DbValue;

		// Field fec_registro
		$categoria->fec_registro->SetDbValueDef(ew_UnFormatDateTime($categoria->fec_registro->CurrentValue, 5), ew_CurrentDate());
		$rsnew['fec_registro'] =& $categoria->fec_registro->DbValue;

		// Field cod_usuario_modificacion
		$categoria->cod_usuario_modificacion->SetDbValueDef($categoria->cod_usuario_modificacion->CurrentValue, NULL);
		$rsnew['cod_usuario_modificacion'] =& $categoria->cod_usuario_modificacion->DbValue;

		// Field fec_ultima_modificacion
		$categoria->fec_ultima_modificacion->SetDbValueDef(ew_UnFormatDateTime($categoria->fec_ultima_modificacion->CurrentValue, 5), NULL);
		$rsnew['fec_ultima_modificacion'] =& $categoria->fec_ultima_modificacion->DbValue;

		// Call Row Inserting event
		$bInsertRow = $categoria->Row_Inserting($rsnew);
		if ($bInsertRow) {

			// Field des_imagen
			if (!is_null($categoria->des_imagen->Upload->Value)) {
				if ($categoria->des_imagen->Upload->FileName == $categoria->des_imagen->Upload->DbValue) { // Overwrite if same file name
					$categoria->des_imagen->Upload->SaveToFile(EW_UPLOAD_DEST_PATH, $rsnew['des_imagen'], TRUE);
					$categoria->des_imagen->Upload->DbValue = ""; // No need to delete any more
				} else {
					$categoria->des_imagen->Upload->SaveToFile(EW_UPLOAD_DEST_PATH, $rsnew['des_imagen'], FALSE);
				}
			}
			if ($categoria->des_imagen->Upload->Action == "2" || $categoria->des_imagen->Upload->Action == "3") { // Update/Remove
				if ($categoria->des_imagen->Upload->DbValue <> "")
					@unlink(ew_UploadPathEx(TRUE, EW_UPLOAD_DEST_PATH) . $categoria->des_imagen->Upload->DbValue);
			}
			$conn->raiseErrorFn = 'ew_ErrorFn';
			$AddRow = $conn->Execute($categoria->InsertSQL($rsnew));
			$conn->raiseErrorFn = '';
		} else {
			if ($categoria->CancelMessage <> "") {
				$this->setMessage($categoria->CancelMessage);
				$categoria->CancelMessage = "";
			} else {
				$this->setMessage("Insertar cancelado");
			}
			$AddRow = FALSE;
		}
		if ($AddRow) {

			// Call Row Inserted event
			$categoria->Row_Inserted($rsnew);
		}

		// Field des_imagen
		$categoria->des_imagen->Upload->RemoveFromSession(); // Remove file value from Session
		return $AddRow;
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
