Rep Compras Detalle: Hacer columnas personalizables
This commit is contained in:
@@ -1650,25 +1650,22 @@ Namespace Extensiones
|
||||
End Function
|
||||
|
||||
<Runtime.CompilerServices.Extension()>
|
||||
Public Function GetColumn(ByVal gv As GridView, ByVal name As String) As Integer
|
||||
Dim index As Integer = 0
|
||||
Dim found As Boolean = False
|
||||
|
||||
For Each c As DataControlField In gv.Columns
|
||||
|
||||
If TypeOf c Is BoundField Then
|
||||
Dim field As BoundField = CType(c, BoundField)
|
||||
|
||||
If name = field.DataField OrElse name = field.SortExpression OrElse name = field.HeaderText Then
|
||||
found = True
|
||||
Exit For
|
||||
Public Function FBColumn(gv As GridView, name As String) As DataControlField
|
||||
name = name.ToLower
|
||||
For Each col As DataControlField In gv.Columns
|
||||
If TypeOf col Is BoundField Then
|
||||
Dim field As BoundField = CType(col, BoundField)
|
||||
If field.DataField.ToLower = name OrElse field.SortExpression.ToLower = name OrElse field.HeaderText.Trim.ToLower = name Then
|
||||
Return col
|
||||
End If
|
||||
ElseIf TypeOf col Is HyperLinkField Then
|
||||
Dim field As HyperLinkField = CType(col, HyperLinkField)
|
||||
If field.DataTextField.ToLower = name OrElse field.SortExpression.ToLower = name OrElse field.HeaderText.Trim.ToLower = name Then
|
||||
Return col
|
||||
End If
|
||||
End If
|
||||
|
||||
index += 1
|
||||
Next
|
||||
|
||||
Return If(found, index, -1)
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
<Runtime.CompilerServices.Extension()>
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-ad-excel"></i> Generar Excel</asp:LinkButton>
|
||||
</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>
|
||||
<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>
|
||||
@@ -153,9 +160,6 @@
|
||||
|
||||
<div class="row ">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-1"><asp:Label ID="LblProyecto" runat="server">Proyecto:</asp:Label></div>
|
||||
<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%">
|
||||
@@ -213,7 +217,7 @@
|
||||
<div class="col-md-12">
|
||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||
<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>
|
||||
<asp:BoundField DataField="SerieFolio" HeaderText="Factura" />
|
||||
<asp:BoundField DataField="SubProyecto" ItemStyle-CssClass="ML Truncate" HeaderText="SubProyecto" />
|
||||
@@ -237,10 +241,7 @@
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div id="DivTipoCambio" class="modal fade" role="dialog">
|
||||
@@ -279,6 +280,80 @@
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</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 ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
||||
|
||||
@@ -82,12 +82,13 @@ Partial Class Compras_RepComprasAFDetalle
|
||||
|
||||
#End Region
|
||||
|
||||
Private Personalizado As Boolean = False
|
||||
|
||||
Private Sub Compras_RepComprasAFDetalle_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaCombos()
|
||||
'ImgPersonalizar.Attributes.Add("onclick", "javascript:$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
|
||||
|
||||
|
||||
GvDatos.DataBind(True)
|
||||
|
||||
Try
|
||||
Dim Fecha, FechaI, FechaF As String
|
||||
@@ -163,9 +164,11 @@ Partial Class Compras_RepComprasAFDetalle
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 72 Then
|
||||
GvDatos.Columns(3).Visible = True
|
||||
GvDatos.FBColumn("NoSerie").Visible = True
|
||||
End If
|
||||
|
||||
UPDatos.Update()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -284,18 +287,12 @@ Partial Class Compras_RepComprasAFDetalle
|
||||
CvePS, Anio.ToEntero, Mes.ToEntero, AnioMes, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveClasificacion2:=DdlClasificacion2.SelectedValue.ToEntero) Then
|
||||
DTDatos = ObjCompras.DtResultados
|
||||
|
||||
GvDatos.DataSource = ObjCompras.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
DTDatos = Nothing
|
||||
GvDatos.DataSource = DTDatos
|
||||
End If
|
||||
|
||||
|
||||
ObjCompras.Dispose()
|
||||
GvDatos.DataBind()
|
||||
|
||||
|
||||
|
||||
GvDatos.DataBind(True)
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
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 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
|
||||
Reference in New Issue
Block a user