$f14 = !isset($_GET["f14"]) ? false : $_GET["f14"];
$f16 = !isset($_GET["f16"]) ? false : $_GET["f16"];
$f18 = !isset($_GET["f18"]) ? false : $_GET["f18"];
//Mostrar Movimiento Especifico
$TOperacion = !isset($_GET["f19"]) ? false : $_GET["f19"];
//Codigo de Tipo de Operacion.- Mvto Especifico
$fecha_inicial = $_GET["on"];
$fecha_final = $_GET["off"];
$xHP->init("initComponents()");
$xRPT = new cReportes($xHP->getTitle());
echo $xHP->getEncabezado();
echo $xRPT->getEncabezado();
$cCred = new cCredito($idsolicitud);
$cCred->init();
//TODO: Modificar
echo $cCred->getFicha(true, "", true, true);
$sql = "SELECT\n\t`creditos_sdpm_historico`.`idcreditos_sdpm_historico` AS `control`,\n\t`creditos_sdpm_historico`.`numero_de_socio`,\n\t`creditos_sdpm_historico`.`numero_de_credito`,\n\t`creditos_sdpm_historico`.`fecha_anterior`,\n\t`creditos_sdpm_historico`.`fecha_actual`,\n\t`creditos_sdpm_historico`.`dias_transcurridos`,\n\t`creditos_sdpm_historico`.`monto_calculado`,\n\t`creditos_sdpm_historico`.`saldo`,\n\t`creditos_sdpm_historico`.`estatus`,\n\t`creditos_sdpm_historico`.`interes_normal`\nFROM\n\t`creditos_sdpm_historico` `creditos_sdpm_historico` \nWHERE\n\t(`creditos_sdpm_historico`.`numero_de_credito` ={$idsolicitud})\nORDER BY\n\t`creditos_sdpm_historico`.`fecha_anterior` ASC\n\t/*`creditos_sdpm_historico`.`fecha_actual` DESC */";
$cTbl = new cTabla($sql);
$cTbl->setTdClassByType();
$cTbl->setWidth();
$cTbl->Show("", false);
$TSum = $cTbl->getFieldsSum();
echo " <table width='100%'>\n\t\t<tr>\n\t\t<td />\n\t\t<td />\n\t\t<td />\n\t\t<td />\n\t\t\n\t\t<th class='mny'>" . getFMoney($TSum["dias_transcurridos"]) . "</th>\n\t\t<th class='mny'>" . getFMoney($TSum["monto_calculado"]) . "</th>\n\t\t<th class='mny'>" . getFMoney($TSum["saldo"]) . "</th>\n\t\t<td />\n\t\t<th class='mny'>" . getFMoney($TSum["interes_normal"]) . "</th>\n\t\t</tr>\n\t\t</table ";
echo $xHP->getPieDePagina();
?>
</body>
<script  >
<?php 
?>
function initComponents(){
	window.print();
$credito = isset($_REQUEST["credito"]) ? $_REQUEST["credito"] : false;
echo $xHP->getHeader();
echo $xHP->setBodyinit("importHTML()");
?>
<style media="all">
	#idMvtosEsp, input[type=button], input[type=submit], .button, .boton, button, nav { display: none; }
	
</style>
<!-- -->
<?php 
echo getRawHeader();
if ($credito != false) {
    $xCred = new cCredito($credito);
    $xCred->init();
    echo $xCred->getFichaDeSocio();
    echo $xCred->getFicha();
}
echo "<div id=\"iPhantom\"></div>";
echo getRawFooter();
?>
</body>
<script  >
function importHTML(){
	var h	= (typeof opener.serializeHTML != "undefined" ) ? opener.serializeHTML : opener.document.body.innerHTML;
	
	document.getElementById("iPhantom").innerHTML = h;
	//document.getElementById("iPhantom").( opener.document.body.innerText);;
	iFrms = document.forms.length - 1;
	for(i=0; i<=iFrms; i++){
		document.forms[i].disabled = true;
		iElm = document.forms[i].elements.length - 1;
        //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
            $xFRM->addToolbar($xBtn->getBasic($xHP->lang("Imprimir", "Orden de Desembolso"), "jsImprimirOrdenDeDesembolso()", "imprimir", "cmdprintdes", false));
        }
        //----------------------------------------------------------------------
        $xFRM->addHTML($xCred->getFichaDeSocio());
        $xFRM->addHTML($xCred->getFicha());
        $xFRM->addCreditoComandos($xCred->getNumeroDeCredito());
        $xFRM->addToolbar($xBtn->getBasic("TR.Autorizar credito", "var CGen=new CredGen();CGen.getFormaAutorizacion({$credito})", "imprimir", "cmdprintdes5", false));
        $xFRM->addToolbar($xBtn->getBasic("TR.GENERAR PLAN_DE_PAGOS", "var CGen=new CredGen();CGen.getFormaPlanPagos({$credito})", "reporte", "generar-plan", false));
    }
}
$msg .= $xSoc->getMessages();
$xFRM->addAviso($msg);
echo $xFRM->get();
?>
<script>
var xGen	= new Gen();
var CGen	= new CredGen();

var idcredito	= <?php 
echo $credito;
$persona = parametro("idsocio", $persona, MQL_INT);
$credito = parametro("credito", DEFAULT_CREDITO, MQL_INT);
$credito = parametro("idsolicitud", $credito, MQL_INT);
$credito = parametro("solicitud", $credito, MQL_INT);
$cuenta = parametro("cuenta", DEFAULT_CUENTA_CORRIENTE, MQL_INT);
$cuenta = parametro("idcuenta", $cuenta, MQL_INT);
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
$action = parametro("action", SYS_NINGUNO);
$xHP->init();
$xFRM = new cHForm("frmseguimiento_llamadas", "llamadas.frm.php");
if ($credito > DEFAULT_CREDITO) {
    $xCred = new cCredito($credito);
    $xCred->init();
    $xFRM->addHTML($xCred->getFicha(true, "", false, true));
    /* -----------------  -----------------------*/
    $clave = parametro("idseguimiento_llamadas", null, MQL_INT);
    $xTabla = new cSeguimiento_llamadas();
    if ($clave != null) {
        $xTabla->setData($xTabla->query()->initByID($clave));
    }
    $xTabla->setData($_REQUEST);
    $clave = parametro("id", null, MQL_INT);
    $xSel = new cHSelect();
    if ($clave == null) {
        $step = MQL_ADD;
        $clave = $xTabla->query()->getLastID() + 1;
        $xTabla->idseguimiento_llamadas($clave);
    } else {
        $step = MQL_MOD;
    $persona = $persona;
    $porSocio = true;
}
$xSoc = new cSocio($persona);
$xSoc->init();
echo $xSoc->getFicha(true);
echo "<hr />";
$mycred = getRecordset($sqlcred);
while ($rwc = mysql_fetch_array($mycred)) {
    $solicitud = $rwc["numero_solicitud"];
    $NCreditos++;
    $cFC = new cCredito($solicitud);
    $cFC->initCredito();
    $cFC->setForceVista($ExtInf);
    $sdoTemp = $cFC->getSaldoActual();
    echo $cFC->getFicha(true, "", true);
    $MontoAutorizado = $rwc["monto_autorizado"];
    echo "<hr />";
    $where = "";
    if ($f15 == "yes") {
        $where = " AND (operaciones_mvtos.docto_afectado={$solicitud}) {$SinEstadisticos} {$solo_este_mvto} {$varByFechas}";
    } else {
        $where = " AND (operaciones_mvtos.docto_afectado={$solicitud}) {$SinEstadisticos} {$solo_este_mvto} {$varByFechas}";
    }
    $sqlST = $xSQL->getEstadoDeCuentaDeCreditos($where);
    $trs = "";
    $cap = 0;
    $ints = 0;
    $otros = 0;
    $iva = 0;
    $sdo = $MontoAutorizado;
echo $xP->getHeader();
echo $xP->setBodyinit();
//
$fecha = parametro("fecha", fechasys());
/*
Fecha_Cierre_Credito,Forma_Pago_Mop ( Que solo puede salir viendo cuantos dias transcurridos  del credito han pasado) y Monto_Ultimo_Pago creo que con eso ya sale para hoy
 * */
$credito_de_pruebas = parametro("credito", 209999801, MQL_INT);
//Crear formularios
$xFRM = new cHForm("frmTest", "./test.php");
$xHTxt = new cHText("");
//====================================================================================================
$xFRM->addHElem("<p class='aviso'>Pruebas de la Clase Creditos</p>");
$xCred = new cCredito($credito_de_pruebas);
$xCred->init();
$xFRM->addHElem($xCred->getFicha(true, "", true, true));
$xFRM->addCreditoComandos($credito_de_pruebas);
//$xFRM->addHElem($xCred->setDetermineDatosDeEstatus(fechasys(), true));
$xUtils->setEstatusDeCreditos(false, fechasys(), false, true, false);
//$xFRM->addAviso($xCred->getMessages(), "id2", false, "warning");
//$xFRM->addAviso(, "id2", false, "warning");
$xFRM->addLog($xUtils->getMessages());
/*$xFRM->addHElem( "<p class='aviso'>Vencimiento : " . $xCred->setDetermineDatosDeEstatus(false, true) . "</p>" );

$xFRM->addHElem( "<p class='aviso'>fecha de ultimo pago de CAPITAL : " . $xCred->getFechaUltimoMvtoCapital() . "</p>" );

$xFRM->addHElem( "<p class='aviso'>Monto de Parcialidad : " . $xCred->getMontoDeParcialidad() . "</p>" );

$xFRM->addHElem( "<p class='aviso'>Saldo Actual Normal : " . $xCred->getSaldoActual() . "</p>" );

$xFRM->addHElem( "<p class='aviso'>Saldo Actual FORZADO: " . $xCred->getSaldoActual($fecha) . "</p>" );
    $idsocio = $id;
    $porSocio = true;
}
$cF = new cFicha(iDE_SOCIO, $idsocio);
$cF->setTableWidth();
$cF->show();
echo "<hr />";
$mycred = getRecordset($sqlcred);
while ($rwc = mysql_fetch_array($mycred)) {
    $solicitud = $rwc["numero_solicitud"];
    $NCreditos++;
    $cFC = new cCredito($solicitud);
    $cFC->initCredito();
    $cFC->setForceVista($ExtInf);
    $sdoTemp = $cFC->getSaldoActual();
    echo $cFC->getFicha(true, "");
    $MontoAutorizado = $rwc["monto_autorizado"];
    echo "<hr />";
    $where = "";
    if ($f15 == "yes") {
        $where = " AND (operaciones_mvtos.docto_afectado={$solicitud})\n\t\t\t\t\t{$SinEstadisticos} {$solo_este_mvto} {$varByFechas}";
    } else {
        $where = " AND (operaciones_mvtos.docto_afectado={$solicitud})\n\t\t\t\t\t{$SinEstadisticos} {$solo_este_mvto} {$varByFechas}";
    }
    $sqlST = $xSQL->getEstadoDeCuentaDeCreditos($where);
    $trs = "";
    $cap = 0;
    $ints = 0;
    $otros = 0;
    $iva = 0;
    $sdo = $MontoAutorizado;
     $oFrm->addCreditBasico();
     $oFrm->addSubmit();
     $oFrm->addAviso($xCred->getMessages());
     //echo $oFrm->get();
 } else {
     if (setNoMenorQueCero($idsocio) <= 0) {
         $idsocio = $xCred->getClaveDePersona();
     }
     $xOPdto = $xCred->getOProductoDeCredito();
     if ($idsocio != $xCred->getClaveDePersona()) {
         $msg = "ERROR\tLa Persona {$idsocio} no es la propietaria del credito, el credito marca " . $xCred->getClaveDePersona() . "\r\n";
         $oFrm->addToolbar($xBtn->getRegresar("../index.xul.php?p=frmcreditos/creditos.panel.frm.php", true));
         $oFrm->addAviso($msg);
     } else {
         $oFrm->addHTML($xCred->getFichaDeSocio(true));
         $oFrm->addHTML($xCred->getFicha(true, "", true));
         $codigo_de_oficial = $xCred->getClaveDeOficialDeCredito();
         if (MODO_DEBUG == true) {
             $oFrm->addToolbar($xBtn->getBasic("TR.EDICION_AVANZADA", "jsActualizarCreditoRAW()", "aviso", "edit-credito2", false));
             $oFrm->addToolbar($xBtn->getBasic("TESTING", "var xG=new Gen();xG.w({url:'../unit/core.creditos.test.php?credito={$idsolicitud}'})", "checar", "test-cred", false));
         }
         $oFrm->addCreditoComandos($idsolicitud);
         $oFrm->addToolbar($xBtn->getBasic("TR.ACTUALIZAR DATOS", "jsActualizarCredito()", "editar", "edit-credito", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.IMPRIMIR PAGARE", "printpagare()", "dinero", "view-pagare", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.IMPRIMIR formato NOTARIAL", "cedulanotario({$idsolicitud})", "reporte", "view-cedula", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.ORDEN_DE_DESEMBOLSO", "printodes()", "imprimir", "print-order", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.CONTRATO", "contratocredito()", "imprimir", "print-contrato", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.IMPRIMIR RECIBO DE credito", "printrec()", "imprimir", "print-recP", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.IMPRIMIR MANDATO", "printMandato()", "imprimir", "print-mandato", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.ESTADO_DE_CUENTA", "getEstadoDeCuenta({$idsolicitud})", "statistics", "estado-cta", false));
         $oFrm->addToolbar($xBtn->getBasic("TR.ESTADO_DE_CUENTA Intereses", "getEstadoDeCuentaIntereses({$idsolicitud})", $oFrm->ic()->COBROS, "estado-cta2", false));
     if ($OConv->getEsProductoDeGrupos() == true) {
         $sqlusolc = "UPDATE operaciones_mvtos\tSET estatus_mvto = 10\tWHERE\n\t\t\t\tgrupo_asociado={$gpoasoc}\tAND (tipo_operacion=112) AND (estatus_mvto=40)";
         my_query($sqlusolc);
     }
     //Eliminar Plan de Pagos
     $plan = setNoMenorQueCero($xCred->getNumeroDePlanDePagos());
     if ($plan > 0) {
         $xPlan = new cPlanDePagos($plan);
         $xPlan->setEliminar();
         $msg .= $xPlan->getMessages();
     }
 }
 //------------------------------- IMPRIME UNA PEQUE%A DESCRIPCION DE LA SOLICITUD -----------------------
 $xCred->init();
 $xFRM->addHTML($xCred->getFichaDeSocio(true));
 $xFRM->addHTML($xCred->getFicha(true));
 //$urlsend 				= "elUrl='" . $OConv->getPathPagare($idsolicitud) . "';";
 $cedula_grupal = 0;
 //$urctr 					= "esUrl='" . $xCred->getPathDelContrato() . "';";
 if ($OConv->getEsProductoDeGrupos() == true) {
     //Si la cedula Grupal existe y el Tipo de Integracion el GRUPO
     if (isset($_SESSION["recibo_en_proceso"])) {
         $cedula_grupal = $_SESSION["recibo_en_proceso"];
     }
     $xFRM->addToolbar($xBtn->getBasic("TR.IMPRIMIR CEDULA GRUPAL DE AUTORIZACION", "jsPrintCedulaGrupal())", "personas", "print-cedulagrupo", false));
 }
 //$xFRM->addToolbar( $xBtn->getBasic("TR.IMPRIMIR CEDULA DE AUTORIZACION", "printcedula()", "documento", "print-cedula", false ) );
 $xFRM->addToolbar($xBtn->getSalir("", true));
 // $xBtn->getIrAlInicio(true) );
 $msg .= "WARN\tLos Datos de Fecha de vencimiento, Dias Autorizados\r\n";
 $msg .= "WARN\tInteres Diario, Monto de la Parcialidad, etc. Varian cuando se elabore el PLAN DE PAGOS (Cuando son PAGOS PERIODICOS)\r\n";
$credito = parametro("x", $credito, MQL_INT);
$credito = parametro("pb", $credito, MQL_INT);
//compatible
$ByFecha = "";
$sql = "SELECT\n\t\t\t\n\t\t\t\t/* `operaciones_mvtos`.`socio_afectado`,\n\t\t\t\t`operaciones_mvtos`.`docto_afectado`, */\n\t\t\t\t`operaciones_mvtos`.`recibo_afectado`,\n\t\t\t\n\t\t\t\t`operaciones_mvtos`.`fecha_operacion` AS 'fecha_de_operacion',\n\t\t\t\t`operaciones_tipos`.`descripcion_operacion` AS 'tipo_de_operacion',\n\t\t\t\n\t\t\t\t(`operaciones_mvtos`.`afectacion_real` *\n\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`afectacion`) AS 'monto'\n\t\t\t\n\t\t\t\n\t\t\tFROM\n\t\t\t\n\t\t\t\n\t\t\t\t`operaciones_mvtos` `operaciones_mvtos`\n\t\t\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros`\n\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`\n\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` =\n\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro`\n\t\t\t\t\t\tINNER JOIN `operaciones_tipos` `operaciones_tipos`\n\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` = `operaciones_tipos`.\n\t\t\t\t\t\t`idoperaciones_tipos`\n\t\t\tWHERE\n\t\t\t\t(`operaciones_mvtos`.`docto_afectado` = {$credito})\n\t\t\t\tAND\n\t\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` =2000)\n\t\t\t\t{$ByFecha}\n\t\t\tORDER BY\n\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t`operaciones_mvtos`.`fecha_operacion`";
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//Ficha
$xCred = new cCredito($credito);
$xCred->init();
$xRPT->addContent($xCred->getFicha(true, "", true, true));
//============ Reporte
//$xT		= new cTabla($sql, 2);
//$xT->setTipoSalida($out);
$body = $xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
$rs = $query->getDataRecord($sql);
$sumP = 0;
$sumD = 0;
$td = "";
foreach ($rs as $rw) {
    $montoD = 0;
    $montoP = 0;
    $recibo = $rw["recibo_afectado"];
    $operacion = $rw["tipo_de_operacion"];
?>
</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td></td>
			<td></td>
		</tr>

	</thead>
</table>
<?php 
$cCred = new cCredito($idsolicitud);
$cCred->init();
//TODO: Modificar
echo $cCred->getFicha();
$sql = "\nSELECT\n\t`operaciones_mvtos`.`recibo_afectado`       AS `recibo`,\n\t`operaciones_mvtos`.`fecha_afectacion`      AS `fecha`,\n\t`operaciones_mvtos`.`tipo_operacion`        AS `operacion`,\n\t`operaciones_tipos`.`descripcion_operacion` AS `descripcion`,\n\t`operaciones_mvtos`.`afectacion_real`       AS `monto`,\n\t`eacp_config_bases_de_integracion_miembros`.`afectacion`\nFROM\n\t`operaciones_mvtos` `operaciones_mvtos`\n\t\tINNER JOIN `operaciones_tipos` `operaciones_tipos`\n\t\tON `operaciones_mvtos`.`tipo_operacion` = `operaciones_tipos`.\n\t\t`idoperaciones_tipos`\n\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros`\n\t\t\t`eacp_config_bases_de_integracion_miembros`\n\t\t\tON `eacp_config_bases_de_integracion_miembros`.`miembro` =\n\t\t\t`operaciones_mvtos`.`tipo_operacion`\nWHERE\n\t\t\t\t\t\t\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` =1111)\n\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t(`operaciones_mvtos`.`docto_afectado` = {$idsolicitud} )\n\t\t\t\t\t\t\t\tGROUP BY\n\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`docto_afectado`,\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`fecha_operacion`\n\t\t\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\n\t\t\t\t\t\t\t\t\t`operaciones_mvtos`.`fecha_operacion`\n";
$cTbl = new cTabla($sql);
$cTbl->setWidth();
$cTbl->Show("", false);
echo getRawFooter();
?>
</body>
<script  >
<?php 
?>
function initComponents(){
	window.print();
}
</script>
</html>
 function setCredito($credito)
 {
     $this->mDocumento = $credito;
     $xFDE = new cFecha();
     $xLng = new cLang();
     $cCred = new cCredito($credito);
     $cCred->init();
     $idsolicitud = $credito;
     $DCred = $cCred->getDatosDeCredito();
     $DProd = $cCred->getOProductoDeCredito();
     $OOParam = new cProductoDeCreditoOtrosDatosCatalogo();
     $numero_de_socio = $cCred->getClaveDePersona();
     $this->mPersona = $numero_de_socio;
     $cSoc = new cSocio($numero_de_socio);
     $cSoc->init();
     $svar_info_cred = "";
     $tblInfCred = new cFicha(iDE_CREDITO, $idsolicitud);
     $this->setPersona($numero_de_socio);
     $svar_info_cred = $tblInfCred->show(true);
     //Lista de Beneficiados
     $lst_beneficiados = "";
     $this->getListadoDeAvales($idsolicitud);
     $SQLCBen = "SELECT `socios_relacionestipos`.`descripcion_relacionestipos` AS 'relacion', `socios_relaciones`.`nombres`,\t`socios_relaciones`.`apellido_paterno`,\t`socios_relaciones`.`apellido_materno`,\n\t\t\t`socios_consanguinidad`.`descripcion_consanguinidad` AS 'consaguinidad'\n\t\t\tFROM `socios_relaciones` `socios_relaciones` INNER JOIN `socios_consanguinidad` `socios_consanguinidad` ON `socios_relaciones`.`consanguinidad` = `socios_consanguinidad`.`idsocios_consanguinidad`\n\t\t\tINNER JOIN `socios_relacionestipos` `socios_relacionestipos` ON `socios_relaciones`.`tipo_relacion` = `socios_relacionestipos`.`idsocios_relacionestipos`\n\t\t\tWHERE (`socios_relaciones`.`socio_relacionado` ={$numero_de_socio}) AND (`socios_relaciones`.`credito_relacionado` ={$idsolicitud})\tAND\t(`socios_relaciones`.`tipo_relacion`=11)";
     $tblCBen = new cTabla($SQLCBen);
     $lst_beneficiados = $tblCBen->Show();
     $firmas_de_avales = $this->mFirmasAvales;
     // $cSoc->getCoResponsables("firmas", "avales", $idsolicitud );
     //Plan de Pago segun SQL
     $splan_pagos = $cCred->getPlanDePago(OUT_HTML, true, true);
     //==================================================================================
     $fichas_de_avales = $this->mFichasAvales;
     //$cCred->getAvales_InText();
     $fecha_larga_de_documento = $xFDE->getFechaLarga($cCred->getFechaDeMinistracion());
     $fichas_de_respsolidarios = "";
     //TODO: FALTA
     //Otros Datos
     $monto_ministrado = $cCred->getMontoAutorizado();
     $tasa_interes_mensual_ordinario = round($cCred->getTasaDeInteres() / 12 * 100, 2);
     $tasa_interes_anual_ordinario = $cCred->getTasaDeInteres();
     $fecha_de_vencimiento = $cCred->getFechaDeVencimiento();
     $fecha_de_ministracion = $cCred->getFechaDeMinistracion();
     $tasa_garantia_liquida = $DCred["porciento_garantia_liquida"] * 100;
     $monto_garantia_liquida = $monto_ministrado * $tasa_garantia_liquida;
     $tasa_interes_mensual_moratorio = round($cCred->getTasaDeMora() / 12 * 100, 2);
     $dias_del_credito = $cCred->getDiasAutorizados();
     $meses_del_credito = sprintf("%02d", ceil($dias_del_credito / 30.416666666666668));
     $periocidad = $cCred->getPeriocidadDePago();
     //Tipo de Credito por SQL
     $SQLTCred = "SELECT * FROM creditos_modalidades WHERE idcreditos_modalidades=" . $DCred["tipo_credito"];
     $tipo_de_credito = mifila($SQLTCred, "descripcion_modalidades");
     //Datos del Grupo Solidarios por SQL
     $SQLGAsoc = "SELECT * FROM socios_grupossolidarios WHERE idsocios_grupossolidarios=" . $DCred["grupo_asociado"];
     $InfoGrupo = obten_filas($SQLGAsoc);
     $nombre_rep_social = $InfoGrupo["representante_nombrecompleto"];
     $codigo_rep_social = $InfoGrupo["representante_numerosocio"];
     $nombre_voc_vigila = $InfoGrupo["vocalvigilancia_nombrecompleto"];
     $nombre_del_grupo = $InfoGrupo["nombre_gruposolidario"];
     $domicilio_rep_social = domicilio($codigo_rep_social);
     $tabla_asociadas = "";
     $lista_asociadas = "";
     $tasa_de_cat = $cCred->getCAT();
     $DPeriocidad = new cPeriocidadDePago($cCred->getPeriocidadDePago());
     $DPeriocidad->init();
     $monto_con_interes = "";
     $monto_con_interes_letras = "";
     if ($DCred["grupo_asociado"] != DEFAULT_GRUPO) {
         $SQL_get_grupo = "SELECT `socios_general`.`codigo`, CONCAT(`socios_general`.`nombrecompleto`, ' ', `socios_general`.`apellidopaterno`, ' ', `socios_general`.`apellidomaterno`) AS 'nombre_completo'\n\t\t\t\t\t\t\t\t\tFROM `socios_general` `socios_general` WHERE (`socios_general`.`grupo_solidario` =" . $DCred["grupo_asociado"] . ")";
         $rsg = getRecordset($SQL_get_grupo);
         while ($rwt = mysql_fetch_array($rsg)) {
             $lista_asociadas .= ", " . $rwt["nombre_completo"];
         }
     }
     if (EACP_INCLUDE_INTERES_IN_PAGARE == true) {
         if ($periocidad == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) {
             $monto_con_interes = $cCred->getMontoAutorizado() + $cCred->getInteresDiariogenerado() * $cCred->getDiasAutorizados();
         } else {
             $sqlInt = "SELECT `operaciones_mvtos`.`docto_afectado`, `operaciones_mvtos`.`tipo_operacion`, COUNT(`operaciones_mvtos`.`idoperaciones_mvtos`) AS `mvtos`,\n\t\t\t\t\tSUM(`operaciones_mvtos`.`afectacion_real` *\t`eacp_config_bases_de_integracion_miembros`.`afectacion`) AS 'monto'\n\t\t\t\t\tFROM `operaciones_mvtos` `operaciones_mvtos` INNER JOIN `eacp_config_bases_de_integracion_miembros`\t`eacp_config_bases_de_integracion_miembros`\n\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` = `eacp_config_bases_de_integracion_miembros`.`miembro` WHERE (`operaciones_mvtos`.`docto_afectado` = {$idsolicitud})\n\t\t\t\t\tAND (`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` = 2601)\n\t\t\t\t\tGROUP BY `operaciones_mvtos`.`docto_afectado`, `eacp_config_bases_de_integracion_miembros`.`codigo_de_base`\n\t\t\t\t\tORDER BY `eacp_config_bases_de_integracion_miembros`.`codigo_de_base`, `operaciones_mvtos`.`fecha_afectacion`, `operaciones_mvtos`.`socio_afectado`\t";
             $xF = obten_filas($sqlInt);
             $monto_con_interes = $xF["monto"];
         }
         $monto_con_interes_letras = convertirletras($monto_con_interes);
         $monto_con_interes = getFMoney($monto_con_interes);
     }
     $this->mArr["variable_informacion_del_credito"] = $cCred->getFicha();
     //"variable_lista_de_beneficiados" 		=> $lst_beneficiados,
     $this->mArr["variable_tipo_de_credito"] = $tipo_de_credito;
     $this->mArr["variable_monto2_ministrado_con_intereses_en_letras"] = $monto_con_interes_letras;
     $this->mArr["variable_monto2_ministrado_con_intereses"] = $monto_con_interes;
     $this->mArr["variable_monto_ministrado"] = getFMoney($monto_ministrado);
     $this->mArr["variable_tasa_mensual_de_interes_ordinario"] = $tasa_interes_mensual_ordinario;
     $this->mArr["variable_credito_fecha_de_vencimiento"] = $xFDE->getFechaMediana($fecha_de_vencimiento);
     $this->mArr["variable_monto_garantia_liquida"] = getFMoney($monto_garantia_liquida);
     $this->mArr["variable_tasa_mensual_de_interes_moratorio"] = $tasa_interes_mensual_moratorio . "";
     $this->mArr["variable_tasa_de_garantia_liquida"] = $tasa_garantia_liquida . "";
     $this->mArr["variable_plan_de_pagos"] = $splan_pagos;
     $this->mArr["variable_docto_fecha_larga_actual"] = $fecha_larga_de_documento;
     $this->mArr["variable_nombre_de_la_representante_social"] = $nombre_rep_social;
     $this->mArr["variable_listado_de_integrantes"] = $lista_asociadas;
     $this->mArr["variable_nombre_de_la_vocal_de_vigilancia"] = $nombre_voc_vigila;
     $this->mArr["variable_nombre_del_grupo_solidario"] = $nombre_del_grupo;
     $this->mArr["variable_domicilio_de_la_representante_social"] = $domicilio_rep_social;
     $this->mArr["variable_meses_de_duracion_del_credito"] = $meses_del_credito;
     $this->mArr["variable_en_letras_monto_ministrado"] = convertirletras($monto_ministrado);
     $this->mArr["variable_credito_fecha_de_ministracion"] = $xFDE->getFechaCorta($fecha_de_ministracion);
     $this->mArr["variable_tasa_cat"] = $tasa_de_cat;
     $this->mArr["variable_credito_periocidad"] = $DPeriocidad->getNombre();
     $this->mArr["variable_credito_monto_parcialidad_fija"] = getFMoney($cCred->getMontoDeParcialidad());
     $this->mArr["variable_credito_numero_de_pagos"] = $cCred->getPagosAutorizados();
     $this->mArr["variable_tasa_anual_de_interes_moratorio"] = $cCred->getTasaDeInteres() * 2 * 100 . "%";
     $this->mArr["variable_tasa_anual_de_interes_ordinario"] = $cCred->getTasaDeInteres() * 100 . "%";
     //sobreescribir datos de la empresa
     $xEmp = new cEmpresas($cCred->getClaveDeEmpresa());
     $xEmp->init();
     $this->mArr["variable_nombre_de_la_empresa"] = $xEmp->getNombre();
     $this->mArr["variable_nombre_de_empresa"] = $xEmp->getNombre();
     $this->mArr["variable_fecha_de_primer_pago"] = $xFDE->getFechaMediana($cCred->getFechaPrimeraParc());
     $this->mArr["variable_avales_en_fichas"] = $fichas_de_avales;
     $this->mArr["variable_firmas_de_avales"] = $firmas_de_avales;
     $this->mArr["variable_avales_autorizacion_central_riesgo"] = $this->mFichaRiesgoAv;
     $this->mArr["variable_fecha_ultimo_abono"] = $xFDE->getFechaLarga($cCred->getFechaUltimaParc());
     $this->mArr["variable_fecha_de_primer_abono"] = $xFDE->getFechaMediana($cCred->getFechaPrimeraParc());
     //$this->mArr["variable_fecha_de_primer_abono"]						=
     $this->mArr["variable_en_letras_tasa_mensual_de_interes_moratorio"] = convertirletras_porcentaje($tasa_interes_mensual_moratorio);
     $this->mArr["variable_lista_de_avales_con_domicilio"] = $this->mLAvalesConDir;
     /*variable_aval1_nombre_completo variable_aval1_domicilio_completo variable_aval1_domicilio_localidad variable_aval1_domicilio_municipio*/
     //Cargar Avales
     $this->mArr["variable_listado_de_garantias"] = $this->getListadoDeGarantias();
     //$this->mArr["variable_modalidad_de_credito"]					= $cCred->getOEstado()
     $this->mArr["variable_estado_de_credito"] = $cCred->getOEstado()->descripcion_estatus()->v(OUT_TXT);
     //$this->mArr["variable_credito_num_de_pago_actual"]				= $cCred->getPeriodoActual();
     $this->mArr["variable_contrato_id_legal"] = $DProd->getOtrosParametros($OOParam->CONTRATO_ID_LEGAL);
     $this->mArr["variable_producto_comision_apertura"] = $DProd->getOtrosParametros($OOParam->TASA_DE_COMISION_AP);
 }
 function show($return = false)
 {
     $exoFicha = "";
     $iNumTools = sizeof($this->mTool);
     $trTool = "";
     $wTable = $this->mTableWidth;
     if ($iNumTools > 0) {
         $iTools = "";
         foreach ($this->mTool as $key => $value) {
             $TParts = explode("@", $value);
             $iImg = $TParts[0];
             $iTitle = $TParts[1];
             $srcImg = vIMG_PATH . "/common/{$iImg}";
             $iTools = $iTools . "<td><img src=\"{$srcImg}\" onclick=\"{$key}(" . $this->mKey . ")\" />{$iTitle}</td>";
         }
         $trTool = "<tr>\r\n\t\t\t<td colspan=\"4\">\r\n\t\t\t<table width=\"100%\">\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t{$iTools}\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t\t</td>\r\n\t\t\t</tr>";
     }
     // end iNumTools
     $cTyp = new cTipos();
     switch ($this->mType) {
         case iDE_SOCIO:
             //INFO del Socio
             $cSoc = new cSocio($this->mKey, true);
             $exoFicha = $cSoc->getFicha($this->mSocioWithDomExt, false, $trTool);
             unset($cSoc);
             break;
         case iDE_CREDITO:
             // Creditos iDE_CREDITO
             $cF = new cCredito($this->mKey);
             $cF->initCredito();
             $exoFicha = $cF->getFicha(false, $trTool);
             unset($cF);
             break;
         case 101:
             //Grupos iDE_GRUPO
             $cG = new cGrupo($this->mKey);
             $exoFicha = $cG->getFicha(false, $trTool);
             unset($cG);
             break;
         case iDE_GARANTIA:
             $sql = "SELECT creditos_garantias.idcreditos_garantias,\r\n\t\t\t\tcreditos_tgarantias.descripcion_tgarantias AS 'Tipo_de_Garantia',\r\n\t\t\t\t creditos_tvaluacion.descripcion_tvaluacion AS 'Tipo_de_Valuacion',\r\n\t\t\t\t creditos_garantias.fecha_recibo AS 'Fecha_de_Recibo',\r\n\t\t\t\t FORMAT(creditos_garantias.monto_valuado, 2) AS 'Monto_valuado',\r\n\t\t\t\t creditos_garantias.fecha_adquisicion AS 'Fecha_de_Adquisicion',\r\n\t\t\t\t creditos_garantias.documento_presentado AS 'Documento_Presentado',\r\n\t\t\t\t creditos_garantias.descripcion AS 'Descripcion',\r\n\t\t\t\t creditos_garantias.propietario AS 'Propietario'\r\n\t\t\t\t FROM creditos_tvaluacion, creditos_garantias, creditos_tgarantias\r\n\t\t\t\t WHERE creditos_tgarantias.idcreditos_tgarantias=creditos_garantias.tipo_garantia\r\n\t\t\t\t AND creditos_tvaluacion.idcreditos_tvaluacion=creditos_garantias.tipo_valuacion\r\n\t\t AND creditos_garantias.idcreditos_garantias=" . $this->mKey;
             $tool = $trTool;
             $rwt = obten_filas($sql);
             $exoFicha = "\r\n\t<table  {$wTable} border='0'>\r\n\t<tbody>\r\n\t\t<tr>\r\n\t\t\t<th class='izq'>Identificador</th><td>{$rwt['0']}</td>\r\n\t\t\t<th class='izq'>Tipo</th><td>{$rwt['1']}</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th class='izq'>Tipo de Valuacion</th><td>{$rwt['2']}</td>\r\n\t\t\t<th class='izq'>Fecha de Resguardo</th><td>{$rwt['3']}</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th class='izq'>Fecha de Adquisicion</th><td>{$rwt['5']}</td>\r\n\t\t\t<th class='izq'>Documento / Factura</th><td>{$rwt['6']}</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th class='izq'>Monto Valuado</th><td>" . getFMoney($rwt[4]) . "</td>\r\n\t\t\t<th class='izq'>Propietario</th><td>{$rwt['8']}</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Descripci&oacute;n</th>\r\n\t\t\t<td>{$rwt['7']}</td>\r\n\t\t</tr>\r\n\t\t{$tool}\r\n\t</tbody>\r\n\t</table>";
             break;
         case 300:
             //TODO: Change this line.- cambiar por la clase global
             $sqli = "\r\n\t\t\tSELECT\r\n\t\t\t\t\t`captacion_cuentas`.`numero_cuenta`,\r\n\t\t\t\t\t`captacion_cuentastipos`.`descripcion_cuentastipos` AS `modalidad`,\r\n\t\t\t\t\t`captacion_subproductos`.`descripcion_subproductos` AS `subproducto`,\r\n\t\t\t\t\t`captacion_cuentas`.`fecha_apertura`                AS `fecha_de_apertura`,\r\n\t\t\t\t\t`captacion_cuentas`.`saldo_cuenta`                  AS `saldo_actual`,\r\n\t\t\t\t\t`captacion_cuentas`.`numero_grupo`                  AS `grupo_asociado`,\r\n\t\t\t\t\t`captacion_cuentas`.`numero_solicitud`              AS `credito_asociado`,\r\n\t\t\t\t\t`captacion_cuentas`.`tasa_otorgada`                 AS `tasa`,\r\n\t\t\t\t\t`captacion_cuentas`.`observacion_cuenta`            AS `observaciones`\r\n\t\t\t\tFROM\r\n\t\t\t\t\t`captacion_cuentas` `captacion_cuentas`\r\n\t\t\t\t\t\tINNER JOIN `captacion_cuentastipos` `captacion_cuentastipos`\r\n\t\t\t\t\t\tON `captacion_cuentas`.`tipo_cuenta` = `captacion_cuentastipos`.\r\n\t\t\t\t\t\t`idcaptacion_cuentastipos`\r\n\t\t\t\t\t\t\tINNER JOIN `captacion_subproductos` `captacion_subproductos`\r\n\t\t\t\t\t\t\tON `captacion_cuentas`.`tipo_subproducto` = `captacion_subproductos`\r\n\t\t\t\t\t\t\t.`idcaptacion_subproductos`\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t(`captacion_cuentas`.`numero_cuenta` =" . $this->mKey . ")";
             $rw = obten_filas($sqli);
             $exoFicha = "\r\n\t\t\t\t<table width='100%' border='0'>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class='izq'>Numero de Cuenta</th  class='mny'><td>" . $rw["numero_cuenta"] . "</td>\r\n\t\t\t\t\t<th class='izq' >Fecha de Apertura</th><td>" . getFechaMediana($rw["fecha_de_apertura"]) . "</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class='izq'>Modalidad</th><td>" . $rw["modalidad"] . "</td>\r\n\t\t\t\t\t<th class='izq'>Producto</th><td>" . $rw["subproducto"] . "</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class='izq'>Tasa Actual</th><td class='mny'>% " . getFMoney($rw["tasa"] * 100) . "</td>\r\n\t\t\t\t\t<th class='izq'>Saldo Actual</th>\r\n\t\t\t\t\t<td class='mny'>" . getFMoney($rw["saldo_actual"]) . "</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class='izq'>Observaciones</th><td colspan='2'>" . $rw["observaciones"] . "</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t</table>";
             break;
         case 310:
             //Depositos a la vista iDE_CVISTA
             $cCapt = new cCuentaALaVista($this->mKey);
             $cCapt->init();
             $exoFicha = $cCapt->getFicha(false, $trTool);
             break;
         case 320:
             //iDE_CINVERSION
             $xCI = new cCuentaInversionPlazoFijo($this->mKey);
             $xCI->init();
             $exoFicha = $xCI->getFicha(false, $trTool);
             break;
         case 400:
             //RECIBO DE OPERACION
             $cRec = new cReciboDeOperacion(99, false, $this->mKey);
             //$cRec->initRecibo();
             $exoFicha = $cRec->getFicha(false, $trTool);
             unset($cRec);
             break;
         default:
             break;
     }
     //retoque fieldset
     if ($this->mTitle != "") {
         $this->mTitle = "|&nbsp;&nbsp;&nbsp;" . $this->mTitle . "&nbsp;&nbsp;&nbsp;|";
     }
     $exoFicha = "<fieldset>\r\n\t\t\t\t\t\t<legend>" . $this->mTitle . "</legend>\r\n\t\t\t\t\t\t\t{$exoFicha}\r\n\t\t\t\t\t</fieldset>";
     if ($return == true) {
         return $exoFicha;
     } else {
         echo $exoFicha;
     }
 }
            $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>
var iSRC 		= "./frmprocesarpago.php?<?php 
    echo "p={$socio}|{$solicitud}|{$parcialidad}|{$periocidad}|";
    ?>
";
var ixsrc		= "./frmcobrosdecreditos2.php?<?php 
    echo "idsocio={$socio}&idsolicitud={$solicitud}&idparcialidad=";
//============ Reporte
$xT = new cTabla($sql, 2);
$xT->setTipoSalida($out);
$body = $xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
//$xRPT->addContent( $xT->Show( $xHP->getTitle() ) );
$xG = new cGrupo($grupo);
$xRPT->addContent($xG->getFicha());
$rs = $query->getDataRecord($sql);
foreach ($rs as $rows) {
    $credito = $rows["numero_solicitud"];
    $xCred = new cCredito($credito);
    $xRPT->addContent($xCred->getFicha(false, "", false, true));
}
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
//$xRPT->addContent( $xHP->end() );
$xRPT->setResponse();
$xRPT->setSenders($senders);
echo $xRPT->render(true);
exit;
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../libs/sql.inc.php";
include_once "../core/core.config.inc.php";
include_once "../core/core.common.inc.php";
$oficial = elusuario($iduser);