$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
//$mURI					= $_SERVER['REQUEST_URI'];
            //$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_");
            $xRPT->addContent($xFMT->get());
            $xRPT->render(true);
        }
    }
} else {
$xF = new cFecha();
$ql = new MQL();
$fecha_inicial = parametro("on", $xF->getDiaInicial(), MQL_DATE);
$fecha_final = parametro("off", $xF->getDiaFinal(), MQL_DATE);
$cuenta_inicial = parametro("for", 0, MQL_INT);
$cuenta_final = parametro("to", 0, MQL_INT);
$out = parametro("out", SYS_DEFAULT, MQL_RAW);
//---------------- Valuar Tipo de Cuenta ----------------
$tipo_cuentas = parametro("tipo", SYS_TODAS, MQL_RAW);
$nivel_cuentas = parametro("nivel", SYS_TODAS, MQL_RAW);
$incluir_cuentas = parametro("estado", SYS_TODAS, MQL_RAW);
$netoCargoRpt = 0;
$netoAbonoRpt = 0;
$ByCuentas = "";
$xRPT = new cReportes($xHP->getTitle());
$xRPT->addContent($xRPT->getEncabezado($xHP->getTitle(), $fecha_inicial, $fecha_final));
$InitRecords = parametro("init", 0, MQL_INT);
$xRPT->setOut($out);
//=================================================================================================================
//$xRPT->setToPagination($InitRecords);
/**
 * Paginacion
 * I.- Parte
 */
$rowLimit = 900;
//4Paginas aprox
//marca el Final de los Registros
$EndRecords = $InitRecords + $rowLimit;
//=================================================================================================================
/**
 * Obtiene Parametros a traves de un GET
        //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);
$jsEvent = $out != OUT_EXCEL ? "initComponents()" : "";
$senders = getEmails($_REQUEST);
$sql = "SELECT * FROM socios LIMIT 0,100";
$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(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
$xCats = new cCatalogoDeDatos("");
$DActividades = $xCats->get("clave_interna", "nombre_de_la_actividad", "personas_actividad_economica_tipos");
$DGenero = $xCats->get("idsocios_genero", "descripcion_genero", "socios_genero");
$DPaises = $xCats->initPorTabla(TCATALOGOS_PAISES);
$DRiesgo = $xCats->initPorTabla(TCATALOGOS_GRADO_RIESGO);
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
$sql = $xL->getInicialDePersonas() . " WHERE (`personalidad_juridica` = 2 OR `personalidad_juridica` = 5)";
$rs = $query->getDataRecord($sql);
$xTa = new cHTabla();
$xDSoc = new cSocios_general();
$xF = new cFecha();
$xTa->initRow();
$xTa->addTH("Sucursal");
$xTa->addTH("Nombre");
	`creditos_solicitud`.`fuente_de_fondeo`,
	`creditos_solicitud`.`fecha_de_primer_pago`,
	COUNT(`operaciones_mvtos`.`tipo_operacion`) AS `operaciones`,
	MAX(`operaciones_mvtos`.`fecha_afectacion`) AS `fecha`,
	SUM(
	IF(`operaciones_mvtos`.`tipo_operacion` = 120,	`operaciones_mvtos`.`afectacion_real`, 0	)
	)  AS `abonos`
FROM
	`operaciones_mvtos` `operaciones_mvtos` 
		RIGHT OUTER JOIN `creditos_solicitud` `creditos_solicitud` 
		ON `operaciones_mvtos`.`docto_afectado` = `creditos_solicitud`.
		`numero_solicitud` 
			INNER JOIN `operaciones_recibos` `operaciones_recibos` 
			ON `operaciones_mvtos`.`recibo_afectado` = `operaciones_recibos`.
			`idoperaciones_recibos` */
$sql = "\nSELECT\n\t`creditos_solicitud`.`numero_solicitud`                  AS `contrato`,\n\t`creditos_tipoconvenio`.`descripcion_tipoconvenio`       AS `producto`,\n\t`socios`.`codigo`                                        AS `persona`,\n\t`socios`.`nombre`                                        AS `nombre`,\n\t`socios`.`alias_dependencia`                             AS `empresa`,\n\t`creditos_solicitud`.`monto_autorizado`                  AS `monto_original`\n\t,\n\t`creditos_solicitud`.`plazo_en_dias`,\n\t`creditos_solicitud`.`fecha_ministracion`                AS \n\t`fecha_de_desembolso`,\n\t`creditos_solicitud`.`tasa_interes`                      AS \n\t`tasa_de_interes`,\n\t`creditos_solicitud`.`pagos_autorizados`                 AS \n\t`numero_de_pagos`,\n\tIF(`creditos_solicitud`.`periocidad_de_pago` = " . CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO . ", 0,`creditos_solicitud`.`monto_parcialidad`)                 AS \n\t`monto_de_amortizacion`,\n\t'?' AS `tipo`,\n\t`creditos_solicitud`.`fecha_de_primer_pago`,\n\t`creditos_periocidadpagos`.`descripcion_periocidadpagos` AS `frecuencia`,\n\t`creditos_solicitud`.`ultimo_periodo_afectado`           AS \n\t`ultima_parcialidad` ,\n\tCOUNT(`operaciones_mvtos`.`tipo_operacion`) AS `operaciones`,\n\tMAX(`operaciones_mvtos`.`fecha_afectacion`) AS `fecha`,\n\tSUM(\n\tIF(`operaciones_mvtos`.`tipo_operacion` = 120,\t`operaciones_mvtos`.`afectacion_real`, 0\t)\n\t)  AS `abonos`,\n\t(`creditos_solicitud`.`monto_autorizado`  - \tSUM(\n\tIF(`operaciones_mvtos`.`tipo_operacion` = 120,\t`operaciones_mvtos`.`afectacion_real`, 0\t)\n\t)) AS 'saldo',\n\t`creditos_solicitud`.`saldo_actual` AS 'saldo_sistema'  \nFROM\n\t`creditos_solicitud` `creditos_solicitud` \n\t\tINNER JOIN `creditos_periocidadpagos` `creditos_periocidadpagos` \n\t\tON `creditos_solicitud`.`periocidad_de_pago` = \n\t\t`creditos_periocidadpagos`.`idcreditos_periocidadpagos` \n\t\t\tINNER JOIN `creditos_tipoconvenio` `creditos_tipoconvenio` \n\t\t\tON `creditos_solicitud`.`tipo_convenio` = `creditos_tipoconvenio`.\n\t\t\t`idcreditos_tipoconvenio` \n\t\t\t\tINNER JOIN `socios` `socios` \n\t\t\t\tON `creditos_solicitud`.`numero_socio` = `socios`.`codigo` \n\t\t\t\t\tRIGHT OUTER JOIN `operaciones_mvtos` `operaciones_mvtos` \n\t\t\t\t\tON `operaciones_mvtos`.`docto_afectado` = \n\t\t\t\t\t`creditos_solicitud`.`numero_solicitud`\n\t\t\t\nWHERE\n\t(\n\t(`operaciones_mvtos`.`tipo_operacion` =120) \n\tOR\n\t(`operaciones_mvtos`.`tipo_operacion` =110))\n\tAND\n\t(`operaciones_mvtos`.`fecha_afectacion` <= '{$fechaFinal}') \n\t{$ByProducto} {$BySucursal}\nGROUP BY\n\t`operaciones_mvtos`.`docto_afectado`\n\t\nHAVING saldo > 0\n\nORDER BY `creditos_solicitud`.`fecha_ministracion`\n \n";
//$sql				= "CALL sp_saldos_al_cierre('$fechaFinal')";
//exit($sql);
$xTbl = new cTabla($sql);
$xTbl->setFootSum(array(5 => "monto_original", 17 => "abonos", 18 => "saldo"));
/*$xTbl->setFootSum(array(
	3 => "monto_autorizado",
		52 => "abonos",
		53 => "saldo"
));*/
$xRPT->setSQL($xTbl->getSQL());
$xTbl->setTipoSalida($formato);
$xRPT->setOut($formato);
$xRPT->addContent($xTbl->Show());
//$xRPT->setResponse();
echo $xRPT->render(true);
 $fecha_de_vencimiento = "";
 $tasa_interes_mensual_ordinario = "";
 $tasa_garantia_liquida = "";
 $tasa_interes_mensual_moratorio = 0;
 $fecha_de_ministracion = "";
 //cargar Datos de la Empresa
 $vars = array("variable_nombre_del_socio" => $cSoc->getNombreCompleto(), "variable_nombre_de_la_sociedad" => EACP_NAME, "variable_nombre_de_la_entidad" => EACP_NAME, "variable_domicilio_del_socio" => trim(substr($cSoc->getDomicilio(), 0, 60)), "variable_documento_de_constitucion_de_la_sociedad" => EACP_DOCTO_CONSTITUCION, "variable_rfc_de_la_entidad" => EACP_RFC, "variable_rfc_del_socio" => $DSoc["rfc"], "variable_curp_del_socio" => $DSoc["curp"], "variable_nombre_del_representante_legal_de_la_sociedad" => EACP_REP_LEGAL, "variable_informacion_del_credito" => $svar_info_cred, "variable_domicilio_de_la_entidad" => EACP_DOMICILIO_CORTO, "variable_acta_notarial_de_poder_al_representante" => EACP_DOCTO_REP_LEGAL, "variable_numero_de_socio" => $numero_de_socio, "variable_tipo_de_credito" => $tipo_de_credito, "variable_monto_ministrado" => getFMoney($monto_ministrado), "variable_tasa_mensual_de_interes_ordinario" => $tasa_interes_mensual_ordinario, "variable_credito_fecha_de_vencimiento" => getFechaLarga($fecha_de_vencimiento), "variable_tasa_mensual_de_interes_moratorio" => $tasa_interes_mensual_moratorio . " %", "variable_tasa_de_garantia_liquida" => $tasa_garantia_liquida . " %", "variable_horario_de_trabajo_de_la_entidad" => EACP_HORARIO_DE_TRABAJO, "variable_testigo_del_acto" => $oficial, "variable_fecha_larga_actual" => fecha_larga(), "variable_nombre_de_presidente_de_vigilancia_de_la_entidad" => EACP_PDTE_VIGILANCIA, "variable_en_letras_monto_ministrado" => convertirletras($monto_ministrado), "variable_credito_fecha_de_ministracion" => getFechaLarga($fecha_de_ministracion), "variable_informacion_del_socio" => $ficha_socio, "variable_oficial" => $variable_oficial, "variable_lugar" => $variable_lugar, "variable_lugar_actual" => $variable_lugar, "variable_monto_inicial_en_numero" => $monto_inicial, "variable_monto_inicial_en_letras" => $monto_inicial_letras, "variable_numero_de_dias" => $numero_dias, "variable_fecha_de_vencimiento" => $variable_fecha_vencimiento, "variable_tasa_otorgada" => $variable_tasa_otorgada, "variable_nombre_empresa" => $nempresa, "variable_numero_de_pagos" => $numero_de_pagos, "variable_numero_parcialidad_actual" => $numero_parcialidad, "variable_monto_parcialidad" => getFMoney($monto_parcialidad), "variable_monto_letras_parcialidad" => convertirletras($monto_parcialidad), "variable_encabezado_de_reporte" => getRawHeader(false, $out), "variable_pie_de_reporte" => getRawFooter(false, $out), "variable_paginas" => $contar);
 if ($out == OUT_DOC) {
     $vars["<hr />"] = "";
 }
 $texto_contrato = $base_contrato;
 foreach ($vars as $key => $value) {
     $texto_contrato = str_replace($key, $value, $texto_contrato);
 }
 if ($monto_parcialidad > 0) {
     $xRPT->addContent($texto_contrato);
     $ppn++;
     if ($ppn == 2) {
         if ($out == OUT_DOC) {
         } else {
             $xRPT->addContent("<hr class='divisormedio' />\n");
         }
     }
     if ($ppn > 2) {
         if ($out == OUT_DOC) {
             $xRPT->addContent("<br clear=all style='mso-special-character:line-break;page-break-before:always'>");
         } else {
             $xRPT->addContent("\n\n<br class='npage' />\n\n");
         }
         $ppn = 1;
     }
//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);
$sdo_al_corte = 0;
	  				<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);
echo $xRPT->render(true);
//Boolean por fechas
$fecha_inicial = parametro("on", EACP_FECHA_DE_CONSTITUCION);
$fecha_final = parametro("off", $xF->getFechaMaximaOperativa());
$output = parametro("out", SYS_DEFAULT);
$es_por_fechas = "";
$xCuenta = new cCuentaALaVista($idcuenta);
$xCuenta->init();
//Datos de la Cuenta
$rwc = $xCuenta->getDatosInArray();
// datos generales del socio
$idsocio = $rwc["numero_socio"];
// Numero de Socio
$CSocio = new cSocio($idsocio);
$CSocio->init();
$mynom = $CSocio->getNombreCompleto();
$xRPT->addContent($CSocio->getFicha());
//Verifica el FORZADO de el Cuadre de Saldos
// datos de la cuenta
$tipocuenta = eltipo("captacion_cuentastipos", $rwc[4]);
$tasa = $rwc[14] * 100;
$saldo = $rwc["saldo_cuenta"];
$sdoact = number_format($rwc[9], 2, '.', ',');
$depositos = 0;
$retiros = 0;
$sdo_i = 0;
$sdo_f = 0;
/*	echo "<hr />
	<table width='100%'>
		<tr>
		<td class='ths'>Numero de cuenta</td><td>$idcuenta</td>
		<td class='ths'>Modalidad de la Cuenta</td><td>$tipocuenta</td>
    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
    }
}
echo $xRPT->render(true);
//Render Normal
$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_saldos`.`cuenta` >= {$cuenta_inicial}) AND  (`contable_saldos`.`cuenta` <= {$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
//$mURI					= $_SERVER['REQUEST_URI'];
$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");
//$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);
echo $xRPT->render(true);
$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"];
$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`tesoreria_tipos_de_pago`.`tipo_de_pago`,\r\n\t`tesoreria_tipos_de_pago`.`descripcion` \r\nFROM\r\n\t`tesoreria_tipos_de_pago` `tesoreria_tipos_de_pago`";
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xT = new cTabla($sql, 0);
$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()));
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
//$xRPT->addContent( $xHP->end() );
$xRPT->setResponse();
$xRPT->setSenders($senders);
echo $xRPT->render(true);
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xSoc2 = new cSocio($idnucleo);
$xSoc2->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);
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
$xRPT->addContent($xSoc->getFicha(true));
$xRPT->addContent($xSoc2->getFicha(true));
$xRPT->addContent($xT->Show($xHP->getTitle()));
//$xT		= new cTabla($xL->getListadoDePerfil($persona) );
//$xRPT->addContent( $xT->Show(  ) );
if (MODO_DEBUG == true) {
    $periodo_inicial = date("Ym", $xF->getInt($FechaInicial));
    $periodo_final = date("Ym", $xF->getInt($FechaFinal));
    //$xT2	= new cTabla($xL->getAMLAcumuladoDeEgresos($periodo_inicial, $periodo_final, $persona));
    //$xRPT->addContent($xT2->Show());
}
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
$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());
if (MODO_DEBUG == true) {
    $periodo_inicial = date("Ym", $xF->getInt($FechaInicial));
    $periodo_final = date("Ym", $xF->getInt($FechaFinal));
    $xT2 = new cTabla($xL->getAMLAcumuladoDeEgresos($periodo_inicial, $periodo_final, $persona));
    $xRPT->addContent($xT2->Show());
}
$xRPT->addContent("<h3>" . $xHP->lang("Mensaje") . "</h3>");
//============ Agregar HTML
//$xRPT->addContent( $xHP->init($jsEvent) );
//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);
$FechaFinal = $FechaFinal == false ? fechasys() : $xF->getFechaISO($FechaFinal);
$jsEvent = $out != OUT_EXCEL ? "initComponents()" : "";
$senders = getEmails($_REQUEST);
$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();
$body = $xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
$xRPT->addContent($xSoc->getFicha(true));
//Bajo revision
$xAl = new cAml_alerts();
$xlistas = new cSQLListas();
$sql = $xlistas->getListadoDeAlertas(false, false, false, $persona, " AND `estado_en_sistema` =" . SYS_UNO);
$xT = new cTabla($sql);
$xRPT->addContent($xT->Show("TR.Alertas pendientes de verificar"));
//Descartados
$sql = $xlistas->getListadoDeAlertas(false, false, false, $persona, " AND `estado_en_sistema` =" . SYS_CERO);
$xT = new cTabla($sql);
$xRPT->addContent($xT->Show("TR.Alertas ignoradas"));
//Riesgos para reportar
$sql = $xlistas->getListadoDeRiesgosConfirmados(false, false, false, false, $persona, " AND `estado_de_envio`= " . SYS_CERO);
$xT = new cTabla($sql);
$xRPT->addContent($xT->Show("TR.Alertas pendientes de reportar"));
$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 />");
//}
$xRPT->setBodyMail($bheader);
//filtrar domicilio -> socio -> credito -> letra
$sql = $xL->getListadoDeCobranza($idnomina);
$xRPT->setSQL($sql);
//exit($sql);
$xT = new cTabla($sql);
$xT->setTipoSalida($out);
$xT->setRowCSS("monto", "mnyres");
$xT->setColTitle("monto", "Monto de Retencion");
$xT->setKeyField("numero_solicitud");
$xT->setKeyTable("creditos_solicitud");
$xT->setTdClassByType();
$xT->setFootSum(array(3 => "letra", 6 => "monto"));
$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);
$jsEvent = $out != OUT_EXCEL ? "initComponents()" : "";
$senders = getEmails($_REQUEST);
$sql = "SELECT numero_socio, numero_solicitud FROM creditos_solicitud WHERE grupo_asociado={$grupo} LIMIT 1,10";
$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(), $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();