function init() { $ql = new MQL(); if ($this->mPersona > 0) { $ByTipo = ""; // ($this->mTipo == false ) ? "" : "AND (`socios_aeconomica`.`tipo_aeconomica` = $tipo)";//no aplica tipo $ByID = setNoMenorQueCero($this->mIDCargado) > 1 ? " AND `idsocios_aeconomica` = " . $this->mIDCargado : ""; $xDB = new cSAFETabla(TPERSONAS_ACTIVIDAD_ECONOMICA); $sql = $xDB->getQueryInicial() . "\tWHERE (`socios_aeconomica`.`socio_aeconomica` =" . $this->mPersona . ") {$ByTipo} {$ByID}\tORDER BY `fecha_alta` DESC, `socios_aeconomica`.`monto_percibido_ae` DESC LIMIT 0,1"; $this->mDatosInArray = $ql->getDataRow($sql); $this->mInit = isset($this->mDatosInArray["idsocios_aeconomica"]) ? true : false; $this->mTipo = FALLBACK_ACTIVIDAD_ECONOMICA; if ($this->mInit == true) { $this->mOB = new cSocios_aeconomica(); $this->mOB->query()->initByID($this->mDatosInArray["idsocios_aeconomica"]); $this->mIDCargado = $this->mOB->idsocios_aeconomica()->v(); $this->mClaveEmpresa = $this->mOB->dependencia_ae()->v(); $this->mDomicilio = $this->mOB->domicilio_ae()->v(); $this->mCodigoPostal = setNoMenorQueCero($this->mOB->ae_codigo_postal()->v()); $this->mIDDomicilio = setNoMenorQueCero($this->mOB->domicilio_vinculado()->v()); $this->mNombreColonia = $this->mOB->localidad_ae()->v(); //Iniciar Empresa $this->mOEmp = new cEmpresas($this->mClaveEmpresa); $this->mOEmp->init(); $this->mEmpresaClavePersona = $this->mOEmp->getClaveDePersona(); $this->mOB->setData($this->mDatosInArray); $this->mPuesto = $this->mOB->puesto()->v(OUT_TXT); $this->mTipo = $this->mOB->tipo_aeconomica()->v(); //$this->mAMLNivelRiesgo = $this->mOB-> //Iniciar por codigo postal $xViv = new cPersonasVivienda($this->mPersona, PERSONAS_TIPO_DOM_LABORAL); if ($this->mIDDomicilio > 1) { $xViv->setID($this->mDomicilio); } $xViv->init(); if ($xViv->isInit() == true) { $this->mDomicilio = $xViv->getDireccionBasica(); $this->mClaveDeEstado = $xViv->getClaveDeEstado(); $this->mClaveDeMunicipio = $xViv->getClaveDeMunicipio(); $this->mClaveDeLocalidad = $xViv->getClaveDeLocalidad(); $this->mCodigoPostal = $xViv->getCodigoPostal(); $this->mNombreDeLocalidad = $xViv->getLocalidad(); $this->mNombreDeMunicipio = $xViv->getMunicipio(); $this->mNombreDeEstado = $xViv->getEstado(); $this->mCalle = $xViv->getCalle(); $this->mNumeroExt = $xViv->getNumeroExterior(); $this->mNombreColonia = $xViv->getColonia(); $this->mClaveDeEstadoSIC = $xViv->getClaveDeEstadoEnSIC(); $this->mClaveDePais = $xViv->getClaveDePais(); $this->mViviendaInit = true; } if ($this->mIDDomicilio <= 1 and $this->mCodigoPostal > 0) { $xCols = new cDomiciliosColonias(); $xCols->getClavePorCodigoPostal($this->mCodigoPostal); $this->mClaveDeEstado = $xCols->getClaveDeEstado(); $this->mClaveDeMunicipio = $xCols->getClaveDeMunicipio(); $this->mClaveDeLocalidad = $xCols->getClaveDeEstado(); $this->mNombreDeLocalidad = $xCols->getNombreLocalidad(); $this->mNombreDeMunicipio = $xCols->getNombreMunicipio(); $this->mNombreDeEstado = $xCols->getNombreEstado(); $this->mNombreColonia = $xCols->getNombre(); $this->mClaveDeEstadoSIC = $xCols->getClaveEstadoEnSIC(); $this->mClaveDePais = $xCols->getClaveDePais(); $this->mViviendaInit = true; } } } if ($this->mOB == null) { $this->mOB = new cSocios_aeconomica(); $this->mClaveEmpresa = FALLBACK_CLAVE_EMPRESA; $this->mEmpresaClavePersona = FALLBACK_CLAVE_DE_PERSONA; } return $this->mDatosInArray; }