$AppByFechas = parametro("v73", false, MQL_BOOL);
//Boolean por fechas
$fecha_inicial = $_GET["on"];
$fecha_final = $_GET["off"];
$out = parametro("out", SYS_DEFAULT);
$es_por_fechas = "";
$xHT = new cHTabla();
//ini_set("display_errors", "on");
$xCuenta = new cCuentaInversionPlazoFijo($cuenta);
$xCuenta->init();
$saldo = $xCuenta->getSaldoActual();
$xRPT = new cReportes();
$persona = $xCuenta->getClaveDePersona();
$xSoc = new cSocio($persona);
$xSoc->init();
$xRPT->setTitle($xHP->getTitle(), true);
$xRPT->addContent($xSoc->getFicha());
$xRPT->addContent($xCuenta->getFicha(true, "", true));
//Datos de la Cuenta
$sqlMvtos = "SELECT\n\t\t\t`operaciones_mvtos`.*,\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\t`eacp_config_bases_de_integracion_miembros`.`afectacion`\n\t\t\tFROM\n\t\t\t`operaciones_mvtos` `operaciones_mvtos`\n\t\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros`\n\t\t\t\t`eacp_config_bases_de_integracion_miembros`\n\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` =\n\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro`\n\t\t\tWHERE\n\t\t\t(`operaciones_mvtos`.`docto_afectado` =" . $cuenta . ") AND\n\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` = 3200)\n\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_afectacion`,\n\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`afectacion` DESC\n\t\t\t";
$xHT->initRow();
$xHT->addTH("TR.Fecha");
$xHT->addTH("TR.Recibo");
$xHT->addTH("TR.Operacion");
$xHT->addTH("TR.Deposito");
$xHT->addTH("TR.Retiro");
$xHT->addTH("TR.Inversion");
$xHT->addTH("TR.Saldo");
$xHT->addTH("TR.Notas");
$xHT->endRow();
$rsmvto = $xQl->getDataRecord($sqlMvtos);
$mx = isset($_GET["mx"]) ? true : false;
if ($mx == true) {
    $fechaInicial = isset($_GET["on"]) ? $xF->getFechaISO($_GET["on"]) : FECHA_INICIO_OPERACIONES_SISTEMA;
    $fechaFinal = isset($_GET["off"]) ? $xF->getFechaISO($_GET["off"]) : fechasys();
} else {
    $fechaInicial = isset($_GET["on"]) ? $_GET["on"] : FECHA_INICIO_OPERACIONES_SISTEMA;
    $fechaFinal = isset($_GET["off"]) ? $_GET["off"] : fechasys();
}
$ByConvenio = $convenio == SYS_TODAS ? "" : " AND\t(`listado_de_ingresos`.`producto` ={$convenio}) ";
$ByEmpresa = $empresa == SYS_TODAS ? "" : " AND (`listado_de_ingresos`.`clave_empresa` = {$empresa}) ";
$ByFecha = "";
echo $xHP->getHeader();
echo $xHP->setBodyinit("initComponents();");
echo getRawHeader();
$xRpt = new cReportes();
echo $xRpt->getEncabezado($xHP->getTitle(), $fechaInicial, $fechaFinal, $oficial);
$sql = "SELECT * FROM listado_de_ingresos WHERE (`listado_de_ingresos`.`fecha` >='{$fechaInicial}')\r\nAND (`listado_de_ingresos`.`fecha` <='{$fechaFinal}') {$ByConvenio} {$ByEmpresa}\r\nAND tipo_de_pago !='" . TESORERIA_COBRO_NINGUNO . "'\r\n";
//echo $sql;
$xTBL = new cTabla($sql);
$xTBL->setTdClassByType();
$xTBL->setFootSum(array(9 => "capital", 10 => "interes_normal", 11 => "interes_moratorio", 12 => "iva", 13 => "otros"));
echo $xTBL->Show();
echo getRawFooter();
echo $xHP->setBodyEnd();
?>
<script language="javascript">
<?php 
?>
function initComponents(){
	window.print();
}
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $x = $xSoc->getIDExPagarByPeriodo(false, $monto, $tipo_de_pago);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idide", $x));
    return $tab->getString();
}
$jxc->exportFunction('jsaGetIDE', array('idsocio', "idmonto", "idtipo_pago"));
$jxc->process();
echo $xHP->getHeader();
$xFRM = new cHForm("depositoahorro", "frmdepositoinversion.php?action=next");
$xBtn = new cHButton();
$xTxt = new cHText();
$xDate = new cHDate();
$xSel = new cHSelect();
$xFRM->setTitle($xHP->getTitle());
?>
<body <?php 
echo $actload;
?>
 >
<?php 
$xFRM->setTitle($xHP->getTitle());
if ($action == SYS_NINGUNO) {
    $xFRM->addCuentaCaptacionBasico(true, CAPTACION_TIPO_PLAZO);
    $xFRM->addSubmit();
    $xFRM->addHElem($xTxt->getDeMoneda("idmonto", "TR.deposito", 0, true));
    $xFRM->addCobroBasico();
    $xFRM->addHElem($xDate->get("TR.Fecha"));
    $xFRM->addObservaciones();
    $xFRM->addJsBasico(iDE_CAPTACION, CAPTACION_TIPO_PLAZO);
$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);
$sql = "SELECT\r\n\t`operaciones_recibos`.`numero_socio`                      AS `persona`,\r\n\t`operaciones_recibos`.`fecha_operacion`                   AS `fecha`,\r\n\t`operaciones_recibostipo`.`descripcion_recibostipo`       AS `tipo`,\r\n\t`operaciones_recibos`.`docto_afectado`                   AS `documento`,\r\n\t`personas_perfil_transaccional_tipos`.`nombre_del_perfil` AS `origen`,\r\n\t`operaciones_recibos`.`idoperaciones_recibos`\t          AS `recibo`,\r\n\t`operaciones_recibos`.`total_operacion`                   AS `monto`,\r\n\t\r\n\t`operaciones_recibos`.`idusuario`                         AS `usuario`,\r\n\t`operaciones_recibos`.`observacion_recibo`                AS `observaciones`,\r\n\t`operaciones_recibos`.`tipo_pago`                         AS `forma_de_pago`,\r\n\t`operaciones_recibos`.`clave_de_moneda`                   AS `moneda`,\r\n\t`operaciones_recibos`.`unidades_en_moneda`                AS `unidades`,\r\n\tIF(UPPER(`operaciones_recibos`.`clave_de_moneda`) != getMonedaLocal(), getEquivalenciaDeMonedas(`operaciones_recibos`.`unidades_en_moneda`, `operaciones_recibos`.`clave_de_moneda`),\r\n\t`operaciones_recibos`.`total_operacion`)\r\n\t                AS `equivalencia`\r\nFROM\r\n\t`operaciones_recibos` `operaciones_recibos` \r\n\t\tINNER JOIN `operaciones_recibostipo` `operaciones_recibostipo` \r\n\t\tON `operaciones_recibos`.`tipo_docto` = `operaciones_recibostipo`.\r\n\t\t`idoperaciones_recibostipo` \r\n\t\t\tINNER JOIN `personas_perfil_transaccional_tipos` \r\n\t\t\t`personas_perfil_transaccional_tipos` \r\n\t\t\tON `operaciones_recibos`.`origen_aml` = \r\n\t\t\t`personas_perfil_transaccional_tipos`.\r\n\t\t\t`idpersonas_perfil_transaccional_tipos` \r\nWHERE\r\n\t(`operaciones_recibos`.`numero_socio` ={$persona})";
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xSoc = new cSocio($persona);
$xSoc->init();
$xT = new cTabla($sql, 2);
$xT->setTipoSalida($out);
$xT->setFootSum(array(4 => "monto", 9 => "unidades", 10 => "equivalencia"));
$body = $xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
$xRPT->addContent($xSoc->getFicha(true));
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
$xRPT->addContent($xT->Show($xHP->getTitle()));
$xT = new cTabla($xL->getListadoDePerfil($persona));
$xRPT->addContent($xT->Show());
$output = !isset($_GET["out"]) ? "default" : $_GET["out"];
$idsolicitud = $_GET["pb"];
//Numero de Solicitud
$id = !isset($_GET["pa"]) ? false : $_GET["pa"];
//Numero de Socio
$f15 = !isset($_GET["f15"]) ? false : $_GET["f15"];
$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();
?>
$FechaFinal = parametro("off", false);
$FechaFinal = parametro("fecha-1", $FechaFinal);
$FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal);
$jsEvent = $out != OUT_EXCEL ? "initComponents()" : "";
$senders = getEmails($_REQUEST);
$xEmp = new cEmpresas($empresa);
$xEmp->init();
$nombre_empresa = $xEmp->getNombre();
$sql = $xL->getListadoDeIncidenciasAhorro($empresa);
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
//$xRPT->setTitle($nombre_empresa. "-". $xHP->getTitle());
//============ Reporte
$xT = new cTabla($sql, 2);
$xT->setTipoSalida($out);
$body = $xRPT->getEncabezado($nombre_empresa . "<br/>" . $xHP->getTitle());
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
$xRPT->addContent($xT->Show());
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
//$xRPT->addContent( $xHP->end() );
$xRPT->setResponse();
$xRPT->setSenders($senders);
echo $xRPT->render(true);
}
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("TR.Catalogo de Bancos", HP_GRID);
$xF = new cFecha();
$xTabla = new cBancos_entidades();
$filtro1 = "";
$filtro2 = "";
$xHP->setNoDefaultCSS();
echo $xHP->getHeader(true);
//HTML Object END
echo '<body onmouseup="SetMouseDown(false);" ><div id="onGrid">';
//Define your grid
$_SESSION["grid"]->SetDatabaseConnection(MY_DB_IN, USR_DB, PWD_DB);
//Propiedades del GRID
$mGridTitulo = $xHP->getTitle();
$mGridKeyField = $xTabla->getKey();
//Nombre del Campo Unico
$mGridKeyEdit = true;
//Es editable el Campo
$mGridTable = $xTabla->get();
//Nombre de la tabla
$mGridSQL = $xTabla->query()->getListaDeCampos();
//  "*"; //$xTabla->query()->getCampos();
$mGridWhere = "";
$mGridProp = array("idbancos_entidades" => "Clave Nacional,true,10", "nombre_de_la_entidad" => "nombre de la entidad,true,100", "rfc_de_la_entidad" => "rfc de la entidad,true,15", "pais_de_origen" => "pais de origen,true,10");
//===========================================================================================================
$_SESSION["grid"]->SetSqlSelect($mGridSQL, $mGridTable, $mGridWhere);
$_SESSION["grid"]->SetUniqueDatabaseColumn($mGridKeyField, $mGridKeyEdit);
$_SESSION["grid"]->SetTitleName($mGridTitulo);
$_SESSION["grid"]->SetEditModeAdd(true);
$xF = new cFecha();
$query = new MQL();
$estatus = parametro("estado", SYS_TODAS);
$frecuencia = parametro("periocidad", SYS_TODAS);
$producto = parametro("convenio", SYS_TODAS);
$producto = parametro("producto", $producto);
$empresa = parametro("empresa", SYS_TODAS);
$out = parametro("out", SYS_DEFAULT);
$fechaInicial = isset($_GET["on"]) ? $xF->getFechaISO($_GET["on"]) : FECHA_INICIO_OPERACIONES_SISTEMA;
$fechaFinal = isset($_GET["off"]) ? $xF->getFechaISO($_GET["off"]) : fechasys();
echo $xHP->getHeader();
$sql = "SELECT\r\n\t`personas_actividad_economica_tipos`.`clave_interna`,\r\n\t`personas_actividad_economica_tipos`.`clave_de_actividad`,\r\n\t`personas_actividad_economica_tipos`.`nombre_de_la_actividad`,\r\n\t`personas_actividad_economica_tipos`.`clasificacion`,\r\n\t`aml_risk_levels`.`nombre_del_nivel` AS `riesgo` \r\nFROM\r\n\t`aml_risk_levels` `aml_risk_levels` \r\n\t\tINNER JOIN `personas_actividad_economica_tipos` \r\n\t\t`personas_actividad_economica_tipos` \r\n\t\tON `aml_risk_levels`.`clave_de_control` = \r\n\t\t`personas_actividad_economica_tipos`.`nivel_de_riesgo` \r\n\tORDER BY\r\n\t\t`personas_actividad_economica_tipos`.`clave_de_actividad`";
if ($out == OUT_EXCEL) {
    echo $xHP->setBodyinit();
    $xls = new cHExcel();
    $xls->convertTable($sql, $xHP->getTitle());
} else {
    echo $xHP->setBodyinit("initComponents();");
    $xRPT = new cReportes();
    $xTBL = new cTabla($sql);
    echo $xRPT->getHInicial($xHP->getTitle());
    echo $xTBL->Show();
    echo $xRPT->getPie();
    ?>
	<script>
	<?php 
    ?>
	function initComponents(){ window.print();	}
	</script>
	<?php 
}
$ByMinistracion = "";
//$periodo		= $periodo + $variacion;
$observaciones = isset($_GET["o"]) ? $_GET["o"] : 0;
$xLoc = new cLocal();
$xHP->addJsFile("../js/jquery/jquery.js");
$xHP->addJsFile("../js/general.js");
$xEmp = new cEmpresas($empresa);
$xEmp->init();
$xTPer = new cPeriocidadDePago($periocidad);
$xTPer->init();
if ($xEmp->getEsPeriodoCerrado($periocidad, $periodo) == false) {
    $xHP->goToPageError(20101, $out);
}
$periodo = $xF->semana();
$bheader = "";
$title = $xHP->getTitle() . "_" . $xEmp->getNombre() . "_" . $xTPer->getNombre() . "_{$periodo}";
$xPer = $xEmp->getOPeriodo(false, false, $idnomina);
$xRPT->setTitle($title);
$xRPT->setOut($out);
$xRPT->setSenders($mails);
$xRPT->setResponse();
//if($out == OUT_EXCEL ){
//$xRPT->setOut($out);
//} else {
// $xLoc->DomicilioLocalidad() . "," . $xLoc->DomicilioEstado() . "," .
$xFMT = new cFormato($xEmp->getIDDeFormatoDeAviso());
$xFMT->setEmpresaPeriodo($empresa, $idnomina);
$xFMT->setProcesarVars();
$xRPT->addContent($xFMT->get());
$xRPT->addContent("<hr />");
//}
//encapsula el patrom
$patron = "/init=\\d*/";
if ($InitRecords > 0) {
    $mURI = preg_replace($patron, "init={$EndRecords}", $mURI);
} else {
    $mURI .= "&init={$EndRecords}";
}
//==================================================================================
/*if($unica_cuenta == 1){
	$dcta 			= getInfoCatalogo($esa_cuenta);
	$nivel 			= $dcta["digitoagrupador"];
	$dicat 			= explode("@", CAT_LEN);
	$largo 			= $dicat[$nivel];
	$pcta 			= getCuentaCompleta($esa_cuenta);
	$pcta 			= substr($pcta, 0, $largo);
	$sqlWHERE 		.= " AND `contable_catalogo`.`numero` LIKE '$pcta%' ";
}*/
$setSql = $xLi->getListadoDeCuentasContables($Cuenta, $niveles, $tipo_cuentas, $afectables, 0, $InitRecords, $EndRecords);
//setLog($setSql);
$xRPT = new cReportes();
$xRPT->setTitle($xHP->getTitle());
$xRPT->addCSSFiles("../css/catalogo.flags.css");
$xRPT->setOut($out);
$cTbl = new cTabla($setSql);
//$xRPT->addContent($xHP->init());
$xRPT->addContent($cTbl->Show("", true, "idcatalogocontable"));
$xRPT->addContent($xHP->fin());
if ($mostrarTodo == false) {
    $xRPT->setToPagination($EndRecords);
}
echo $xRPT->render(true);
$base = parametro("base", 2002);
$xB = new cEacp_config_bases_de_integracion();
$xB->setData($xB->query()->getRow("codigo_de_base={$base}"));
$nombreBase = $xB->descripcion()->v();
//$xHP->setNoDefaultCSS();
//$xHP->addCSS( CSS_REPORT_FILE );
echo $xHP->getHeader();
echo $xHP->setBodyinit("initComponents();");
echo getRawHeader();
?>
<!-- -->
<table >
	<thead>
		<tr>
			<th colspan="3" class='title'><?php 
echo $xHP->getTitle();
?>
</th>
		</tr>
<!-- DATOS GENERALES DEL REPORTE  -->
		<tr>
			<td width="20%">&nbsp;</td>
			<td width="40%">Fecha de Elaboracion:</td>
			<td width="40%"><?php 
echo fecha_larga();
?>
</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>Preparado por:</td>
<?php

//=====================================================================================================
//=====>	INICIO_H
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Reportes de Creditos");
$xHP->init();
$xChk = new cHCheckBox();
$xB = new cPanelDeReportes(iDE_CREDITO, "general_operaciones");
$xB->setTitle($xHP->getTitle());
$xB->setConOperacion();
$xB->setConRecibos();
$xB->addListadDeCuentasBancarias();
$xB->addHTML($xChk->get("TR.Omitir Estadisticos", "estadisticos"));
echo $xB->get();
echo $xB->getJs(true);
$xHP->fin();
$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}";
	  			<tr>
	  				<th class='izq'>[$counter]Monto Ministrado</th>
	  				<td class='mny'>" .  getFMoney($sumCAP) . "</td>
	  				<th class='izq'>Saldo Actual</th>
	  				<td class='mny'>" .  getFMoney($sumSDO) . "</td>
  				</tr>		
		</tr> -->
		</tr>*/
$sql = $setSql;
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xT = new cTabla($sql, 2);
$xT->setTipoSalida($out);
$body = $xRPT->getEncabezado($xHP->getTitle(), $fecha_inicial, $fecha_final);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
//$xRPT->addContent( $xT->Show( $xHP->getTitle() ) );
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
//$xRPT->addContent( $xHP->end() );
$xRPT->addContent("<table>{$TR_parent}</table>");
$xRPT->setResponse();
$xRPT->setSenders($senders);
             $adr .= $xDom->getFicha();
         }
         //$xTbl->addTH();
         //$xTbl->addTD($adr);
         $xTbl->addRaw("<tr><td colspan='3'><h1>" . $xLng->getT("TR.Direcciones") . "<h1><hr />{$adr}</td></tr>");
         //$xTbl->endRow()
         $xFld = new cHFieldset($flTitle);
         $xFld->addHElem($xTbl->get());
         $txtLst .= $xFld->get();
     }
 }
 if ($getPDF == true) {
     //base64_encode($sql)
     $xFMT = new cFormato(8801);
     $xFMT->setProcesarVars(array("variable_listado_de_cedulas" => $txtLst, "variable_item_buscado" => "{$nombre} / {$apaterno} / {$amaterno}", "variable_cadena_consulta" => ""));
     $xRPT = new cReportes($xHP->getTitle());
     $xRPT->getEncabezado($xHP->getTitle());
     if ($ret == true) {
         $xRPT->setOut(OUT_HTML);
         $xRPT->setFile("ofacs_list_");
         $xRPT->addContent($xFMT->get());
         $xRPT->render(true);
         $dompdf = new DOMPDF();
         $dompdf->load_html($xRPT->render(true));
         $dompdf->set_paper("letter", "portrait");
         $dompdf->render();
         $json["pdf"] = base64_encode($dompdf->output());
     } else {
         $xRPT->setSenders($mails);
         $xRPT->setOut(OUT_PDF);
         $xRPT->setFile("ofacs_list_");
$idrecibo = "";
$recibo_de_prestamo = "";
$idsocio = isset($_REQUEST["idsocio"]) ? $_REQUEST["idsocio"] : false;
$idsolicitud = isset($_REQUEST["idsolicitud"]) ? $_REQUEST["idsolicitud"] : false;
$idsocio = parametro("persona", $idsocio);
$idsolicitud = parametro("credito", $idsolicitud);
$idrecibo = DEFAULT_RECIBO;
echo $xHP->getHeader();
$oFrm = new cHForm("frmextrasol", "creditos.panel.frm.php");
$xJs = new jsBasicForm("frmextrasol");
//$xJs->setEstatusDeCreditos($estatus);
$xJs->setIncludeJQuery();
$mSQL = new cSQLListas();
$pathContrato = "";
$pathPagare = "";
$oFrm->setTitle($xHP->getTitle());
?>
<body>
<?php 
if (setNoMenorQueCero($idsolicitud) <= 0) {
    $idsocio = getPersonaEnSession();
    $oFrm->addCreditBasico();
    $oFrm->addSubmit();
    echo $oFrm->get();
    //echo $xJs->get();
    $idsolicitud = DEFAULT_CREDITO;
    //exit( "<p class='aviso'>AGREGUE UN NUMERO DE SOLICITUD</p></body></html>");
} else {
    $oFrm->OButton("TR.Recargar", "jsRecargar()", "refrescar", "refrescar");
    //Tabs
    $xHTabs = new cHTabs();
$BySuc = "";
//;
if ($sucursal != SYS_TODAS) {
    $BySuc = " AND creditos.`sucursal` = '{$sucursal}' ";
}
if ($fecha_inicial && $fecha_final) {
    $si_es_por_fecha = " AND operaciones_mvtos.fecha_operacion>='{$fecha_inicial}' AND operaciones_mvtos.fecha_operacion<='{$fecha_final}' ";
}
$senders = getEmails($_REQUEST);
$tipo_operacion = parametro("f711", SYS_TODAS, MQL_INT);
$tipo_operacion = parametro("operacion", $tipo_operacion, MQL_INT);
$out = parametro("out", SYS_DEFAULT);
$def_type = 110;
$sql = "SELECT creditos.convenio AS 'tipo', \n\t\t\tCOUNT(operaciones_mvtos.idoperaciones_mvtos) AS 'numero',\n\n\t\t\t\n\t\t\tSUM(operaciones_mvtos.afectacion_real) AS 'monto',\n\n\t\t\t/*SUM(creditos.monto_autorizado) AS 'monto_original',*/\n\t\t\t(SUM(operaciones_mvtos.afectacion_real) - SUM(creditos.saldo_actual)) AS 'cobros',\n\t\t\tSUM(creditos.saldo_actual) AS 'saldo_de_credito'\n\t\t\t \nFROM\n\t`operaciones_mvtos` `operaciones_mvtos` \n\t\tINNER JOIN `operaciones_recibos` `operaciones_recibos` \n\t\tON `operaciones_mvtos`.`recibo_afectado` = `operaciones_recibos`.\n\t\t`idoperaciones_recibos` \n\t\t\tINNER JOIN `creditos` `creditos` \n\t\t\tON `operaciones_mvtos`.`docto_afectado` = `creditos`.`solicitud` \nWHERE\n\t(`operaciones_recibos`.`tipo_pago` !='" . TESORERIA_COBRO_NINGUNO . "')\n\tAND (operaciones_mvtos.tipo_operacion={$def_type})\n\t{$BySuc}\n\t{$si_es_por_fecha}\nGROUP BY creditos.convenio";
$xHP->setTitle("TR.Reporte de Colocacion");
$titulo = $xHP->getTitle();
$archivo = "{$titulo}.pdf";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xT = new cTabla($sql, 2);
$xT->setTipoSalida($out);
$xT->setFootSum(array(1 => "numero", 2 => "monto", 3 => "cobros", 4 => "saldo_de_credito"));
$body = $xRPT->getEncabezado($xHP->getTitle(), $fecha_inicial, $fecha_final);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
$xRPT->addContent("<h1>" . $sucursal . "</h1>");
//$xT->setEventKey("jsGoPanel");
} else {
    if ($production == true and $errors == false and $operaciones > 0) {
        $archivo = $xLayout->getClave() . $xT->cSerial(6, $casfin) . $FechaTitulo . "." . $xT->cSerial(3, $supervisor);
        //header("Content-type: text/x-csv");
        header("Content-type: text/plain");
        //header("Content-type: application/csv");
        header("Content-Disposition: attachment; filename={$archivo}");
        echo $rpt;
        if ($definitivo == true) {
            //Guardar
            $sqlUpdate = " UPDATE `aml_risk_register` SET `estado_de_envio` = 1, `fecha_de_envio`= " . $xF->getInt() . "\n\t\t\tWHERE (SELECT `tipo_de_riesgo` FROM `aml_risk_catalog` WHERE `clave_de_control`= `aml_risk_register`.`tipo_de_riesgo`= " . AML_CLAVE_OPERACIONES_INUSUALES . "\n\t\t\tAND (getFechaByInt(`aml_risk_register`.`fecha_de_reporte`) <='{$FechaFinal}')\n\t\t\tAND (`aml_risk_register`.`estado_de_envio` =0)";
            $query->setRawQuery($sqlUpdate);
            //enviar por mail al administrador
            $xLog = new cFileLog($archivo, true);
            $xLog->setWrite($rpt);
            $xLog->setSendToMail($xHP->getTitle(), ARCHIVO_MAIL);
        }
    } else {
        $xRPT = new cReportes();
        $xRPT->setOut(OUT_HTML);
        $xRPT->addContent($xRPT->getHInicial($xHP->getTitle(), $FechaInicial, $FechaFinal));
        $arrTitulos = array();
        foreach ($Estructura as $indice => $propiedades) {
            $xCampo = new cReportes_LayoutTipos($propiedades);
            $arrTitulos[] = $xCampo->getNombre();
        }
        $xHTable->addTitles($arrTitulos);
        if ($msg != "") {
            $xRPT->addFooterBar("<h3>El reporte contiene los siguientes errores</h3>" . $msg);
        }
        $xRPT->addContent($xHTable->get());
$idsolicitud = parametro("credito", $idsolicitud, MQL_INT);
$ShowAvales = parametro("p", false, MQL_BOOL);
if ($idrecibo == false) {
    if ($idsolicitud != false) {
        $xCred = new cCredito($idsolicitud);
        $xCred->init();
        $idrecibo = $xCred->getNumeroDePlanDePagos();
        if (setNoMenorQueCero($idrecibo) > 0) {
        } else {
            exit(JS_CLOSE);
        }
    } else {
        exit(JS_CLOSE);
    }
}
$xHP->setTitle($xHP->getTitle() . " # {$idrecibo}");
echo $xHP->getHeader(true);
echo $xHP->setBodyinit("window.print()");
echo $xHP->getEncabezado();
$PlanBody = $xHP->h1() . "<hr />";
$xRec = new cReciboDeOperacion(false, false, $idrecibo);
$xRec->init();
$xSoc = $xRec->getSocio();
$xSoc->init();
$xCred = $xRec->getCredito();
$xCred->init();
$xF = new cFecha();
$idsocio = $xSoc->getCodigo();
//"numero_socio"
$idsolicitud = $xRec->getCodigoDeDocumento();
// docto_afectado
$frecuencia = parametro("periocidad", SYS_TODAS);
$producto = parametro("convenio", SYS_TODAS);
$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) );
    $NombreOtorgante = $xCR->getNombreOtorgante();
    $DomicilioDevolucion = "";
    //str_replace(",", ";",  EACP_DOMICILIO_CORTO);
    //============================== ELEMENTOS DE CONTROL
    $linea .= "{$TotalSaldosActuales}|{$TotalSaldosVencidos}|{$TotalElementosNombres}|{$TotalElementosDireccion}|{$TotalElementosEmpleo}|{$TotalElementosCuenta}|{$NombreOtorgante}|{$DomicilioDevolucion}";
    //
    if ($xSoc->getEsPersonaFisica() == true) {
        if ($toJson == true) {
            $arrLinea = explode("|", $linea);
            $jsonNew = array();
            foreach ($itemJson as $ix => $item) {
                $jsonNew[$item] = isset($arrLinea[$ix]) ? $arrLinea[$ix] : "ERORR";
            }
            $lineaJson[] = $jsonNew;
        } else {
            echo $linea . "\r\n";
        }
    } else {
        //OMITIDO
        $xLog->add("WARN\t{$idpersona}-{$idcredito}\t{$sucres}\tOmitir por ser Persona Moral " . $xSoc->getNombre() . "\r\n", $xLog->DEVELOPER);
    }
    $icnt++;
}
if (MODO_DEBUG) {
    $xFil = new cFileLog();
    $xFil->setWrite($xLog->getMessages());
    $xFil->setSendToMail($xHP->getTitle(), ADMIN_MAIL);
}
if ($toJson == true) {
    echo _json_encode($lineaJson, JSON_PRETTY_PRINT);
}
        //header("Content-type: text/x-csv");
        header("Content-type: text/plain");
        //header("Content-type: application/csv");
        header("Content-Disposition: attachment; filename={$archivo}");
        echo $rpt;
        if ($definitivo == true) {
            //Guardar
            $sqlUpdate = " UPDATE `aml_risk_register` SET `estado_de_envio` = 1, `fecha_de_envio`= " . $xF->getInt() . "\n\t\t\tWHERE (SELECT `tipo_de_riesgo` FROM `aml_risk_catalog` WHERE\n\t\t\t(`clave_de_control`= `aml_risk_register`.`tipo_de_riesgo`= " . AML_CLAVE_OPERACIONES_INTERNAS . "\n\t\t\t\tOR\n\t\t\t`clave_de_control`= `aml_risk_register`.`tipo_de_riesgo`= " . AML_CLAVE_OPERACIONES_INUSUALES . ")\n\t\t\tAND (getFechaByInt(`aml_risk_register`.`fecha_de_reporte`) <='{$FechaFinal}')\n\t\t\tAND (`aml_risk_register`.`estado_de_envio` =0)\n\t\t\tAND (`aml_risk_register`.`reporte_inmediato` =1)\t\t\t\n\t\t\t";
            $query->setRawQuery($sqlUpdate);
            //enviar por mail al administrador
            $xMail = new cNotificaciones();
            $xMail->sendMail($archivo, $rpt, ADMIN_MAIL);
        }
    } else {
        $xRPT = new cReportes();
        $xRPT->setOut(OUT_HTML);
        $xRPT->addContent($xRPT->getHInicial($xHP->getTitle(), $FechaInicial, $FechaFinal));
        $arrTitulos = array();
        foreach ($Estructura as $indice => $propiedades) {
            $xCampo = new cReportes_LayoutTipos($propiedades);
            $arrTitulos[] = $xCampo->getNombre();
        }
        $xHTable->addTitles($arrTitulos);
        if ($msg != "") {
            $xRPT->addFooterBar("<h3>El reporte contiene los siguientes errores</h3>" . $msg);
        }
        $xRPT->addContent($xHTable->get());
        $xRPT->setToPrint();
        echo $xRPT->render(true);
    }
}
$frecuencia = parametro("periocidad", SYS_TODAS);
$producto = parametro("convenio", SYS_TODAS);
$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);
$sucursal = parametro("s", SYS_TODAS);
$si_es_por_fecha = "";
$graficos = parametro("graficos", false, MQL_BOOL);
$BySuc = $sucursal == SYS_TODAS ? "" : " AND `creditos_solicitud`.`sucursal`= '{$sucursal}'";
$si_es_por_fecha = " AND fecha_ministracion>='{$FechaInicial}' AND fecha_ministracion<='{$FechaFinal}' ";
$xF->set($FechaFinal);
$ejercicio = $xF->anno();
my_query("SET @ejercicio:={$ejercicio};");
$sql = "\nSELECT\n\t`creditos_tipoconvenio`.`descripcion_tipoconvenio`   AS `convenio`,\n\tCOUNT(`creditos_saldo_mensuales`.`numero_solicitud`) AS `creditos`,\n\tSUM(`creditos_saldo_mensuales`.`enero`)      AS `enero`,\n\tSUM(`creditos_saldo_mensuales`.`febrero`)    AS `febrero`,\n\tSUM(`creditos_saldo_mensuales`.`marzo`)      AS `marzo`,\n\tSUM(`creditos_saldo_mensuales`.`abril`)      AS `abril`,\n\tSUM(`creditos_saldo_mensuales`.`mayo`)       AS `mayo`,\n\tSUM(`creditos_saldo_mensuales`.`junio`)      AS `junio`,\n\tSUM(`creditos_saldo_mensuales`.`julio`)      AS `julio`,\n\tSUM(`creditos_saldo_mensuales`.`agosto`)     AS `agosto`,\n\tSUM(`creditos_saldo_mensuales`.`septiembre`) AS `septiembre`,\n\tSUM(`creditos_saldo_mensuales`.`octubre`)    AS `octubre`,\n\tSUM(`creditos_saldo_mensuales`.`noviembre`)  AS `noviembre`,\n\tSUM(`creditos_saldo_mensuales`.`diciembre`)  AS `diciembre` \n\t\t\nFROM\n\t`creditos_saldo_mensuales` `creditos_saldo_mensuales` \n\t\tINNER JOIN `creditos_tipoconvenio` `creditos_tipoconvenio` \n\t\tON `creditos_saldo_mensuales`.`tipo_convenio` = `creditos_tipoconvenio`.\n\t\t`idcreditos_tipoconvenio`\n\tGROUP BY\n\t\t\n\t\t`creditos_saldo_mensuales`.`tipo_convenio`\n\t\t ";
$xT = new cTabla($sql);
$xT->setFootSum(array(1 => "creditos", 2 => "enero", 3 => "febrero", 4 => "marzo", 5 => "abril", 6 => "mayo", 7 => "junio", 8 => "julio", 9 => "agosto", 10 => "septiembre", 11 => "octubre", 12 => "noviembre", 13 => "diciembre"));
$xRPT->setOut($out);
$xRPT->addContent($xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal));
$xRPT->setSQL($sql);
$xT->setTipoSalida($out);
$xRPT->addContent($xT->Show());
//$xRPT->addContent("<script>setTimeout('mychart',1500);  function mychart() { $('#sqltable').visualize({type: 'bar', width: '450px'}).appendTo('body'); }</script>");
echo $xRPT->render(true);
$nivel_cuentas = parametro("nivel", SYS_TODAS, MQL_RAW);
$incluir_cuentas = parametro("estado", SYS_TODAS, MQL_RAW);
$ByCuentas = "";
$ByCuentasSaldos = "";
if ($cuenta_inicial > 0 and $cuenta_final > 0) {
    $xCtaInit = new cCuentaContableEsquema($cuenta_inicial);
    $cuenta_inicial = $xCtaInit->CUENTA;
    $ByCuentas .= " AND (`contable_catalogo`.`numero`>={$cuenta_inicial}) ";
    $xCtaFin = new cCuentaContableEsquema($cuenta_final);
    $cuenta_final = $xCtaFin->CUENTA;
    $ByCuentas .= " AND (`contable_catalogo`.`numero`<={$cuenta_final}) ";
    $ByCuentasSaldos = "  AND (`contable_movimientos`.`numerocuenta` >= {$cuenta_inicial}) AND  (`contable_movimientos`.`numerocuenta` <= {$cuenta_final}) ";
}
$FechaInicial = $xF->getDiaInicial("{$ejercicio}-{$periodo}-01");
$FechaFinal = $xF->getDiaFinal("{$ejercicio}-{$periodo}-01");
$xRPT = new cReportes($xHP->getTitle());
$xRPT->addContent($xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal));
$InitRecords = parametro("init", 0, MQL_INT);
$xRPT->addCSSFiles("../css/flags.css");
$xRPT->setOut($out);
//=================================================================================================================
//$xRPT->setToPagination($InitRecords);
/**
 * Paginacion
 * I.- Parte
 */
$rowLimit = 1500;
//4Paginas aprox
//marca el Final de los Registros
$EndRecords = $InitRecords + $rowLimit;
//captura el URI para manipularlo
$oficial = elusuario($iduser);
/**
 */
$xF = new cFecha();
$estatus = isset($_GET["estado"]) ? $_GET["estado"] : SYS_TODAS;
$frecuencia = isset($_GET["periocidad"]) ? $_GET["periocidad"] : SYS_TODAS;
$convenio = isset($_GET["convenio"]) ? $_GET["convenio"] : SYS_TODAS;
$empresa = isset($_GET["empresa"]) ? $_GET["empresa"] : SYS_TODAS;
$out = isset($_GET["out"]) ? $_GET["out"] : SYS_DEFAULT;
$fechaInicial = isset($_GET["on"]) ? $xF->getFechaISO($_GET["on"]) : FECHA_INICIO_OPERACIONES_SISTEMA;
$fechaFinal = isset($_GET["off"]) ? $xF->getFechaISO($_GET["off"]) : fechasys();
echo $xHP->getHeader();
echo $xHP->setBodyinit("initComponents();");
echo getRawHeader();
$xRPT = new cReportes();
echo $xRPT->getEncabezado($xHP->getTitle());
$sql = "SELECT * FROM personas_documentacion_tipos";
$xTBL = new cTabla($sql);
echo $xTBL->Show();
echo getRawFooter();
echo $xHP->setBodyEnd();
?>
<script>
<?php 
?>
function initComponents(){
	window.print();
}
</script>
<?php 
$xHP->end();
    $fecha_inicial = $xF->getFechaISO($_REQUEST["fechaMX"]);
    $fecha_final = $xF->getFechaISO($_REQUEST["fechaMX"]);
}
$ByDependencia = $empresa == SYS_TODAS ? "" : " AND `socios`.`iddependencia`=" . $empresa;
$ByUsuario = $cajero == SYS_TODAS ? "" : " AND operaciones_recibos.idusuario={$cajero} ";
$ByFecha = " AND (operaciones_recibos.fecha_operacion>='{$fecha_inicial}' AND operaciones_recibos.fecha_operacion<='{$fecha_final}') ";
$nombre_empresa = "";
if ($empresa != SYS_TODAS) {
    $xEmp = new cEmpresas($empresa);
    $xEmp->init();
    $nombre_empresa = $xEmp->getNombreCorto();
}
//XXX: Hacer un UNION para captacion
$setSql = "\nSELECT\n\t`operaciones_recibos`.`idoperaciones_recibos`,\n\t`operaciones_recibos`.`fecha_operacion`,\n\t`operaciones_recibos`.`docto_afectado`,\n\t`operaciones_recibos`.`numero_socio`,\n\t`socios`.`nombre`,\n\t\n\t(CASE WHEN (`creditos_solicitud`.`persona_asociada` = " . DEFAULT_EMPRESA . ")\n\tTHEN ''\n\tELSE `socios`.`dependencia` END) AS 'dependencia',\n\t\n\t`operaciones_recibos`.`tipo_docto`,\n\t`operaciones_recibostipo`.`descripcion_recibostipo` AS `tipo_de_recibo`,\n\t`operaciones_recibos`.`tipo_pago`,\n\t`operaciones_recibos`.`recibo_fiscal`,\t\n\t\n\t`operaciones_recibos`.`total_operacion`,\n\t`operaciones_recibos`.`observacion_recibo`,\n\n\t\n\t`operaciones_recibos`.`idusuario`\n\t\n\t\n\tFROM\n\t`operaciones_recibos` `operaciones_recibos` \n\t\tLEFT OUTER JOIN `creditos_solicitud` `creditos_solicitud` \n\t\tON `operaciones_recibos`.`docto_afectado` = `creditos_solicitud`.\n\t\t`numero_solicitud` \n\t\t\tINNER JOIN `operaciones_recibostipo` `operaciones_recibostipo` \n\t\t\tON `operaciones_recibos`.`tipo_docto` = `operaciones_recibostipo`.\n\t\t\t`idoperaciones_recibostipo` \n\t\t\t\tINNER JOIN `socios` `socios` \n\t\t\t\tON `operaciones_recibos`.`numero_socio` = `socios`.`codigo`\n\t\t\t\t\n\tWHERE operaciones_recibostipo.mostrar_en_corte!='0'\n\t\t\t{$ByFecha}\n\t\t\t{$ByUsuario}\n\t\t\t{$ByDependencia}\n\t\tORDER BY\n\t\t\t`operaciones_recibos`.`tipo_pago`,\n\t\t\t`operaciones_recibos`.`fecha_operacion`,\n\t\t\t`operaciones_recibos`.`tipo_docto`,\n\t\t\t`socios`.`dependencia`,\n\t\t\t`operaciones_recibos`.`idoperaciones_recibos`\n\t";
$output = $output == SYS_DEFAULT ? OUT_RXML : $output;
$xRPT = new cReportes($xHP->getTitle() . "-{$nombre_empresa}");
$xRPT->setSenders($senders);
$xRPT->setFile("report38");
$xRPT->setOut($output);
$xRPT->setSQL($setSql);
echo $xRPT->render(true);
//exit( $setSql);
/*if ($input!=OUT_EXCEL) {
	$oRpt = new PHPReportMaker();
	$oRpt->setDatabase(MY_DB_IN);
	$oRpt->setUser(RPT_USR_DB);
	$oRpt->setPassword(RPT_PWD_DB);
	$oRpt->setSQL($setSql);
	$oRpt->setXML("../repository/report38.xml");
	$oOut = $oRpt->createOutputPlugin($input);
	$oRpt->setOutputPlugin($oOut);
$jxc->exportFunction('getNombre_FechaDeMinistracion', array("ideldia1", "idelmes1", "idelanno1"), "#swFechaMin");
$jxc->exportFunction('jsaCargarDatosDeConvenio', array("idtipoconvenio"));
$jxc->process();
echo $xHP->getHeader(true);
$xFRM = new cHForm("frm", "./");
$xBtn = new cHButton();
$xTxt = new cHText();
$xDate = new cHDate();
$xSel = new cHSelect();
$xFRM->addJsBasico();
$xFRM->addPersonaBasico();
?>
<body>
<fieldset>
	<legend><?php 
echo $xHP->getTitle();
?>
</legend>
		<form name="frmsolicitud" id="frmsolicitud" action="clssolicitudcredito_v102.php" method="POST" id="idfrmsolicitud">

		<input type="hidden" name="cFechaMinistracion" id="idFechaMinistracion" />
		<input type="hidden" name="cFechaVencimiento" id="idFechaVencimiento" />

<table>
	<?php 
if (PERMITIR_EXTEMPORANEO == true) {
    echo CTRL_FECHA_EXTEMPORANEA;
}
?>
	<tr>
		<td><?php 
//$jxc = new TinyAjax();
//$jxc ->exportFunction('datos_del_pago', array('idsolicitud', 'idparcialidad'), "#iddatos_pago");
//$jxc ->process();
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
$action = parametro("action", SYS_NINGUNO);
$clave = parametro("id", null, MQL_INT);
$xHP->init();
$xFRM = new cHForm("frm", "./");
$msg = "";
//$xFRM->addJsBasico();
//$xFRM->addCreditBasico();
$xFRM->addSubmit();
$xP = new cCreditos_productos_otros_parametros();
$xGrid = new cHGrid("idotrosdatos", $xHP->getTitle());
$xGrid->addkey($xP->idcreditos_productos_otros_parametros()->get(), "false");
$xGrid->addElement($xP->clave_del_parametro()->get(), "TR.Parametro", "50%");
$xGrid->addElement($xP->valor_del_parametro()->get(), "TR.Valor", "50%");
$where = base64_encode(" `clave_del_producto`={$clave} ");
$xGrid->setListAction("../svc/datos.svc.php?out=jtable&tabla=creditos_productos_otros_parametros&w={$where}");
$xFRM->addHTML($xGrid->getDiv());
echo $xFRM->get();
echo $xGrid->getJsHeaders();
?>
<script>
$(document).ready(function () {
	<?php 
echo $xGrid->getJs(true);
?>
});
$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);
$xODat = new cPersonasCatalogoOtrosDatos();
$sql = "SELECT\r\n\t`socios`.`codigo`,\r\n\t`socios`.`nombre`,\r\n\t`socios_otros_parametros`.`clave_del_parametro` \r\nFROM\r\n\t`socios_otros_parametros` `socios_otros_parametros` \r\n\t\tINNER JOIN `socios` `socios` \r\n\t\tON `socios_otros_parametros`.`clave_de_persona` = `socios`.`codigo` \r\nWHERE\r\n\t(`socios_otros_parametros`.`clave_del_parametro` ='" . $xODat->AML_PEP_PRINCIPAL . "')\r\n\t\t\tOR\r\n\t(`socios_otros_parametros`.`clave_del_parametro` ='" . $xODat->AML_PEP_AFINIDAD . "')\t\t\t\r\n\tOR\r\n(`socios_otros_parametros`.`clave_del_parametro` ='" . $xODat->AML_PEP_CONSANGUINIDAD . "')\t\t\t\r\n\t\tOR\r\n(`socios_otros_parametros`.`clave_del_parametro` ='" . $xODat->AML_PEP_VINCULO_ECONOM . "')\t";
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xT = new cTabla($sql, 1);
$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());
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
//$xRPT->addContent( $xHP->end() );
$xRPT->setResponse();
$xRPT->setSenders($senders);
echo $xRPT->render(true);
}
if (count($mails) <= 0) {
    if (MODULO_CAJA_ACTIVADO == true) {
        if ($xF->getInt($fecha_final) > $xF->getInt(fechasys())) {
            if ($xCaja->getEstatus() == TESORERIA_CAJA_ABIERTA) {
                $xHP->goToPageError(70102);
            }
        }
    }
}
$xUsr = new cSystemUser($cajero);
$xUsr->init();
$nombre = $xUsr->getNombreCompleto();
$ByDependencia = (isset($_GET["dependencia"]) and $_GET["dependencia"] != SYS_TODAS) ? " AND `socios`.`iddependencia`=" . $_GET["dependencia"] : "";
$xRPT = new cReportes();
$title = $xHP->getTitle();
$xRPT->setTitle($title);
$xRPT->setOut($out);
$xRPT->setSenders($mails);
$bheader = $xRPT->getHInicial($xHP->getTitle(), $fecha_inicial, $fecha_final, $nombre);
$xRPT->addContent($bheader);
$xRPT->setBodyMail($bheader);
$xRPT->setResponse();
$xRPT->addContent($xCaja->getResumenDeCaja());
//setlog( $xCaja->getMessages() );
if (count($mails) > 0) {
    if ($xCaja->getSumaDeRecibos() <= 0) {
        $xRPT->setSenders(array());
        //no enviar
    }
}