function jsaGetDatos($solicitud)
{
    if ($solicitud != 0 and $solicitud != '') {
        $xCred = new cCreditos_solicitud();
        $xCred->setData($xCred->query()->getRow("numero_solicitud={$solicitud}"));
        $pagos = $xCred->numero_pagos()->v();
        $monto = $xCred->monto_solicitado()->v();
        $periocidad = $xCred->periocidad_de_pago()->v();
        $tasa = $xCred->tasa_interes()->v();
        $xF = new cFecha();
        $xT = new cTipos();
        $tab = new TinyAjaxBehavior();
        $tab->add(TabSetvalue::getBehavior('idpagos', $pagos));
        $tab->add(TabSetvalue::getBehavior('idmonto', $monto));
        $tab->add(TabSetvalue::getBehavior('idtasa', $tasa * 100));
        $tab->add(TabSetvalue::getBehavior('idperiocidad', $periocidad));
        $tab->add(TabSetvalue::getBehavior('idtipodepago', $xCred->tipo_de_pago()->v()));
        //Fechas de ministracion
        $tab->add(TabSetvalue::getBehavior('idfecha1', $xF->getFechaMX($xCred->fecha_autorizacion()->v(), "-")));
        $tab->add(TabSetvalue::getBehavior('idfecha2', $xF->getFechaMX($xCred->fecha_ministracion()->v(), "-")));
        $tab->add(TabSetvalue::getBehavior('idautorizacion', $xCred->docto_autorizacion()->v()));
        $tab->add(TabSetvalue::getBehavior('idtipodeautorizacion', $xCred->tipo_autorizacion()->v()));
        return $tab->getString();
    }
}
function jsaGetDatosEmpresa($idEmpresa)
{
    $xEmp = new cEmpresas($idEmpresa);
    $xF = new cFecha();
    $ql = new MQL();
    $xl = new cSQLListas();
    $observaciones = "";
    $xEmp->init();
    $persona = $xEmp->getClaveDePersona();
    $xF = new cFecha(0);
    $opts = "";
    $exT = "";
    $periocidad = $xEmp->getPeriocidadPref();
    $periodo = $periocidad == CREDITO_TIPO_PERIOCIDAD_SEMANAL ? $xF->semana() : $xF->quincena();
    $periodo = intval($xEmp->getPeriodo()) < 1 ? $periodo : intval($xEmp->getPeriodo());
    $data = $ql->getDataRecord($xl->getListadoDePeriodoPorEmpresa($idEmpresa));
    $variacion = "0";
    $fecha_inicial = $xF->getFechaMX();
    $fecha_final = $xF->getFechaMX();
    $control = 0;
    $ctrl = "<label for=\"idperiodo\">Periodo {$periodo}</label><input type=\"number\" id=\"idperiodo\" onchange=\"jsGetCobranza()\" onblur=\"jsGetCobranza()\" />";
    $contar = 1;
    $max = 5;
    foreach ($data as $rw) {
        $idsel = "";
        $idclave = $rw["codigo"];
        $xPer = $xEmp->getOPeriodo(false, false, $idclave);
        if ($periodo == $xPer->periodo_marcado()->v() and $periocidad == $xPer->periocidad()->v()) {
            $control = $idclave;
            $periodo = $xPer->periodo_marcado()->v();
            $periocidad = $xPer->periocidad()->v();
            $fecha_final = $xPer->fecha_final()->v();
            $fecha_inicial = $xPer->fecha_inicial()->v();
            $idsel = " selected=\"true\" ";
        }
        if ($contar <= $max) {
            $opts .= "<option value=\"" . $idclave . " \"{$idsel}>" . $rw["nombre_periocidad"] . "[" . $xPer->periodo_marcado()->v() . "]";
            $opts .= "  - DEL: " . $xF->getFechaDDMM($rw["fecha_inicial"]) . " - " . $xF->getFechaDDMM($rw["fecha_final"]) . " SALDO " . getFMoney($rw["saldo"]) . "</option>";
        }
        $contar++;
    }
    if ($opts != "") {
        $ctrl = "<label for='idperiodo'>Periodo</label><select id=\"idperiodo\" name=\"idperiodo\" onblur=\"jsGetCobranza()\" onchange=\"jsGetCobranza()\">{$opts}</select>";
    }
    $ctrl .= "<input type=\"hidden\" id=\"idvariacion\" value=\"{$variacion}\" />";
    $ctrl .= "<input type=\"hidden\" id=\"idperiodo\" value=\"{$periodo}\" />";
    $ctrl .= "<input type=\"hidden\" id=\"idperiocidad\" value=\"{$periocidad}\" />";
    $ctrl .= "<input type=\"hidden\" id=\"idclavedepersona\" value=\"{$periocidad}\" />";
    return $ctrl;
}
function jsaInitPeriodo($empresa, $periocidad, $periodo)
{
    $xF = new cFecha();
    $xEmp = new cEmpresas($empresa);
    $xEmp->init();
    $tab = new TinyAjaxBehavior();
    $DPer = $xEmp->getOPeriodo($periocidad);
    $empPeriodo = $xEmp->getPeriodo();
    if ($periodo > $empPeriodo) {
        $fechaInicial = $xEmp->getFechaDeAviso($periocidad, false, $periodo, $periodo + 1);
    } else {
        $dias_dif = setNoMenorQueCero($periodo - $empPeriodo);
        $starD = $periocidad * $dias_dif + 1;
        $fechaInicial = $xF->setSumarDias($starD, $DPer->fecha_final()->v());
    }
    $fechaFinal = $xF->setSumarDias($xEmp->getPeriocidadPref(), $fechaInicial);
    $tab->add(TabSetvalue::getBehavior("idfecha-10", $xF->getFechaMX($fechaInicial, "-")));
    $tab->add(TabSetvalue::getBehavior("idfecha-11", $xF->getFechaMX($fechaFinal, "-")));
    return $tab->getString();
}
$xTa->addTH("Numero Maximo de Operaciones");
$xTa->addTH("Monto Maximo de Operaciones");
$xTa->endRow();
$xT = new cFileImporter();
foreach ($rs as $rows) {
    $xDSoc->setData($rows);
    $codigo_de_socio = $xDSoc->codigo()->v();
    $xSoc = new cSocio($codigo_de_socio);
    $xSoc->init($rows);
    $xSoc->getOEstats()->initDatosDeCredito();
    $saldoCred = setNoMenorQueCero($xSoc->getCreditosComprometidos());
    if ($saldoCred > 0) {
        $xTa->initRow();
        $xTa->addTD($xSoc->getSucursal());
        $xTa->addTD(htmlentities($xSoc->getNombreCompleto()));
        $xTa->addTD($xF->getFechaMX($xSoc->getFechaDeNacimiento()));
        $xTa->addTD("MEXICANA");
        $xTa->addTD($xSoc->getRFC());
        $xOAE = $xSoc->getOActividadEconomica();
        if ($xOAE == null) {
            $xTa->addTD(" ");
            $xTa->addTD(" ");
        } else {
            $idclave = $xOAE->getClaveDeActividad();
            $actividad = isset($DActividades[$idclave]) ? htmlentities($DActividades[$idclave]) : "";
            $actividad = strtoupper($xT->cleanString($actividad));
            $actividad = $actividad == "DESCONOCIDO_MIGRADO" ? "" : $actividad;
            $xTa->addTD($actividad);
            //$xTa->addTD( $xOAE->getPuesto(true) );
        }
        $xViv = $xSoc->getODomicilio();
// mysql_num_rows($rs);
$counter = 0;
//while($rw = mysql_fetch_array($rs)){
foreach ($rs as $rw) {
    //$TR_head		= "";
    if ($credito_anterior == false) {
        $credito_anterior = $rw["solicitud"];
    }
    $credito = $rw["solicitud"];
    if ($credito != $credito_anterior) {
        //resetear TR_child
        $TR_parent .= "\n\n  \t\t\t\t{$TR_head}\n\n  \t\t\t\t<tr>\n  \t\t\t\t\t<td colspan='4'>\n  \t\t\t\t\t\t<table>\n  \t\t\t\t\t\t\t<thead>\n  \t\t\t\t\t\t\t\t<th width='10%'>Recibo</th>\n  \t\t\t\t\t\t\t\t<th width='15%'>Fecha</th>\n  \t\t\t\t\t\t\t\t<th width='25%'>Operacion</th>\n  \t\t\t\t\t\t\t\t<th width='20%'>Monto</th>\n  \t\t\t\t\t\t\t\t<th width='30%'>Detalles</th>\n  \t\t\t\t\t\t\t<thead>\n  \t\t\t\t\t\t\t<tbody>\n  \t\t\t\t\t\t\t{$TR_child}\n  \t\t\t\t\t\t\t</tbody>\n  \t\t\t\t\t\t</table>\n  \t\t\t\t\t</td>\n  \t\t\t\t\t<tr>\n  \t\t\t\t\t\t<td colspan='4'></td>\n  \t\t\t\t\t\t<td colspan='4'></td>\n  \t\t\t\t\t</tr>\n  \t\t\t\t</tr>\n  \t\t\t\t";
        $TR_child = "";
        $TR_head = "";
    }
    $TR_child .= "\n\t\t\t<tr>\n\t\t\t\t<td>" . $rw["recibo"] . "</td>\n\t\t\t\t<td>" . $xF->getFechaMX($rw["fecha"]) . "</td>\n\t\t\t\t<td>" . $rw["tipo_de_operacion"] . "</td>\n\t\t\t\t<td class='mny'>" . getFMoney($rw["monto"]) . "</td>\n\t\t\t\t<td>" . $rw["detalles"] . "</td>\n\t\t\t</tr>";
    $sumCAP += $rw["monto_original"];
    $sumSDO += $rw["saldo_insoluto"];
    $TR_head = "\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>Socio</th>\n\t\t\t\t\t<td>" . $rw["socio"] . "</td>\n\t  \t\t\t\t<th class='izq'>Nombre\n\t  \t\t\t\t</th><td>" . $rw["nombre"] . "</td>\n\t  \t\t\t</tr>\n\t  \t\t\t<tr>\n  \t\t\t\t\t<th class='izq'>Numero de Solicitud</th>\n  \t\t\t\t\t<td>" . $rw["solicitud"] . "</td>\n  \t\t\t\t\t<th class='izq'>Fecha de Ministracion</th>\n  \t\t\t\t\t<td>" . $rw["fecha_de_otorgamiento"] . "</td>\n  \t\t\t\t</tr>\n  \t\t\t\t<tr>\n\t  \t\t\t\t<th class='izq'>Tipo de Convenio</th>\n\t  \t\t\t\t<td>" . $rw["modalidad"] . "</td>\n\t  \t\t\t\t<th class='izq'>Fecha de Vencimiento</th>\n\t  \t\t\t\t<td>" . $rw["fecha_de_vencimiento"] . "</td>\n\t  \t\t\t</tr>\n\t  \t\t\t<tr>\n \t\t\t\t\t<th class='izq'>Periocidad</th>\n \t\t\t\t\t<td>" . $rw["condiciones_de_pago"] . "</td>\n \t\t\t\t\t<th class='izq'>Estatus</th>\n \t\t\t\t\t<td>" . $rw["estatus"] . "</td>\n\t  \t\t\t</tr>\n\t  \t\t\t<tr>\n\t  \t\t\t\t<th class='izq'>Monto Ministrado</th>\n\t  \t\t\t\t<td class='mny'>" . getFMoney($rw["monto_original"]) . "</td>\n\t  \t\t\t\t<th class='izq'>Saldo Actual</th>\n\t  \t\t\t\t<td class='mny'>" . getFMoney($rw["saldo_insoluto"]) . "</td>\n  \t\t\t\t</tr>";
    $credito_anterior = $credito;
    $counter++;
}
//Corregir el último
//resetear TR_child
$TR_parent .= "\n{$TR_head}\n<tr>\n\t<td colspan='4'>\n\t\t<table>\n\t\t\t<thead>\n\t\t\t\t<th width='10%'>Recibo</th>\n\t\t\t\t<th width='15%'>Fecha</th>\n\t\t\t\t<th width='25%'>Operacion</th>\n\t\t\t\t<th width='20%'>Monto</th>\n\t\t\t\t<th width='30%'>Detalles</th>\n\t\t\t<thead>\n\t\t<tbody> {$TR_child} </tbody>\n\t\t</table>\n\t</td>\n</tr>";
/*		<!-- <tr>
		<td colspan='4'> 
		<hr />
		</td>
	  			<tr>
	  				<th class='izq'>[$counter]Monto Ministrado</th>
 /**
  * Genera la Tabla
  * @param string	$vCaption	Titulo de la Tabla
  * @param boolean	$retorna	Retornar la Tabla como Valor? true/false
  */
 function Show($vCaption = "", $retorna = true, $TableID = "")
 {
     $xHComm = new cHObject();
     $xD = new cFecha();
     $xLng = new cLang();
     $xT = new cTipos();
     $xQL = new MQL();
     $xBtn = new cHButton();
     $xIcs = $this->ODicIcons();
     $this->mID = $TableID == "" ? $this->mID : $TableID;
     if (MODO_DEBUG == true and isset($_SERVER["REQUEST_URI"])) {
         //setLog($_SERVER["REQUEST_URI"]);
         if (strpos($_SERVER["REQUEST_URI"], "rpt") === false) {
             $this->addTool(3);
         }
     }
     $xD->setSeparador("/");
     if ($this->mSql != "") {
         //Miembros de las Tablas
         $tds = "";
         $ths = "";
         //Inicio de Tabla
         $pushInit = "";
         $pushEnd = "";
         $vClassT = "";
         $vWidth = "";
         $tdt = "";
         $tht = "";
         $tab = "";
         $tfoot = "";
         $trick = 1;
         $capTable = "";
         $oldTags = false;
         if ($this->mTipoSalida == OUT_EXCEL) {
             $oldTags = true;
         }
         //si hay Caption formar el caption
         if ($vCaption != "" and $this->mPrepareChart == false) {
             $vCaption = $xLng->getT($vCaption);
             $vCaption = "<legend>[&nbsp;&nbsp;&nbsp;&nbsp;{$vCaption}&nbsp;&nbsp;&nbsp;&nbsp;]</legend>";
             $pushInit = "<fieldset>{$vCaption}";
             $pushEnd = "</fieldset>";
         }
         if ($vCaption != "" and $this->mPrepareChart == true) {
             $capTable = "<caption>{$vCaption}</caption>";
         }
         if ($vCaption != "" and $this->mTipoSalida == OUT_EXCEL) {
             $capTable = "<caption>{$vCaption}</caption>";
         }
         //Clase de la Tabla
         if ($this->mClassT != "") {
             $this->mClassT = " " . $this->mClassT;
         }
         $vClassT = "class=\"listado" . $this->mClassT . "\" ";
         //Contar Tools
         $il = count($this->mTool);
         $itmCmd = count($this->mEspCMD);
         $itmEspTool = count($this->mEspTool);
         $itmTot = $il + $itmCmd + $itmEspTool;
         if ($itmTot > 0) {
             $wd = setNoMenorQueCero($this->mWidthTool) <= 0 ? $itmTot * 26 . "px" : $this->mWidthTool;
             $tht = "<th style='min-width:" . $wd . ";width:" . $wd . ";'>Acciones</th>";
         }
         // --------------------------------------------------------------
         $rs = getRecordset($this->mSql);
         if ($this->mKeyField == "") {
             $this->mKeyField = mysql_field_name($rs, $this->mKey);
         }
         if ($this->mTbl == "") {
             $this->mTbl = mysql_field_table($rs, $this->mKey);
         }
         //Arrays de Nombres y tipo
         $arrFieldNames = array();
         $arrFieldTypes = array();
         $preCols = count($this->Fields) <= 1 ? false : true;
         //
         $ifl = mysql_num_fields($rs) - 1;
         //Limite de Fields
         //-------------------------------------------------------------	//Cabeceras de Columnas
         for ($iCols = 0; $iCols <= $ifl; $iCols++) {
             $fname = mysql_field_name($rs, $iCols);
             $ftypes = mysql_field_type($rs, $iCols);
             $this->Fields[] = $fname;
             if ($this->mKey == 0 and $this->mKeyField != "") {
                 if (strtolower($fname) == strtolower($this->mKeyField)) {
                     $this->mKey = $iCols;
                 }
             }
             $tths = "";
             if (isset($this->mColTitles[$fname])) {
                 $tths = $this->mColTitles[$fname];
             } else {
                 $tths = strtoupper(str_replace("_", " ", $fname));
             }
             $tths = $xLng->getT("TR.{$tths}");
             $cssTh = $iCols == $this->mKey ? " class='key' " : "";
             $scope = $this->mPrepareChart == true ? " scope='col' " : "";
             //Mejorar codigo
             if ($this->mTipoSalida == OUT_EXCEL) {
                 $ths .= "<th class=\"xl25\">{$tths}</th>";
             } else {
                 if ($this->mTipoSalida == OUT_TXT or $this->mTipoSalida == OUT_CSV) {
                     $ths .= $iCols == 0 ? $tths : $this->mDelimiter . $tths;
                     $ths .= $iCols == $ifl ? "\r\n" : "";
                 } else {
                     $ths .= ($this->mPrepareChart == true and $iCols == $this->mKey) ? "<td></td>" : "<th {$scope} {$cssTh}>{$tths}</th>";
                 }
             }
             /**
              * Construye el Array de Tipos y Nombres
              */
             $arrFieldNames[$iCols] = $fname;
             $arrFieldTypes[$iCols] = $ftypes;
         }
         //$ths . "\n $tht";
         // --------------------------------------------------------------
         while ($rw = mysql_fetch_array($rs)) {
             $this->mRowCount++;
             $tdt = "";
             $pKey = $this->mKey;
             $idKey = is_string($rw[$pKey]) == true ? "'" . $rw[$pKey] . "'" : $rw[$pKey];
             $dataCustom = "";
             $trick = $trick >= 2 ? 1 : $trick + 1;
             //switch oddr
             $lis = "";
             $liCss = $trick == 2 ? "tags green" : "tags blue";
             /*$t = array(
             			0 => $xBtn->getBasic("TR.Ejecutar", $this->mActionExec . "($idKey)", ) "<img src='../images/common/execute.png' onclick=\"" . $this->mActionExec . "($idKey);\" title='Ejecutar Una acci&oacute;n' />",
             			1 => "<img src='../images/common/edit.png' onclick=\"if(typeof actualizame" . $this->mRndK . " != 'undefined'){actualizame" . $this->mRndK . "($idKey);} else {jsUp('" . $this->mTbl . "','" . $this->mKeyField . "', $idKey); } \" title='Editar Registro' />",
             			SYS_DOS => "<img src='../images/common/trash.png' onclick=\"var xG = new Gen(); xG.rmRecord({tabla:'" . $this->mTbl .  "',id:" . $idKey . "});\" title='Eliminar Registro' />"
             		);*/
             $t = array(0 => $xBtn->getBasic("TR.Ejecutar", $this->mActionExec . "({$idKey})", $xIcs->EJECUTAR, "exec{$idKey}", false, true), 1 => $xBtn->getBasic("TR.Editar", "if(typeof actualizame" . $this->mRndK . " != 'undefined'){actualizame" . $this->mRndK . "({$idKey});} else {jsUp('" . $this->mTbl . "','" . $this->mKeyField . "', {$idKey}); }", $xIcs->EDITAR, "redit{$idKey}", false, true), 2 => $xBtn->getBasic("TR.Eliminar", "var xG = new Gen(); xG.rmRecord({tabla:'" . $this->mTbl . "',id:" . $idKey . "});", $xIcs->ELIMINAR, "rdel{$idKey}", false, true), 3 => $xBtn->getBasic("TR.Ver", "var xDev=new SafeDev(); xDev.recordRAW({tabla:'" . $this->mTbl . "',id:" . $idKey . "});", $xIcs->EXPORTAR, "idcmdview{$idKey}", false, true));
             foreach ($this->mTool as $idx => $clave) {
                 $lis .= isset($t[$clave]) ? "<li>" . $t[$clave] . "</li>" : "";
             }
             foreach ($this->mEspCMD as $idx => $cnt) {
                 $lis .= "<li>" . str_replace(HP_REPLACE_ID, $rw[$pKey], $cnt) . "</li>";
             }
             $tdt = $lis == "" ? "" : "<ul class='{$liCss}'>{$lis}</ul>";
             /**
              * Herramientas especiales
              */
             foreach ($this->mEspTool as $key => $value) {
                 $DefValue = str_replace(HP_REPLACE_ID, $rw[$pKey], $value);
                 //validar si no es PHP
                 if (strpos($DefValue, "PHP::") !== false) {
                     $cod = str_replace("PHP::", "\$DefValue=", $DefValue);
                     eval($cod);
                 }
                 $tdt .= "\n " . $DefValue;
             }
             $tdt = trim($tdt) != "" ? "<td id=\"options-" . $rw[$pKey] . "\" class=\"toolbar-24\">{$tdt}</td>" : "";
             if ($this->mTipoSalida == OUT_EXCEL) {
                 $tdt = "";
             }
             //-------------------------------------------------------
             $ttds = "";
             for ($i = 0; $i <= $ifl; $i++) {
                 $event = "";
                 $css = "";
                 $oprp = "";
                 $currVal = $rw[$i];
                 $sanID = str_replace(" ", "_", $currVal);
                 $type = isset($arrFieldTypes[$i]) ? $arrFieldTypes[$i] : "text";
                 $name = $arrFieldNames[$i];
                 $scope = "";
                 $delims = "td";
                 $mkEnd = "";
                 $extraCNT = "";
                 if ($i == $this->mKey) {
                     $event = $this->EventKey;
                     if ($event != "") {
                         $event = "<a class='button' onclick=\"{$event}('{$rw[$i]}');\" >";
                         $mkEnd = "</a>";
                     }
                     $css .= "key";
                     $oprp = " id=\"pk-" . $sanID . "\" ";
                     $scope = $this->mPrepareChart == true ? "scope=\"row\"" : "";
                     $delims = $this->mPrepareChart == true ? "th" : "td";
                 }
                 /**
                  *Agrega el data Custom
                  */
                 if ($this->mDataCustom == true) {
                     $dataCustom .= $dataCustom == "" ? "{$name}={$currVal}" : "|{$name}={$currVal}";
                 }
                 /**
                  * Agrega una suma si el tipo aplica
                  */
                 if (isset($this->arrTypesPHP[$type]) and $this->arrTypesPHP[$type] == "numeric") {
                     if (!isset($this->mFieldSum[$name])) {
                         $this->mFieldSum[$name] = 0;
                     }
                     $this->mFieldSum[$name] += $currVal;
                 }
                 //Agregar sub consulta
                 /*if($this->mSubsEnable	== true){
                 			$sqlSub			= "";
                 			//si no encuentra
                 			if(isset($this->mSubSQLs[$i])){
                 				$sqlSub		= $this->mSubSQLs[$i];
                 			} elseif(isset($this->mSubSQLs[$name])){
                 				$sqlSub		= $this->mSubSQLs[$name];
                 			} else {
                 				if ($i == $this->mKey OR $name == $this->mKeyField){
                 					$sqlSub		= (isset($this->mSubSQLs[0])) ? $this->mSubSQLs[0] : "";
                 				}
                 			}
                 			if($sqlSub == ""){
                 				
                 			} else {
                 				$sqlSub			= str_replace(HP_REPLACE_ID,$currVal, $sqlSub);
                 				//if($currVal == 	200039104){setLog($sqlSub);}
                 				$mql			= new MQL();
                 				$data			= $mql->getDataRecord($sqlSub);
                 				$cnt			= "";
                 				$outc			= new cHObject();
                 				
                 				foreach($data as $info){
                 					foreach($info as $pfield => $pvalue){
                 						$cnt		.= $pvalue . "\r\n";
                 					}
                 				}
                 				$extraCNT			.= $outc->Out($cnt, OUT_HTML);
                 			}
                 		}*/
                 //Tipo de Dato
                 /**
                  * Si la Opcion de Class por tipo es verdadero
                  * formatea cada Td como su tipo
                  */
                 $oStr = array("string" => "string", "varchar" => "varchar", "text" => "text", "tinytext" => "tinytext");
                 if (!isset($oStr[$type])) {
                     $css = $css == "" ? $type : "{$css} {$type}";
                 }
                 if (isset($this->arrRowCSS[$name])) {
                     $css = $css == "" ? $type : "{$css} " . $this->arrRowCSS[$name];
                 }
                 $css = $css == "" ? "" : " class=\"{$css}\" ";
                 //Formatea a Moneda el valor si es tpo real
                 if ($type == "real") {
                     $currVal = ($this->mPrepareChart == true or $this->mTipoSalida == OUT_EXCEL) ? round($currVal, 2) : getFMoney($currVal);
                 }
                 if ($type == "date") {
                     $currVal = $xD->getFechaMX($currVal);
                 }
                 if (isset($oStr[$type])) {
                     $currVal = $xHComm->Out($currVal, OUT_HTML);
                 }
                 if ($this->mTipoSalida == OUT_EXCEL) {
                     //class=xl2216681 nowrap
                     $ttds .= "<{$delims} class=\"xl25\" >" . $currVal . "</{$delims}>";
                 } else {
                     if ($this->mTipoSalida == OUT_TXT or $this->mTipoSalida == OUT_CSV) {
                         $ttds .= $i == 0 ? $currVal : $this->mDelimiter . $currVal;
                     } else {
                         $css = $this->mPrepareChart == true ? "" : $css;
                         $ttds .= "<{$delims} {$scope} {$css} {$oprp}>{$event}" . $currVal . "{$mkEnd}{$extraCNT}</{$delims}>";
                     }
                 }
             }
             //
             $trcss = $trick >= 2 ? " class='trOdd' " : "";
             if ($this->mTipoSalida == OUT_EXCEL) {
                 $tds .= "<tr>{$ttds}{$tdt}</tr>\r\n";
             } else {
                 if ($this->mTipoSalida == OUT_TXT or $this->mTipoSalida == OUT_CSV) {
                     $tds .= $ttds . "\r\n";
                 } else {
                     $dataCustom = $dataCustom != "" ? " data-info=\"{$dataCustom}\" " : "";
                     $tds .= "<tr id=\"tr-" . $this->mTbl . "-" . str_replace(" ", "_", $rw[$this->mKey]) . "\"{$dataCustom} {$trcss}>{$ttds} {$tdt} </tr>";
                 }
             }
             if ($this->mSubsEnable == true) {
                 foreach ($this->mSubSQLs as $idx => $sqls) {
                     if ($sqls != "") {
                         $sqlSub = str_replace(HP_REPLACE_ID, $rw[$this->mKey], $sqls);
                         $mql = new MQL();
                         $data = $mql->getDataRecord($sqlSub);
                         $outc = new cHObject();
                         foreach ($data as $info) {
                             foreach ($info as $pfield => $pvalue) {
                                 $cnt .= $pvalue . "\r\n";
                             }
                         }
                         $extraCNT .= $outc->Out($cnt, OUT_HTML);
                         $icx22 = $ifl + 2;
                         $tds .= "<tr id=\"tr-subs-" . $this->mTbl . "-" . str_replace(" ", "_", $rw[$this->mKey]) . "\"><td colspan='{$icx22}'>{$extraCNT}</td></tr>";
                     }
                 }
             }
         }
         $this->vFields = $rw;
         // --------------------------------------------------------------
         @mysql_free_result($rs);
         $ism = $this->mFootSums;
         //sumas
         $tfoot = "";
         for ($i = 0; $i <= $ifl; $i++) {
             if (isset($ism[$i])) {
                 if ($this->mTipoSalida == OUT_EXCEL) {
                     $tfoot .= isset($this->mFieldSum[$ism[$i]]) ? "<th>" . getFMoney($this->mFieldSum[$ism[$i]]) . "</th>" : "<td></td>";
                 } else {
                     $tfoot .= isset($this->mFieldSum[$ism[$i]]) ? "<th><input type='hidden' id='idsum-" . $ism[$i] . "' value='" . $this->mFieldSum[$ism[$i]] . "' /><mark id='sum-" . $ism[$i] . "'>" . getFMoney($this->mFieldSum[$ism[$i]]) . "</mark></th>" : "<td></td>";
                 }
             } else {
                 $tfoot .= $i == 0 ? "<th>Filas: " . $this->mRowCount . "</th>" : "<td></td>";
             }
         }
         $tfoot = $oldTags == true ? "<tr>{$tfoot}</tr>" : "<tfoot><tr>{$tfoot}</tr></tfoot>";
         $tfoot = ($this->mSumFoot == false or $this->mPrepareChart == true) ? "" : $tfoot;
         //Da Salida  a la Tbla
         $mID = $this->mID;
         $aProps = $this->mTipoSalida == OUT_EXCEL ? " x:str border=0   style='border-collapse: collapse' " : " {$vClassT} id=\"{$mID}\"";
         $aProps = $this->mPrepareChart == true ? "  style=\"display: none; text-align: center \" > " : $aProps;
         $tBody = $oldTags == true ? "{$tds}" : "<tbody>{$tds}</tbody>";
         $tHead = $oldTags == true ? "<tr>{$ths}{$tht}</tr>" : "<thead><tr>{$ths}{$tht}</tr></thead>";
         $tHead = trim($ths) == "" ? "" : $tHead;
         if ($this->mTipoSalida == OUT_TXT or $this->mTipoSalida == OUT_CSV) {
             $tab = "{$ths} {$tds}";
         } else {
             $tab = "{$pushInit}<table{$aProps}>{$capTable}{$tHead}{$tBody}{$tfoot}</table>{$pushEnd}";
         }
         if ($retorna == true) {
             return $tab;
         } else {
             echo $tab;
         }
     }
 }