Files
SIG/Contabilidad/PlantillasPolizas.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

83 lines
3.4 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports System.Linq
Imports Extensiones
Partial Class Contabilidad_PlantillasPolizas
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaDatos()
End If
End Sub
Public Sub CargaDatos()
Dim ObjPlantillaPolizas As New ClsContabilidad
If ObjPlantillaPolizas.GetConta_PlantillasPolizas(-1, -1) Then
GvDatos.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GvDatos.DataBind()
DdlPlantillaPoliza.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros("", "", {"CvePlantillaPoliza", "PlantillaPoliza"})
DdlPlantillaPoliza.DataBind()
Else
Me.GvDatos.DataSource = Nothing
End If
OrdenaDatos()
ObjPlantillaPolizas.Dispose()
End Sub
Private Sub DdlPlantillaPoliza_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPlantillaPoliza.SelectedIndexChanged
Response.Redirect(String.Format("/Contabilidad/PlantillasPolizasDetalle.aspx?CvePlantillaPoliza={0}", DdlPlantillaPoliza.SelectedValue))
End Sub
#Region "G V D A T O S"
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.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(50)
e.Row.Cells(1).Width = Unit.Pixel(250)
e.Row.Cells(2).Width = Unit.Pixel(100)
e.Row.Cells(3).Width = Unit.Pixel(100)
e.Row.Cells(4).Width = Unit.Pixel(100)
e.Row.Cells(5).Width = Unit.Pixel(100)
e.Row.Cells(6).Width = Unit.Pixel(80)
End If
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.FCLiteral("LtlPlantillaPoliza").Text = "<a class=""Texto"" href=""/Contabilidad/PlantillasPolizasDetalle.aspx?CvePlantillaPoliza=" & e.Row.DBCampo("CvePlantillaPoliza") & """>" & e.Row.FCLiteral("LtlPlantillaPoliza").Text & "</a>"
End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim ObjPlantillaPolizas As New ClsContabilidad
If ObjPlantillaPolizas.RemoveConta_PlantillasPolizasDetalle(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
If ObjPlantillaPolizas.RemoveConta_PlantillasPolizas(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero, UsuarioActual.CveEmpresa) Then
GvDatos.EditIndex = -1
GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa) = ObjPlantillaPolizas.DtResultados
CargaDatos()
Alert("La Plantilla Poliza se eliminó correctamente.", TipoMensaje.MsgInformacion)
End If
End If
ObjPlantillaPolizas.Dispose()
End Sub
#End Region
#Region " O R D E N A M I E N T O JAVASCRIPT"
Private Sub OrdenaDatos()
If (GvDatos.Rows.Count > 0) Then
GvDatos.UseAccessibleHeader = True
GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
RegistraScript("OrdenarGV();")
End If
End Sub
#End Region
End Class