Unidades, rep comisiones
This commit is contained in:
167
Inventarios/CatUnidades.aspx.vb
Normal file
167
Inventarios/CatUnidades.aspx.vb
Normal file
@@ -0,0 +1,167 @@
|
||||
Imports Extensiones
|
||||
Partial Class Inventarios_CatUnidades
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property CveCamion As Integer
|
||||
Get
|
||||
|
||||
If ViewState("CveCamion") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("CveCamion").ToString().ToEntero()
|
||||
End If
|
||||
End Get
|
||||
Set(ByVal value As Integer)
|
||||
ViewState("CveCamion") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Sub Catalogos_CatPtoSubFunsion_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaCombos()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDatos()
|
||||
|
||||
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
|
||||
If ObjInventarios.GetCamiones(-1, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjInventarios.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjInventarios.Dispose()
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCombos()
|
||||
|
||||
Using ObjGral As New ClsGenerales
|
||||
If ObjGral.GetCartaPorteConfigAutoTransportes() Then
|
||||
DdlConfigAuto.DataSource = ObjGral.DtResultados
|
||||
End If
|
||||
End Using
|
||||
|
||||
DdlConfigAuto.DataBind()
|
||||
|
||||
UpModalUnidades.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub LnkAgregarUnidad_Click(sender As Object, e As EventArgs)
|
||||
|
||||
CveCamion = -1
|
||||
|
||||
BtnAgregarCamion.Text = "Agregar"
|
||||
|
||||
TxtPlacaNuevo.Text = ""
|
||||
TxtEspecificacionNuevo.Text = ""
|
||||
TxtEspecificacionNuevo.Text = ""
|
||||
DdlConfigAuto.SelectedValueExist(-1)
|
||||
|
||||
TxtAnio.Text = ""
|
||||
TxtTipoPermisoSCT.Text = ""
|
||||
TxtNumermisoSCT.Text = ""
|
||||
TxtNombreAseguradora.Text = ""
|
||||
TxtNumPolizaSeguro.Text = ""
|
||||
|
||||
LtlTituloModal.Text = "Agregar Unidad"
|
||||
|
||||
UpModalUnidades.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarUnidad"))
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkEditar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
BtnAgregarCamion.Text = "Actualizar"
|
||||
Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow)
|
||||
|
||||
CveCamion = GvRow.DataKey("CveCamion").ToEntero()
|
||||
|
||||
|
||||
TxtPlacaNuevo.Text = GvRow.DataKey("Placa")
|
||||
TxtEspecificacionNuevo.Text = GvRow.DataKey("Especificacion")
|
||||
|
||||
DdlConfigAuto.SelectedValueExist(GvRow.DataKey("ConfigCartaPorte"))
|
||||
|
||||
TxtAnio.Text = GvRow.DataKey("Anio")
|
||||
TxtTipoPermisoSCT.Text = GvRow.DataKey("TipoPermisoSCT")
|
||||
TxtNumermisoSCT.Text = GvRow.DataKey("NumPermisoSCT")
|
||||
TxtNombreAseguradora.Text = GvRow.DataKey("NombreAseguradora")
|
||||
TxtNumPolizaSeguro.Text = GvRow.DataKey("NumPolizaSeguro")
|
||||
|
||||
LtlTituloModal.Text = "Actualizar Unidad"
|
||||
|
||||
UpModalUnidades.Update()
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarUnidad"))
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ErrorAlElimiar As Boolean = False
|
||||
|
||||
Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow)
|
||||
|
||||
Dim CveCamionEliminar = GvRow.DataKey("CveCamion").ToEntero()
|
||||
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
|
||||
If (ObjInventarios.RemoveCamiones(CveCamionEliminar, UsuarioActual.CveEmpresa)) Then
|
||||
|
||||
UpDatos.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarUnidad"))
|
||||
Alert("Unidad Eliminada Correctamente")
|
||||
Else
|
||||
ErrorAlElimiar = True
|
||||
End If
|
||||
|
||||
ObjInventarios.Dispose()
|
||||
|
||||
If Not ErrorAlElimiar Then
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarCamion_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ErrorPrceso As Boolean = False
|
||||
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
|
||||
If CveCamion <= 0 Then
|
||||
If ObjInventarios.AddCamiones(TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, UsuarioActual.CveEmpresa, DdlConfigAuto.SelectedValue, TxtAnio.Text.ToEntero(), TxtTipoPermisoSCT.Text, TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario) Then
|
||||
Alert("Unidad agregada correctamente")
|
||||
Else
|
||||
ErrorPrceso = True
|
||||
End If
|
||||
Else
|
||||
If ObjInventarios.UpdateCamiones(CveCamion, TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, DdlConfigAuto.SelectedValue, TxtAnio.Text.ToEntero(), TxtTipoPermisoSCT.Text, TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Unidad actualizada correctamente")
|
||||
Else
|
||||
ErrorPrceso = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If Not ErrorPrceso Then
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
UpDatos.Update()
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarUnidad"))
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user