$dias_aviso = $xEmp->getConjugarPeriodo($periocidad1, $diasaviso1) . $xEmp->getConjugarPeriodo($periocidad2, $diasaviso2);
    $dias_pago = $xEmp->getConjugarPeriodo($periocidad1, $diaspago1) . $xEmp->getConjugarPeriodo($periocidad2, $diaspago2);
    $dias_nomina = $xEmp->getConjugarPeriodo($periocidad1, $diasnomina1) . $xEmp->getConjugarPeriodo($periocidad2, $diasnomina2);
    $res = $xEmp->add($idsocio, $directivo, $iddirectivo, $dias_aviso, $periocidad1, $alias, $oficial, $emails, $producto, $dias_nomina, $dias_pago);
    $msg .= $xEmp->getMessages();
}
if ($action == MQL_MOD and setNoMenorQueCero($empresa) > 0) {
    //TODO: Actualizar
    $xEmp = new cEmpresas($empresa);
    $xEmp->init();
    $dias_aviso = $xEmp->getConjugarPeriodo($periocidad1, $diasaviso1) . $xEmp->getConjugarPeriodo($periocidad2, $diasaviso2);
    $dias_pago = $xEmp->getConjugarPeriodo($periocidad1, $diaspago1) . $xEmp->getConjugarPeriodo($periocidad2, $diaspago2);
    $dias_nomina = $xEmp->getConjugarPeriodo($periocidad1, $diasnomina1) . $xEmp->getConjugarPeriodo($periocidad2, $diasnomina2);
    $msg .= $xEmp->getMessages();
    $xOEmp = new cSocios_aeconomica_dependencias();
    $xOEmp->setData($xOEmp->query()->initByID($empresa));
    $xOEmp->dias_de_avisos($dias_aviso);
    $xOEmp->dias_de_liquidacion($dias_pago);
    $xOEmp->dias_de_pago_nomina($dias_nomina);
    $xOEmp->directivo_principal($directivo);
    $xOEmp->clave_de_directivo($iddirectivo);
    $xOEmp->periocidad_de_avisos($periocidad1);
    $xOEmp->oficial_que_cierra($oficial);
    $xOEmp->nombre_corto($alias);
    $xOEmp->producto_preferente($producto);
    $xOEmp->email_de_envio($emails);
    $xOEmp->clave_de_persona($idsocio);
    $xOEmp->query()->update()->save($empresa);
    $xEmp = new cEmpresas($empresa);
    $xEmp->init();
    $xEmp->setActualizarPorPersona();
    case TPERSONAS_DIRECCIONES:
        $xDom = new cSocios_vivienda();
        $D = obten_filas("SELECT * FROM socios_vivienda WHERE socio_numero = {$data} ORDER BY fecha_alta DESC LIMIT 0,1");
        $xDom->setData($D);
        //setLog("SELECT * FROM socios_vivienda WHERE socio_numero = $data ORDER BY fecha_alta DESC LIMIT 0,1");
        //$value = mb_check_encoding($value, 'UTF-8') ? $value : utf8_encode($value);
        //$comment = iconv('UTF-8', 'UTF-8//IGNORE', $comment);
        //SELECT column1, CONVERT(column2 USING utf8)
        $query = $xDom->query();
        $query->setToUTF8();
        //setLog(json_encode($query->getCampos()) );
        $cnt = $svc->getEncryptData(json_encode($query->getCampos()));
        break;
    case TPERSONAS_ACTIVIDAD_ECONOMICA:
        $xTrab = new cSocios_aeconomica();
        $D = obten_filas("SELECT * FROM `socios_aeconomica` WHERE\t(`socios_aeconomica`.`socio_aeconomica` = {$data} ) ORDER BY `socios_aeconomica`.`fecha_alta` DESC\tLIMIT 0,1");
        $xTrab->setData($D);
        $query = $xTrab->query();
        $query->setToUTF8();
        $cnt = $svc->getEncryptData(json_encode($query->getCampos()));
        break;
    case TCATALOGOS_EMPRESAS:
        $xEmp = new cSocios_aeconomica_dependencias();
        $D = obten_filas("SELECT * FROM `socios_aeconomica_dependencias` WHERE (`socios_aeconomica_dependencias`.`clave_de_persona` ={$data}) LIMIT 0,1");
        $xEmp->setData($D);
        $query = $xEmp->query();
        $query->setToUTF8();
        $cnt = $svc->getEncryptData(json_encode($query->getCampos()));
        break;
}
echo $cnt;
 function getFicha()
 {
     $cEmp = new cSocios_aeconomica_dependencias();
     $cEmp->idsocios_aeconomica_dependencias($this->mClave);
     $cEmp->setData($cEmp->query()->getRow("idsocios_aeconomica_dependencias=" . $this->mClave));
     $this->mPeriodo = $cEmp->periocidad_de_avisos()->get();
     return "<table>\n\t\t\t<tr>\n\t\t\t\t<th>Clave</th>\n\t\t\t\t<td>" . $this->mClave . "</td>\n\t\t\t\t<th>Nombre</th>\n\t\t\t\t<td>" . $cEmp->descripcion_dependencia()->v() . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Domicilio</th>\n\t\t\t\t<td>" . $cEmp->domicilio_completo()->v() . "</td>\n\t\t\t\t<th>Telefono</th>\n\t\t\t\t<td>" . $cEmp->telefono()->v() . "</td>\n\t\t\t</tr>\n\t\t</table>";
 }