<?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
//====================================================================================================
$xHP = new cHPage("TR.Creditos del Sistema");
$xDiv = new cHDiv();
$xHP->init();
$xFRM = new cHForm("frm", "./");
$msg = "";
$xFRM->addDivSolo('<img src="../images/banner-safe.png" />');
$xFRM->addHTML("<h3>AUTOR</h3>");
$xFRM->addHTML("<h5>Balam Gonzalez Luis Humberto 2005-2014</h5>");
$xUl2 = new cHUl();
$xUl2->li('<a href="http://www.opencorebanking.com/">P&aacute;gina del Proyecto : www.opencorebanking.com</a>');
$xUl2->li('<a href="http://sourceforge.net/projects/safemicrofin/"> Hosting del Proyecto :  SourceForge</a>');
//$xUl2->li('Blog del Proyecto <a href="http://sourceforge.net/apps/wordpress/safemicrofin/">Hospedado en SourceForge</a>');
//$xFRM->addHTML( $xUl2->li('<a href="http://wiki.opencorebanking.com/">Wiki del Proyecto Hospedado en www.opencorebanking.com</a>')->end());
//$xFRM->addDivSolo("")
$xFRM->addHTML("<h3>FINANCIAMIENTO</h3>");
<?php

//=====================================================================================================
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
$permiso = getSIPAKALPermissions(__FILE__);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$iduser = $_SESSION["log_id"];
//=====================================================================================================
include_once "../core/entidad.datos.php";
include_once "../core/core.deprecated.inc.php";
include_once "../core/core.fechas.inc.php";
include_once "../libs/sql.inc.php";
include_once "../core/core.config.inc.php";
$fecha_inicial = $_GET["on"];
$fecha_final = $_GET["off"];
$input = $_GET["out"];
if (!$input) {
    $input = "default";
}
include_once "../reports/PHPReportMaker.php";
$sql_set = "SELECT socios_general.codigo, CONCAT(socios_general.nombrecompleto, ' ', socios_general.apellidopaterno, ' ', socios_general.apellidomaterno) AS 'nombre_completo', \r\n\tcaptacion_cuentas.numero_cuenta AS 'numero_de_cuenta',  captacion_cuentas.fecha_apertura AS 'fecha_de_apertura',\r\n\tcaptacion_cuentastipos.descripcion_cuentastipos AS 'tipo_de_cuenta' , captacion_cuentas.saldo_cuenta AS 'saldo_actual', \r\n\tcaptacion_cuentas.inversion_fecha_vcto AS 'proximo_vencimiento', captacion_cuentas.tasa_otorgada, captacion_cuentas.dias_invertidos\r\n\tAS 'numero_de_dias', captacion_cuentas.observacion_cuenta AS 'observaciones', operaciones_mvtos.fecha_afectacion AS 'fecha_de_operacion', \r\n\toperaciones_tipos.descripcion_operacion AS 'tipo_de_operacion', operaciones_mvtos.afectacion_real AS 'monto', operaciones_mvtos.saldo_anterior, \r\n\toperaciones_mvtos.saldo_actual FROM socios_general, captacion_cuentas, operaciones_mvtos, captacion_cuentastipos,  operaciones_tipos \r\n\tWHERE captacion_cuentas.tipo_cuenta=20 and captacion_cuentas.saldo_cuenta>0 and captacion_cuentas.numero_socio=socios_general.codigo \r\n\tAND operaciones_mvtos.docto_afectado=captacion_cuentas.numero_cuenta AND operaciones_mvtos.tipo_operacion=operaciones_tipos.idoperaciones_tipos\r\n\tAND captacion_cuentas.tipo_cuenta=captacion_cuentastipos.idcaptacion_cuentastipos\r\n\tAND operaciones_mvtos.fecha_afectacion>='{$fecha_inicial}' AND operaciones_mvtos.fecha_afectacion<='{$fecha_final}'\r\n\tORDER BY socios_general.codigo,captacion_cuentas.numero_cuenta,  operaciones_mvtos.fecha_afectacion";
//exit($sql_set);
if ($input != OUT_EXCEL) {
    $oRpt = new PHPReportMaker();
    $oRpt->setDatabase(MY_DB_IN);
    $oRpt->setUser(RPT_USR_DB);
    $oRpt->setPassword(RPT_PWD_DB);
    $oRpt->setSQL($sql_set);