$xP = new cHPage("Pruebas de Fechas", HP_FORM);
$xP->setIncludes();
echo $xP->getHeader();
echo $xP->setBodyinit();
//Crear formularios
$xHFrm = new cHForm("frmTest", "./test.php");
$xHTxt = new cHText("");
//$txt 	= $xHTxt->getDeMoneda("id", "Moneda de Prueba",  100);
$miFecha = parametro("fecha", fechasys());
$xF = new cFecha(0, $miFecha);
//$xHFrm->addHElem( $txt );
$xHFrm->addHElem($xF->show(true));
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Inicio se semana==" . $xF->getFechaDeInicioDeSemana() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Inicio se nombre semana==" . $xF->getDayName($xF->getFechaDeInicioDeSemana()) . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Dias del Mes==" . $xF->getDiasDelMes() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, En Fecha Corta==" . $xF->getFechaCorta() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Fecha Larga==" . $xF->getFechaLarga() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, En Fecha Mediana==" . $xF->getFechaMediana() . "</p>");
//$xHFrm->addHElem(  );
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Fecha Operativa Maxima==" . $xF->getFechaMaximaOperativa() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, El Mes Anterior==" . $xF->getFechaMesAnterior() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, dos meses atras==" . $xF->getFechaMesAnterior(false, 2) . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}  - 30 Dias==" . $xF->setRestarDias(30) . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}  + 30 Dias==" . $xF->setSumarDias(30) . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}  + 2 meses==" . $xF->setSumarMeses(2) . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}  - 2 meses==" . $xF->setRestarMeses(2) . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Nombre del Dia==" . $xF->getDayName() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Dia Inicial del mes==" . $xF->getDiaInicial() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Obtener Dia Habil==" . $xF->getDiaHabil() . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Dias desde el 31Dic2013==" . $xF->setRestarFechas($xF->get(), "2013-12-31") . "</p>");
$xHFrm->addHElem("<p class='aviso'>La {$miFecha}, Buscar Sabado(D6) para el dia de hoy==" . $xF->getDiaAbonoSemanal(6) . "</p>");
 function add($fecha_inicial = false, $fecha_final = false, $responsable = false, $fecha_reunion = false, $descripcion = "", $codigo = false)
 {
     $xF = new cFecha();
     $fecha_inicial = $fecha_inicial == false ? fechasys() : $fecha_inicial;
     $anno = $fecha_inicial == false ? date("Y", strtotime(fechasys())) : date("Y", strtotime($fecha_inicial));
     $fecha_final = $fecha_final == false ? date("Y-m-d", strtotime("{$anno}-12-31")) : $fecha_final;
     $responsable = $responsable == false ? DEFAULT_USER : $responsable;
     $codigo = $codigo == false ? $anno . "99" : $codigo;
     $descripcion = $descripcion == "" ? "[{$codigo}]Periodo de solicitudes de Credito del " . $xF->getFechaCorta($fecha_inicial) . " al " . $xF->getFechaCorta($fecha_final) : $descripcion;
     $fecha_reunion = $fecha_reunion == false ? $xF->setSumarDias(1, $fecha_final) : $fecha_reunion;
     $sql = "INSERT INTO creditos_periodos(idcreditos_periodos, descripcion_periodos, fecha_inicial, fecha_final, fecha_reunion, periodo_responsable) \n    \t\t\tVALUES({$codigo}, '{$descripcion}', '{$fecha_inicial}', '{$fecha_final}', '{$fecha_reunion}', {$responsable}) ";
     my_query($sql);
 }
 function sendAlerts($PersonaDeOrigen, $PersonaDeDestino, $TipoDeAlerta, $mensaje = "", $documento = false, $fecha = false, $hora = false, $valorDeterminado = 0, $tipo_de_docto = false, $tercero_relacionado = DEFAULT_SOCIO)
 {
     $hora = setNoMenorQueCero($hora) <= 0 ? date("Hi") : $hora;
     $fecha = $fecha == false ? fechasys() : $fecha;
     $documento = $documento == false ? DEFAULT_RECIBO : $documento;
     $tipo_de_docto = $tipo_de_docto == false ? $this->mTipoDeDocto : $tipo_de_docto;
     $this->mTipoDeDocto = $tipo_de_docto;
     $resultado = true;
     $xRsk = new cAml_risk_catalog();
     $xSuc = new cSucursal();
     $xSuc->init();
     $idnumerico = $xSuc->getClaveNumerica();
     $xRsk->setData($xRsk->query()->initByID($TipoDeAlerta));
     $riesgo = $xRsk->valor_ponderado()->v();
     $nombreRies = $xRsk->descripcion()->v();
     $claseRies = $xRsk->tipo_de_riesgo()->v();
     $valorDeterminado = $valorDeterminado == 0 ? $xRsk->valor_ponderado()->v() : $valorDeterminado;
     $xF = new cFecha();
     $fecha = $xF->getInt($fecha);
     $xAl = new cAml_alerts();
     $xAl->estado_en_sistema(SYS_UNO);
     $xAl->fecha_de_checking(SYS_CERO);
     $xAl->fecha_de_origen($fecha);
     $xAl->fecha_de_registro($xF->getInt(fechasys()));
     $xAl->hora_de_proceso($hora);
     $xAl->documento_relacionado($documento);
     $xAl->medio_de_envio(AML_ALERT_MAIL);
     $xAl->mensaje($mensaje);
     $xAl->riesgo_calificado($valorDeterminado);
     $xAl->tipo_de_aviso($TipoDeAlerta);
     $xAl->sucursal($idnumerico);
     //Verificar
     $xAl->entidad(EACP_CLAVE_CASFIN);
     //Actualizar
     $xAl->usuario(getUsuarioActual());
     $xAl->persona_de_destino($PersonaDeDestino);
     $xAl->persona_de_origen($PersonaDeOrigen);
     $xAl->tipo_de_documento($tipo_de_docto);
     $xAl->tercero_relacionado($tercero_relacionado);
     $id_de_alerta = $xAl->query()->getLastID();
     $xAl->clave_de_control($id_de_alerta);
     $ql = $xAl->query()->insert();
     $res = $ql->save();
     if (setNoMenorQueCero($res) <= 0) {
         $this->mMessages .= "ERROR\tAl guardar registro ({$idnumerico})\r\n";
         if (MODO_DEBUG == true) {
             $this->mMessages .= $ql->getMessages(OUT_TXT);
         }
         $resultado = false;
     }
     //$xCatRiesgo				= new cAml_risk_catalog();
     //$xCatRiesgo->setData( $xCatRiesgo->query()->initByID($TipoDeAlerta) );
     //
     $xCatRiesgos = new cAml_risk_catalog();
     $xCatRiesgos->setData($xCatRiesgos->query()->initByID($TipoDeAlerta));
     $nombre_riesgo = $xCatRiesgos->descripcion()->v();
     //Enviar SMS
     $xMail = new cNotificaciones();
     //obtener los datos del usuario
     $xVUser = new cVistaUsuarios();
     $xD = $xVUser->query()->initByID($PersonaDeDestino);
     $xVUser->setData($xD);
     $userP = $xVUser->codigo_de_persona()->v();
     $mailD = false;
     $telD = false;
     $xSoc = new cSocio($userP);
     if ($xSoc->existe($userP) == true) {
         $xSoc->init();
         $mailD = $xSoc->getCorreoElectronico();
         $telD = $xSoc->getTelefonoPrincipal();
     } else {
         $this->mMessages .= "ERROR\tNo existe la persona de envio {$userP}\r\n";
     }
     //Array de valores
     $arrV = array();
     $fechacorta = $xF->getFechaCorta($xF->getFechaByInt($fecha));
     $arrV["variable_documento_codigo"] = $documento;
     $arrV["variable_docto_fecha"] = $fechacorta;
     $arrV["variable_docto_hora"] = $hora;
     $arrV["variable_nivel_de_riesgo"] = $riesgo;
     $arrV["variable_tipo_de_riesgo"] = $nombreRies;
     $arrV["variable_clasificacion_de_riesgo"] = $claseRies;
     $arrV["variable_codigo_de_alerta"] = $id_de_alerta;
     $arrV["variable_mensaje_de_alerta"] = $mensaje;
     $arrV["variable_url_del_sistema"] = SAFE_HOST_URL;
     //Enviar Mail
     $xFmt = new cFormato(800);
     $xFmt->setUsuario($PersonaDeDestino);
     $xFmt->setPersona($PersonaDeOrigen);
     $xFmt->setProcesarVars($arrV);
     $txtMail = $xFmt->get();
     if ($valorDeterminado > 51 or $this->mForceAvisos == true) {
         $xMail->setTitulo(AML_TITULO_DE_ALERTA);
         $this->mMessages .= $xMail->send($txtMail, $mailD, $telD, $PersonaDeDestino, "{$fechacorta}-{$claseRies}-{$mensaje}", "aml.{$mailD}");
         if ($this->mForceRegRiesgo == true) {
             //Agregar el riesgo
             $xAlert = new cAMLAlertas($id_de_alerta);
             $regFecha = $xF->getFechaByInt($fecha);
             $xAlert->setConfirmaAlerta($mensaje, $regFecha);
             $this->mMessages .= $xAlert->getMessages();
             //$xPAML		= new cAMLPersonas($PersonaDeOrigen);
             //$xPAML->setAgregarPerfilDeRiesgo($TipoDeAlerta, $fecha, $valorDeterminado, $documento, $tipo_de_docto, $PersonaDeDestino, $hora, $tercero_relacionado, $mensaje );
             //$this->mMessages	.= $xPAML->getMessages();
         }
     }
     return $resultado;
 }
 //tab4
 // Tabla de Relacion Patrimonial
 $xHTabs->addTab("TR.PATRIMONIO", "");
 //tab5?
 //=======================================================================
 $cnt = "";
 $xB = new cBases();
 $mems = $xSoc->getEsPersonaFisica() == true ? $xB->getMembers_InArray(false, BASE_DOCTOS_PERSONAS_FISICAS) : $xB->getMembers_InArray(false, BASE_DOCTOS_PERSONAS_MORALES);
 $rsDocs = $ql->getDataRecord($xql->getListadoDePersonasDoctos($idsocio));
 $xTbl = new cHTabla();
 foreach ($rsDocs as $rows) {
     $iddocto = $rows["archivo_de_documento"];
     $fecha = $xF->getFechaByInt($rows["fecha_de_carga"]);
     $xTbl->initRow();
     $xTbl->addTD($rows["tipo"]);
     $xTbl->addTD($xF->getFechaCorta($fecha));
     $xTbl->addTD($xBtn->getBasic($rows["archivo_de_documento"], "var xPers = new PersGen();xPers.getDocumento({persona:{$idsocio}, docto: '" . $rows["archivo_de_documento"] . "'});", $oFrm->ic()->TIPO));
     $xTbl->addTD($rows["observaciones"]);
     $xTbl->endRow();
 }
 $xHTabs->addTab("TR.DOCUMENTOS", $xTbl->get());
 //tabs
 if (getEsModuloMostrado(USUARIO_TIPO_OFICIAL_AML) == true) {
     $xDiv3 = new cHDiv("tx1", "msgcumplimiento");
     $oFrm->addToolbar($xBtn->getBasic("TR.validar documentos", "jsaValidarDocumentacion()", "documentos", "idvalidadoc", false));
     $oFrm->addToolbar($xBtn->getBasic("TR.validar perfil_transaccional", "jsaValidarPerfilT()", "perfil", "validaperfil", false));
     $oFrm->addToolbar($xBtn->getBasic("TR.validar riesgo", "jsaValidarRiesgo()", "riesgo", "validariesgo", false));
     $oFrm->addToolbar($xBtn->getBasic("TR.Actualizar Nivel de Riesgo", "jsActualizarNivelDeRiesgo({$idsocio})", "riesgo", "actualizarriesgo", false));
     $oFrm->OButton("TR.ARBOL_DE_RELACIONES", "jsSigmaRelaciones()", $oFrm->ic()->EXPORTAR);
     $oFrm->OButton("TR.Consulta en LISTA_NEGRA", "var xAML = new AmlGen(); xAML.getConsultaListaNegra({$idsocio})", $oFrm->ic()->REGISTROS);
     $xHTabs->addTab("TR.cumplimiento", $xDiv3->get());
 function getDescripcion()
 {
     $xF = new cFecha(0);
     if ($this->mReciboIniciado == false) {
         $this->init();
     }
     $xSoc = new cSocio($this->mSocio);
     $xSoc->init();
     $desc = $this->mCodigoDeRecibo . "|" . $xF->getFechaCorta($this->mFechaDeOperacion) . "|" . $xSoc->getNombreCompleto();
     return $desc;
 }
 function getFicha($fieldset = false, $trTool = "", $extendido = false)
 {
     $Dcta = $this->getDatosInArray();
     $xF = new cFecha();
     $xLi = new cSQLListas();
     $xQL = new MQL();
     $rw = $Dcta;
     $cuenta = $rw["numero_cuenta"];
     $modalidad = $rw["tipo"];
     $FApertura = getFechaMX($rw["fecha_apertura"]);
     $tasa = $rw["tasa_otorgada"];
     $producto = $rw["subproducto"];
     $saldo = $rw["saldo_cuenta"];
     $mancomunantes = $this->mNombreMancomunados;
     $observaciones = $rw["observaciones"];
     $tool = $trTool;
     $thead = "";
     $xL = new cLang();
     if ($extendido == true) {
         $xSoc = new cSocio($this->getClaveDePersona());
         $xSoc->init();
         $nombrepersona = $xSoc->getNombreCompleto();
         $thead .= "<tr><th  class='izq'>" . $xL->getT("TR.nombre completo") . "</th>";
         $thead .= "<td colspan='3'>{$nombrepersona}</td><tr>";
     }
     //eOperations		= false;
     if (trim($mancomunantes) == "") {
     } else {
         $tool .= "<tr><th>" . $xL->getT("TR.Mancomunados") . "</th><td colspan='3'>{$mancomunantes}</td><tr>";
     }
     //Obtener Mancomunantes
     /*$SQLMan			= $xLi->getListadoDeRelaciones($this->getClaveDePersona(), $this->getNumeroDeCuenta(), PERSONAS_REL_MANCOMUNADO );
     		$rsMan				= $xQL->getDataRecord($SQLMan);
     		if($xQL->getNumberOfRows() > 0){
     			$tool			.= "<tr><th colspan='4'>" . $xL->getT("TR.Mancomunados") . "</th><tr>";
     			foreach ($rsMan as $rowM){
     				//$idmanco	= 
     				$tool		.= "<tr>";
     				$tool		.= "<td>";
     				$tool		.= "</tr>";
     			}
     		}*/
     if ($this->mTipoDeCuenta == CAPTACION_TIPO_PLAZO) {
         $thead = $thead == "" ? "" : "<thead>{$thead}</thead>";
         $exoFicha = "\n\t\t\t\t<table id='ficha-captacion'>\n\t\t\t\t\t{$thead}\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.clave_de_cuenta") . "</th>\n\t\t\t\t\t<td>" . $this->mNumeroCuenta . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.Producto") . "</th>\n\t\t\t\t\t<td>" . $Dcta["subproducto"] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.Fecha de Operacion") . "</th>\n\t\t\t\t\t<td>" . $xF->getFechaCorta($Dcta["apertura"]) . "</td>\n\t\t\t\t\t<th class='izq'>Fecha de Vencimiento</th>\n\t\t\t\t\t<td>" . $xF->getFechaCorta($Dcta["vencimiento"]) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.tasa actual") . "</th>\n\t\t\t\t\t<td class='mny'> %  " . $Dcta["tasa"] * 100 . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.dias de Inversion") . "</th>\n\t\t\t\t\t<td class='mny'>" . $Dcta["dias"] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.saldo") . "</th><td class='mny'>" . getFMoney($Dcta["saldo"]) . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.observaciones") . "</th><td>" . $Dcta["observaciones"] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$tool}\n\t\t\t\t</tbody>\n\t\t\t\t</table>";
     } elseif ($this->mTipoDeCuenta == CAPTACION_TIPO_VISTA) {
         $thead = $thead == "" ? "" : "<thead>{$thead}</thead>";
         $exoFicha = "\n\t\t\t\t<table id='ficha-captacion'>\n\t\t\t\t{$thead}\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.clave_de_cuenta") . "</th><td>{$cuenta}</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.Fecha de Registro") . "</th><td>" . $xF->getFechaCorta($FApertura) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.tipo") . "</th><td>{$modalidad}</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.producto") . "</th><td>{$producto}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.tasa") . "</th><td class='mny'>% " . getFMoney($tasa * 100) . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.saldo") . "</th><td class='mny'>" . getFMoney($saldo) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.notas") . "</th><td colspan='3'>{$observaciones}</td>\n\t\t\t\t</tr>\n\t\t\t\t{$tool}\n\t\t\t\t</tbody>\n\t\t\t\t</table>";
     } else {
     }
     if ($fieldset == true) {
         $exoFicha = "<fieldset>\n\t\t\t\t\t\t\t\t<legend>&nbsp;&nbsp;" . $xL->getT("TR.Ficha de datos") . "&nbsp;&nbsp;</legend>\n\t\t\t\t\t\t\t\t{$exoFicha}\n\t\t\t\t\t\t\t</fieldset>";
     }
     return $exoFicha;
 }
$tfIVA = "<th class='mny'>" . getFMoney($SUMIva) . "</th>";
if ($SUMAh == 0) {
    $thAhorro = "";
    $tfAhorro = "";
}
if ($SUMOtros == 0) {
    $thOtros = "";
    $tfOtros = "";
}
if ($SUMIva == 0) {
    $thIVA = "";
    $tfIVA = 0;
}
foreach ($arrLetras as $parcial => $dat) {
    $txt = "<tr><th>" . $parcial . "</th>";
    $txt .= isset($dat[SYS_FECHA]) ? "<td>" . $xF->getDayName($dat[SYS_FECHA]) . "|" . $xF->getFechaCorta($dat[SYS_FECHA]) . "</td>" : "<td />";
    $txt .= isset($dat[SYS_CAPITAL]) ? "<td class='mny'>" . getFMoney($dat[SYS_CAPITAL]) . "</td>" : "<td />";
    $txt .= isset($dat[SYS_INTERES_NORMAL]) ? "<td class='mny'>" . getFMoney($dat[SYS_INTERES_NORMAL]) . "</td>" : "<td />";
    $txt .= isset($dat[SYS_GASTOS_DE_COBRANZA]) ? "<td class='mny'>" . getFMoney($dat[SYS_GASTOS_DE_COBRANZA]) . "</td>" : "";
    $txt .= isset($dat[SYS_IMPUESTOS]) ? "<td class='mny'>" . getFMoney($dat[SYS_IMPUESTOS]) . "</td>" : "";
    $txt .= isset($dat[SYS_AHORRO]) ? "<td class='mny'>" . getFMoney($dat[SYS_AHORRO]) . "</td>" : "";
    $txt .= "<td class='mny'>" . getFMoney($dat[SYS_TOTAL]) . "</td>";
    $netoNivel -= $dat[SYS_TOTAL];
    $txt .= "<th class='mny'>" . getFMoney($netoNivel) . "</th>";
    $txt .= "<tr>";
    $tmpcap = isset($dat[SYS_CAPITAL]) ? $dat[SYS_CAPITAL] : 0;
    if (setNoMenorQueCero($tmpcap) > 0 or $pagoactual == 0 or $xCred->getPagosSinCapital() == true) {
        $trs .= $txt;
    }
}
//<th>" . $xHP->lang("dia") . "</th>
function getFechaCorta($dateme = false)
{
    $xF = new cFecha(0, $dateme);
    $comp = $xF->getFechaCorta();
    return $comp;
}
$producto = parametro("producto", $producto);
$empresa = parametro("empresa", SYS_TODAS);
$out = parametro("out", SYS_DEFAULT);
$FechaInicial = parametro("on", false);
$FechaInicial = parametro("fecha-0", $FechaInicial);
$FechaInicial = $FechaInicial == false ? FECHA_INICIO_OPERACIONES_SISTEMA : $xF->getFechaISO($FechaInicial);
$FechaFinal = parametro("off", false);
$FechaFinal = parametro("fecha-1", $FechaFinal);
$FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal);
$jsEvent = $out != OUT_EXCEL ? "initComponents()" : "";
$senders = getEmails($_REQUEST);
$ByConvenio = $producto == SYS_TODAS ? "" : " AND (`creditos_tipoconvenio`.`tipo_en_sistema` = {$producto} ) ";
$sql = $xL->getListadoDeLetrasConCreditos($FechaFinal, false, "", "", $ByConvenio);
$titulo = $xHP->getTitle();
$archivo = "";
$xRPT = new cReportes($titulo . "-" . $xF->getFechaCorta($FechaFinal));
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
//============ REPORTE " AND (`creditos_tipoconvenio`.`tipo_en_sistema` =" . CREDITO_PRODUCTO_INDIVIDUAL . ") "
$xT = new cTabla($sql, 2);
$xT->setTipoSalida($out);
$xRPT->addContent($xRPT->getEncabezado("", $FechaInicial, $FechaFinal));
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
$xRPT->addContent($xT->Show($xRPT->getTitle()));
$xRPT->setBodyMail($xHP->getTitle());
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
//$xRPT->addContent( $xHP->end() );
$xRPT->setTitle($xHP->getTitle());
?>
</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>Preparado por:</td>
			<td><?php 
echo $oficial;
?>
</td>
		</tr>
		<tr>
			<td></td>
			<td>Fechas</td>
			<td><?php 
echo $xF->getFechaCorta($fechaInicial) . " AL " . $xF->getFechaCorta($fechaFinal);
?>
</td>
		</tr>
		<tr>
			<td />
			<td>Base</td>
			<td ><?php 
echo $nombreBase;
?>
</td>
		</tr>
	</thead>
</table>
<?php 
$xD = new cFecha();
 function getFicha()
 {
     $xL = new cLang();
     $xF = new cFecha();
     $xTipo = $this->OTipoPoliza()->nombre_del_diario()->v();
     $table = "<table>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>" . $xL->get("fecha") . "</th><td>" . $xF->getFechaCorta($this->mFechaPoliza) . "</td>\n\t\t\t\t\t\t<th>" . $xL->get("tipo") . "</th><td>" . $xTipo . "</td>\n\t\t\t\t\t\t<th>" . $xL->get("numero") . "</th><td>" . $this->mNumeroDePoliza . "</td>\n\t\t\t\t\t\t<th>" . $xL->get("concepto") . "</th><td>" . $this->mConceptoPoliza . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>";
     return $table;
 }
$ql->setRawQuery("CALL `sp_clonar_actividades` ");
$ql->setRawQuery("CALL `proc_perfil_egresos_por_persona` ");
$ql->setRawQuery("CALL `proc_creditos_letras_pendientes` ");
//
//Limpiar el Cache
//$xSys->setPowerOff();
//apagar el sistema
$xCache = new cCache();
$xCache->clean();
if ($parser != false) {
    $log = $aliasFil;
    $xPage = new cHPage("TR.Cierre del Dia", HP_FORM);
    $xBtn = new cHButton("iact");
    $oFRM = new cHForm("frmSubmit", "");
    $oFRM->setElementByLine(2);
    $oFRM->setTitle($xPage->getTitle() . " " . $xF->getFechaCorta());
    echo $xPage->getHeader();
    echo $xPage->setBodyinit();
    $oFRM->addHTML("<a href=\"../utils/download.php?type=txt&download={$log}&file={$log}\" target=\"_blank\" class='button'>Descargar Archivo de EVENTOS DEL SISTEMA</a><br /><br />");
    $log = getSucursal() . "-eventos-al-cierre-de-colocacion-del-dia-{$fechaop}";
    $oFRM->addHTML("<a href=\"../utils/download.php?type=txt&download={$log}&file={$log}\" target=\"_blank\" class='button'>Descargar Archivo de EVENTOS de CIERRE DE COLOCACION</a><br /><br />");
    if (MODULO_SEGUIMIENTO_ACTIVADO == true) {
        $log = getSucursal() . "-eventos-al-cierre-de-seguimiento-del-dia-{$fechaop}";
        $oFRM->addHTML("<a href=\"../utils/download.php?type=txt&download={$log}&file={$log}\" target=\"_blank\" class='button'>Descargar Archivo de EVENTOS de CIERRE DE SEGUIMIENTO</a><br /><br />");
    }
    if (MODULO_CONTABILIDAD_ACTIVADO == true) {
        $log = getSucursal() . "-eventos-al-cierre-de-contabilidad-del-dia-{$fechaop}";
        $oFRM->addHTML("<a href=\"../utils/download.php?type=txt&download={$log}&file={$log}\" target=\"_blank\" class='button'>Descargar Archivo de EVENTOS de CIERRE DE CONTABILIDAD</a><br /><br />");
    }
    if (MODULO_CAPTACION_ACTIVADO == true) {
        $log = getSucursal() . "-eventos-al-cierre-de-captacion-del-dia-{$fechaop}";
 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);
 }
    $WhereTipos = "";
}
$exoTbl = "";
$NetoCargos = 0;
$NetoAbonos = 0;
$xT = new cTipos();
$xFe = new cFecha(0);
$SQL_poliza = "SELECT\n\t`contable_polizas`.`fecha`,\n\t`contable_polizasdiarios`.`nombre_del_diario`,\n\t`contable_polizas`.`numeropoliza`,\n\t`contable_polizas`.`concepto`,\n\t`contable_polizas`.`cargos`,\n\t`contable_polizas`.`abonos`,\n\t`contable_polizas`.`tipopoliza`,\n\t`contable_polizas`.`ejercicio`,\n\t`contable_polizas`.`periodo`\nFROM\n\t`contable_polizas` `contable_polizas` \n\t\tINNER JOIN `contable_polizasdiarios` \n\t\t`contable_polizasdiarios` \n\t\tON `contable_polizas`.`tipopoliza` = \n\t\t`contable_polizasdiarios`.`idcontable_polizadiarios`\n\t\t\n\t\tWHERE `contable_polizas`.`numeropoliza` != 0 \n\t\t{$ByCodigo}\n\t\t{$ByFecha}\n\t\t{$ByFolio}\n\n\t\t{$WhereTipos}\n\nORDER BY\n\t`contable_polizas`.`ejercicio`,\n\t`contable_polizas`.`periodo`,\n\t`contable_polizas`.`tipopoliza`,\n\t`contable_polizas`.`numeropoliza`\n\t";
//exit( $SQL_poliza );
$rsPol = $ql->getDataRecord($SQL_poliza);
foreach ($rsPol as $rwPol) {
    $ejercicio = $rwPol["ejercicio"];
    $periodo = $rwPol["periodo"];
    $TPoliza = $rwPol["tipopoliza"];
    $NPoliza = $rwPol["numeropoliza"];
    $FPoliza = $xFe->getFechaCorta($rwPol["fecha"]);
    $CPoliza = $rwPol["concepto"];
    $TCargos = $rwPol["cargos"];
    $TAbonos = $rwPol["abonos"];
    $NTPoliza = $rwPol["nombre_del_diario"];
    $exoTD = "";
    $exoPol = "\n\t\t<tr>\n\t\t\t<td>{$FPoliza}</td>\n\t\t\t<td class='cwarn'>{$NTPoliza}</td>\n\t\t\t<td class='mny'>{$NPoliza}</td>\n\t\t\t<td >{$CPoliza}</td>\n\t\t\t<td ></td>\n\t\t\t<td ></td>\n\t\t</tr>\n\t\t";
    switch ($mostrar_como) {
        case "detalle":
            $SQL_mvtos = "SELECT\n\t\t`contable_movimientos`.`numeromovimiento`,\n\t\t`contable_movimientos`.`referencia`,\n\t\t`contable_movimientos`.`numerocuenta`,\n\t\t`contable_catalogo`.`nombre`,\n\t\t`contable_movimientos`.`concepto`,\n\t\t`contable_movimientos`.`cargo`,\n\t\t`contable_movimientos`.`abono` \n\t\tFROM\n\t`contable_movimientos` `contable_movimientos` \n\t\tINNER JOIN `contable_catalogo` `contable_catalogo` \n\t\tON `contable_movimientos`.`numerocuenta` = \n\t\t`contable_catalogo`.`numero`\n\t\t\n\t\tWHERE\n\t\t\t(`contable_movimientos`.`ejercicio` ={$ejercicio}) AND\n\t\t\t(`contable_movimientos`.`periodo` ={$periodo}) AND\n\t\t\t(`contable_movimientos`.`tipopoliza` ={$TPoliza}) AND\n\t\t\t(`contable_movimientos`.`numeropoliza` ={$NPoliza}) \n\t\t";
            $exoTMP = "";
            $rsMvtos = $ql->getDataRecord($SQL_mvtos);
            foreach ($rsMvtos as $rwMov) {
                $MCargo = "";
                $MAbono = "";
                if ($rwMov["cargo"] != 0) {