function jsaSetGenerarPolizaPorRecibo($numero)
{
    if (setNoMenorQueCero($numero) > 0) {
        //return $tab -> getString();
        $Recibo = $numero;
        $msg = "";
        $Regenerar = true;
        //( strtoupper($id2) == "SI") ? true : false;
        $xUCont = new cUtileriasParaContabilidad();
        $xBtn = new cHButton();
        if ($Regenerar == true) {
            $msg .= $xUCont->setRegenerarPrepolizaContable(false, $Recibo);
        }
        $xUCont->setPolizaPorRecibo($Recibo);
        $idPol = trim($xUCont->getIDPoliza());
        $xPolCW = new cPolizaCompacW(0);
        $xPolCW->initByID($idPol);
        $xPolCW->setRun();
        $strDown = $xPolCW->setExport();
        if (MODO_DEBUG == true) {
            $xLog = new cFileLog();
            $xLog->setWrite($xUCont->getMessages());
            $xLog->setClose();
            $strDown .= $xLog->getLinkDownload("TR.Log");
        }
        //return $xBtn->getBasic("TR.Modificar Poliza","jsModificarPoliza('$idPol')", $xBtn->ic()->EDITAR, "cmdeditpoliza") . $strDown ;
    } else {
        return "NO HAY REGISTRO QUE GENERAR [{$numero}]";
    }
}
function jsaSetCreditosADespedidos($credito, $fecha, $observaciones)
{
    $msg = "";
    $xCred = new cCredito($credito);
    $xCred->init();
    $xdat = new cFecha(0);
    $fecha = $xdat->getFechaISO($fecha);
    $xCred->init();
    $socio = $xCred->getClaveDePersona();
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $xCred->setCambioProducto(CREDITO_PRODUCTO_DESTINO_DESCARTADOS);
    $xCred->setResetPersonaAsociada($fecha, $observaciones);
    //Agregar operacion de desvinculacion
    $xRe = new cReciboDeOperacion(RECIBOS_TIPO_ESTADISTICO, false, DEFAULT_RECIBO);
    $xRe->init();
    $xRe->setNuevoMvto($fecha, $xCred->getSaldoActual(), OPERACION_CLAVE_DESVINCULACION, $xCred->getPeriodoActual(), "", 1, false, $socio, $credito, $fecha);
    $xRe->setFinalizarRecibo();
    $msg .= $xSoc->getMessages(OUT_TXT);
    $msg .= $xCred->getMessages(OUT_TXT);
    $msg .= $xRe->getMessages(OUT_TXT);
    $xRN = new cReglaDeNegocio();
    $xEmp = new cEmpresas($xCred->getClaveDeEmpresa());
    $xEmp->init();
    $oP = $xCred->getOPersona();
    $xRN->setVariables(array("nombre_de_persona" => $oP->getNombreCompleto(), "mensaje" => $observaciones, "saldo_del_credito" => $xCred->getSaldoActual(), "nombre_de_la_empresa" => $xEmp->getNombreCorto()));
    $xRN->setExecuteActions($xRN->reglas()->RN_NOMINA_AL_DESPEDIR);
    $xF = new cFileLog();
    $xF->setWrite($msg);
    $xF->setClose();
    return $xF->getLinkDownload("Descarga de Log");
}
function jsaGuardarReestructura($credito, $monto, $pagos, $periocidad, $tasa, $observaciones, $producto, $tipopago)
{
    $tasa = $tasa / 100;
    $xCred = new cCredito($credito);
    $xCred->init();
    $xCred->setReconvenido($monto, 0, $tasa, $periocidad, $pagos, $observaciones, false, false, $tipopago, $producto);
    $xF = new cFileLog();
    $xF->setWrite($xCred->getMessages());
    $xF->setClose();
    return $xCred->getMessages(OUT_HTML) . $xF->getLinkDownload("Descarga de Log");
}
function jsaGetFiles($uLike)
{
    //Crea Archivos a partir de un Read de Files en el Archivo
    //principal
    $d = dir(PATH_TMP);
    $links = "";
    while ($entry = $d->read()) {
        $OName = $entry;
        $siPoint = strpos($OName, ".");
        $i = 0;
        if (!$siPoint) {
            $handle = opendir($d->path . "/" . $OName);
            while ($file = readdir($handle)) {
                $siTXT = strpos($file, ".txt");
                $siLOG = strpos($file, "log");
                if ($siLOG !== false and $siTXT !== false) {
                    //si no es linux
                    //bkp y no es
                    //texto
                    $file = str_replace(".txt", "", $file);
                    $xF = new cFileLog($file);
                    if ($uLike != "") {
                        if (strpos($file, $uLike) !== false) {
                            $links .= "<tr><td colspan='3'>" . $xF->getLinkDownload($file) . "</td></tr>";
                            $i++;
                        }
                    } else {
                        $links .= "<tr><td colspan='3'>" . $xF->getLinkDownload($file) . "</td></tr>";
                        $i++;
                    }
                    if ($i > 25) {
                        break;
                    }
                }
            }
            closedir($handle);
        }
    }
    $d->close();
    echo $links;
}
                $xLoc->clave_de_municipio(1);
                $xLoc->clave_unica($xT->cInt($idlocalidad));
                $xLoc->latitud(0);
                $xLoc->longitud(0);
                $xLoc->nombre_de_la_localidad($nombrelocal);
                $xLoc->clave_de_pais($paislocal);
                $ins = $xLoc->query()->insert();
                $ins->save();
                $msg .= $ins->getMessages(OUT_TXT);
            }
            $linea++;
        }
    }
    $msg .= $xFil->getMessages();
    if (MODO_DEBUG == true) {
        $xFl = new cFileLog();
        $xFl->setWrite($msg);
        $xFl->setClose();
        $xFRM->addToolbar($xFl->getLinkDownload("TR.archivo de eventos", ""));
    } else {
        echo JS_CLOSE;
    }
    echo $xFRM->get();
}
//$jsb->show();
?>
<!-- HTML content -->
<script>
</script>
<?php 
$xHP->fin();
                        }
                    } else {
                        $msg .= "{$socio}\tNO.EXIST\t0\t{$sdoCW}\t0\tSocio No existe en la Sucursal\r\n";
                    }
                }
                $html = new cHTMLObject();
                $fileDw = getSucursal() . "-compacw-comparacion_auxiliares_del_catalogo-" . date("ydmHsi");
                $fileDi = getSucursal() . "-{$TipoDeImportacion}-diferencias_compaqw-vs-safe_" . date("ydmHsi");
                $cF = new cFileLog($fileDw);
                $cFd = new cFileLog($fileDi);
                $cF->setWrite($msg);
                $cF->setClose();
                //
                $cFd->setWrite($msgD);
                $cFd->setClose();
                echo $cFd->getLinkDownload("Archivo de diferencias");
                echo $cF->getLinkDownload("Datos del proceso de Comparacion");
            } else {
                echo "<p class='aviso'>EL TIPO DE ARCHIVO DE " . $usrFiles[$i]['name'] . "(" . $mExt . ") NO ES SOPORTADO</p>";
            }
        }
    }
    ?>
</fieldset>
</form>
<?php 
}
if (!isset($iReg)) {
    $iReg = 0;
}
?>
                                $msg .= "{$iReg}\tOMITIDO\t{$socio}\tSocio[{$socio}] y Dato Omitido\r\n";
                            }
                        }
                        $iReg++;
                    }
                }
                fclose($gestor);
                $html = new cHTMLObject();
                if ($TipoDeSalida == "comparable") {
                    $msg = "SOCIO,NOMBRE,MONTO,CUENTA,ESTATUS\r\n";
                    $msg .= $txt;
                }
                $cF = new cFileLog();
                $cF->setWrite($msg);
                $cF->setClose();
                echo $cF->getLinkDownload("Mostrar Datos del Proceso");
            } else {
                echo "<p class='aviso'>EL TIPO DE ARCHIVO DE " . $usrFiles[$i]['name'] . "(" . $mExt . ") NO ES SOPORTADO</p>";
            }
        }
    }
}
if (!isset($iReg)) {
    $iReg = 0;
}
?>
</fieldset>
</form>
</body>
<script  >
</script>
                    while (!feof($gestor)) {
                        $bufer = fgets($gestor, 4096);
                        //$bufer			= stream_get_line($gestor, "\r\n");
                        if (!isset($bufer)) {
                            $msg .= "{$iReg}\t\tERROR\tLa Linea({$iReg}) no se leyo({$bufer})\r\n";
                        } else {
                            $bufer = trim($bufer);
                            $datos = explode(",", $bufer, 6);
                            $socio = $cT->cInt($datos[0]);
                        }
                        $iReg++;
                    }
                }
                fclose($gestor);
                $xLog->setWrite($msg);
                echo $xLog->getLinkDownload("Archivo del proceso");
            } else {
                echo "<p class='aviso'>EL TIPO DE ARCHIVO DE " . $usrFiles[$i]['name'] . "(" . $mExt . ") NO SE ACEPTA</p>";
            }
        }
    }
}
if (!isset($iReg)) {
    $iReg = 0;
}
?>
</fieldset>
</form>
</body>
<script  >
</script>
     $oficial_de_seguimiento = $xConv->getOficialDeSeguimiento();
 }
 if ($esrenovado == true) {
     $TipoDeAutorizacion = CREDITO_AUTORIZACION_RENOVADO;
     $msg .= "WARN\tCredito marcado como Renovado \r\n";
 }
 $xCred = new cCredito();
 $result = $xCred->add($tipoconvenio, $persona, $contrato_corriente, $monto_solicitado, $periocidad, $numeropagos, $dias_solicitados, $rubro_destino, false, $grupo_asociado, $amp_destino, $observaciones, $oficial_de_credito, $fecha_solicitud, $tipo_de_pago, INTERES_POR_SALDO_INSOLUTO, false, $fecha_ministracion, $xSoc->getClaveDeEmpresa(), $TipoDeAutorizacion);
 if ($result == false) {
     $xFRM->addToolbar($xBtn->getRegresar("solicitud_de_credito.frm.php", true));
     $xFRM->addAviso($xHP->lang(MSG_ERROR_SAVE));
     $xFL = new cFileLog();
     $xFL->setWrite($xCred->getMessages(OUT_TXT));
     $xFL->setWrite($xSoc->getMessages());
     $xFL->setClose();
     $xFRM->addToolbar($xFL->getLinkDownload("Log de eventos", ""));
     $xFRM->addAviso($xCred->getMessages());
 } else {
     $xCred->init();
     $credito = $xCred->getNumeroDeCredito();
     //Si es Automatizado
     $xCat = new cCreditosOtrosDatos();
     if ($tieneprops == true) {
         $xCred->setOtrosDatos($xCat->AML_CON_PROPIETARIO, "1");
     }
     if ($tieneprovs == true) {
         $xCred->setOtrosDatos($xCat->AML_CON_PROVEEDOR, "1");
     }
     if ($xCred->getTipoDeAutorizacion() == CREDITO_TIPO_AUTORIZACION_AUTOMATICA) {
         //$saldo_actual = $monto_autorizado;
         //TODO: Acabar con este modulo
function jsaSetAplicarPerfiles($id)
{
    $xP = new cSystemPermissions();
    $xP->setAplicarPerfil();
    $xFil = new cFileLog();
    $xFil->setWrite($xP->getMessages());
    $xFil->setClose();
    return $xFil->getLinkDownload("Cambios");
}
                reset($arrAbonos);
                foreach ($arrAbonos as $key => $value) {
                    $msg .= "{$key},FRACASO,0," . $arrInfo[$key] . ",0," . $value . "\r\n";
                    unset($arrAbonos[$key]);
                    $busq++;
                }
                //Eliminar Cargos
                reset($arrCargos);
                foreach ($arrCargos as $key => $value) {
                    $msg .= "{$key},FRACASO,0," . $arrInfo[$key] . "," . $value . ",0\r\n";
                    $busq++;
                    unset($arrCargos[$key]);
                }
                $xLog->setWrite($msg);
                unset($msg);
                echo $xLog->getLinkDownload("Archivo del proceso con {$busq} Busquedas");
            } else {
                echo "<p class='aviso'>EL TIPO DE ARCHIVO DE " . $usrFiles[$i]['name'] . "(" . $mExt . ") NO SE ACEPTA</p>";
            }
        }
    }
}
function EsValido($valor, $comparado1, $comparado2 = 0, $comparado3 = 0)
{
    $comp = $comparado1 + $comparado2 + $comparado3;
    $ret = false;
    if ($valor < $comp + 4.99 and $valor > $comp - 4.99) {
        $ret = true;
    }
    return $ret;
}
 function addLog($msg)
 {
     //if(MODO_DEBUG == true){
     $xFL = new cFileLog(false, true);
     $xFL->setWrite($msg);
     $xFL->setClose();
     unset($msg);
     $this->addToolbar($xFL->getLinkDownload("TR.LOG_FILE", ""));
     //}
 }
    $fecha = $rw["fecha_afectacion"];
    $detalles = $rw["detalles"];
    if ($cuenta_movible != $cuenta) {
        $mvto = 0;
        $saldo = 0;
        $init = "<tr><td colspan='8' ><hr /></td></tr>";
    } else {
        $mvto++;
        $init = "";
    }
    $saldo += $importe * $rw["afectacion"];
    $txt .= "{$socio}\t{$cuenta}\t{$mvto}\t{$fecha}\t" . round($importe, 2) . "\t" . $arrConvMvto[$rw["afectacion"]] . "\t" . round($saldo, 2) . "\t{$detalles}\r\n";
    $cuenta_movible = $cuenta;
    $limit++;
    if ($limit == 35000) {
        $x = new cFileLog($filename . "_hasta_" . $cuenta);
        $x->setWrite($txt);
        $x->setClose();
        echo $x->getLinkDownload("Archivo para Importar") . "<br />";
        $limit = 0;
        $txt = "";
    }
}
?>
</body>
<script  >
function initComponents(){
	//window.print();
}
</script>
</html>
            $oFrm->addToolbar($xhBtn->getBasic("TR.PAGO COMPLETO", "jsGetPago('pc')", "dinero", "pc1", false));
            break;
        default:
            $oFrm->addToolbar($xhBtn->getBasic("TR.LETRA COMPLETA", "jsGetPago('plc')", "dinero", "pc2", false));
            $oFrm->addToolbar($xhBtn->getBasic("TR.LETRA VARIABLE", "jsGetPago('pli')", "dinero", "pc3", false));
            $oFrm->addToolbar($xhBtn->getBasic("TR.PAGO COMPLETO", "jsGetPago('pc')", "dinero", "pc1", false));
            $defaultPago = OPERACION_PAGO_LETRA_COMPLETA;
            break;
    }
    $oFrm->addToolbar($xhBtn->getRegresar("../index.xul?p=frmcaja/frmcobrosdecreditos.php", true));
    $oFrm->addToolbar($xhBtn->getBasic("TR.Recargar", "jsCargarFrame()", "refrescar", "idrefrescar", false));
    if (MODO_DEBUG == true and $xCred->getTipoEnSistema() != CREDITO_PRODUCTO_NOMINA) {
        $xLog = new cFileLog(false, true);
        $xLog->setWrite($msg);
        $xLog->setClose();
        $oFrm->addToolbar($xLog->getLinkDownload("Log de descargas", ""));
    }
    $xSelP->addEvent("showInCommand()", "onblur");
    $xTxt = new cHText("idobservaciones");
    $html = "";
    $oFrm->addFooterBar("<h3>FECHA DE PAGO : [" . $xF->getFechaDDMM($Fecha) . "] NUMERO DE PARCIALIDAD: [{$parcialidad}]</h3>");
    $html .= $xCred->getFicha(false, "", false, true);
    $xHCob->setEvents("onblur='jsGetPago()'");
    $html .= $xHCob->get(false, "", "", false);
    $html .= $xTxt->get("idobservaciones", "", "Observaciones");
    $html .= "<iframe id=\"idFPrincipal\" src=\"./../principal.php\" width='100%' height=\"800px\" ></iframe>";
    $oFrm->addHElem($html);
    echo $oFrm->get();
    echo $xHP->setBodyEnd();
    ?>
<script>
            } else {
                $msg .= "WARN\tLINEA OMITIDA\r\n";
            }
        }
        $msg .= $xCred->getMessages();
        $msg .= $xPlan->getMessages();
        $mObj = $xPlan->getObjRec();
        if ($mObj != null) {
            $mObj->setFinalizarRecibo(true);
            $msg .= $mObj->getMessages(OUT_TXT);
        }
    }
    $msg .= $xFil->getMessages();
    if (MODO_DEBUG == true) {
        $xFl = new cFileLog();
        $xFl->setWrite($msg);
        $xFl->setClose();
        $xFRM->addHTML($xFl->getLinkDownload("archivo de eventos"));
    } else {
        echo JS_CLOSE;
    }
    echo $xFRM->get();
}
echo $xHP->setBodyEnd();
//$jsb->show();
?>
<!-- HTML content -->
<script>
</script>
<?php 
$xHP->end();
        $ql = new MQL();
        $sql = "SHOW TABLES IN " . MY_DB_IN;
        $rs = $ql->getDataRecord($sql);
        foreach ($rs as $row) {
            $tabla = $row["Tables_in_" . MY_DB_IN];
            $isql = "UPDATE {$tabla} SET sucursal='{$asucursal}' WHERE sucursal='{$desucursal}' ";
            $ql->setRawQuery($isql);
            $ql->setRawQuery("UPDATE {$tabla} SET sucursal=LOWER(sucursal)");
        }
        break;
}
if ($command != false) {
    //Graba los Mensajes del LOG y cierra el Archivo
    $xFLog->setWrite($msg);
    $xFLog->setClose();
    echo $xFLog->getLinkDownload("Registro de Eventos");
}
?>
	</fieldset>
<?php 
$jxc->drawJavaScript(false, true);
?>
<script  >
var mFrm	= document.frmUtils;

function myInfoUtil(){
	
	jsinfo_util();
	<?php 
echo $jsExtra;
?>
function jsaVincularEmpresa($credito, $observaciones, $empresa)
{
    $msg = "";
    $xCred = new cCredito($credito);
    $xCred->init();
    $xdat = new cFecha(0);
    $fecha = $xdat->get();
    // FechaISO($fecha);
    $xCred->init();
    $socio = $xCred->getClaveDePersona();
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $xCred->setCambioProducto(CREDITO_PRODUCTO_NOMINA);
    $xCred->setResetPersonaAsociada($fecha, $observaciones, $empresa);
    //Agregar operacion de desvinculacion
    $xRe = new cReciboDeOperacion(RECIBOS_TIPO_ESTADISTICO, false, DEFAULT_RECIBO);
    $xRe->init();
    $xRe->setNuevoMvto($fecha, $xCred->getSaldoActual(), OPERACION_CLAVE_VINCULACION, $xCred->getPeriodoActual(), "", 1, false, $socio, $credito, $fecha);
    $xRe->setFinalizarRecibo();
    $msg .= $xSoc->getMessages(OUT_TXT);
    $msg .= $xCred->getMessages(OUT_TXT);
    $msg .= $xRe->getMessages(OUT_TXT);
    $xF = new cFileLog();
    $xF->setWrite($msg);
    $xF->setClose();
    return $xF->getLinkDownload("Descarga de Log");
}
                    if ($TipoDeImportacion == "credito") {
                        $sqlD = "DELETE FROM sisbancs_temp_creditos WHERE sucursal != '" . getSucursal() . "' ";
                        my_query($sqlD);
                    } else {
                        $sqlD = "DELETE FROM sisbancs_temp_depositos WHERE sucursal != '" . getSucursal() . "' ";
                        my_query($sqlD);
                    }
                }
                fclose($gestor);
                $html = new cHTMLObject();
                //$htmlmsg = $html->setInHTML($msg);
                //echo "<p class ='aviso'>$htmlmsg</p>";
                $cF = new cFileLog();
                $cF->setWrite($msg);
                $cF->setClose();
                echo $cF->getLinkDownload("Datos del proceso");
                //echo $msg;
            } else {
                echo "<p class='aviso'>EL TIPO DE ARCHIVO DE " . $usrFiles[$i]['name'] . "(" . $mExt . ") NO ES SOPORTADO</p>";
            }
        }
    }
    ?>
</fieldset>
</form>
<?php 
}
//end else action
if (!isset($iReg)) {
    $iReg = 0;
}
                                my_query($sql);
                            }
                            $msg .= "{$ClaveEntidad}\t{$claveMunicipio}\t{$ClaveLocalidad}\tAgregando la Localidad {$NombreLocalidad} con codigo {$ClaveUnica}\r\n";
                        }
                        $iReg++;
                    }
                }
                @fclose($gestor);
                $html = new cHTMLObject();
                //$htmlmsg = $html->setInHTML($msg);
                $xlog = new cFileLog("carga_batch-localidades-" . date("Ymd"), true);
                $xlog->setWrite($msg);
                $xBtn = new cHButton("");
                echo $xBtn->getSalir();
                $xlog->setClose();
                echo $xlog->getLinkDownload("Archivo de Resultados de la Carga");
                //echo "<p class ='aviso'>$htmlmsg</p>";
                //echo $msg;
            } else {
                echo "<p class='aviso'>EL TIPO DE ARCHIVO DE " . $usrFiles[$i]['name'] . "(" . $mExt . ") NO SE ACEPTA</p>";
            }
        }
    }
}
if (!isset($iReg)) {
    $iReg = 0;
}
?>
</fieldset>
</form>
</body>
        $xFRM->addToolbar($xBtn->getBasic($xFRM->lang("imprimir", "orden de desembolso"), "jsImprimirOrdenDesembolso()", "lista", "cm2", false));
        $xFRM->addToolbar($xBtn->getBasic($xFRM->lang(array("imprimir", "CONTRATO de", "credito")), "jsImprimirContrato()", "lista", "cm3", false));
        $xFRM->addToolbar($xBtn->getBasic($xFRM->lang("imprimir", "recibo"), "jsImprimirReciboDePrestamo()", "lista", "cm4", false));
        $xFRM->addToolbar($xBtn->getBasic($xFRM->lang("imprimir", "mandato"), "jsImprimirMandato()", "lista", "cm5", false));
        $xFRM->addToolbar($xBtn->getBasic($xFRM->lang("imprimir", "pagare"), "jsImprimirPagare()", "lista", "cm6", false));
        $xFRM->addHElem("<div class='tx4'><label for='idNoAvales'>No Mostrar Avales</label><input name=\"noAvales\" id=\"idNoAvales\" type=\"checkbox\" onchange=\"setNoAvales()\" /></div>");
    }
    //Graba los Mensages del LOG y cierra el Archivo
    $msg .= $xPlan->getMessages();
    $msg .= $msgM;
    $msg .= $msgC;
    $msg .= $msgPIE;
    if (MODO_DEBUG == true) {
        $xLog->setWrite($msg);
        $xLog->setClose();
        $xFRM->addToolbar($xLog->getLinkDownload("Archivo de Eventos", ""));
    }
}
$xFRM->addAviso($msgAlertas);
echo $xFRM->get();
?>
</body>
<script >
var siAvales	= "si";
var vCredito	= <?php 
echo $solicitud;
?>
;
var urlPagare	= "<?php 
echo $urlsend;
?>
                            if ($xSoc->init() == true) {
                                $xSoc->addActividadEconomica($xFi->getV($tmp->EMPRESA_TRABAJO, ""), $ingreso, $xFi->getV($tmp->OCUPACION, ""));
                            }
                        }
                    }
                }
                $msg .= $xSoc->getMessages();
            }
            $conteo++;
        }
    }
    $msg .= $xFi->getMessages();
    if (MODO_DEBUG == true) {
        $xLog = new cFileLog();
        $xLog->setWrite($msg);
        $xFRM->addToolbar($xLog->getLinkDownload("Archivo del proceso", ""));
    }
    //==================================================================================================================
    /*			fclose ($gestor);
    				$xLog->setWrite($msg);
    				$xFRM->addToolbar( $xLog->getLinkDownload("Archivo del proceso", ""));
    		}	else {
    			$xFRM->addAviso("EL TIPO DE ARCHIVO DE " . $usrFiles[0]['name'] . "(" .$mExt . ") NO SE ACEPTA");
    		}
    
    	}*/
}
if (!isset($iReg)) {
    $iReg = 0;
}
echo $xFRM->get();
 function setExport($FechaInicial = false, $FechaFinal = false)
 {
     $wByFi = $FechaInicial == false ? "" : " WHERE fecha_de_alta>='{$FechaInicial}' ";
     $wByFf = $FechaFinal == false ? "" : " AND fecha_de_alta<='{$FechaFinal}' ";
     $sucursal = getSucursal();
     $arrTipos = array("AD" => "A", "AA" => "B", "PD" => "C", "PA" => "D", "CD" => "E", "CA" => "F", "RD" => "G", "RA" => "H", "OD" => "K", "OA" => "L", "ED" => "I", "EA" => "J");
     //safe => Compaq
     $arrMayor = array("3" => "1", "4" => "2", "1" => "3", "2" => "4");
     //3 safe mayor
     $WriteText = "F  00000000000000\r\n";
     //cuenta de flujo de efectivo
     $sql = "SELECT numero, equivalencia, nombre, tipo, ctamayor, afectable, centro_de_costo, fecha_de_alta, digitoagrupador \r\n    \t\t\tFROM contable_catalogo {$wByFi} {$wByFf} \r\n    \t\t\tORDER BY numero\r\n    \t\t\t";
     $rs = mysql_query($sql, cnnGeneral());
     if (!$rs) {
         //Codigo de Control de Error
         saveError(2, $_SESSION["SN_b80bb7740288fda1f201890375a60c8f"], "Depurar :" . mysql_error() . "|||Numero: " . mysql_errno() . "|||Instruccion SQL: \n " . $sql);
     }
     //$WriteText	.= "$sql\r\n";
     while ($rw = mysql_fetch_array($rs)) {
         //XXX: Si el titulo asignar 0 a superior
         //$WriteText	.= "C ";
         //CompAQi
         $WriteText .= "C  ";
         //$WriteText	.= substr(str_pad($rw["numero"], 20, " ", STR_PAD_RIGHT), 0, 20);
         $WriteText .= substr(str_pad($rw["numero"], 30, " ", STR_PAD_RIGHT), 0, 30);
         $WriteText .= " ";
         $WriteText .= substr(str_pad(trim($rw["nombre"]), 50, " ", STR_PAD_RIGHT), 0, 50);
         $WriteText .= " ";
         $WriteText .= substr(str_pad("", 50, " ", STR_PAD_RIGHT), 0, 50);
         $WriteText .= " ";
         //cuenta superior, mod a 30. compaqi
         //$WriteText	.= substr(str_pad( cuenta_superior( $rw["numero"] ), 20, " ", STR_PAD_RIGHT), 0, 20);
         $WriteText .= $rw["ctamayor"] == 1 ? substr(str_pad(cuenta_superior("0"), 30, " ", STR_PAD_RIGHT), 0, 30) : substr(str_pad(cuenta_superior($rw["numero"]), 30, " ", STR_PAD_RIGHT), 0, 30);
         $WriteText .= " ";
         $WriteText .= $arrTipos[$rw["tipo"]];
         $WriteText .= " ";
         $WriteText .= "0 ";
         //Baja
         $WriteText .= $arrMayor[$rw["ctamayor"]];
         $WriteText .= " ";
         $WriteText .= "0 ";
         $WriteText .= date("Ymd", strtotime($rw["fecha_de_alta"]));
         $WriteText .= " ";
         //Actualizacion ContPAQi
         $WriteText .= "81 ";
         //Sistema de Origen
         $WriteText .= "   1 ";
         //Moneda
         $WriteText .= "   0 ";
         //Digito Agrupador
         $WriteText .= "0    ";
         //Segmento de Negocio
         $WriteText .= "0 ";
         //Mvto.Segmento de Negocio
         $WriteText .= "\r\n";
         //$WriteText	.= "01 01 0000 000\r\n";
     }
     $nombre = "{$sucursal}-catalogo-contable-" . date("Ymd", strtotime(fechasys())) . "-" . rand(0, 1000) . "";
     $xFile = new cFileLog($nombre);
     $xFile->setWrite($WriteText);
     $xFile->setClose();
     return $xFile->getLinkDownload($nombre);
 }
            $xRec->setNumeroDeRecibo($recibo, true);
            $xFRM->addHTML($xRec->getFichaSocio());
            $xFRM->addHTML($xRec->getFicha(true));
            $xFRM->addHTML($xRec->getJsPrint(true));
            if (CAPTACION_IMPUESTOS_A_DEPOSITOS_ACTIVO == true) {
                if ($ReciboIDE != 0) {
                    $xFRM->addToolbar($xBtn->getBasic("TR. Imprimir recibo de impuestos", "jsPrintIDE()", "imprimir", "idrec-ide", false));
                }
            }
            if (MODO_DEBUG == true) {
                $msg .= $xCta->getMessages();
                $msg .= $xRec->getMessages();
                $xFL = new cFileLog(false, true);
                $xFL->setWrite($msg);
                $xFL->setClose();
                $xFRM->addToolbar($xFL->getLinkDownload("TR.Archivo de sucesos", ""));
            }
            $xFRM->addToolbar($xBtn->getBasic("TR. Imprimir recibo de deposito", "jsImprimirRecibo()", "imprimir", "idrec-dep", false));
        } else {
            $msg .= "ERROR\tLA CUENTA NO ES OPERATIVA EN LA FECHA {$Fecha}\r\n";
        }
        $xFRM->addToolbar($xBtn->getIrAlInicio(true));
    }
    $xFRM->addAviso($msg, "idmsg", true);
}
echo $xFRM->get();
?>
</body>
<script  >

 	function jsPrintIDE() {
function jsaSetGenerarPolizaPorRecibo($numero)
{
    if (setNoMenorQueCero($numero) > 0) {
        $Recibo = $numero;
        $xPol = new cPoliza(false);
        $idpoliza = "";
        $msg = "";
        if ($xPol->setPorRecibo($numero) == true) {
            $idpoliza = $xPol->getCodigo();
        } else {
            $xUCont = new cUtileriasParaContabilidad();
            $xUCont->setRegenerarPrepolizaContable(false, $Recibo);
            $xUCont->setPolizaPorRecibo($Recibo);
            $idpoliza = $xUCont->getIDPoliza();
            $msg .= $xUCont->getMessages();
        }
        $msg .= $xPol->getMessages();
        //exportar
        $xPolCW = new cPolizaCompacW(0);
        $xPolCW->initByID($idpoliza);
        $xPolCW->setRun();
        $msg .= $xPolCW->getMessages();
        $strDown = $xPolCW->setExport();
        if (MODO_DEBUG == true) {
            $xLog = new cFileLog();
            $xLog->setWrite($msg);
            $strDown .= $xLog->getLinkDownload("TR.Eventos");
        }
        $xBtn = new cHButton();
        return $xBtn->getBasic("TR.Modificar Poliza", "jsModificarPoliza('{$idpoliza}')", $xBtn->ic()->EDITAR, "cmdeditpoliza") . $strDown;
    } else {
        return "NO HAY REGISTRO QUE GENERAR [{$numero}]";
    }
}