163 lines
7.5 KiB
VB.net
163 lines
7.5 KiB
VB.net
Option Strict On
|
|
Option Explicit On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
|
|
Partial Class Contratos_RepContratosAvancesCP
|
|
Inherits ClsPaginas
|
|
|
|
|
|
#Region "PROPIEDADES"
|
|
|
|
|
|
#End Region
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
InicializaValores()
|
|
End If
|
|
End Sub
|
|
|
|
#Region " Inicializa Valores "
|
|
Private Sub InicializaValores()
|
|
|
|
'DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
|
|
'DdlProveedor.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
'DdlProveedor.DataBind()
|
|
|
|
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
|
DdlClientes.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
DdlClientes.DataBind()
|
|
|
|
DdlTipo.DataSource = GlobalDTContratosTipos(UsuarioActual.CveEmpresa)
|
|
DdlTipo.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
DdlTipo.DataBind()
|
|
|
|
|
|
'DdlContrato.DataSource = GlobalDTContratos().FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa}")
|
|
'DdlContrato.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
'DdlContrato.DataBind()
|
|
Dim CveEstatusVigente = -1
|
|
Dim ObjContratos As New ClsContratos
|
|
ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa)
|
|
DdlEstatus.DataSource = ObjContratos.DtResultados
|
|
CveEstatusVigente = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus = 1", Orderby:="CveContratoEstatus").ToEntero
|
|
DdlEstatus.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
DdlEstatus.DataBind()
|
|
ObjContratos.Dispose()
|
|
|
|
DdlEstatus.SelectedValueExist(If(CveEstatusVigente > 0, CveEstatusVigente, -1))
|
|
|
|
CargaDatos()
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " CARGA DATOS "
|
|
Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs) Handles BtnFiltrar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjContratos As New ClsContratos
|
|
|
|
If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, DdlClientes.SelectedValue.ToEntero, -1, DdlTipo.SelectedValue.ToEntero, DdlAgrupador.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero) Then
|
|
GvDatos.DataSource = ObjContratos.DtResultados
|
|
Else
|
|
Alert("Ocurrió un error al obtener el Reporte. Por favor vuelva a intentar", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
ObjContratos.Dispose()
|
|
GvDatos.DataBind()
|
|
|
|
'If (GvDatos.Rows.Count > 0) Then
|
|
' GvDatos.UseAccessibleHeader = True
|
|
' GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
|
' RegistraScript("OrdenarGV();")
|
|
'End If
|
|
|
|
LtEncabezado.Text = DdlAgrupador.SelectedItem.Text
|
|
|
|
UPDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " GV DATOS "
|
|
'
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
|
|
If e.Row.DBCampo("CveContrato").ToString.ToEntero > 0 Then
|
|
Dim Liga = String.Format("/Contratos/Contrato.aspx?CveContrato={0}&Tipo=2", e.Row.DBCampo("CveContrato"))
|
|
|
|
e.Row.FCHyperLink("HLAgrupador").NavigateUrl = Liga
|
|
e.Row.FCHyperLink("HLImporteContratado").NavigateUrl = Liga
|
|
e.Row.FCHyperLink("HLImporteAvance").NavigateUrl = Liga
|
|
e.Row.FCHyperLink("HLPorcentajeAvance").NavigateUrl = Liga
|
|
e.Row.FCHyperLink("HLImporteFaltante").NavigateUrl = Liga
|
|
e.Row.FCHyperLink("HLPorcentajeFaltante").NavigateUrl = Liga
|
|
e.Row.FCHyperLink("HLAvancePorFacturar").NavigateUrl = Liga
|
|
Else
|
|
e.Row.CssClass = "sinlink SubTotales2"
|
|
End If
|
|
|
|
|
|
'e.Row.FCHyperLink("HLPadron").NavigateUrl = String.Format("/ZDG/RepMunicipiosSeguimiento.aspx?CM={0}&CV={1}&CT={2}", e.Row.DBCampo("CveMunicipio"), -1, -1)
|
|
'e.Row.FCHyperLink("HLVotos").NavigateUrl = String.Format("/ZDG/RepMunicipiosSeguimiento.aspx?CM={0}&CV={1}&CT={2}", e.Row.DBCampo("CveMunicipio"), 1, -1)
|
|
'e.Row.FCHyperLink("HLVotos1").NavigateUrl = String.Format("/ZDG/RepMunicipiosSeguimiento.aspx?CM={0}&CV={1}&CT={2}", e.Row.DBCampo("CveMunicipio"), 1, 1)
|
|
'e.Row.FCHyperLink("HLVotos2").NavigateUrl = String.Format("/ZDG/RepMunicipiosSeguimiento.aspx?CM={0}&CV={1}&CT={2}", e.Row.DBCampo("CveMunicipio"), 1, 2)
|
|
'e.Row.FCHyperLink("HLVotos3").NavigateUrl = String.Format("/ZDG/RepMunicipiosSeguimiento.aspx?CM={0}&CV={1}&CT={2}", e.Row.DBCampo("CveMunicipio"), 1, 3)
|
|
'e.Row.FCHyperLink("HLVotos4").NavigateUrl = String.Format("/ZDG/RepMunicipiosSeguimiento.aspx?CM={0}&CV={1}&CT={2}", e.Row.DBCampo("CveMunicipio"), 1, 4)
|
|
'e.Row.FCHyperLink("HLFaltanVotar").NavigateUrl = String.Format("/ZDG/RepMunicipiosSeguimiento.aspx?CM={0}&CV={1}&CT={2}", e.Row.DBCampo("CveMunicipio"), 0, 1)
|
|
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region "Imprimir"
|
|
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
GvDatos.ExportToExcel("ReporteCompras" & Now.ToShortDateString)
|
|
End Sub
|
|
|
|
Private Sub GenerarPDF()
|
|
Dim ObjContratos As New ClsContratos
|
|
If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, DdlClientes.SelectedValue.ToEntero, -1, DdlTipo.SelectedValue.ToEntero, DdlAgrupador.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero) Then
|
|
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
|
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
|
Dim dt As DataTable = ObjContratos.DtResultados
|
|
Dim Cliente = If(DdlClientes.SelectedValue = "-1", "", $" <b>Cliente:</b> {DdlClientes.SelectedItem.Text}")
|
|
Dim Estatus = ($" <b>Estatus:</b> {DdlEstatus.SelectedItem.Text}")
|
|
Dim Tipo = If(DdlTipo.SelectedValue = "-1", "", $" <b>Tipo:</b> {DdlTipo.SelectedItem.Text}")
|
|
Dim Grupo = ($" <b>Grupo:</b> {DdlAgrupador.SelectedItem.Text}")
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("FechaInicio", "-1"))
|
|
params.Add(New ReportParameter("FechaFin", "-1"))
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
|
params.Add(New ReportParameter("AgrupadoPor", $"<b>Agrupado Por:</b> {Cliente}{Estatus}{Tipo}{Grupo}"))
|
|
If Imagen.Exists Then
|
|
params.Add(New ReportParameter("LogoPath", logouri))
|
|
Else
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepContratosAvanceCP.rdlc", dt, params, "ReporteContratosAvanceCP")
|
|
Else
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
End Sub
|
|
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
|
GenerarPDF()
|
|
End Sub
|
|
#End Region
|
|
|
|
End Class
|