Rep Compras Detalle: Hacer columnas personalizables
This commit is contained in:
@@ -1650,25 +1650,22 @@ Namespace Extensiones
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
<Runtime.CompilerServices.Extension()>
|
<Runtime.CompilerServices.Extension()>
|
||||||
Public Function GetColumn(ByVal gv As GridView, ByVal name As String) As Integer
|
Public Function FBColumn(gv As GridView, name As String) As DataControlField
|
||||||
Dim index As Integer = 0
|
name = name.ToLower
|
||||||
Dim found As Boolean = False
|
For Each col As DataControlField In gv.Columns
|
||||||
|
If TypeOf col Is BoundField Then
|
||||||
For Each c As DataControlField In gv.Columns
|
Dim field As BoundField = CType(col, BoundField)
|
||||||
|
If field.DataField.ToLower = name OrElse field.SortExpression.ToLower = name OrElse field.HeaderText.Trim.ToLower = name Then
|
||||||
If TypeOf c Is BoundField Then
|
Return col
|
||||||
Dim field As BoundField = CType(c, BoundField)
|
End If
|
||||||
|
ElseIf TypeOf col Is HyperLinkField Then
|
||||||
If name = field.DataField OrElse name = field.SortExpression OrElse name = field.HeaderText Then
|
Dim field As HyperLinkField = CType(col, HyperLinkField)
|
||||||
found = True
|
If field.DataTextField.ToLower = name OrElse field.SortExpression.ToLower = name OrElse field.HeaderText.Trim.ToLower = name Then
|
||||||
Exit For
|
Return col
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
index += 1
|
|
||||||
Next
|
Next
|
||||||
|
Return Nothing
|
||||||
Return If(found, index, -1)
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
<Runtime.CompilerServices.Extension()>
|
<Runtime.CompilerServices.Extension()>
|
||||||
|
|||||||
@@ -25,6 +25,13 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-ad-excel"></i> Generar Excel</asp:LinkButton>
|
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-ad-excel"></i> Generar Excel</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
<asp:UpdatePanel runat="server">
|
||||||
|
<ContentTemplate>
|
||||||
|
<li>
|
||||||
|
<asp:HyperLink NavigateUrl="#" data-toggle="modal" data-target="#DivPersonalizar" ID="ImgPersonalizar" runat="server"> <i class="fa fa-pencil"></i> Personalizar</asp:HyperLink>
|
||||||
|
</li>
|
||||||
|
</ContentTemplate>
|
||||||
|
</asp:UpdatePanel>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink NavigateUrl="javascript:;" data-toggle="modal" data-target="#DivTipoCambio" ID="ImgTipoCambio" runat="server"> <i class="fa fa-money"></i> Ver Dlls en pesos</asp:HyperLink>
|
<asp:HyperLink NavigateUrl="javascript:;" data-toggle="modal" data-target="#DivTipoCambio" ID="ImgTipoCambio" runat="server"> <i class="fa fa-money"></i> Ver Dlls en pesos</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
@@ -153,9 +160,6 @@
|
|||||||
|
|
||||||
<div class="row ">
|
<div class="row ">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-1"><asp:Label ID="LblProyecto" runat="server">Proyecto:</asp:Label></div>
|
<div class="col-md-1"><asp:Label ID="LblProyecto" runat="server">Proyecto:</asp:Label></div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<asp:DropDownList ID="DdlProyecto" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Width="95%">
|
<asp:DropDownList ID="DdlProyecto" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Width="95%">
|
||||||
@@ -213,7 +217,7 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:GridView ID="GvDatos" runat="server" data-sort="true" DataKeyNames="Cantidad,Total,Moneda" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros con los filtros especificados" ToolTip="Listado de Ventas" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" GridLines="None">
|
<asp:GridView ID="GvDatos" runat="server" data-sort="true" DataKeyNames="Cantidad,Total,Moneda" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros con los filtros especificados" ToolTip="Listado de Ventas" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" GridLines="None">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField DataField="SerieFolio" HeaderText="Factura" />
|
<asp:BoundField DataField="SerieFolio" HeaderText="Factura" />
|
||||||
<asp:BoundField DataField="SubProyecto" ItemStyle-CssClass="ML Truncate" HeaderText="SubProyecto" />
|
<asp:BoundField DataField="SubProyecto" ItemStyle-CssClass="ML Truncate" HeaderText="SubProyecto" />
|
||||||
@@ -237,10 +241,7 @@
|
|||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional">
|
<asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div id="DivTipoCambio" class="modal fade" role="dialog">
|
<div id="DivTipoCambio" class="modal fade" role="dialog">
|
||||||
@@ -279,6 +280,80 @@
|
|||||||
</div>
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
|
<asp:UpdatePanel runat="server" ID="UPPersonalizar" UpdateMode="Conditional">
|
||||||
|
<ContentTemplate>
|
||||||
|
<div id="DivPersonalizar" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
|
||||||
|
<!-- Modal content-->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">
|
||||||
|
<asp:Label ID="Label2" runat="server" ClientIDMode="Static" Text="Personalizar Columnas"></asp:Label></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<table style="width: 100%" class="table table-striped table-advance table-hover">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkFactura" runat="server" Text="Factura" Checked="true"/></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkSubProyecto" runat="server" Text="SubProyecto" Checked="true"/></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkAF" runat="server" Text="Activo Fijo" Checked="true"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkPS" runat="server" Text="Producto" Checked="true"/></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkResp" runat="server" Text="Responsable" Checked="true"/></td>
|
||||||
|
<td><td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkNS" runat="server" Text="No. Serie"/></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkTipoAF" runat="server" Text="Tipo"/></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkSubTipoAF" runat="server" Text="SubTipo"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkClasif" runat="server" Text="Clasificación"/></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkClasif2" runat="server" Text="Clasificación 2" Checked="true"/></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkUM" runat="server" Text="Unidad de Medida" Checked="true"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkCant" runat="server" Text="Cantidad" Checked="true" /></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkPU" runat="server" Text="Precio Unitario" Checked="true" /></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkTotal" runat="server" Text="Total" Checked="true" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkCuenta" runat="server" Text="Cuenta" Checked="true" /></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkMedidaAF" runat="server" Text="Tipo de Medida" /></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="ChkTipoMant" runat="server" Text="Tipo de Mantenimiento" /></td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<asp:Button ID="BtnPersonalizar" runat="server" Text="Personalizar" class="btn btn-primary" />
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ContentTemplate>
|
||||||
|
</asp:UpdatePanel>
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
||||||
|
|||||||
@@ -82,12 +82,13 @@ Partial Class Compras_RepComprasAFDetalle
|
|||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
Private Personalizado As Boolean = False
|
||||||
|
|
||||||
Private Sub Compras_RepComprasAFDetalle_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Private Sub Compras_RepComprasAFDetalle_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
CargaCombos()
|
CargaCombos()
|
||||||
'ImgPersonalizar.Attributes.Add("onclick", "javascript:$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
|
'ImgPersonalizar.Attributes.Add("onclick", "javascript:$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
|
||||||
|
GvDatos.DataBind(True)
|
||||||
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim Fecha, FechaI, FechaF As String
|
Dim Fecha, FechaI, FechaF As String
|
||||||
@@ -163,9 +164,11 @@ Partial Class Compras_RepComprasAFDetalle
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa = 72 Then
|
If UsuarioActual.CveEmpresa = 72 Then
|
||||||
GvDatos.Columns(3).Visible = True
|
GvDatos.FBColumn("NoSerie").Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
UPDatos.Update()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -284,18 +287,12 @@ Partial Class Compras_RepComprasAFDetalle
|
|||||||
CvePS, Anio.ToEntero, Mes.ToEntero, AnioMes, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveClasificacion2:=DdlClasificacion2.SelectedValue.ToEntero) Then
|
CvePS, Anio.ToEntero, Mes.ToEntero, AnioMes, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveClasificacion2:=DdlClasificacion2.SelectedValue.ToEntero) Then
|
||||||
DTDatos = ObjCompras.DtResultados
|
DTDatos = ObjCompras.DtResultados
|
||||||
|
|
||||||
GvDatos.DataSource = ObjCompras.DtResultados
|
GvDatos.DataSource = DTDatos
|
||||||
Else
|
|
||||||
GvDatos.DataSource = Nothing
|
|
||||||
DTDatos = Nothing
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
ObjCompras.Dispose()
|
ObjCompras.Dispose()
|
||||||
GvDatos.DataBind()
|
GvDatos.DataBind(True)
|
||||||
|
UPDatos.Update()
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||||
|
|
||||||
@@ -482,4 +479,31 @@ Partial Class Compras_RepComprasAFDetalle
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub PersonalizarColumnas()
|
||||||
|
GvDatos.FBColumn("SerieFolio").Visible = ChkFactura.Checked
|
||||||
|
GvDatos.FBColumn("SubProyecto").Visible = ChkSubProyecto.Checked
|
||||||
|
GvDatos.FBColumn("CodigoAF").Visible = ChkAF.Checked
|
||||||
|
GvDatos.FBColumn("NoSerie").Visible = ChkNS.Checked
|
||||||
|
GvDatos.FBColumn("CodigoPS").Visible = ChkPS.Checked
|
||||||
|
GvDatos.FBColumn("NombreCompleto").Visible = ChkResp.Checked
|
||||||
|
GvDatos.FBColumn("AFMedida").Visible = ChkMedidaAF.Checked
|
||||||
|
GvDatos.FBColumn("AFTipoMantenimientoStr").Visible = ChkTipoMant.Checked
|
||||||
|
GvDatos.FBColumn("TipoActivoFijo").Visible = ChkTipoAF.Checked
|
||||||
|
GvDatos.FBColumn("SubTipoActivoFijo").Visible = ChkSubTipoAF.Checked
|
||||||
|
GvDatos.FBColumn("Clasificacion").Visible = ChkClasif.Checked
|
||||||
|
GvDatos.FBColumn("Clasificacion2").Visible = ChkClasif2.Checked
|
||||||
|
GvDatos.FBColumn("UnidadMedida").Visible = ChkUM.Checked
|
||||||
|
GvDatos.FBColumn("Cantidad").Visible = ChkCant.Checked
|
||||||
|
GvDatos.FBColumn("PU").Visible = ChkPU.Checked
|
||||||
|
GvDatos.FBColumn("Total").Visible = ChkTotal.Checked
|
||||||
|
GvDatos.FBColumn("Cuenta").Visible = ChkCuenta.Checked
|
||||||
|
UPDatos.Update()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
||||||
|
Personalizado = True
|
||||||
|
PersonalizarColumnas()
|
||||||
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
Reference in New Issue
Block a user