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;
echo $xHP->setBodyEnd();
?>
<!-- HTML content -->
<!-- Start Formoid form-->
<form class="formoid-default" name="frm" id="frm" title="Registro de Fichas de Pago de Empresas" method="post">
	<div class="element-title" ><h2 class="title">Registro de Depositos</h2></div>
	<div class="element-select" >
		<label class="title">Fecha de Pago<span class="required">*</span></label>
		<?php 
$xF = new cFecha(98);
echo $xF->show(true, FECHA_TIPO_OPERATIVA);
?>
	</div>
	<div class="element-select" ><label class="title">Empresa<span class="required">*</span></label>
		<?php 
$xEmp = new cSocios_aeconomica_dependencias();
$xSel = new cSelect("idempresa", "idempresa", $xEmp->get());
$xSel->addEvent("onchange", "jsaGetEmpresa");
echo $xSel->get();
?>
	</div>
	<div class="element-select" >
		<label class="title">Periocidad<span class="required">*</span></label>
	<?php 
$sqlSc = "SELECT\r\n\t\t\t    `creditos_periocidadpagos`.`idcreditos_periocidadpagos`,\r\n\t\t\t    `creditos_periocidadpagos`.`descripcion_periocidadpagos`\r\n\t\t    FROM\r\n\t\t\t    `creditos_periocidadpagos` `creditos_periocidadpagos`\r\n\t\t    WHERE\r\n\t\t\t    (`creditos_periocidadpagos`.`idcreditos_periocidadpagos` !=99) ";
$xTP = new cSelect("periocidadpagos", "idperiocidadpagos", $sqlSc);
$xTP->addEvent("onchange", "jsaGetEmpresa");
$xTP->setOptionSelect(SYS_NINGUNO);
$xTP->addEspOption(SYS_NINGUNO);
$xTP->SetEsSql();
$xTP->show(false);
    $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);
    $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();
 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>";
 }
 function addEmpresasConConvenio()
 {
     $xEmp = new cSocios_aeconomica_dependencias();
     $xSel = new cSelect("idempresa", "idempresa", $xEmp->get());
     $xSel->addEspOption(SYS_TODAS);
     $xSel->setOptionSelect(SYS_TODAS);
     $v = $xSel->get("TR.Empresa", true);
     $this->mJsVars .= "var idempresa\t= \$('#idempresa').val();\r\n";
     $this->mURL .= " + \"&empresa=\" + idempresa ";
     $this->mURL .= " + \"&dependencia=\" + idempresa ";
     $this->mStruct .= $v;
 }
 function obj()
 {
     $mObj = null;
     switch ($this->mTabla) {
         case TPERSONAS_RELACIONES:
             $mObj = new cSocios_relaciones();
             break;
         case TBANCOS_CUENTAS:
             $mObj = new cBancos_cuentas();
             break;
         case TOPERACIONES_RECIBOS:
             $mObj = new cOperaciones_recibos();
             break;
         case TOPERACIONES_MVTOS:
             $mObj = new cOperaciones_mvtos();
             break;
         case TBANCOS_OPERACIONES:
             $mObj = new cBancos_operaciones();
             break;
         case TBANCOS_CUENTAS:
             $mObj = new cBancos_cuentas();
             break;
         case TCREDITOS_REGISTRO:
             $mObj = new cCreditos_solicitud();
             break;
         case TTESORERIA_MVTOS:
             $mObj = new cTesoreria_cajas_movimientos();
             break;
         case TCATALOGOS_EMPRESAS:
             $mObj = new cSocios_aeconomica_dependencias();
             $this->mCampoDesc = $mObj->nombre_corto()->v();
             break;
         case TCATALOGOS_RELACIONES:
             $mObj = new cSocios_relacionestipos();
             $this->mCampoDesc = $mObj->descripcion_relacionestipos()->get();
             break;
         case TCATALOGOS_ACTIVIDADES_ECONOMICAS:
             $mObj = new cPersonas_actividad_economica_tipos();
             $this->mCampoDesc = $mObj->nombre_de_la_actividad()->get();
             break;
         case TCATALOGOS_LOCALIDADES:
             $mObj = new cCatalogos_localidades();
             $this->mCampoDesc = $mObj->nombre_de_la_localidad()->get();
             break;
         case TCAPTACION_CUENTAS:
             $mObj = new cCaptacion_cuentas();
             break;
         case TCATALOGOS_PAISES:
             $mObj = new cPersonas_domicilios_paises();
             $this->mCampoDesc = $mObj->nombre_oficial()->get();
             break;
         case TPERSONAS_DIRECCIONES:
             $mObj = new cSocios_vivienda();
             break;
         case TPERSONAS_GENERALES:
             $mObj = new cSocios_general();
             break;
         case TPERSONAS_MEMOS:
             $mObj = new cSocios_memo();
             break;
         case TPERSONAS_PERFIL_TRANSACCIONAL:
             $mObj = new cPersonas_perfil_transaccional();
             break;
         case TSEGUMIENTO_LLAMADAS:
             $mObj = new cSeguimiento_llamadas();
             break;
         case TSYSTEM_LOG:
             $mObj = new cGeneral_log();
             break;
         case TCREDITOS_PRODUCTOS_OTROS_PARAMETROS:
             $mObj = new cCreditos_productos_otros_parametros();
             break;
         case TPERSONAS_ACTIVIDAD_ECONOMICA:
             $mObj = new cSocios_aeconomica();
             break;
         case TUSUARIOS_NOTAS:
             $mObj = new cUsuarios_web_notas();
             break;
         case TAML_PERFIL_RIESGO:
             $mObj = new cAml_riesgo_perfiles();
             break;
         case TCATALOGOS_GRADO_RIESGO:
             $mObj = new cAml_risk_levels();
             $this->mCampoDesc = $mObj->nombre_del_nivel()->get();
             break;
         case TAML_REGISTRO_DE_RIESGOS:
             $mObj = new cAml_risk_register();
             $this->mCampoDesc = $mObj->mensajes_del_sistema()->get();
             break;
         case TAML_REGISTRO_DE_RIESGOS:
             $mObj = new cAml_alerts();
             $this->mCampoDesc = $mObj->mensaje()->get();
             break;
         default:
             $mObj = null;
             break;
     }
     if ($mObj != null) {
         $this->mClavePrincipal = $mObj->getKey();
     }
     return $mObj;
 }
            $xSoc->query()->insert()->save();
            //Iniciar Cuenta de Captacion
        }
        break;
    case TPERSONAS_DIRECCIONES:
        $ddomicilio = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        if (is_array($ddomicilio)) {
            $xDom = new cSocios_vivienda($ddomicilio);
            $xDom->query()->insert()->save();
        }
        break;
    case TPERSONAS_ACTIVIDAD_ECONOMICA:
        $dtrabajo = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        if (is_array($dtrabajo)) {
            $xAe = new cSocios_aeconomica($dtrabajo);
            $xAe->query()->insert()->save();
        }
        break;
    case TCATALOGOS_EMPRESAS:
        $dempresa = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        foreach ($dempresa as $indice => $valor) {
            if ($indice == TCATALOGOS_EMPRESAS) {
                $dempresa = $valor;
            }
        }
        if (is_array($dempresa)) {
            $xEmp = new cSocios_aeconomica_dependencias($dempresa);
            $xEmp->query()->insert()->save();
        }
        break;
}
//$jxc ->exportFunction('datos_del_pago', array('idsolicitud', 'idparcialidad'), "#iddatos_pago");
//$jxc ->process();
echo $xHP->getHeader();
$jsb = new jsBasicForm("mfrm", iDE_CAPTACION);
$jsb->show();
//$jxc ->drawJavaScript(false, true);
echo $xHP->setBodyinit();
$oFRM = new cHForm("frmTemplate", "./", "mfrm", "", "formoid-default");
$oFRM->setTitle("TR.Reportes por Empresas");
echo $xHP->setBodyEnd();
$xReports = new cPanelDeReportes(iDE_CREDITO, "empresas");
$xReports->get();
$rpts = new cGeneral_reports();
$sel3 = $xReports->getSelectReportes();
//$rpts->query()->html()->select( $rpts->descripcion_reports()->get(), " aplica='empresas' " );
$emp = new cSocios_aeconomica_dependencias();
$sel = $emp->query()->html()->select($emp->descripcion_dependencia()->get());
$sel->addOptions(array("todas" => "TODAS"));
$per = new cCreditos_periocidadpagos();
$sel4 = $per->query()->html()->select($per->descripcion_periocidadpagos()->get());
$sel4->addOptions(array("todas" => "TODAS"));
$pdto = new cCreditos_tipoconvenio();
$sel2 = $pdto->query()->html()->select($pdto->descripcion_tipoconvenio()->get());
$sel2->addOptions(array("todas" => "TODAS"));
$base = new cEacp_config_bases_de_integracion();
$selB = $base->query()->html()->select($base->descripcion()->get());
//
$xSel = new cHSelect();
$xSel->addOptions(array("chart" => "Grafico", "default" => "Normal", OUT_EXCEL => "Compatible con Excel"));
$xSel->setDefault(SYS_DEFAULT);
$xF1 = new cHDate(0);