Commit inicial Ventas Productivo
This commit is contained in:
478
AF/CatAF.aspx.vb
Normal file
478
AF/CatAF.aspx.vb
Normal file
@@ -0,0 +1,478 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class AF_CatAF
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region " PROPIEDADES"
|
||||
Private Property DtActivosFijos As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtActivosFijos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtActivosFijos") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private ReadOnly Property CveActivoFijo As Integer
|
||||
Get
|
||||
Return ViewState("CveActivoFijo").ToString.ToEntero
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Property DTAFCaracteristicas As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DTAFCaracteristicas"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTAFCaracteristicas") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
CargaCombos()
|
||||
CargaCaracteristicas()
|
||||
|
||||
If (Request("GPO") IsNot Nothing AndAlso Request("GPO").ToEntero() > 0) Then
|
||||
CargaParametrosInicial()
|
||||
Else
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " CARGA PARAMETROS "
|
||||
Private Sub CargaParametrosInicial()
|
||||
|
||||
Dim CveTipoActivoFijo As Integer = (Request("CveTipoActivoFijo")).ToEntero
|
||||
Dim CveSubTipoActivoFijo As Integer = (Request("CveSubTipoActivoFijo")).ToEntero
|
||||
Dim CvePersonalResponsable As Integer = (Request("CvePersonaResponsable")).ToEntero
|
||||
Dim CveSubProyecto As Integer = (Request("CveSubProyecto")).ToEntero
|
||||
Dim CveEstadoActivoFijo As Integer = (Request("CveEstadoActivoFijo")).ToEntero
|
||||
|
||||
Dim Año As Integer = -1
|
||||
Dim Grupo, CveAgrupador As Integer
|
||||
Dim ObjAF As New ClsAF()
|
||||
Grupo = If(Request("GPO") IsNot Nothing AndAlso Request("GPO").ToEntero() > 0, Request("GPO").ToEntero(), -1).ToString.ToEntero
|
||||
CveAgrupador = If(Request("CveAgrupador") IsNot Nothing AndAlso Request("CveAgrupador").ToEntero() > 0, Request("CveAgrupador").ToEntero(), -1).ToEntero
|
||||
|
||||
If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, "-1", "-1", IfNull(CveTipoActivoFijo, "-1").ToString.ToEntero, IfNull(CveSubTipoActivoFijo, "-1").ToString.ToEntero, "-1", IfNull(Request("Anio"), Now.Year).ToString.ToEntero,
|
||||
IfNull(CvePersonalResponsable, "-1").ToString.ToEntero, DdlProyecto.SelectedValue.ToEntero, IfNull(CveSubProyecto, "-1").ToString.ToEntero, IfNull(CveEstadoActivoFijo, "-1").ToString.ToEntero, "", -1) Then
|
||||
If ObjAF.DtResultados.Rows.Count > 0 Then
|
||||
DtActivosFijos = ObjAF.DtResultados
|
||||
Else
|
||||
DtActivosFijos = Nothing
|
||||
Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
CargaGvDatos()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " CARGA COMBOS "
|
||||
Protected Sub CargaCombos()
|
||||
DdlSubTipoActivo.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
DdlEstatus.DataSource = GlobalDTEstadoActivoFijo
|
||||
DdlEstatus.DataBind()
|
||||
DdlEstatus.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
DdlProyecto.DataSource = GlobalDTProyectos(UsuarioActual.CveEmpresa)
|
||||
DdlProyecto.DataBind()
|
||||
DdlProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
||||
DdlCliente.DataBind()
|
||||
DdlCliente.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
CargarTipoActivoFijo()
|
||||
CargaGrupos()
|
||||
CargaResponsable()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGrupos()
|
||||
Dim ObjAF As New ClsAF
|
||||
|
||||
DdlGrupo.Items.Clear()
|
||||
If ObjAF.GetGrupoAF(-1, UsuarioActual.CveEmpresa) Then
|
||||
DdlGrupo.DataSource = ObjAF.DtResultados
|
||||
Else
|
||||
DdlGrupo.DataSource = Nothing
|
||||
End If
|
||||
DdlGrupo.DataBind()
|
||||
ObjAF.Dispose()
|
||||
DdlGrupo.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
|
||||
Protected Sub CargarTipoActivoFijo()
|
||||
DdlTipoActivo.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo")
|
||||
DdlTipoActivo.DataBind()
|
||||
DdlTipoActivo.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
Private Sub CargaResponsable()
|
||||
Dim DtPersonal = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("", "NombreCompleto")
|
||||
DdlResponsable.DataSource = DtPersonal
|
||||
DdlResponsable.DataBind()
|
||||
End Sub
|
||||
Protected Sub DdlTipoActivo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
DdlSubTipoActivo.Items.Clear()
|
||||
DdlSubTipoActivo.DataSource = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveTipoActivoFijo = {0}", DdlTipoActivo.SelectedValue), "SubTipoActivoFijo")
|
||||
DdlSubTipoActivo.DataBind()
|
||||
DdlSubTipoActivo.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
CargaCaracteristicas()
|
||||
End Sub
|
||||
Protected Sub DdlSubTipoActivo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaCaracteristicas()
|
||||
End Sub
|
||||
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
DdlSubProyecto.Items.Clear()
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
Protected Sub BtnFiltrar_Click1(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim ObjAF As New ClsAF()
|
||||
|
||||
Dim Codigo As String = "-1"
|
||||
Dim Descripcion As String = "-1"
|
||||
Dim CveMarcaActivoFijo As Integer = -1
|
||||
Dim NoSerie As String = "-1"
|
||||
Dim Año As Integer = -1
|
||||
Dim CvePersonaResponsable As Integer = DdlResponsable.SelectedValue.ToEntero()
|
||||
If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim
|
||||
If TxtAño.Text.Trim <> String.Empty Then Año = TxtAño.Text.Trim.ToEntero
|
||||
|
||||
Dim strSQL1 As New StringBuilder
|
||||
Dim booPrimerCampo As Boolean = False
|
||||
Dim intContador As Integer = 0
|
||||
|
||||
For Each DR As GridViewRow In GvCaracteristicas.Rows
|
||||
Dim CveCaracteristicaOpcion As Integer = -1
|
||||
Dim CveValor As Integer = DR.FCHiddenField("HdnCveValor").Value.ToEntero
|
||||
Dim Valor As String = DR.FCTextBox("TxtValor").Text.Trim
|
||||
Dim CveCaracteristica As Integer = DR.FCHiddenField("HdnCveCaracteristica").Value.ToEntero
|
||||
|
||||
Select Case DR.FCHiddenField("HdnEsOpcion").Value
|
||||
Case "0", "4"
|
||||
If booPrimerCampo = True And Valor.Length <> 0 Then strSQL1.Append(" Or ")
|
||||
If Valor.Length <> 0 Then
|
||||
If booPrimerCampo = False Then strSQL1.Append("Select CveActivoFijo from AF_ActivosFijosValores where ")
|
||||
strSQL1.AppendFormat(" (CveCaracteristica = {0} And Valor Like '%{1}%') ", CveCaracteristica, Valor)
|
||||
If booPrimerCampo = False Then booPrimerCampo = True
|
||||
intContador += 1
|
||||
End If
|
||||
Case "1" 'Listado o DropDownList
|
||||
CveCaracteristicaOpcion = DR.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero
|
||||
If booPrimerCampo = True And CveCaracteristicaOpcion <> 0 Then strSQL1 = strSQL1.Append(" or ")
|
||||
If CveCaracteristicaOpcion <> 0 Then
|
||||
If booPrimerCampo = False Then strSQL1 = strSQL1.Append("Select CveActivoFijo from AF_ActivosFijosValores where ")
|
||||
strSQL1.AppendFormat(" (CveCaracteristica = {0} and CveOpcion = {1} ) ", CveCaracteristica, CveCaracteristicaOpcion)
|
||||
If booPrimerCampo = False Then booPrimerCampo = True
|
||||
intContador += 1
|
||||
End If
|
||||
Case "2" 'Radio o RadioButtonList
|
||||
CveCaracteristicaOpcion = DR.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero
|
||||
If booPrimerCampo = True And CveCaracteristicaOpcion <> 0 Then strSQL1 = strSQL1.Append(" or ")
|
||||
If CveCaracteristicaOpcion <> 0 Then
|
||||
If booPrimerCampo = False Then strSQL1 = strSQL1.Append("Select CveActivoFijo from AF_ActivosFijosValores where ")
|
||||
strSQL1.AppendFormat(" (CveCaracteristica = {0} and CveOpcion = {1} ) ", CveCaracteristica, CveCaracteristicaOpcion)
|
||||
If booPrimerCampo = False Then booPrimerCampo = True
|
||||
intContador += 1
|
||||
End If
|
||||
Case "3"
|
||||
If booPrimerCampo = True And Valor.Length <> 0 Then strSQL1.Append(" or ")
|
||||
If Valor.Length <> 0 Then
|
||||
If booPrimerCampo = False Then strSQL1.Append("Select CveActivoFijo from AF_ActivosFijosValores where ")
|
||||
strSQL1.AppendFormat(" (CveCaracteristica = {0} and Valor = '{1}') ", CveCaracteristica, Valor)
|
||||
If booPrimerCampo = False Then booPrimerCampo = True
|
||||
intContador += 1
|
||||
End If
|
||||
Case "5"
|
||||
Valor = DR.FCCheckBox("ChbValor").Checked.ToString
|
||||
If booPrimerCampo = True And Valor.Length <> 0 Then strSQL1.Append(" or ")
|
||||
If Valor.Length <> 0 Then
|
||||
If booPrimerCampo = False Then strSQL1.Append("Select CveActivoFijo from AF_ActivosFijosValores where ")
|
||||
strSQL1.AppendFormat(" (CveCaracteristica = {0} and Valor = '{1}') ", CveCaracteristica, Valor)
|
||||
If booPrimerCampo = False Then booPrimerCampo = True
|
||||
intContador += 1
|
||||
End If
|
||||
Case "6"
|
||||
Valor = DR.FCTextBox("TxtValorNum").Text.Trim
|
||||
If booPrimerCampo = True And Valor.Length <> 0 Then strSQL1.Append(" or ")
|
||||
If Valor.Length <> 0 Then
|
||||
If booPrimerCampo = False Then strSQL1.Append("Select CveActivoFijo from AF_ActivosFijosValores where ")
|
||||
strSQL1.AppendFormat(" (CveCaracteristica = {0} and Valor like '{1}') ", CveCaracteristica, Valor)
|
||||
If booPrimerCampo = False Then booPrimerCampo = True
|
||||
intContador += 1
|
||||
End If
|
||||
End Select
|
||||
|
||||
Next
|
||||
|
||||
If intContador > 0 Then strSQL1.AppendFormat(" group by CveActivoFijo having count(*)={0}", intContador)
|
||||
|
||||
If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, Codigo, Descripcion, DdlTipoActivo.SelectedValue.ToEntero, DdlSubTipoActivo.SelectedValue.ToEntero, NoSerie, Año, CvePersonaResponsable, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, strSQL1.ToString, -1, CveGrupo:=DdlGrupo.SelectedValue.ToEntero) Then
|
||||
If ObjAF.DtResultados.Rows.Count > 0 Then
|
||||
DtActivosFijos = ObjAF.DtResultados
|
||||
'GvDatos.DataSource = ObjAF.DtResultados
|
||||
Else
|
||||
DtActivosFijos = Nothing
|
||||
Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
Alert("Ocurrió un error al cargar los Activos Fijos. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
DtActivosFijos = Nothing
|
||||
End If
|
||||
|
||||
ObjAF.Dispose()
|
||||
|
||||
CargaGvDatos()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " GV DATOS "
|
||||
Private Sub OrdenaDatos()
|
||||
If (GvDatos.Rows.Count > 0) Then
|
||||
GvDatos.UseAccessibleHeader = True
|
||||
GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
||||
RegistraScript("OrdenarGV();")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaGvDatos()
|
||||
GvDatos.DataSource = DtActivosFijos
|
||||
GvDatos.DataBind()
|
||||
|
||||
'LtlTotalRegistros.Text = DtActivosFijos.Rows.Count.ToString.FormatoNumero(0)
|
||||
|
||||
UpGV.Update()
|
||||
OrdenaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
e.Row.Cells(9).Attributes.Add("data-order", e.Row.DBCampo("FechaIng").ToDate.Ticks.ToString)
|
||||
|
||||
If DtActivosFijos.Rows.Count.ToEntero < 17 Then
|
||||
'e.Row.Cells(0).Width = Unit.Pixel(80)
|
||||
'e.Row.Cells(1).Width = Unit.Pixel(135)
|
||||
'e.Row.Cells(2).Width = Unit.Pixel(63)
|
||||
'e.Row.Cells(3).Width = Unit.Pixel(98)
|
||||
'e.Row.Cells(4).Width = Unit.Pixel(93)
|
||||
'e.Row.Cells(5).Width = Unit.Pixel(125)
|
||||
'e.Row.Cells(6).Width = Unit.Pixel(52)
|
||||
'e.Row.Cells(7).Width = Unit.Pixel(92)
|
||||
'e.Row.Cells(8).Width = Unit.Pixel(74)
|
||||
'e.Row.Cells(9).Width = Unit.Pixel(83)
|
||||
'e.Row.Cells(10).Width = Unit.Pixel(68)
|
||||
'e.Row.FCLiteral("LtlCodigo").Text = "<a class=""Texto"" href=""/AF/AF.aspx?CveActivoFijo=" & e.Row.DBCampo("CveActivoFijo") & """>" & e.Row.FCLiteral("LtlCodigo").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlDescripcion").Text = "<a class=""Texto"" href=""/RH/Personal.aspx?CvePersonal=" & e.Row.DBCampo("CvePersonal") & """>" & e.Row.FCLiteral("LtlDescripcion").Text & "</a>"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " CARACTERISTICAS "
|
||||
Private Sub CargaCaracteristicas()
|
||||
Dim ObjAFCaracteristicas As New ClsAF
|
||||
If ObjAFCaracteristicas.GetActivosFijosValores(-1, UsuarioActual.CveEmpresa) Then
|
||||
If DdlSubTipoActivo.SelectedIndex <> 0 Then
|
||||
GvCaracteristicas.DataSource = ObjAFCaracteristicas.DtResultados.FiltraParametros("CveSubTipoActivoFijo = '" + DdlSubTipoActivo.SelectedValue + "'")
|
||||
Else
|
||||
GvCaracteristicas.DataSource = Nothing
|
||||
End If
|
||||
If ObjAFCaracteristicas.GetCaracteristicasOpcionesSubTipo(-1, DdlSubTipoActivo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
DTAFCaracteristicas = ObjAFCaracteristicas.DtResultados '.FiltraParametros("SubtipoActivoFijo = '" + DdlSubTipoActivoFijo.SelectedValue + "'") 'FiltraParametros("EstatusOpcion = 'True'")
|
||||
End If
|
||||
|
||||
End If
|
||||
ObjAFCaracteristicas.Dispose()
|
||||
GvCaracteristicas.DataBind()
|
||||
UpFiltro.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvCaracteristicas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCaracteristicas.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim TipoCampo As Integer = e.Row.DBCampo("TipoCampo").ToEntero
|
||||
Dim CveCaracteristica As Integer = e.Row.DBCampo("CveCaracteristica").ToEntero
|
||||
|
||||
Select Case TipoCampo
|
||||
Case 0, 4 'Texto, Multiline
|
||||
With e.Row.FCTextBox("TxtValor")
|
||||
.Visible = True
|
||||
If TipoCampo = 4 Then
|
||||
.Rows = 3
|
||||
.TextMode = TextBoxMode.MultiLine
|
||||
End If
|
||||
.Text = e.Row.DBCampo("Valor")
|
||||
If e.Row.DBCampo("Requerida") = "True" Then
|
||||
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").Enabled = True
|
||||
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").ControlToValidate = "TxtValor"
|
||||
End If
|
||||
|
||||
End With
|
||||
|
||||
Case 1, 2 'DropDownList, Radios
|
||||
Dim dt As DataTable = DTAFCaracteristicas.FiltraParametros(String.Format("CveCaracteristica = {0} AND EstatusOpcion ='True' AND CveCaracteristicaOpcion > 0 ", CveCaracteristica))
|
||||
|
||||
If TipoCampo = 1 Then
|
||||
With e.Row.FCDropDownList("DdlRespuesta")
|
||||
.Visible = True
|
||||
.DataTextField = "CaracteristicaOpcion"
|
||||
.DataValueField = "CveCaracteristicaOpcion"
|
||||
.DataSource = dt
|
||||
|
||||
.DataBind()
|
||||
.Items.Insert(0, New ListItem("Seleccione", ""))
|
||||
.SelectedValue = e.Row.DBCampo("CveOpcion")
|
||||
|
||||
If e.Row.DBCampo("Requerida") = "True" Then
|
||||
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").Enabled = True
|
||||
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").ControlToValidate = "DdlRespuesta"
|
||||
End If
|
||||
|
||||
End With
|
||||
ElseIf TipoCampo = 2 Then
|
||||
With e.Row.FCRadioButtonList("RbRespuesta")
|
||||
.Visible = True
|
||||
.DataSource = dt
|
||||
.DataBind()
|
||||
|
||||
End With
|
||||
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").ErrorMessage = String.Format("ERROR: Falta contestar la pregunta: <b>{0}</b>", e.Row.DBCampo("Caracteristica"))
|
||||
End If
|
||||
|
||||
Case 3 'Fecha
|
||||
With e.Row.FCTextBox("TxtValor")
|
||||
|
||||
.Visible = True
|
||||
.Width = New Unit(80)
|
||||
End With
|
||||
e.Row.FCImageButton("ImgTxtValor").Visible = True
|
||||
e.Row.FCMaskedEditExtender("MEETxtValor").Enabled = True
|
||||
e.Row.FCCalendarExtender("CETxtValor").Enabled = True
|
||||
e.Row.FCCompareValidator("CVTxtValor").Enabled = True
|
||||
e.Row.FCCompareValidator("CVTxtValor").Type = ValidationDataType.Date
|
||||
|
||||
Case 5 'Checkbox
|
||||
With e.Row.FCCheckBox("ChbValor")
|
||||
.Visible = True
|
||||
.Text = e.Row.DBCampo("Caracteristica")
|
||||
.Checked = CBool(e.Row.DBCampo("Valor").ToEntero)
|
||||
End With
|
||||
|
||||
Case 6 ' Numerico
|
||||
With e.Row.FCTextBox("TxtValorNum")
|
||||
.Visible = True
|
||||
.Text = e.Row.DBCampo("Valor")
|
||||
e.Row.FCCompareValidator("CVTxtValor").Enabled = True
|
||||
e.Row.FCCompareValidator("CVTxtValor").Type = ValidationDataType.Integer
|
||||
|
||||
If e.Row.DBCampo("Requerida") = "True" Then
|
||||
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").Enabled = True
|
||||
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").ControlToValidate = "TxtValorNum"
|
||||
End If
|
||||
End With
|
||||
End Select
|
||||
End If
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "O R D E N A M I E N T O"
|
||||
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim Orden As String = ""
|
||||
Dim Campo As String = ""
|
||||
Dim Literal As Literal = Nothing
|
||||
Const OrdenInicial As String = ""
|
||||
Dim Arg(2) As String
|
||||
|
||||
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
||||
Campo = Arg(0)
|
||||
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
|
||||
|
||||
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
||||
Else
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
||||
End If
|
||||
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
||||
ViewState("Orden") = Orden
|
||||
CargaGrid(Orden)
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGrid(Orden As String)
|
||||
Dim DV As DataView = Nothing
|
||||
DV = New DataView(DtActivosFijos, "", Orden, DataViewRowState.CurrentRows)
|
||||
If Orden <> String.Empty Then
|
||||
GvDatos.DataSource = DV.ToTable()
|
||||
GvDatos.DataBind()
|
||||
Else
|
||||
GvDatos.DataSource = DtActivosFijos
|
||||
End If
|
||||
|
||||
DV.Dispose()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "I M P R I M I R P D F / Excel"
|
||||
Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
GenerarPDF("EXCEL")
|
||||
End Sub
|
||||
|
||||
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
||||
If DtActivosFijos.Rows.Count > 0 Then
|
||||
Dim params As New List(Of ReportParameter)
|
||||
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)
|
||||
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF(String.Format("{0}Formatos\CatAF.rdlc", UsuarioActual.Empresa.Ruta), DtActivosFijos, params, "CatalogoActivosFijos", Formato:=Formato)
|
||||
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user