<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg12.php" ?>
<?php include_once ((EW_USE_ADODB) ? "adodb5/adodb.inc.php" : "ewmysql12.php") ?>
<?php include_once "phpfn12.php" ?>
<?php include_once "consulta_general_2019info.php" ?>
<?php include_once "userfn12.php" ?>
<?php

//
// Page class
//

$consulta_general_2019_search = NULL; // Initialize page object first

class cconsulta_general_2019_search extends cconsulta_general_2019 {

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

	// Project ID
	var $ProjectID = "{612F4CEC-277D-477B-ABAC-2B8738F52202}";

	// Table name
	var $TableName = 'consulta general 2019';

	// Page object name
	var $PageObjName = 'consulta_general_2019_search';

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

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

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

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Methods to clear message
	function ClearMessage() {
		$_SESSION[EW_SESSION_MESSAGE] = "";
	}

	function ClearFailureMessage() {
		$_SESSION[EW_SESSION_FAILURE_MESSAGE] = "";
	}

	function ClearSuccessMessage() {
		$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = "";
	}

	function ClearWarningMessage() {
		$_SESSION[EW_SESSION_WARNING_MESSAGE] = "";
	}

	function ClearMessages() {
		$_SESSION[EW_SESSION_MESSAGE] = "";
		$_SESSION[EW_SESSION_FAILURE_MESSAGE] = "";
		$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = "";
		$_SESSION[EW_SESSION_WARNING_MESSAGE] = "";
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-info ewInfo\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-danger ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}
	var $Token = "";
	var $TokenTimeout = 0;
	var $CheckToken = EW_CHECK_TOKEN;
	var $CheckTokenFn = "ew_CheckToken";
	var $CreateTokenFn = "ew_CreateToken";

	// Valid Post
	function ValidPost() {
		if (!$this->CheckToken || !ew_IsHttpPost())
			return TRUE;
		if (!isset($_POST[EW_TOKEN_NAME]))
			return FALSE;
		$fn = $this->CheckTokenFn;
		if (is_callable($fn))
			return $fn($_POST[EW_TOKEN_NAME], $this->TokenTimeout);
		return FALSE;
	}

	// Create Token
	function CreateToken() {
		global $gsToken;
		if ($this->CheckToken) {
			$fn = $this->CreateTokenFn;
			if ($this->Token == "" && is_callable($fn)) // Create token
				$this->Token = $fn();
			$gsToken = $this->Token; // Save to global variable
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;
		$this->TokenTimeout = ew_SessionTimeoutTime();

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (consulta_general_2019)
		if (!isset($GLOBALS["consulta_general_2019"]) || get_class($GLOBALS["consulta_general_2019"]) == "cconsulta_general_2019") {
			$GLOBALS["consulta_general_2019"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["consulta_general_2019"];
		}

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'search', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'consulta general 2019', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect($this->DBID);
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsCustomExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action
		$this->Count_Contador->Visible = !$this->IsAddOrEdit();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();

		// Check token
		if (!$this->ValidPost()) {
			echo $Language->Phrase("InvalidPostRequest");
			$this->Page_Terminate();
			exit();
		}

		// Create Token
		$this->CreateToken();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $gsExportFile, $gTmpImages;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		// Export
		global $EW_EXPORT, $consulta_general_2019;
		if ($this->CustomExport <> "" && $this->CustomExport == $this->Export && array_key_exists($this->CustomExport, $EW_EXPORT)) {
				$sContent = ob_get_contents();
			if ($gsExportFile == "") $gsExportFile = $this->TableVar;
			$class = $EW_EXPORT[$this->CustomExport];
			if (class_exists($class)) {
				$doc = new $class($consulta_general_2019);
				$doc->Text = $sContent;
				if ($this->Export == "email")
					echo $this->ExportEmail($doc->Text);
				else
					$doc->Export();
				ew_DeleteTmpImages(); // Delete temp images
				exit();
			}
		}
		$this->Page_Redirecting($url);

		 // Close connection
		ew_CloseConn();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $FormClassName = "form-horizontal ewForm ewSearchForm";
	var $IsModal = FALSE;
	var $SearchLabelClass = "col-sm-3 control-label ewLabel";
	var $SearchRightColumnClass = "col-sm-9";

	//
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsSearchError;
		global $gbSkipHeaderFooter;

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Check modal
		$this->IsModal = (@$_GET["modal"] == "1" || @$_POST["modal"] == "1");
		if ($this->IsModal)
			$gbSkipHeaderFooter = TRUE;
		if ($this->IsPageRequest()) { // Validate request

			// Get action
			$this->CurrentAction = $objForm->GetValue("a_search");
			switch ($this->CurrentAction) {
				case "S": // Get search criteria

					// Build search string for advanced search, remove blank field
					$this->LoadSearchValues(); // Get search values
					if ($this->ValidateSearch()) {
						$sSrchStr = $this->BuildAdvancedSearch();
					} else {
						$sSrchStr = "";
						$this->setFailureMessage($gsSearchError);
					}
					if ($sSrchStr <> "") {
						$sSrchStr = $this->UrlParm($sSrchStr);
						$sSrchStr = "consulta_general_2019list.php" . "?" . $sSrchStr;
						if ($this->IsModal) {
							$row = array();
							$row["url"] = $sSrchStr;
							echo ew_ArrayToJson(array($row));
							$this->Page_Terminate();
							exit();
						} else {
							$this->Page_Terminate($sSrchStr); // Go to list page
						}
					}
			}
		}

		// Restore search settings from Session
		if ($gsSearchError == "")
			$this->LoadAdvancedSearch();

		// Render row for search
		$this->RowType = EW_ROWTYPE_SEARCH;
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Build advanced search
	function BuildAdvancedSearch() {
		$sSrchUrl = "";
		$this->BuildSearchUrl($sSrchUrl, $this->Count_Contador); // Count_Contador
		$this->BuildSearchUrl($sSrchUrl, $this->Codigo_tres); // Codigo_tres
		$this->BuildSearchUrl($sSrchUrl, $this->Titulo_codigo_tres); // Titulo_codigo_tres
		$this->BuildSearchUrl($sSrchUrl, $this->Sexo); // Sexo
		$this->BuildSearchUrl($sSrchUrl, $this->Unidad_edad); // Unidad_edad
		$this->BuildSearchUrl($sSrchUrl, $this->Edad); // Edad
		if ($sSrchUrl <> "") $sSrchUrl .= "&";
		$sSrchUrl .= "cmd=search";
		return $sSrchUrl;
	}

	// Build search URL
	function BuildSearchUrl(&$Url, &$Fld, $OprOnly=FALSE) {
		global $objForm;
		$sWrk = "";
		$FldParm = substr($Fld->FldVar, 2);
		$FldVal = $objForm->GetValue("x_$FldParm");
		$FldOpr = $objForm->GetValue("z_$FldParm");
		$FldCond = $objForm->GetValue("v_$FldParm");
		$FldVal2 = $objForm->GetValue("y_$FldParm");
		$FldOpr2 = $objForm->GetValue("w_$FldParm");
		$FldVal = ew_StripSlashes($FldVal);
		if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
		$FldVal2 = ew_StripSlashes($FldVal2);
		if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
		$FldOpr = strtoupper(trim($FldOpr));
		$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
		if ($FldOpr == "BETWEEN") {
			$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
				($lFldDataType == EW_DATATYPE_NUMBER && $this->SearchValueIsNumeric($Fld, $FldVal) && $this->SearchValueIsNumeric($Fld, $FldVal2));
			if ($FldVal <> "" && $FldVal2 <> "" && $IsValidValue) {
				$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
					"&y_" . $FldParm . "=" . urlencode($FldVal2) .
					"&z_" . $FldParm . "=" . urlencode($FldOpr);
			}
		} else {
			$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
				($lFldDataType == EW_DATATYPE_NUMBER && $this->SearchValueIsNumeric($Fld, $FldVal));
			if ($FldVal <> "" && $IsValidValue && ew_IsValidOpr($FldOpr, $lFldDataType)) {
				$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
					"&z_" . $FldParm . "=" . urlencode($FldOpr);
			} elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL" || ($FldOpr <> "" && $OprOnly && ew_IsValidOpr($FldOpr, $lFldDataType))) {
				$sWrk = "z_" . $FldParm . "=" . urlencode($FldOpr);
			}
			$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
				($lFldDataType == EW_DATATYPE_NUMBER && $this->SearchValueIsNumeric($Fld, $FldVal2));
			if ($FldVal2 <> "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $lFldDataType)) {
				if ($sWrk <> "") $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
				$sWrk .= "y_" . $FldParm . "=" . urlencode($FldVal2) .
					"&w_" . $FldParm . "=" . urlencode($FldOpr2);
			} elseif ($FldOpr2 == "IS NULL" || $FldOpr2 == "IS NOT NULL" || ($FldOpr2 <> "" && $OprOnly && ew_IsValidOpr($FldOpr2, $lFldDataType))) {
				if ($sWrk <> "") $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
				$sWrk .= "w_" . $FldParm . "=" . urlencode($FldOpr2);
			}
		}
		if ($sWrk <> "") {
			if ($Url <> "") $Url .= "&";
			$Url .= $sWrk;
		}
	}

	function SearchValueIsNumeric($Fld, $Value) {
		if (ew_IsFloatFormat($Fld->FldType)) $Value = ew_StrToFloat($Value);
		return is_numeric($Value);
	}

	// Load search values for validation
	function LoadSearchValues() {
		global $objForm;

		// Load search values
		// Count_Contador

		$this->Count_Contador->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Count_Contador"));
		$this->Count_Contador->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Count_Contador");

		// Codigo_tres
		$this->Codigo_tres->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Codigo_tres"));
		$this->Codigo_tres->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Codigo_tres");

		// Titulo_codigo_tres
		$this->Titulo_codigo_tres->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Titulo_codigo_tres"));
		$this->Titulo_codigo_tres->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Titulo_codigo_tres");

		// Sexo
		$this->Sexo->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Sexo"));
		$this->Sexo->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Sexo");
		if (is_array($this->Sexo->AdvancedSearch->SearchValue)) $this->Sexo->AdvancedSearch->SearchValue = implode(",", $this->Sexo->AdvancedSearch->SearchValue);
		if (is_array($this->Sexo->AdvancedSearch->SearchValue2)) $this->Sexo->AdvancedSearch->SearchValue2 = implode(",", $this->Sexo->AdvancedSearch->SearchValue2);

		// Unidad_edad
		$this->Unidad_edad->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Unidad_edad"));
		$this->Unidad_edad->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Unidad_edad");
		if (is_array($this->Unidad_edad->AdvancedSearch->SearchValue)) $this->Unidad_edad->AdvancedSearch->SearchValue = implode(",", $this->Unidad_edad->AdvancedSearch->SearchValue);
		if (is_array($this->Unidad_edad->AdvancedSearch->SearchValue2)) $this->Unidad_edad->AdvancedSearch->SearchValue2 = implode(",", $this->Unidad_edad->AdvancedSearch->SearchValue2);

		// Edad
		$this->Edad->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Edad"));
		$this->Edad->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Edad");
	}

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

		// Initialize URLs
		// Call Row_Rendering event

		$this->Row_Rendering();

		// Common render codes for all row types
		// Count_Contador
		// Codigo_tres
		// Titulo_codigo_tres
		// Sexo
		// Unidad_edad
		// Edad

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

		// Count_Contador
		$this->Count_Contador->ViewValue = $this->Count_Contador->CurrentValue;
		$this->Count_Contador->ViewCustomAttributes = "";

		// Codigo_tres
		if ($this->Codigo_tres->VirtualValue <> "") {
			$this->Codigo_tres->ViewValue = $this->Codigo_tres->VirtualValue;
		} else {
			$this->Codigo_tres->ViewValue = $this->Codigo_tres->CurrentValue;
		if (strval($this->Codigo_tres->CurrentValue) <> "") {
			$sFilterWrk = "`Codigo_tres`" . ew_SearchString("=", $this->Codigo_tres->CurrentValue, EW_DATATYPE_STRING, "");
		$sSqlWrk = "SELECT `Codigo_tres`, `Codigo_tres` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `CIE10`";
		$sWhereWrk = "";
		ew_AddFilter($sWhereWrk, $sFilterWrk);
		$this->Lookup_Selecting($this->Codigo_tres, $sWhereWrk); // Call Lookup selecting
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = Conn()->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$arwrk = array();
				$arwrk[1] = $rswrk->fields('DispFld');
				$this->Codigo_tres->ViewValue = $this->Codigo_tres->DisplayValue($arwrk);
				$rswrk->Close();
			} else {
				$this->Codigo_tres->ViewValue = $this->Codigo_tres->CurrentValue;
			}
		} else {
			$this->Codigo_tres->ViewValue = NULL;
		}
		}
		$this->Codigo_tres->ViewCustomAttributes = "";

		// Titulo_codigo_tres
		$this->Titulo_codigo_tres->ViewValue = $this->Titulo_codigo_tres->CurrentValue;
		$this->Titulo_codigo_tres->ViewCustomAttributes = "";

		// Sexo
		if (strval($this->Sexo->CurrentValue) <> "") {
			$arwrk = explode(",", $this->Sexo->CurrentValue);
			$sFilterWrk = "";
			foreach ($arwrk as $wrk) {
				if ($sFilterWrk <> "") $sFilterWrk .= " OR ";
				$sFilterWrk .= "`Sexo`" . ew_SearchString("=", trim($wrk), EW_DATATYPE_STRING, "");
			}
		$sSqlWrk = "SELECT `Sexo`, `Sexo` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `Sexo`";
		$sWhereWrk = "";
		ew_AddFilter($sWhereWrk, $sFilterWrk);
		$this->Lookup_Selecting($this->Sexo, $sWhereWrk); // Call Lookup selecting
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = Conn()->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->Sexo->ViewValue = "";
				$ari = 0;
				while (!$rswrk->EOF) {
					$arwrk = array();
					$arwrk[1] = $rswrk->fields('DispFld');
					$this->Sexo->ViewValue .= $this->Sexo->DisplayValue($arwrk);
					$rswrk->MoveNext();
					if (!$rswrk->EOF) $this->Sexo->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options
					$ari++;
				}
				$rswrk->Close();
			} else {
				$this->Sexo->ViewValue = $this->Sexo->CurrentValue;
			}
		} else {
			$this->Sexo->ViewValue = NULL;
		}
		$this->Sexo->ViewCustomAttributes = "";

		// Unidad_edad
		if (strval($this->Unidad_edad->CurrentValue) <> "") {
			$arwrk = explode(",", $this->Unidad_edad->CurrentValue);
			$sFilterWrk = "";
			foreach ($arwrk as $wrk) {
				if ($sFilterWrk <> "") $sFilterWrk .= " OR ";
				$sFilterWrk .= "`Unidad_medida`" . ew_SearchString("=", trim($wrk), EW_DATATYPE_NUMBER, "");
			}
		$sSqlWrk = "SELECT `Unidad_medida`, `Unidad_medida` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `Unidad_medida`";
		$sWhereWrk = "";
		ew_AddFilter($sWhereWrk, $sFilterWrk);
		$this->Lookup_Selecting($this->Unidad_edad, $sWhereWrk); // Call Lookup selecting
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = Conn()->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->Unidad_edad->ViewValue = "";
				$ari = 0;
				while (!$rswrk->EOF) {
					$arwrk = array();
					$arwrk[1] = $rswrk->fields('DispFld');
					$this->Unidad_edad->ViewValue .= $this->Unidad_edad->DisplayValue($arwrk);
					$rswrk->MoveNext();
					if (!$rswrk->EOF) $this->Unidad_edad->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options
					$ari++;
				}
				$rswrk->Close();
			} else {
				$this->Unidad_edad->ViewValue = $this->Unidad_edad->CurrentValue;
			}
		} else {
			$this->Unidad_edad->ViewValue = NULL;
		}
		$this->Unidad_edad->ViewCustomAttributes = "";

		// Edad
		$this->Edad->ViewValue = $this->Edad->CurrentValue;
		$this->Edad->ViewCustomAttributes = "";

			// Count_Contador
			$this->Count_Contador->LinkCustomAttributes = "";
			$this->Count_Contador->HrefValue = "";
			$this->Count_Contador->TooltipValue = "";

			// Codigo_tres
			$this->Codigo_tres->LinkCustomAttributes = "";
			$this->Codigo_tres->HrefValue = "";
			$this->Codigo_tres->TooltipValue = "";

			// Titulo_codigo_tres
			$this->Titulo_codigo_tres->LinkCustomAttributes = "";
			$this->Titulo_codigo_tres->HrefValue = "";
			$this->Titulo_codigo_tres->TooltipValue = "";

			// Sexo
			$this->Sexo->LinkCustomAttributes = "";
			$this->Sexo->HrefValue = "";
			$this->Sexo->TooltipValue = "";

			// Unidad_edad
			$this->Unidad_edad->LinkCustomAttributes = "";
			$this->Unidad_edad->HrefValue = "";
			$this->Unidad_edad->TooltipValue = "";

			// Edad
			$this->Edad->LinkCustomAttributes = "";
			$this->Edad->HrefValue = "";
			$this->Edad->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_SEARCH) { // Search row

			// Count_Contador
			$this->Count_Contador->EditAttrs["class"] = "form-control";
			$this->Count_Contador->EditCustomAttributes = "";
			$this->Count_Contador->EditValue = ew_HtmlEncode($this->Count_Contador->AdvancedSearch->SearchValue);
			$this->Count_Contador->PlaceHolder = ew_RemoveHtml($this->Count_Contador->FldCaption());

			// Codigo_tres
			$this->Codigo_tres->EditAttrs["class"] = "form-control";
			$this->Codigo_tres->EditCustomAttributes = "";
			$this->Codigo_tres->EditValue = ew_HtmlEncode($this->Codigo_tres->AdvancedSearch->SearchValue);
			$this->Codigo_tres->PlaceHolder = ew_RemoveHtml($this->Codigo_tres->FldCaption());

			// Titulo_codigo_tres
			$this->Titulo_codigo_tres->EditAttrs["class"] = "form-control";
			$this->Titulo_codigo_tres->EditCustomAttributes = "";
			$this->Titulo_codigo_tres->EditValue = ew_HtmlEncode($this->Titulo_codigo_tres->AdvancedSearch->SearchValue);
			$this->Titulo_codigo_tres->PlaceHolder = ew_RemoveHtml($this->Titulo_codigo_tres->FldCaption());

			// Sexo
			$this->Sexo->EditCustomAttributes = "";
			if (trim(strval($this->Sexo->AdvancedSearch->SearchValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$arwrk = explode(",", $this->Sexo->AdvancedSearch->SearchValue);
				$sFilterWrk = "";
				foreach ($arwrk as $wrk) {
					if ($sFilterWrk <> "") $sFilterWrk .= " OR ";
					$sFilterWrk .= "`Sexo`" . ew_SearchString("=", trim($wrk), EW_DATATYPE_STRING, "");
				}
			}
			$sSqlWrk = "SELECT `Sexo`, `Sexo` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `Sexo`";
			$sWhereWrk = "";
			ew_AddFilter($sWhereWrk, $sFilterWrk);
			$this->Lookup_Selecting($this->Sexo, $sWhereWrk); // Call Lookup selecting
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = Conn()->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			$this->Sexo->EditValue = $arwrk;

			// Unidad_edad
			$this->Unidad_edad->EditCustomAttributes = "";
			if (trim(strval($this->Unidad_edad->AdvancedSearch->SearchValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$arwrk = explode(",", $this->Unidad_edad->AdvancedSearch->SearchValue);
				$sFilterWrk = "";
				foreach ($arwrk as $wrk) {
					if ($sFilterWrk <> "") $sFilterWrk .= " OR ";
					$sFilterWrk .= "`Unidad_medida`" . ew_SearchString("=", trim($wrk), EW_DATATYPE_NUMBER, "");
				}
			}
			$sSqlWrk = "SELECT `Unidad_medida`, `Unidad_medida` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `Unidad_medida`";
			$sWhereWrk = "";
			ew_AddFilter($sWhereWrk, $sFilterWrk);
			$this->Lookup_Selecting($this->Unidad_edad, $sWhereWrk); // Call Lookup selecting
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = Conn()->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			$this->Unidad_edad->EditValue = $arwrk;

			// Edad
			$this->Edad->EditAttrs["class"] = "form-control";
			$this->Edad->EditCustomAttributes = "";
			$this->Edad->EditValue = ew_HtmlEncode($this->Edad->AdvancedSearch->SearchValue);
			$this->Edad->PlaceHolder = ew_RemoveHtml($this->Edad->FldCaption());
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate search
	function ValidateSearch() {
		global $gsSearchError;

		// Initialize
		$gsSearchError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return TRUE;
		if (!ew_CheckInteger($this->Count_Contador->AdvancedSearch->SearchValue)) {
			ew_AddMessage($gsSearchError, $this->Count_Contador->FldErrMsg());
		}

		// Return validate result
		$ValidateSearch = ($gsSearchError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateSearch = $ValidateSearch && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsSearchError, $sFormCustomError);
		}
		return $ValidateSearch;
	}

	// Load advanced search
	function LoadAdvancedSearch() {
		$this->Count_Contador->AdvancedSearch->Load();
		$this->Codigo_tres->AdvancedSearch->Load();
		$this->Titulo_codigo_tres->AdvancedSearch->Load();
		$this->Sexo->AdvancedSearch->Load();
		$this->Unidad_edad->AdvancedSearch->Load();
		$this->Edad->AdvancedSearch->Load();
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$url = substr(ew_CurrentUrl(), strrpos(ew_CurrentUrl(), "/")+1);
		$Breadcrumb->Add("list", $this->TableVar, $this->AddMasterUrl("consulta_general_2019list.php"), "", $this->TableVar, TRUE);
		$PageId = "search";
		$Breadcrumb->Add("search", $PageId, $url);
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

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

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($consulta_general_2019_search)) $consulta_general_2019_search = new cconsulta_general_2019_search();

// Page init
$consulta_general_2019_search->Page_Init();

// Page main
$consulta_general_2019_search->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$consulta_general_2019_search->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Form object
var CurrentPageID = EW_PAGE_ID = "search";
<?php if ($consulta_general_2019_search->IsModal) { ?>
var CurrentAdvancedSearchForm = fconsulta_general_2019search = new ew_Form("fconsulta_general_2019search", "search");
<?php } else { ?>
var CurrentForm = fconsulta_general_2019search = new ew_Form("fconsulta_general_2019search", "search");
<?php } ?>

// Form_CustomValidate event
fconsulta_general_2019search.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fconsulta_general_2019search.ValidateRequired = true;
<?php } else { ?>
fconsulta_general_2019search.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
fconsulta_general_2019search.Lists["x_Codigo_tres"] = {"LinkField":"x_Codigo_tres","Ajax":true,"AutoFill":false,"DisplayFields":["x_Codigo_tres","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""};
fconsulta_general_2019search.Lists["x_Sexo[]"] = {"LinkField":"x_Sexo","Ajax":true,"AutoFill":false,"DisplayFields":["x_Sexo","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""};
fconsulta_general_2019search.Lists["x_Unidad_edad[]"] = {"LinkField":"x_Unidad_medida","Ajax":true,"AutoFill":false,"DisplayFields":["x_Unidad_medida","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""};

// Form object for search
// Validate function for search

fconsulta_general_2019search.Validate = function(fobj) {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	fobj = fobj || this.Form;
	var infix = "";
	elm = this.GetElements("x" + infix + "_Count_Contador");
	if (elm && !ew_CheckInteger(elm.value))
		return this.OnError(elm, "<?php echo ew_JsEncode2($consulta_general_2019->Count_Contador->FldErrMsg()) ?>");

	// Fire Form_CustomValidate event
	if (!this.Form_CustomValidate(fobj))
		return false;
	return true;
}
</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php if (!$consulta_general_2019_search->IsModal) { ?>
<div class="ewToolbar">
<?php $Breadcrumb->Render(); ?>
<?php echo $Language->SelectionForm(); ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php $consulta_general_2019_search->ShowPageHeader(); ?>
<?php
$consulta_general_2019_search->ShowMessage();
?>
<form name="fconsulta_general_2019search" id="fconsulta_general_2019search" class="<?php echo $consulta_general_2019_search->FormClassName ?>" action="<?php echo ew_CurrentPage() ?>" method="post">
<?php if ($consulta_general_2019_search->CheckToken) { ?>
<input type="hidden" name="<?php echo EW_TOKEN_NAME ?>" value="<?php echo $consulta_general_2019_search->Token ?>">
<?php } ?>
<input type="hidden" name="t" value="consulta_general_2019">
<input type="hidden" name="a_search" id="a_search" value="S">
<?php if ($consulta_general_2019_search->IsModal) { ?>
<input type="hidden" name="modal" value="1">
<?php } ?>
<div>
<?php if ($consulta_general_2019->Count_Contador->Visible) { // Count_Contador ?>
	<div id="r_Count_Contador" class="form-group">
		<label for="x_Count_Contador" class="<?php echo $consulta_general_2019_search->SearchLabelClass ?>"><span id="elh_consulta_general_2019_Count_Contador"><?php echo $consulta_general_2019->Count_Contador->FldCaption() ?></span>	
		<p class="form-control-static ewSearchOperator"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_Count_Contador" id="z_Count_Contador" value="="></p>
		</label>
		<div class="<?php echo $consulta_general_2019_search->SearchRightColumnClass ?>"><div<?php echo $consulta_general_2019->Count_Contador->CellAttributes() ?>>
			<span id="el_consulta_general_2019_Count_Contador">
<input type="text" data-table="consulta_general_2019" data-field="x_Count_Contador" name="x_Count_Contador" id="x_Count_Contador" size="30" placeholder="<?php echo ew_HtmlEncode($consulta_general_2019->Count_Contador->getPlaceHolder()) ?>" value="<?php echo $consulta_general_2019->Count_Contador->EditValue ?>"<?php echo $consulta_general_2019->Count_Contador->EditAttributes() ?>>
</span>
		</div></div>
	</div>
<?php } ?>
<?php if ($consulta_general_2019->Codigo_tres->Visible) { // Codigo_tres ?>
	<div id="r_Codigo_tres" class="form-group">
		<label class="<?php echo $consulta_general_2019_search->SearchLabelClass ?>"><span id="elh_consulta_general_2019_Codigo_tres"><?php echo $consulta_general_2019->Codigo_tres->FldCaption() ?></span>	
		<p class="form-control-static ewSearchOperator"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Codigo_tres" id="z_Codigo_tres" value="LIKE"></p>
		</label>
		<div class="<?php echo $consulta_general_2019_search->SearchRightColumnClass ?>"><div<?php echo $consulta_general_2019->Codigo_tres->CellAttributes() ?>>
			<span id="el_consulta_general_2019_Codigo_tres">
<?php
$wrkonchange = trim(" " . @$consulta_general_2019->Codigo_tres->EditAttrs["onchange"]);
if ($wrkonchange <> "") $wrkonchange = " onchange=\"" . ew_JsEncode2($wrkonchange) . "\"";
$consulta_general_2019->Codigo_tres->EditAttrs["onchange"] = "";
?>
<span id="as_x_Codigo_tres" style="white-space: nowrap; z-index: 8980">
	<input type="text" name="sv_x_Codigo_tres" id="sv_x_Codigo_tres" value="<?php echo $consulta_general_2019->Codigo_tres->EditValue ?>" size="30" placeholder="<?php echo ew_HtmlEncode($consulta_general_2019->Codigo_tres->getPlaceHolder()) ?>" data-placeholder="<?php echo ew_HtmlEncode($consulta_general_2019->Codigo_tres->getPlaceHolder()) ?>"<?php echo $consulta_general_2019->Codigo_tres->EditAttributes() ?>>
</span>
<input type="hidden" data-table="consulta_general_2019" data-field="x_Codigo_tres" data-value-separator="<?php echo ew_HtmlEncode(is_array($consulta_general_2019->Codigo_tres->DisplayValueSeparator) ? json_encode($consulta_general_2019->Codigo_tres->DisplayValueSeparator) : $consulta_general_2019->Codigo_tres->DisplayValueSeparator) ?>" name="x_Codigo_tres" id="x_Codigo_tres" value="<?php echo ew_HtmlEncode($consulta_general_2019->Codigo_tres->AdvancedSearch->SearchValue) ?>"<?php echo $wrkonchange ?>>
<?php
$sSqlWrk = "SELECT `Codigo_tres`, `Codigo_tres` AS `DispFld` FROM `CIE10`";
$sWhereWrk = "`Codigo_tres` LIKE '{query_value}%'";
$consulta_general_2019->Lookup_Selecting($consulta_general_2019->Codigo_tres, $sWhereWrk); // Call Lookup selecting
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " LIMIT " . EW_AUTO_SUGGEST_MAX_ENTRIES;
?>
<input type="hidden" name="q_x_Codigo_tres" id="q_x_Codigo_tres" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&d=">
<script type="text/javascript">
fconsulta_general_2019search.CreateAutoSuggest({"id":"x_Codigo_tres","forceSelect":false});
</script>
</span>
		</div></div>
	</div>
<?php } ?>
<?php if ($consulta_general_2019->Titulo_codigo_tres->Visible) { // Titulo_codigo_tres ?>
	<div id="r_Titulo_codigo_tres" class="form-group">
		<label for="x_Titulo_codigo_tres" class="<?php echo $consulta_general_2019_search->SearchLabelClass ?>"><span id="elh_consulta_general_2019_Titulo_codigo_tres"><?php echo $consulta_general_2019->Titulo_codigo_tres->FldCaption() ?></span>	
		<p class="form-control-static ewSearchOperator"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Titulo_codigo_tres" id="z_Titulo_codigo_tres" value="LIKE"></p>
		</label>
		<div class="<?php echo $consulta_general_2019_search->SearchRightColumnClass ?>"><div<?php echo $consulta_general_2019->Titulo_codigo_tres->CellAttributes() ?>>
			<span id="el_consulta_general_2019_Titulo_codigo_tres">
<input type="text" data-table="consulta_general_2019" data-field="x_Titulo_codigo_tres" name="x_Titulo_codigo_tres" id="x_Titulo_codigo_tres" size="30" maxlength="190" placeholder="<?php echo ew_HtmlEncode($consulta_general_2019->Titulo_codigo_tres->getPlaceHolder()) ?>" value="<?php echo $consulta_general_2019->Titulo_codigo_tres->EditValue ?>"<?php echo $consulta_general_2019->Titulo_codigo_tres->EditAttributes() ?>>
</span>
		</div></div>
	</div>
<?php } ?>
<?php if ($consulta_general_2019->Sexo->Visible) { // Sexo ?>
	<div id="r_Sexo" class="form-group">
		<label class="<?php echo $consulta_general_2019_search->SearchLabelClass ?>"><span id="elh_consulta_general_2019_Sexo"><?php echo $consulta_general_2019->Sexo->FldCaption() ?></span>	
		<p class="form-control-static ewSearchOperator"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Sexo" id="z_Sexo" value="LIKE"></p>
		</label>
		<div class="<?php echo $consulta_general_2019_search->SearchRightColumnClass ?>"><div<?php echo $consulta_general_2019->Sexo->CellAttributes() ?>>
			<span id="el_consulta_general_2019_Sexo">
<div id="tp_x_Sexo" class="ewTemplate"><input type="checkbox" data-table="consulta_general_2019" data-field="x_Sexo" data-value-separator="<?php echo ew_HtmlEncode(is_array($consulta_general_2019->Sexo->DisplayValueSeparator) ? json_encode($consulta_general_2019->Sexo->DisplayValueSeparator) : $consulta_general_2019->Sexo->DisplayValueSeparator) ?>" name="x_Sexo[]" id="x_Sexo[]" value="{value}"<?php echo $consulta_general_2019->Sexo->EditAttributes() ?>></div>
<div id="dsl_x_Sexo" data-repeatcolumn="5" class="ewItemList" style="display: none;"><div>
<?php
$arwrk = $consulta_general_2019->Sexo->EditValue;
if (is_array($arwrk)) {
	$armultiwrk = (strval($consulta_general_2019->Sexo->AdvancedSearch->SearchValue) <> "") ? explode(",", strval($consulta_general_2019->Sexo->AdvancedSearch->SearchValue)) : array();
	$cnt = count($armultiwrk);
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (ew_SameStr($arwrk[$rowcntwrk][0], $armultiwrk[$ari]) && !is_null($armultiwrk[$ari])) {
				$armultiwrk[$ari] = NULL; // Marked for removal
				$selwrk = " checked";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}
		if ($selwrk <> "") {
?>
<label class="checkbox-inline"><input type="checkbox" data-table="consulta_general_2019" data-field="x_Sexo" name="x_Sexo[]" id="x_Sexo_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $consulta_general_2019->Sexo->EditAttributes() ?>><?php echo $consulta_general_2019->Sexo->DisplayValue($arwrk[$rowcntwrk]) ?></label>
<?php
		}
	}
	for ($ari = 0; $ari < $cnt; $ari++) {
		if (!is_null($armultiwrk[$ari])) {
?>
<label class="checkbox-inline"><input type="checkbox" data-table="consulta_general_2019" data-field="x_Sexo" name="x_Sexo[]" value="<?php echo ew_HtmlEncode($armultiwrk[$ari]) ?>" checked<?php echo $consulta_general_2019->Sexo->EditAttributes() ?>><?php echo $armultiwrk[$ari] ?></label>
<?php
		}
	}
}
?>
</div></div>
<?php
$sSqlWrk = "SELECT `Sexo`, `Sexo` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `Sexo`";
$sWhereWrk = "";
$consulta_general_2019->Sexo->LookupFilters = array("s" => $sSqlWrk, "d" => "");
$consulta_general_2019->Sexo->LookupFilters += array("f0" => "`Sexo` = {filter_value}", "t0" => "200", "fn0" => "");
$sSqlWrk = "";
$consulta_general_2019->Lookup_Selecting($consulta_general_2019->Sexo, $sWhereWrk); // Call Lookup selecting
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
if ($sSqlWrk <> "") $consulta_general_2019->Sexo->LookupFilters["s"] .= $sSqlWrk;
?>
<input type="hidden" name="s_x_Sexo" id="s_x_Sexo" value="<?php echo $consulta_general_2019->Sexo->LookupFilterQuery() ?>">
</span>
		</div></div>
	</div>
<?php } ?>
<?php if ($consulta_general_2019->Unidad_edad->Visible) { // Unidad_edad ?>
	<div id="r_Unidad_edad" class="form-group">
		<label class="<?php echo $consulta_general_2019_search->SearchLabelClass ?>"><span id="elh_consulta_general_2019_Unidad_edad"><?php echo $consulta_general_2019->Unidad_edad->FldCaption() ?></span>	
		<p class="form-control-static ewSearchOperator"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Unidad_edad" id="z_Unidad_edad" value="LIKE"></p>
		</label>
		<div class="<?php echo $consulta_general_2019_search->SearchRightColumnClass ?>"><div<?php echo $consulta_general_2019->Unidad_edad->CellAttributes() ?>>
			<span id="el_consulta_general_2019_Unidad_edad">
<div id="tp_x_Unidad_edad" class="ewTemplate"><input type="checkbox" data-table="consulta_general_2019" data-field="x_Unidad_edad" data-value-separator="<?php echo ew_HtmlEncode(is_array($consulta_general_2019->Unidad_edad->DisplayValueSeparator) ? json_encode($consulta_general_2019->Unidad_edad->DisplayValueSeparator) : $consulta_general_2019->Unidad_edad->DisplayValueSeparator) ?>" name="x_Unidad_edad[]" id="x_Unidad_edad[]" value="{value}"<?php echo $consulta_general_2019->Unidad_edad->EditAttributes() ?>></div>
<div id="dsl_x_Unidad_edad" data-repeatcolumn="5" class="ewItemList" style="display: none;"><div>
<?php
$arwrk = $consulta_general_2019->Unidad_edad->EditValue;
if (is_array($arwrk)) {
	$armultiwrk = (strval($consulta_general_2019->Unidad_edad->AdvancedSearch->SearchValue) <> "") ? explode(",", strval($consulta_general_2019->Unidad_edad->AdvancedSearch->SearchValue)) : array();
	$cnt = count($armultiwrk);
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (ew_SameStr($arwrk[$rowcntwrk][0], $armultiwrk[$ari]) && !is_null($armultiwrk[$ari])) {
				$armultiwrk[$ari] = NULL; // Marked for removal
				$selwrk = " checked";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}
		if ($selwrk <> "") {
?>
<label class="checkbox-inline"><input type="checkbox" data-table="consulta_general_2019" data-field="x_Unidad_edad" name="x_Unidad_edad[]" id="x_Unidad_edad_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $consulta_general_2019->Unidad_edad->EditAttributes() ?>><?php echo $consulta_general_2019->Unidad_edad->DisplayValue($arwrk[$rowcntwrk]) ?></label>
<?php
		}
	}
	for ($ari = 0; $ari < $cnt; $ari++) {
		if (!is_null($armultiwrk[$ari])) {
?>
<label class="checkbox-inline"><input type="checkbox" data-table="consulta_general_2019" data-field="x_Unidad_edad" name="x_Unidad_edad[]" value="<?php echo ew_HtmlEncode($armultiwrk[$ari]) ?>" checked<?php echo $consulta_general_2019->Unidad_edad->EditAttributes() ?>><?php echo $armultiwrk[$ari] ?></label>
<?php
		}
	}
}
?>
</div></div>
<?php
$sSqlWrk = "SELECT `Unidad_medida`, `Unidad_medida` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `Unidad_medida`";
$sWhereWrk = "";
$consulta_general_2019->Unidad_edad->LookupFilters = array("s" => $sSqlWrk, "d" => "");
$consulta_general_2019->Unidad_edad->LookupFilters += array("f0" => "`Unidad_medida` = {filter_value}", "t0" => "3", "fn0" => "");
$sSqlWrk = "";
$consulta_general_2019->Lookup_Selecting($consulta_general_2019->Unidad_edad, $sWhereWrk); // Call Lookup selecting
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
if ($sSqlWrk <> "") $consulta_general_2019->Unidad_edad->LookupFilters["s"] .= $sSqlWrk;
?>
<input type="hidden" name="s_x_Unidad_edad" id="s_x_Unidad_edad" value="<?php echo $consulta_general_2019->Unidad_edad->LookupFilterQuery() ?>">
</span>
		</div></div>
	</div>
<?php } ?>
<?php if ($consulta_general_2019->Edad->Visible) { // Edad ?>
	<div id="r_Edad" class="form-group">
		<label for="x_Edad" class="<?php echo $consulta_general_2019_search->SearchLabelClass ?>"><span id="elh_consulta_general_2019_Edad"><?php echo $consulta_general_2019->Edad->FldCaption() ?></span>	
		<p class="form-control-static ewSearchOperator"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_Edad" id="z_Edad" value="="></p>
		</label>
		<div class="<?php echo $consulta_general_2019_search->SearchRightColumnClass ?>"><div<?php echo $consulta_general_2019->Edad->CellAttributes() ?>>
			<span id="el_consulta_general_2019_Edad">
<input type="text" data-table="consulta_general_2019" data-field="x_Edad" name="x_Edad" id="x_Edad" size="30" maxlength="10" placeholder="<?php echo ew_HtmlEncode($consulta_general_2019->Edad->getPlaceHolder()) ?>" value="<?php echo $consulta_general_2019->Edad->EditValue ?>"<?php echo $consulta_general_2019->Edad->EditAttributes() ?>>
</span>
		</div></div>
	</div>
<?php } ?>
</div>
<?php if (!$consulta_general_2019_search->IsModal) { ?>
<div class="form-group">
	<div class="col-sm-offset-3 col-sm-9">
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("Search") ?></button>
<button class="btn btn-default ewButton" name="btnReset" id="btnReset" type="button" onclick="ew_ClearForm(this.form);"><?php echo $Language->Phrase("Reset") ?></button>
	</div>
</div>
<?php } ?>
</form>
<script type="text/javascript">
fconsulta_general_2019search.Init();
</script>
<?php
$consulta_general_2019_search->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

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

</script>
<?php include_once "footer.php" ?>
<?php
$consulta_general_2019_search->Page_Terminate();
?>
