Commit inicial Ventas Productivo
This commit is contained in:
147
Contratos/RepContratosFianzas.aspx.cs
Normal file
147
Contratos/RepContratosFianzas.aspx.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
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 Extensiones;
|
||||
using Microsoft.Reporting.WebForms;
|
||||
|
||||
public partial class Contratos_RepContratosFianzas : ClsPaginas
|
||||
{
|
||||
#region "Propiedades"
|
||||
private DataTable DTDatos
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DataTable)ViewState["DTDatos"];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["DTDatos"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InicializaFiltros();
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region "BOTONES"
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
|
||||
protected void ImgImprimir_Click(object sender, EventArgs e)
|
||||
{
|
||||
GenerarPDF();
|
||||
}
|
||||
|
||||
protected void ImgExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
GenerarPDF("Excel");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "CARGA DATOS"
|
||||
|
||||
protected void InicializaFiltros()
|
||||
{
|
||||
DdlContratos.SelectedValue = "-1";
|
||||
txtFechaVencI.Text = DateTime.Today.ToShortDateString();
|
||||
txtFechaVencF.Text = DateTime.Today.AddYears(1).ToShortDateString();
|
||||
CargaContratos();
|
||||
CargaClientes();
|
||||
|
||||
}
|
||||
|
||||
protected void CargaContratos()
|
||||
{
|
||||
DdlContratos.DataSource = GlobalDTContratos.FiltraParametros("CveEmpresa = " + UsuarioActual.CveEmpresa);
|
||||
DdlContratos.DataBind();
|
||||
}
|
||||
protected void CargaClientes()
|
||||
{
|
||||
DdlClientes.DataSource = get_GlobalDTCliente(UsuarioActual.CveEmpresa);
|
||||
DdlClientes.DataBind();
|
||||
DdlClientes.Items.Insert(0, new ListItem("Todos", "-1"));
|
||||
DdlClientes.SelectedValue = "-1";
|
||||
}
|
||||
|
||||
protected void CargaDatos()
|
||||
{
|
||||
int CveContrato = DdlContratos.SelectedValue.ToEntero();
|
||||
int Estatus = DdlEstatus.SelectedValue.ToEntero();
|
||||
int CveCliente = DdlClientes.SelectedValue.ToEntero();
|
||||
|
||||
String FechaVI = txtFechaVencI.Text;
|
||||
String FechaVF = txtFechaVencF.Text;
|
||||
|
||||
ClsContratos ObjContrato = new ClsContratos();
|
||||
|
||||
if (ObjContrato.GetContratoFianza(CveContrato, Estatus, FechaVI, FechaVF, UsuarioActual.CveEmpresa, CveCliente))
|
||||
{
|
||||
DTDatos = ObjContrato.DtResultados;
|
||||
GvFianzas.DataSource = DTDatos;
|
||||
}
|
||||
ObjContrato.Dispose();
|
||||
GvFianzas.DataBind();
|
||||
UPFiltros.Update();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "REPORTE"
|
||||
|
||||
private void GenerarPDF(string Formato = "PDF")
|
||||
{
|
||||
var Contrato = DdlContratos.SelectedItem;
|
||||
var Estatus = DdlEstatus.SelectedItem;
|
||||
|
||||
string FechaI = txtFechaVencI.Text;
|
||||
string FechaF = txtFechaVencF.Text;
|
||||
|
||||
if (txtFechaVencI.Text == "")
|
||||
FechaI = "-1";
|
||||
if (txtFechaVencF.Text == "")
|
||||
FechaF = "-1";
|
||||
|
||||
System.IO.FileInfo Imagen = new System.IO.FileInfo(string.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
|
||||
var logouri = string.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
||||
|
||||
List<ReportParameter> @params = new List<ReportParameter>();
|
||||
|
||||
@params.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
|
||||
@params.Add(new ReportParameter("FechaInicio", FechaI));
|
||||
@params.Add(new ReportParameter("FechaFin", FechaF));
|
||||
@params.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
|
||||
@params.Add(new ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString()));
|
||||
@params.Add(new ReportParameter("Contrato", Contrato.Text));
|
||||
@params.Add(new ReportParameter("Estatus", Estatus.Text));
|
||||
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
@params.Add(new ReportParameter("LogoPath", logouri));
|
||||
}
|
||||
else
|
||||
{
|
||||
@params.Add(new ReportParameter("LogoPath", ""));
|
||||
}
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepContratosFianzas.rdlc", DTDatos, @params, "ReporteContratosFianzas", Formato);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user