2019-05-27 14:46:35 +00:00
|
|
|
|
/*===========================================================================================================================
|
|
|
|
|
|
* Instituto Costarricense de Acueductos y Alcantarillados. - 2019
|
|
|
|
|
|
* Formularios para Proyectos de Inversión
|
|
|
|
|
|
* Nombre de la Pantalla: wfrFinanciamiento.aspx
|
|
|
|
|
|
*
|
|
|
|
|
|
* Explicación de los contenidos del archivo
|
|
|
|
|
|
*===========================================================================================================================
|
|
|
|
|
|
* HISTORIAL
|
|
|
|
|
|
*
|
|
|
|
|
|
* PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
|
|
|
|
|
* Esteban Gutierrez Rapso 17 – 02 - 2019 Se inicia con el diseño de la pagina
|
|
|
|
|
|
* …………………………………………………………
|
|
|
|
|
|
* …………………………………………………………
|
|
|
|
|
|
*===========================================================================================================================
|
|
|
|
|
|
* Derechos Reservados (C) 2019 AyA.
|
|
|
|
|
|
* ESTE CÓDIGO ES PROVEÍDO “TAL CUAL ES” SIN GARANTÍA ALGUNA
|
|
|
|
|
|
* DE NINGÚN TIPO, SEA IMPLICITA O EXPLICITA.
|
|
|
|
|
|
* NO SE PERMITE SU REPRODUCCIÓN PARCIAL O TOTAL, NI SU COMERCIALIZACIÓN
|
|
|
|
|
|
*===========================================================================================================================
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using AyABL;
|
|
|
|
|
|
|
|
|
|
|
|
using AyADAL;
|
|
|
|
|
|
using AyABL.RCS;
|
|
|
|
|
|
using AyABL.ADM;
|
|
|
|
|
|
using AyABL.AGP;
|
|
|
|
|
|
using AyABL.FNP;
|
|
|
|
|
|
using System.Web.UI.HtmlControls;
|
2019-06-02 05:36:32 +00:00
|
|
|
|
using AyABL.PPP;
|
2019-05-27 14:46:35 +00:00
|
|
|
|
|
|
|
|
|
|
public partial class webforms_FOR_wfrFinanciamiento : General
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Inicializar Formulario (R0)
|
|
|
|
|
|
|
|
|
|
|
|
override protected void OnInit(EventArgs e) //M0
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnInit(e);
|
|
|
|
|
|
|
|
|
|
|
|
InicializarFormulario();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R0M0", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void InicializarFormulario() //M1
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
|
|
|
|
|
construirgrvPIRecursosI();
|
|
|
|
|
|
construirgrvPIRecursosE();
|
|
|
|
|
|
construirgrvEIRecursosI();
|
|
|
|
|
|
construirgrvEIRecursosE();
|
|
|
|
|
|
construirGrvListaDetalle();
|
|
|
|
|
|
construirGrvEndeudamiento();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R0M1", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Variables (R1)
|
|
|
|
|
|
|
|
|
|
|
|
GridView grvPIRecursosITemp, grvPIRecursosETemp, grvEIRecursosITemp, grvEIRecursosETemp, grvListaDetalleTemp, grvTotalFinancimientoTemp, grvListaEndeudamientoTemp;
|
|
|
|
|
|
|
|
|
|
|
|
FuenteFinanciamientoBL objFuenteFinanciamientoBL;
|
|
|
|
|
|
RecursoBL objRecursoBL;
|
|
|
|
|
|
FinanciamientoBL objFinanciamientoBL;
|
|
|
|
|
|
EndeudamientoBL objEndeudamientoBL;
|
|
|
|
|
|
ProyectoBL objProyectoBL;
|
2019-06-02 05:36:32 +00:00
|
|
|
|
DistribucionPartidaBL objDistribucionPartidaBL;
|
2019-05-27 14:46:35 +00:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Eventos Formulario (R2)
|
|
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e) //M0
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((!IsPostBack) && (Session.Count > 0))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
objProyectoBL = new ProyectoBL();
|
|
|
|
|
|
objProyectoBL.objProyectoEL.PK = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
DataSet dsProyecto = objProyectoBL.getProyectos();
|
|
|
|
|
|
if (dsProyecto.Tables[0].Rows.Count != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
txtProyecto.Text = dsProyecto.Tables[0].Rows[0]["NOMBREPROYECTO"].ToString();
|
|
|
|
|
|
txtNumeroBPIP.Text = dsProyecto.Tables[0].Rows[0]["NUMEROBPIPPROYECTO"].ToString();
|
|
|
|
|
|
txtEstadoProyecto.Text = string.IsNullOrEmpty(dsProyecto.Tables[0].Rows[0]["NOMBREESTADO"].ToString()) ? "Sin Asignar" : dsProyecto.Tables[0].Rows[0]["NOMBREESTADO"].ToString();
|
2019-06-24 04:03:12 +00:00
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(txtNumeroBPIP.Text))
|
|
|
|
|
|
txtProyecto.ReadOnly = true;
|
2019-05-27 14:46:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
llenarGrvPIRecursosI();
|
|
|
|
|
|
llenarGRVPIRecursosE();
|
|
|
|
|
|
llenarGRVEIRecursosI();
|
|
|
|
|
|
llenarGRVEIRecursosE();
|
|
|
|
|
|
llenarGRVTotalFinanciamiento();
|
|
|
|
|
|
llenarGrvListaDetalle();
|
|
|
|
|
|
|
|
|
|
|
|
llenarDDLTipoRecurso();
|
|
|
|
|
|
llenarDDLRecurso();
|
|
|
|
|
|
llenarDDLAnio();
|
|
|
|
|
|
|
|
|
|
|
|
llenarGrvListaEndeudamiento();
|
|
|
|
|
|
llenarDDLTipoFuente();
|
|
|
|
|
|
llenarDDLFuenteFinanciamiento();
|
|
|
|
|
|
llenarDDLDesembolsoI();
|
|
|
|
|
|
llenarDDLDesembolsoF();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2019-06-02 05:36:32 +00:00
|
|
|
|
|
|
|
|
|
|
ScriptManager.RegisterStartupScript(Page, typeof(Page), "Check", "validarEstado()", true);
|
2019-05-27 14:46:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R2M0", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Eventos Controles Web (R3)
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnAnterior_Click(object sender, EventArgs e) //M0
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
Response.Redirect("wfrProyectos.aspx");
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M0", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnVerDetalle_Click(object sender, EventArgs e) //M1
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
mostrarDetalleyTabulado(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M1", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnVerTabulado_Click(object sender, EventArgs e) //M2
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
mostrarDetalleyTabulado(2);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M2", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnNuevoFN_Click(object sender, EventArgs e) //M3
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["Modo_Financiamiento"] = "Nuevo";
|
|
|
|
|
|
mostrarFilasDetalle(2);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M3", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnEliminarFN_Click(object sender, EventArgs e) //M4
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
// recorro el grid
|
|
|
|
|
|
foreach (GridViewRow row in grvListaDetalleTemp.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
|
|
|
|
if (chkTemp != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
// si el registro esta marcado
|
|
|
|
|
|
if (chkTemp.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
int intPkEliminar = Convert.ToInt32(row.Cells[2].Text);
|
|
|
|
|
|
eliminarDatosFN(intPkEliminar);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
MensajeInformativo("El registro fue eliminado");
|
|
|
|
|
|
|
|
|
|
|
|
llenarGrvListaDetalle();
|
|
|
|
|
|
llenarGrvPIRecursosI();
|
|
|
|
|
|
llenarGRVPIRecursosE();
|
|
|
|
|
|
llenarGRVEIRecursosI();
|
|
|
|
|
|
llenarGRVEIRecursosE();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M4", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void ddlTipoRecurso_SelectedIndexChanged(object sender, EventArgs e) //M5
|
|
|
|
|
|
{
|
|
|
|
|
|
llenarDDLRecurso();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnGuardarFN_Click(object sender, EventArgs e) //M6
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GuardarDatosFN())
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeInformativo("El registro fue almacenado");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("El registro no fue almacenado, verifique", null);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M6", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnAnteriorFN_Click(object sender, EventArgs e) //M7
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
mostrarFilasDetalle(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M7", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void grvListaDetalle_RowCommand(object sender, GridViewCommandEventArgs e) //M8
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.CommandName == "editar")
|
|
|
|
|
|
{
|
|
|
|
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|
|
|
|
|
GridViewRow selectedRow = grvListaDetalle.Rows[i];
|
|
|
|
|
|
ViewState["PkFinanciamiento"] = Convert.ToInt32(selectedRow.Cells[2].Text);
|
|
|
|
|
|
ViewState["Modo_Financiamiento"] = "Modifica";
|
|
|
|
|
|
|
|
|
|
|
|
mostrarFilasDetalle(2);
|
|
|
|
|
|
|
|
|
|
|
|
mostrarDatosDetalle();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M8", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void grvListaDetalle_PageIndexChanging(object sender, GridViewPageEventArgs e) //M9
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvListaDetalle.PageIndex = e.NewPageIndex;
|
|
|
|
|
|
llenarGrvListaDetalle();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error R3M9", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnNuevoED_Click(object sender, EventArgs e) //M10
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["Modo_Endeudamiento"] = "Nuevo";
|
|
|
|
|
|
mostrarFilasEndeudamiento(2);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M10", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnEliminarED_Click(object sender, EventArgs e) //M11
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
// recorro el grid
|
|
|
|
|
|
foreach (GridViewRow row in grvListaEndeudamientoTemp.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
HtmlInputCheckBox chkTemp = (HtmlInputCheckBox)row.Controls[0].Controls[1];
|
|
|
|
|
|
if (chkTemp != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
// si el registro esta marcado
|
|
|
|
|
|
if (chkTemp.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
int intPkEliminar = Convert.ToInt32(row.Cells[2].Text);
|
|
|
|
|
|
eliminarDatosED(intPkEliminar);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
MensajeInformativo("El registro fue eliminado");
|
|
|
|
|
|
|
|
|
|
|
|
llenarGrvListaEndeudamiento();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M11", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnGuardarED_Click(object sender, EventArgs e) //M12
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GuardarDatosED())
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeInformativo("El registro fue almacenado");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("El registro no fue almacenado, verifique", null);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M12", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnAnteriorED_Click(object sender, EventArgs e) //M13
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
mostrarFilasEndeudamiento(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M13", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void grvListaEndeudamiento_RowCommand(object sender, GridViewCommandEventArgs e) //M14
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.CommandName == "editar")
|
|
|
|
|
|
{
|
|
|
|
|
|
int i = Convert.ToInt32(e.CommandArgument);
|
|
|
|
|
|
GridViewRow selectedRow = grvListaEndeudamiento.Rows[i];
|
|
|
|
|
|
ViewState["PkEndeudamiento"] = Convert.ToInt32(selectedRow.Cells[2].Text);
|
|
|
|
|
|
ViewState["Modo_Endeudamiento"] = "Modifica";
|
|
|
|
|
|
|
|
|
|
|
|
mostrarFilasEndeudamiento(2);
|
|
|
|
|
|
|
|
|
|
|
|
mostrarDatosEndeudamiento();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M14", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void grvListaEndeudamiento_PageIndexChanging(object sender, GridViewPageEventArgs e)//M15
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvListaEndeudamiento.PageIndex = e.NewPageIndex;
|
|
|
|
|
|
llenarGrvListaEndeudamiento();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error R3M15", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void ddlTipoFuente_SelectedIndexChanged(object sender, EventArgs e) //M16
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
llenarDDLFuenteFinanciamiento();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R3M16", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Metodos Personalizados (R4)
|
|
|
|
|
|
|
|
|
|
|
|
private void mostrarDetalleyTabulado(int p_intFila) //M0
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
divTabulado.Visible = false;
|
|
|
|
|
|
divDetalle.Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
switch (p_intFila)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
llenarGrvListaDetalle();
|
|
|
|
|
|
divDetalle.Visible = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
llenarGrvPIRecursosI();
|
|
|
|
|
|
llenarGRVPIRecursosE();
|
|
|
|
|
|
llenarGRVEIRecursosI();
|
|
|
|
|
|
llenarGRVEIRecursosE();
|
|
|
|
|
|
divTabulado.Visible = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M0", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void construirgrvPIRecursosI() //M1
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvPIRecursosITemp = (GridView)divTabulado.FindControl("grvPIRecursosRI");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M1", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void construirgrvPIRecursosE() //M2
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvPIRecursosETemp = (GridView)divTabulado.FindControl("grvPIRecursosE");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M2", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void construirgrvEIRecursosI() //M3
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvEIRecursosITemp = (GridView)divTabulado.FindControl("grvEIRecursosI");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M3", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void construirgrvEIRecursosE() //M4
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvEIRecursosETemp = (GridView)divTabulado.FindControl("grvEIRecursosE");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M4", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void construirGrvListaDetalle() //M5
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvListaDetalleTemp = (GridView)divDetalle.FindControl("grvListaDetalle");
|
|
|
|
|
|
|
|
|
|
|
|
GridViewBoundField bdfPkFinanciamiento = new GridViewBoundField("PKFINANCIAMIENTO", "PK", false, false, false);
|
|
|
|
|
|
GridViewBoundField bdfTipoFinanciamiento = new GridViewBoundField("TIPOFINANCIAMIENTO", "TIPO FINANCIAMIENTO", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfTipoRecurso = new GridViewBoundField("TIPORECURSOFINANCIAMIENTO", "TIPO RECURSO", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfPkRecurso = new GridViewBoundField("PKRECURSO", "PK", true, true, false);
|
|
|
|
|
|
GridViewBoundField bdfRecurso = new GridViewBoundField("NOMBRERECURSO", "RECURSO", true, true, true);
|
|
|
|
|
|
GridViewBoundField bdfAnio = new GridViewBoundField("ANIOFINANCIAMIENTO", "AÑO", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfMonto = new GridViewBoundField("MONTOFINANCIAMIENTO", "MONTO", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfFkProyecto = new GridViewBoundField("FKPROYECTO", "PROYECTO", true, false, false);
|
|
|
|
|
|
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfPkFinanciamiento);
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfTipoFinanciamiento);
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfTipoRecurso);
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfPkRecurso);
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfRecurso);
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfAnio);
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfMonto);
|
|
|
|
|
|
grvListaDetalleTemp.Columns.Add(bdfFkProyecto);
|
|
|
|
|
|
|
|
|
|
|
|
grvListaDetalleTemp.Columns[0].ItemStyle.Width = 25;
|
|
|
|
|
|
grvListaDetalleTemp.Columns[1].ItemStyle.Width = 25;
|
|
|
|
|
|
grvListaDetalleTemp.Columns[7].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaDetalleTemp.Columns[8].ItemStyle.HorizontalAlign = HorizontalAlign.Right;
|
|
|
|
|
|
|
|
|
|
|
|
bdfMonto.DataFormatString = "{0:N2}";
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M5", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void mostrarFilasDetalle(int p_intFila) //M6
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
divListado.Visible = false;
|
|
|
|
|
|
divFormularioDatos.Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
switch (p_intFila)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
llenarGrvListaDetalle();
|
|
|
|
|
|
divListado.Visible = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
limpiarCamposFN();
|
|
|
|
|
|
divFormularioDatos.Visible = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M6", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void limpiarCamposFN() //M7
|
|
|
|
|
|
{
|
|
|
|
|
|
txtMonto.Text = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void ddlListaDatos(DataSet p_dsDatos, DropDownList p_ddlListado,
|
|
|
|
|
|
string p_strSeleccion) //M8
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
p_ddlListado.DataSource = p_dsDatos;
|
|
|
|
|
|
p_ddlListado.DataTextField = p_dsDatos.Tables[0].Columns[2].ColumnName;
|
|
|
|
|
|
p_ddlListado.DataValueField = p_dsDatos.Tables[0].Columns[0].ColumnName;
|
|
|
|
|
|
p_ddlListado.DataBind();
|
|
|
|
|
|
|
|
|
|
|
|
p_ddlListado.Items.Insert(0, new ListItem(p_strSeleccion, "-1"));
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw ex;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void construirGrvEndeudamiento() //M9
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvListaEndeudamientoTemp = (GridView)divTabulado.FindControl("grvListaEndeudamiento");
|
|
|
|
|
|
|
|
|
|
|
|
GridViewBoundField bdfPkEndeudamiento = new GridViewBoundField("PKENDEUDAMIENTO", "PK", false, false, false);
|
|
|
|
|
|
GridViewBoundField bdfFuenteFinanciamiento = new GridViewBoundField("NOMBREFUENTEFINANCIAMIENTO", "FUENTE", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfMonto = new GridViewBoundField("MONTOENDEUDAMIENTO", "MONTO", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfPeriodoGracia = new GridViewBoundField("PERIODOGRACIAENDEUDAMIENTO", "PERIODO GRACIA", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfPlazo = new GridViewBoundField("PLAZOENDEUDAMIENTO", "PLAZO", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfDesembolsoInicio = new GridViewBoundField("DESEMBOLSOINICIOENDEUDAMIENTO", "DESEMBOLSO INICIAL", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfDesembolsoFin = new GridViewBoundField("DESEMBOLSOFINENDEUDAMIENTO", "DESEMBOLSO FINAL", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfTipoCambio = new GridViewBoundField("TIPOCAMBIOCONTRATOENDEUDAMIENTO", "TIPO CAMBIO", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfFechaContrato = new GridViewBoundField("FECHACONTRATOENDEUDAMIENTO", "FECHA DE CONTRATO", true, true, true);
|
|
|
|
|
|
GridViewBoundField bdfSituacionActual = new GridViewBoundField("SITUACIONACTUALENDEUDAMIENTO", "SITUACION ACTUAL", true, false, true);
|
|
|
|
|
|
GridViewBoundField bdfTasa = new GridViewBoundField("TASAENDEUDAMIENTO", "TASA INTERES", true, false, true);
|
|
|
|
|
|
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfPkEndeudamiento);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfFuenteFinanciamiento);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfMonto);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfPeriodoGracia);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfPlazo);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfDesembolsoInicio);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfDesembolsoFin);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfTipoCambio);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfFechaContrato);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfSituacionActual);
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns.Add(bdfTasa);
|
|
|
|
|
|
|
|
|
|
|
|
bdfMonto.DataFormatString = "{0:N2}";
|
|
|
|
|
|
bdfTipoCambio.DataFormatString = "{0:N2}";
|
|
|
|
|
|
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[0].ItemStyle.Width = 15;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[1].ItemStyle.Width = 25;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[3].ItemStyle.Width = 300;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[4].ItemStyle.Width = 110;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[5].ItemStyle.Width = 50;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[6].ItemStyle.Width = 50;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[7].ItemStyle.Width = 50;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[8].ItemStyle.Width = 50;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[9].ItemStyle.Width = 50;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[10].ItemStyle.Width = 50;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[11].ItemStyle.Width = 50;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[12].ItemStyle.Width = 50;
|
|
|
|
|
|
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[4].ItemStyle.HorizontalAlign = HorizontalAlign.Right;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[5].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[6].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[7].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[8].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[9].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[10].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[11].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
grvListaEndeudamientoTemp.Columns[12].ItemStyle.HorizontalAlign = HorizontalAlign.Center;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M9", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void mostrarFilasEndeudamiento(int p_intFila) //M10
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
divListadoEndeudamiento.Visible = false;
|
|
|
|
|
|
divDatosEndeudamiento.Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
switch (p_intFila)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
llenarGrvListaEndeudamiento();
|
|
|
|
|
|
divListadoEndeudamiento.Visible = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
limpiarCamposED();
|
|
|
|
|
|
divDatosEndeudamiento.Visible = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M10", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void limpiarCamposED() //M11
|
|
|
|
|
|
{
|
|
|
|
|
|
llenarDDLTipoFuente();
|
|
|
|
|
|
llenarDDLFuenteFinanciamiento();
|
|
|
|
|
|
txtMontoDeuda.Text = string.Empty;
|
|
|
|
|
|
txtTasa.Text = string.Empty;
|
|
|
|
|
|
txtPeriodoGracia.Text = string.Empty;
|
|
|
|
|
|
txtPlazo.Text = string.Empty;
|
|
|
|
|
|
llenarDDLDesembolsoI();
|
|
|
|
|
|
llenarDDLDesembolsoF();
|
|
|
|
|
|
txtTipoCambio.Text = string.Empty;
|
|
|
|
|
|
txtFechaContrato.Text = string.Empty;
|
|
|
|
|
|
txtSituacionContrato.Text = string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void construirgrvTotalFinancimiento() //M12
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
grvTotalFinancimientoTemp = (GridView)divTabulado.FindControl("grvTotalFinanciamiento");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R4M12", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Metodos Controles a Datos (R5)
|
|
|
|
|
|
|
|
|
|
|
|
private bool GuardarDatosFN() //M0
|
|
|
|
|
|
{
|
|
|
|
|
|
bool blnEjecutado = false;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
string strModo = ViewState["Modo_Financiamiento"].ToString();
|
|
|
|
|
|
|
|
|
|
|
|
//Valida que los campos están llenos
|
|
|
|
|
|
if (ddlAnio.SelectedItem.Text != string.Empty && txtMonto.Text != string.Empty && ddlTipoFinanciamiento.SelectedItem.Text != string.Empty && ddlTipoRecurso.SelectedItem.Text != string.Empty)
|
|
|
|
|
|
{
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Anio = Int32.Parse(ddlAnio.SelectedItem.Text);
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Monto = decimal.Parse(txtMonto.Text);
|
|
|
|
|
|
//Guarda el tipo de financiamiento
|
|
|
|
|
|
if (ddlTipoFinanciamiento.SelectedValue == "1")
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoFinanciamiento = "PI"; //PreInversión
|
|
|
|
|
|
else
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoFinanciamiento = "EI"; //Ejecución e Inversión
|
|
|
|
|
|
//Guarda el tipo de recurso
|
|
|
|
|
|
if (ddlTipoRecurso.SelectedValue == "1")
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoRecurso = "RI"; //Recurso Interno
|
|
|
|
|
|
else
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoRecurso = "RE"; //Recurso Externo
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Recurso = Int32.Parse(ddlRecurso.SelectedValue);
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
|
|
|
|
|
|
if (strModo == "Nuevo")
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int intFinancimiento = objFinanciamientoBL.insertarFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
|
|
|
|
AccionBitacora.INSERT.ToString(),
|
|
|
|
|
|
MensajesBitacora.IngresarRegistro + ": Año: " + ddlAnio.SelectedItem.Text + ", Monto: " + txtMonto.Text + ", Tipo Recurso: " + ddlTipoRecurso.SelectedItem.Text +
|
|
|
|
|
|
", Recurso: " + ddlRecurso.SelectedItem.Text + ", Proyecto: " + txtProyecto.Text,
|
|
|
|
|
|
"wfrFinancimiento.aspx");
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (strModo == "Modifica")
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.PK = Int32.Parse(ViewState["PkFinanciamiento"].ToString());
|
|
|
|
|
|
|
|
|
|
|
|
if (objFinanciamientoBL.actualizarFinanciamiento())
|
|
|
|
|
|
{
|
|
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
|
|
|
|
AccionBitacora.UPDATE.ToString(),
|
|
|
|
|
|
MensajesBitacora.ModificarRegistro + ": Año: " + ddlAnio.SelectedItem.Text + ", Monto: " + txtMonto.Text + ", Tipo Recurso: " + ddlTipoRecurso.SelectedItem.Text +
|
|
|
|
|
|
", Recurso: " + ddlRecurso.SelectedItem.Text + ", Proyecto: " + txtProyecto.Text,
|
|
|
|
|
|
"wfrFinancimiento.aspx");
|
|
|
|
|
|
|
|
|
|
|
|
llenarGrvListaDetalle();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
llenarGrvListaDetalle();
|
|
|
|
|
|
|
|
|
|
|
|
blnEjecutado = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeAdvertencia("Debe suminitrar toda la información");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
blnEjecutado = false;
|
|
|
|
|
|
throw ex;
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
return blnEjecutado;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void eliminarDatosFN(int p_intPKFinanciamiento) //M1
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.PK = p_intPKFinanciamiento;
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.ASTATE = false;
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL.actualizaEstadoFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
|
|
|
|
AccionBitacora.INSERT.ToString(),
|
|
|
|
|
|
MensajesBitacora.EliminarRegistro + " PK: " + p_intPKFinanciamiento + " del Proyecto: " + txtProyecto.Text,
|
|
|
|
|
|
"frwFinancimiento.aspx");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R5M1", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private bool GuardarDatosED() //M2
|
|
|
|
|
|
{
|
|
|
|
|
|
bool blnEjecutado = false;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
string strModo = ViewState["Modo_Endeudamiento"].ToString();
|
|
|
|
|
|
|
|
|
|
|
|
if (txtMontoDeuda.Text != string.Empty && txtPeriodoGracia.Text != string.Empty && txtPlazo.Text != string.Empty && ddlDesembolInicio.SelectedItem.Text != "Desembolso Inicial" &&
|
|
|
|
|
|
ddlDesembolFinal.SelectedItem.Text != "Desembolso Final" && txtTipoCambio.Text != string.Empty && txtFechaContrato.Text != string.Empty && txtSituacionContrato.Text != string.Empty &&
|
|
|
|
|
|
txtTasa.Text != string.Empty && ddlFuenteFinanciamiento.SelectedItem.Text != "Fuente de Financiamiento" && ddlTipoFuente.SelectedItem.Text != "Tipo de Fuente")
|
|
|
|
|
|
{
|
|
|
|
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.Monto = Decimal.Parse(txtMontoDeuda.Text);
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.PeriodoGracia = txtPeriodoGracia.Text;
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.Plazo = txtPlazo.Text;
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.DesembolsoInicio = Int32.Parse(ddlDesembolInicio.SelectedItem.Text);
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.DesembolsoFin = Int32.Parse(ddlDesembolFinal.SelectedItem.Text);
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.TipoCambio = Decimal.Parse(txtTipoCambio.Text);
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.FechaContrato = DateTime.Parse(txtFechaContrato.Text);
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.SituacinActual = txtSituacionContrato.Text;
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.Tasa = txtTasa.Text;
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.FuenteFinanciamiento = Int32.Parse(ddlFuenteFinanciamiento.SelectedValue);
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
|
|
|
|
|
|
if (strModo == "Nuevo")
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (objEndeudamientoBL.insertarEndeudamiento())
|
|
|
|
|
|
{
|
|
|
|
|
|
blnEjecutado = true;
|
|
|
|
|
|
|
|
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
|
|
|
|
AccionBitacora.INSERT.ToString(),
|
|
|
|
|
|
MensajesBitacora.IngresarRegistro + ": Monto: " + Decimal.Parse(txtMontoDeuda.Text).ToString("###,###,###.#0") + ", " +
|
|
|
|
|
|
"Periodo Gracia: " + txtPeriodoGracia.Text + ", Plazo: " + txtPlazo.Text + ", Desembolzo Inicial: " +
|
|
|
|
|
|
ddlDesembolInicio.SelectedItem.Text + ", Desembolso Final: " + ddlDesembolFinal.SelectedItem.Text +
|
|
|
|
|
|
", Tipo Cambio: " + Decimal.Parse(txtTipoCambio.Text).ToString("###,###,###.#0") + ", Fecha Contrato: " +
|
|
|
|
|
|
txtFechaContrato.Text + ", Situación Actual: " + txtSituacionContrato.Text + ", Tasa: " +
|
|
|
|
|
|
txtTasa.Text + ", Fuente de Financiamiento: " + ddlFuenteFinanciamiento.SelectedItem.Text +
|
|
|
|
|
|
", Proyecto: " + txtProyecto.Text, "wfrFinancimiento.aspx");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (strModo == "Modifica")
|
|
|
|
|
|
{
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = Int32.Parse(ViewState["PkEndeudamiento"].ToString());
|
|
|
|
|
|
|
|
|
|
|
|
if (objEndeudamientoBL.actualizarEndeudamiento())
|
|
|
|
|
|
{
|
|
|
|
|
|
blnEjecutado = true;
|
|
|
|
|
|
|
|
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
|
|
|
|
AccionBitacora.UPDATE.ToString(),
|
|
|
|
|
|
MensajesBitacora.ModificarRegistro + ": " + "Monto: " + Decimal.Parse(txtMontoDeuda.Text).ToString("###,###,###.#0") + ", Periodo Gracia: " +
|
|
|
|
|
|
txtPeriodoGracia.Text + ", Plazo: " + txtPlazo.Text + ", Desembolzo Inicial: " +
|
|
|
|
|
|
ddlDesembolInicio.SelectedItem.Text + ", Desembolso Final: " + ddlDesembolFinal.SelectedItem.Text +
|
|
|
|
|
|
", Tipo Cambio: " + Decimal.Parse(txtTipoCambio.Text).ToString("###,###,###.#0") + ", Fecha Contrato: " +
|
|
|
|
|
|
txtFechaContrato.Text + ", Situación Actual: " + txtSituacionContrato.Text + ", Tasa: " +
|
|
|
|
|
|
txtTasa.Text + ", Fuente de Financiamiento: " + ddlFuenteFinanciamiento.SelectedItem.Text +
|
|
|
|
|
|
", Proyecto: " + txtProyecto.Text, "wfrFinancimiento.aspx");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
llenarGrvListaEndeudamiento();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeAdvertencia("Debe suminitrar toda la información");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R5M2", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return blnEjecutado;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void eliminarDatosED(int p_intPKEndeudamiento) //M3
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
|
|
|
|
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = p_intPKEndeudamiento;
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.ASTATE = false;
|
|
|
|
|
|
objEndeudamientoBL.actualizaEstadoEndeudamiento();
|
|
|
|
|
|
|
|
|
|
|
|
GuardarEventoBitacora(Session["LOGIN"].ToString(),
|
|
|
|
|
|
AccionBitacora.DELETE.ToString(),
|
|
|
|
|
|
MensajesBitacora.EliminarRegistro + " PK: " + ": " + p_intPKEndeudamiento +
|
|
|
|
|
|
" del Proyecto: " + txtProyecto.Text, "wfrFinancimiento.aspx");
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R5M3", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Metodos Datos a Controles (R6)
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarGrvPIRecursosI() //M0
|
|
|
|
|
|
{
|
|
|
|
|
|
string strTipoFinanciamiento = string.Empty;
|
|
|
|
|
|
string strTipoRecurso = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
//Limpiar el datagrid
|
|
|
|
|
|
detalleGRVDatos(null, grvPIRecursosI);
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoFinanciamiento = "PI";
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoRecurso = "RI";
|
|
|
|
|
|
|
|
|
|
|
|
DataSet dsRecursos = objFinanciamientoBL.getFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
if (dsRecursos.Tables.Count == 0)
|
|
|
|
|
|
dsRecursos.Tables.Add();
|
|
|
|
|
|
|
|
|
|
|
|
detalleGRVDatos(dsRecursos, grvPIRecursosI);
|
|
|
|
|
|
|
|
|
|
|
|
if (grvPIRecursosI.HeaderRow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvPIRecursosI.HeaderRow.Cells[1].Text = "Recurso Interno";
|
|
|
|
|
|
|
|
|
|
|
|
//Invisiviliza el titulo de la columna de la PK
|
|
|
|
|
|
grvPIRecursosI.HeaderRow.Cells[0].Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <= grvPIRecursosI.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvPIRecursosI.Rows[i].Cells[0].Visible = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Dar formato a las cifras por año
|
|
|
|
|
|
for (int i = 0; i <= grvPIRecursosI.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int j = 2; j <= grvPIRecursosI.Rows[i].Cells.Count - 1; ++j)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (grvPIRecursosI.Rows[i].Cells[j].Text != "0.00")
|
|
|
|
|
|
grvPIRecursosI.Rows[i].Cells[j].Text = Decimal.Parse(grvPIRecursosI.Rows[i].Cells[j].Text).ToString("###,###,###,###.#0");
|
|
|
|
|
|
|
|
|
|
|
|
grvPIRecursosI.Rows[i].Cells[j].HorizontalAlign = HorizontalAlign.Right;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M0", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarGRVPIRecursosE() //M1
|
|
|
|
|
|
{
|
|
|
|
|
|
string strTipoFinanciamiento = string.Empty;
|
|
|
|
|
|
string strTipoRecurso = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
//Limpiar el datagrid
|
|
|
|
|
|
//detalleGRVDatos(null, grvPIRecursosE);
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoFinanciamiento = "PI";
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoRecurso = "RE";
|
|
|
|
|
|
|
|
|
|
|
|
DataSet dsRecursos = objFinanciamientoBL.getFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
if (dsRecursos.Tables.Count == 0)
|
|
|
|
|
|
dsRecursos.Tables.Add();
|
|
|
|
|
|
|
|
|
|
|
|
detalleGRVDatos(dsRecursos, grvPIRecursosE);
|
|
|
|
|
|
|
|
|
|
|
|
if (grvPIRecursosE.HeaderRow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvPIRecursosE.HeaderRow.Cells[1].Text = "Recurso Externo";
|
|
|
|
|
|
//Invisiviliza el titulo de la columna de la PK
|
|
|
|
|
|
grvPIRecursosE.HeaderRow.Cells[0].Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
//Invisibiliza la columna de PK
|
|
|
|
|
|
for (int i = 0; i <= grvPIRecursosE.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvPIRecursosE.Rows[i].Cells[0].Visible = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Dar formato a las cifras por año
|
|
|
|
|
|
for (int i = 0; i <= grvPIRecursosE.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int j = 2; j <= grvPIRecursosE.Rows[i].Cells.Count - 1; ++j)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (grvPIRecursosE.Rows[i].Cells[j].Text != "0.00")
|
|
|
|
|
|
grvPIRecursosE.Rows[i].Cells[j].Text = Decimal.Parse(grvPIRecursosE.Rows[i].Cells[j].Text).ToString("###,###,###,###.#0");
|
|
|
|
|
|
grvPIRecursosE.Rows[i].Cells[j].HorizontalAlign = HorizontalAlign.Right;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M1", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarGRVEIRecursosI() //M2
|
|
|
|
|
|
{
|
|
|
|
|
|
string strTipoFinanciamiento = string.Empty;
|
|
|
|
|
|
string strTipoRecurso = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
//Limpiar el datagrid
|
|
|
|
|
|
detalleGRVDatos(null, grvEIRecursosI);
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoFinanciamiento = "EI";
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoRecurso = "RI";
|
|
|
|
|
|
|
|
|
|
|
|
DataSet dsRecursos = objFinanciamientoBL.getFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
if (dsRecursos.Tables.Count == 0)
|
|
|
|
|
|
dsRecursos.Tables.Add();
|
|
|
|
|
|
|
|
|
|
|
|
detalleGRVDatos(dsRecursos, grvEIRecursosI);
|
|
|
|
|
|
|
|
|
|
|
|
if (grvEIRecursosI.HeaderRow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvEIRecursosI.HeaderRow.Cells[1].Text = "Recurso Interno";
|
|
|
|
|
|
//Invisiviliza el titulo de la columna de la PK
|
|
|
|
|
|
grvEIRecursosI.HeaderRow.Cells[0].Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
//Invisibiliza la columna de PK
|
|
|
|
|
|
for (int i = 0; i <= grvEIRecursosI.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvEIRecursosI.Rows[i].Cells[0].Visible = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Dar formato a las cifras por año
|
|
|
|
|
|
for (int i = 0; i <= grvEIRecursosI.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int j = 2; j <= grvEIRecursosI.Rows[i].Cells.Count - 1; ++j)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (grvEIRecursosI.Rows[i].Cells[j].Text != "0.00")
|
|
|
|
|
|
grvEIRecursosI.Rows[i].Cells[j].Text = Decimal.Parse(grvEIRecursosI.Rows[i].Cells[j].Text).ToString("###,###,###,###.#0");
|
|
|
|
|
|
grvEIRecursosI.Rows[i].Cells[j].HorizontalAlign = HorizontalAlign.Right;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M2", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarGRVEIRecursosE() //M3
|
|
|
|
|
|
{
|
|
|
|
|
|
string strTipoFinanciamiento = string.Empty;
|
|
|
|
|
|
string strTipoRecurso = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
//Limpiar el datagrid
|
|
|
|
|
|
detalleGRVDatos(null, grvEIRecursosE);
|
|
|
|
|
|
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoFinanciamiento = "EI";
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.TipoRecurso = "RE";
|
|
|
|
|
|
|
|
|
|
|
|
DataSet dsRecursos = objFinanciamientoBL.getFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
if (dsRecursos.Tables.Count == 0)
|
|
|
|
|
|
dsRecursos.Tables.Add();
|
|
|
|
|
|
|
|
|
|
|
|
detalleGRVDatos(dsRecursos, grvEIRecursosE);
|
|
|
|
|
|
|
|
|
|
|
|
if (grvEIRecursosE.HeaderRow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvEIRecursosE.HeaderRow.Cells[1].Text = "Recurso Externo";
|
|
|
|
|
|
|
|
|
|
|
|
//Invisiviliza el titulo de la columna de la PK
|
|
|
|
|
|
grvEIRecursosE.HeaderRow.Cells[0].Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
//Invisibiliza la columna de PK
|
|
|
|
|
|
for (int i = 0; i <= grvEIRecursosE.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvEIRecursosE.Rows[i].Cells[0].Visible = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Dar formato a las cifras por año
|
|
|
|
|
|
for (int i = 0; i <= grvEIRecursosE.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int j = 2; j <= grvEIRecursosE.Rows[i].Cells.Count - 1; ++j)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (grvEIRecursosE.Rows[i].Cells[j].Text != "0.00")
|
|
|
|
|
|
grvEIRecursosE.Rows[i].Cells[j].Text = Decimal.Parse(grvEIRecursosE.Rows[i].Cells[j].Text).ToString("###,###,###,###.#0");
|
|
|
|
|
|
grvEIRecursosE.Rows[i].Cells[j].HorizontalAlign = HorizontalAlign.Right;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M3", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarGrvListaDetalle() //M4
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.PK = 0;
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
DataSet dsDetalle = objFinanciamientoBL.getDetalle();
|
|
|
|
|
|
|
|
|
|
|
|
detalleGRVDatos(dsDetalle, grvListaDetalle);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M4", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarDDLTipoRecurso() //M5
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objRecursoBL = new RecursoBL();
|
|
|
|
|
|
|
|
|
|
|
|
string strTipoRecurso = "Tipo Recurso";
|
|
|
|
|
|
|
|
|
|
|
|
objRecursoBL.objRecursoEL.PK = 0;
|
|
|
|
|
|
objRecursoBL.objRecursoEL.Padre = -1;
|
|
|
|
|
|
objRecursoBL.objRecursoEL.ASTATE = true;
|
|
|
|
|
|
|
|
|
|
|
|
//Carga la información en un dataset
|
|
|
|
|
|
DataSet dsTipoRecurso = objRecursoBL.getRecurso();
|
|
|
|
|
|
|
|
|
|
|
|
ddlListaDatos(dsTipoRecurso, ddlTipoRecurso, strTipoRecurso);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M5", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarDDLRecurso() //M6
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objRecursoBL = new RecursoBL();
|
|
|
|
|
|
|
|
|
|
|
|
string strRecurso = "Recurso";
|
|
|
|
|
|
|
|
|
|
|
|
objRecursoBL.objRecursoEL.PK = 0;
|
|
|
|
|
|
objRecursoBL.objRecursoEL.Padre = Int32.Parse(ddlTipoRecurso.SelectedValue); ;
|
|
|
|
|
|
objRecursoBL.objRecursoEL.ASTATE = true;
|
|
|
|
|
|
|
|
|
|
|
|
//Carga la información en un dataset
|
|
|
|
|
|
DataSet dsRecurso = objRecursoBL.getRecurso();
|
|
|
|
|
|
|
|
|
|
|
|
ddlListaDatos(dsRecurso, ddlRecurso, strRecurso);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M6", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarDDLAnio() //M7
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
ddlAnio.Items.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
ListItem lstAnios = new ListItem("Año");
|
|
|
|
|
|
ddlAnio.Items.Add(lstAnios);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = DateTime.Now.Year - 7; i <= DateTime.Now.Year + 7; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
lstAnios = new ListItem(i.ToString());
|
|
|
|
|
|
ddlAnio.Items.Add(lstAnios);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M7", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void mostrarDatosDetalle() //M8
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
|
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.PK = Int32.Parse(ViewState["PkFinanciamiento"].ToString());
|
|
|
|
|
|
DataSet dsFinanciamiento = objFinanciamientoBL.getDetalle();
|
|
|
|
|
|
if (dsFinanciamiento.Tables[0].Rows.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
ddlTipoFinanciamiento.SelectedValue = dsFinanciamiento.Tables[0].Rows[0]["PKTIPOFINANCIAMIENTO"].ToString();
|
|
|
|
|
|
ddlTipoRecurso.SelectedValue = dsFinanciamiento.Tables[0].Rows[0]["PKTIPORECURSOFINANCIAMIENTO"].ToString();
|
|
|
|
|
|
llenarDDLRecurso();
|
|
|
|
|
|
ddlRecurso.SelectedValue = dsFinanciamiento.Tables[0].Rows[0]["PKRECURSO"].ToString();
|
|
|
|
|
|
ddlAnio.SelectedItem.Text = dsFinanciamiento.Tables[0].Rows[0]["ANIOFINANCIAMIENTO"].ToString();
|
|
|
|
|
|
txtMonto.Text = dsFinanciamiento.Tables[0].Rows[0]["MONTOFINANCIAMIENTO"].ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M8", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarGrvListaEndeudamiento() //M9
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = 0;
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
|
|
|
|
|
|
|
|
|
|
|
DataSet dsEndeudamiento = objEndeudamientoBL.getEndeudamiento();
|
|
|
|
|
|
detalleGRVDatos(dsEndeudamiento, grvListaEndeudamientoTemp);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M9", ex);
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void mostrarDatosEndeudamiento() //M10
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objEndeudamientoBL = new EndeudamientoBL();
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.PK = Int32.Parse(ViewState["PkEndeudamiento"].ToString());
|
|
|
|
|
|
objEndeudamientoBL.objEndeudamientoEL.Proyecto = 0;
|
|
|
|
|
|
DataSet dsEndeudamiento = objEndeudamientoBL.getEndeudamiento();
|
|
|
|
|
|
|
|
|
|
|
|
if (dsEndeudamiento.Tables[0].Rows.Count != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
ddlTipoFuente.SelectedValue = dsEndeudamiento.Tables[0].Rows[0]["PADREFUENTEFINANCIAMIENTO"].ToString();
|
|
|
|
|
|
llenarDDLFuenteFinanciamiento();
|
|
|
|
|
|
ddlFuenteFinanciamiento.SelectedValue = dsEndeudamiento.Tables[0].Rows[0]["FKFUENTEFINANCIAMIENTO"].ToString();
|
|
|
|
|
|
txtMontoDeuda.Text = Decimal.Parse(dsEndeudamiento.Tables[0].Rows[0]["MONTOENDEUDAMIENTO"].ToString()).ToString("###,###,###,###.#0");
|
|
|
|
|
|
txtTasa.Text = dsEndeudamiento.Tables[0].Rows[0]["TASAENDEUDAMIENTO"].ToString();
|
|
|
|
|
|
txtPeriodoGracia.Text = dsEndeudamiento.Tables[0].Rows[0]["PERIODOGRACIAENDEUDAMIENTO"].ToString();
|
|
|
|
|
|
txtPlazo.Text = dsEndeudamiento.Tables[0].Rows[0]["PLAZOENDEUDAMIENTO"].ToString();
|
|
|
|
|
|
ddlDesembolInicio.SelectedItem.Text = dsEndeudamiento.Tables[0].Rows[0]["DESEMBOLSOINICIOENDEUDAMIENTO"].ToString();
|
|
|
|
|
|
ddlDesembolFinal.SelectedItem.Text = dsEndeudamiento.Tables[0].Rows[0]["DESEMBOLSOFINENDEUDAMIENTO"].ToString();
|
|
|
|
|
|
txtTipoCambio.Text = dsEndeudamiento.Tables[0].Rows[0]["TIPOCAMBIOCONTRATOENDEUDAMIENTO"].ToString();
|
|
|
|
|
|
txtFechaContrato.Text = DateTime.Parse(dsEndeudamiento.Tables[0].Rows[0]["FECHACONTRATOENDEUDAMIENTO"].ToString()).ToString("dd/MM/yyyy");
|
|
|
|
|
|
txtSituacionContrato.Text = dsEndeudamiento.Tables[0].Rows[0]["SITUACIONACTUALENDEUDAMIENTO"].ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeInformativo("No se encontró el registro solicitado");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M10" +
|
|
|
|
|
|
"", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarDDLFuenteFinanciamiento() //M11
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objFuenteFinanciamientoBL = new FuenteFinanciamientoBL();
|
|
|
|
|
|
|
|
|
|
|
|
string strFuente = "Fuente Financiamiento";
|
|
|
|
|
|
|
|
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.Padre = Int32.Parse(ddlTipoFuente.SelectedValue);
|
|
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.PK = 0;
|
|
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.ASTATE = true;
|
|
|
|
|
|
|
|
|
|
|
|
//Carga la información en un dataset
|
|
|
|
|
|
DataSet dsFuente = objFuenteFinanciamientoBL.getFuenteFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
ddlListaDatos(dsFuente, ddlFuenteFinanciamiento, strFuente);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M11", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarDDLTipoFuente() //M12
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
objFuenteFinanciamientoBL = new FuenteFinanciamientoBL();
|
|
|
|
|
|
|
|
|
|
|
|
string strFuente = "Tipo Fuente";
|
|
|
|
|
|
|
|
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.Padre = -1;
|
|
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.PK = 0;
|
|
|
|
|
|
objFuenteFinanciamientoBL.objFuenteFinanciamientoEL.ASTATE = true;
|
|
|
|
|
|
|
|
|
|
|
|
//Carga la información en un dataset
|
|
|
|
|
|
DataSet dsFuente = objFuenteFinanciamientoBL.getFuenteFinanciamiento();
|
|
|
|
|
|
|
|
|
|
|
|
ddlListaDatos(dsFuente, ddlTipoFuente, strFuente);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M12", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarDDLDesembolsoI() //M13
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
ddlDesembolInicio.Items.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
ListItem lstAnios = new ListItem("Desembolso Inicial");
|
|
|
|
|
|
ddlDesembolInicio.Items.Add(lstAnios);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = DateTime.Now.Year - 7; i <= DateTime.Now.Year + 7; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
lstAnios = new ListItem(i.ToString());
|
|
|
|
|
|
ddlDesembolInicio.Items.Add(lstAnios);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M13", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarDDLDesembolsoF() //M14
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
ddlDesembolFinal.Items.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
ListItem lstAnios = new ListItem("Desembolso Final");
|
|
|
|
|
|
ddlDesembolFinal.Items.Add(lstAnios);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = DateTime.Now.Year - 7; i <= DateTime.Now.Year + 7; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
lstAnios = new ListItem(i.ToString());
|
|
|
|
|
|
ddlDesembolFinal.Items.Add(lstAnios);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
MensajeError("Error en R6M14", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void llenarGRVTotalFinanciamiento() //M15
|
|
|
|
|
|
{
|
|
|
|
|
|
string strTipoFinanciamiento = string.Empty;
|
|
|
|
|
|
string strTipoRecurso = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
//Limpiar el datagrid
|
|
|
|
|
|
detalleGRVDatos(null, grvTotalFinanciamiento);
|
|
|
|
|
|
|
2019-06-02 05:36:32 +00:00
|
|
|
|
objDistribucionPartidaBL = new DistribucionPartidaBL();
|
2019-05-27 14:46:35 +00:00
|
|
|
|
objFinanciamientoBL = new FinanciamientoBL();
|
2019-06-02 05:36:32 +00:00
|
|
|
|
|
2019-05-27 14:46:35 +00:00
|
|
|
|
objFinanciamientoBL.objFinanciamientoEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
2019-06-02 05:36:32 +00:00
|
|
|
|
objDistribucionPartidaBL.objDistribucionPartidaEL.Proyecto = Int32.Parse(Session["PKPROYECTO"].ToString());
|
2019-05-27 14:46:35 +00:00
|
|
|
|
|
|
|
|
|
|
DataSet dsRecursos = objFinanciamientoBL.getTotalFinanciamiento();
|
2019-06-02 05:36:32 +00:00
|
|
|
|
DataSet dsPartidas = objDistribucionPartidaBL.getTotalPartida();
|
2019-05-27 14:46:35 +00:00
|
|
|
|
|
|
|
|
|
|
if (dsRecursos.Tables.Count == 0)
|
|
|
|
|
|
dsRecursos.Tables.Add();
|
|
|
|
|
|
|
|
|
|
|
|
detalleGRVDatos(dsRecursos, grvTotalFinanciamiento);
|
2019-06-02 05:36:32 +00:00
|
|
|
|
decimal vMontoTotalFinanciamiento = 0M;
|
|
|
|
|
|
decimal vMontoTotalPartidas = 0M;
|
|
|
|
|
|
|
|
|
|
|
|
#region VERIFICAR MONTO PARTIDAS
|
|
|
|
|
|
if (dsPartidas != null || dsPartidas.Tables.Count > 0 || dsPartidas.Tables[0].Rows.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 1; i <= dsPartidas.Tables[0].Columns.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
vMontoTotalPartidas += Convert.ToDecimal(dsPartidas.Tables[0].Rows[0][i].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2019-05-27 14:46:35 +00:00
|
|
|
|
|
|
|
|
|
|
if (grvTotalFinanciamiento.HeaderRow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvTotalFinanciamiento.HeaderRow.Cells[0].Text = "";
|
|
|
|
|
|
//Dar formato a las cifras por año
|
|
|
|
|
|
for (int i = 0; i <= grvTotalFinanciamiento.Rows.Count - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int j = 1; j <= grvTotalFinanciamiento.Rows[i].Cells.Count - 1; ++j)
|
|
|
|
|
|
{
|
2019-06-02 05:36:32 +00:00
|
|
|
|
vMontoTotalFinanciamiento += Convert.ToDecimal(grvTotalFinanciamiento.Rows[i].Cells[j].Text);
|
2019-05-27 14:46:35 +00:00
|
|
|
|
|
|
|
|
|
|
if (grvTotalFinanciamiento.Rows[i].Cells[j].Text != "0.00")
|
|
|
|
|
|
grvTotalFinanciamiento.Rows[i].Cells[j].Text = Decimal.Parse(grvTotalFinanciamiento.Rows[i].Cells[j].Text).ToString("###,###,###,###.#0");
|
|
|
|
|
|
|
|
|
|
|
|
grvTotalFinanciamiento.Rows[i].Cells[j].HorizontalAlign = HorizontalAlign.Right;
|
|
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[j].BorderStyle = BorderStyle.None;
|
|
|
|
|
|
}
|
|
|
|
|
|
grvTotalFinanciamiento.Rows[i].Font.Bold = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Mostrar Total
|
2019-06-24 04:03:12 +00:00
|
|
|
|
if (grvTotalFinanciamiento.Rows.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
grvTotalFinanciamiento.Rows[0].Cells[0].Text = "TOTAL ANUAL";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-02 05:36:32 +00:00
|
|
|
|
var vMontosCoinciden = vMontoTotalPartidas == vMontoTotalFinanciamiento;
|
|
|
|
|
|
|
2019-06-24 04:03:12 +00:00
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[0].Text = "TOTAL GENERAL";
|
2019-05-27 14:46:35 +00:00
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[0].Font.Bold = true;
|
|
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[0].HorizontalAlign = HorizontalAlign.Left;
|
|
|
|
|
|
|
2019-06-02 05:36:32 +00:00
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[1].Text = vMontoTotalFinanciamiento.ToString("###,###,###,###.#0");
|
2019-05-27 14:46:35 +00:00
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[1].Font.Bold = true;
|
|
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[1].HorizontalAlign = HorizontalAlign.Right;
|
2019-06-24 04:03:12 +00:00
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[1].BackColor = vMontosCoinciden ? System.Drawing.Color.Green : System.Drawing.Color.IndianRed;
|
2019-06-02 05:36:32 +00:00
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[1].ForeColor = System.Drawing.Color.White;
|
|
|
|
|
|
|
2019-05-27 14:46:35 +00:00
|
|
|
|
|
|
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[0].BorderStyle = BorderStyle.Solid;
|
|
|
|
|
|
grvTotalFinanciamiento.FooterRow.Cells[1].BorderStyle = BorderStyle.Solid;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
General.ReportarError(ex, Session["LOGIN"].ToString());
|
|
|
|
|
|
MensajeError("Error en R6M15", ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|