function jsaHeredarDatos($idcuenta) { $tab = new TinyAjaxBehavior(); $xLog = new cCoreLog(); $xCta = new cCuentaContable($idcuenta); $cuenta = ""; $nombre = ""; $superior = ""; $nombresupe = ""; $tipo = ""; $nivel = ""; $centro = ""; $superiorf = ""; $operar = 0; $equivale = ""; if ($xCta->init() == true) { $cuenta = $xCta->get(); $nombre = $xCta->getNombre(); $superior = $xCta->getInmediatoSuperior(); $nivel = $xCta->getDigitoAgrupador(); $centro = $xCta->getCentroDeCosto(); $tipo = $xCta->getTipoDeCuenta(); $operar = 1; $xLog->add("OK\tModificar la cuenta {$idcuenta} - {$operar} - {$superior}\r\n"); $equivale = $xCta->getEquivalencia(); } else { $xEsq = new cCuentaContableEsquema($idcuenta); $cuenta = $xEsq->CUENTA; $superior = $xEsq->CUENTA_SUPERIOR; $nivel = $xEsq->NIVEL_ACTUAL; $xLog->add("OK\tAgregar Nueva cuenta {$idcuenta} ({$cuenta}) - {$superior}\r\n"); } $xLog->add($xCta->getMessages(), $xLog->DEVELOPER); //inicializar superior if ($nivel > 1) { $xSup = new cCuentaContable($superior); if ($xSup->init() == true) { $tipo = $tipo == "" ? $xSup->getTipoDeCuenta() : $tipo; $centro = $centro == "" ? $xSup->getCentroDeCosto() : $centro; $superiorf = $xSup->getCuentaCompleta($superior, true); $nombresupe = $xSup->getNombre(); if ($operar == 0) { $equivale = $xSup->getEquivalencia(); } } $xLog->add($xSup->getMessages(), $xLog->DEVELOPER); } $tab->add(TabSetvalue::getBehavior('idcuenta', $cuenta)); $tab->add(TabSetvalue::getBehavior('idnombrecuenta', $nombre)); $tab->add(TabSetvalue::getBehavior('idtipodecuentacontable', $tipo)); $tab->add(TabSetvalue::getBehavior('idcentrodecosto', $centro)); $tab->add(TabSetvalue::getBehavior('idcuentasuperior', $superiorf)); $tab->add(TabSetvalue::getBehavior('idnombresuperior', $nombresupe)); $tab->add(TabSetvalue::getBehavior('idoperacion', $operar)); $tab->add(TabSetvalue::getBehavior('idequivalencia', $equivale)); $tab->add(TabSetvalue::getBehavior('idmsg3', $xLog->getMessages())); return $tab->getString(); }