131 lines
3.9 KiB
C#
131 lines
3.9 KiB
C#
using System;
|
|
using System.Activities.Expressions;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Extensiones;
|
|
using Microsoft.Reporting.WebForms;
|
|
|
|
public partial class Bancos_RepComprobaciones : ClsPaginas
|
|
{
|
|
#region "P R O P I E D A D E S"
|
|
private DataTable DTDatos
|
|
{
|
|
get
|
|
{
|
|
return (DataTable)ViewState["DTDatos"];
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["DTDatos"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
InicializaDatos();
|
|
}
|
|
}
|
|
|
|
#region "C A R G A D A T O S"
|
|
protected void InicializaDatos()
|
|
{
|
|
TxtFechaInicio.Text = DateTime.Today.AddDays(-30).ToString();
|
|
TxtFechaFin.Text = DateTime.Today.ToString();
|
|
|
|
CargaCuentas();
|
|
CargaDatos();
|
|
}
|
|
protected void CargaDatos()
|
|
{
|
|
ClsBancos ObjBanco = new ClsBancos();
|
|
|
|
int CveCuenta = DdlCuentas.SelectedValue.ToEntero();
|
|
DateTime FechaI = Convert.ToDateTime(TxtFechaInicio.Text);
|
|
DateTime FechaF = Convert.ToDateTime(TxtFechaFin.Text);
|
|
|
|
if (ObjBanco.GetComprobacionesRep(CveCuenta, FechaI, FechaF, UsuarioActual.CveEmpresa))
|
|
{
|
|
DTDatos = ObjBanco.DtResultados;
|
|
GvDatos.DataSource = DTDatos;
|
|
}
|
|
ObjBanco.Dispose();
|
|
GvDatos.DataBind();
|
|
UPDatos.Update();
|
|
}
|
|
protected void CargaCuentas()
|
|
{
|
|
DdlCuentas.DataSource = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros("Banco = 'Empresa'");
|
|
DdlCuentas.DataBind();
|
|
DdlCuentas.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlCuentas.SelectedValue = "-1";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region "PDF"
|
|
private void GenerarPDF(string Formato = "PDF")
|
|
{
|
|
List<ReportParameter> @params = new List<ReportParameter>();
|
|
|
|
System.IO.FileInfo Imagen = new System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png");
|
|
|
|
@params.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
|
|
@params.Add(new ReportParameter("FechaInicio", TxtFechaInicio.Text));
|
|
@params.Add(new ReportParameter("FechaFin", TxtFechaFin.Text));
|
|
@params.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
|
|
@params.Add(new ReportParameter("FechaImpresion", NowADS().ToString()));
|
|
@params.Add(new ReportParameter("Cuenta", DdlCuentas.SelectedItem.Text));
|
|
|
|
@params.Add(new ReportParameter("LogoPath", Imagen.Exists ? $"file://{Imagen.FullName}" : ""));
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepComprobaciones.rdlc", DTDatos, @params, "ReporteComprobaciones", Formato);
|
|
}
|
|
#endregion
|
|
|
|
#region"B O T O N E S"
|
|
protected void BtnConsultar_Click(object sender, EventArgs e)
|
|
{
|
|
CargaDatos();
|
|
}
|
|
|
|
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
if (String.IsNullOrEmpty(e.Row.DBCampo("CveCompra")))
|
|
{
|
|
e.Row.CssClass = "Totales";
|
|
e.Row.FCHyperLink("HypAgrupador").ForeColor = System.Drawing.Color.White;
|
|
e.Row.FCHyperLink("HypAgrupador").NavigateUrl = string.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIEDevolucion"));
|
|
}
|
|
else
|
|
{
|
|
e.Row.FCHyperLink("HypAgrupador").NavigateUrl = string.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"));
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void ImgImprimirPDF_Click(object sender, EventArgs e)
|
|
{
|
|
GenerarPDF();
|
|
}
|
|
#endregion
|
|
|
|
#region EXCEL
|
|
protected void ImgExcel_Click(object sender, EventArgs e)
|
|
{
|
|
GenerarPDF("EXCEL");
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
|