288 lines
9.8 KiB
VB.net
288 lines
9.8 KiB
VB.net
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
|
|
If ObjGral.GetCartaPorteTipoPermisoSCT() Then
|
|
DdlTipoPermisoSCT.DataSource = ObjGral.DtResultados
|
|
End If
|
|
|
|
If ObjGral.GetCartaPorteTiposRemolques() Then
|
|
DdlTiposRemolque.DataSource = ObjGral.DtResultados
|
|
End If
|
|
|
|
|
|
End Using
|
|
|
|
DdlConfigAuto.DataBind()
|
|
DdlConfigAuto.Items.Insert(0, New ListItem("Seleccione Uno ", "-1"))
|
|
|
|
DdlTipoPermisoSCT.DataBind()
|
|
DdlTipoPermisoSCT.Items.Insert(0, New ListItem("Seleccione Uno ", "-1"))
|
|
|
|
DdlTiposRemolque.DataBind()
|
|
DdlTiposRemolque.Items.Insert(0, New ListItem("Seleccione Uno ", "-1"))
|
|
|
|
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 = ""
|
|
TxtNombreAseguradoraMedioAmbiente.Text = ""
|
|
TxtNumPolizaSeguroMedioAmbiente.Text = ""
|
|
TxtNombreAseguradoraCarga.Text = ""
|
|
TxtNumPolizaSeguroCarga.Text = ""
|
|
TxtLongitudCaja.Text = ""
|
|
TxtLineaTransportacion.Text = ""
|
|
TxtNumeroTrailer.Text = ""
|
|
TxtSCAC.Text = ""
|
|
TxtCAAT.Text = ""
|
|
|
|
RdTipoUnidad.SelectedValue = "1"
|
|
LtlTituloModal.Text = "Agregar Unidad"
|
|
DdlTiposRemolque.SelectedValueExist(-1)
|
|
|
|
RdTipoUnidad_SelectedIndexChanged(Nothing, Nothing)
|
|
|
|
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()
|
|
Dim CveTipoRemolque As Integer = GvRow.DataKey("CveTipoRemolque").ToEntero
|
|
|
|
TxtPlacaNuevo.Text = GvRow.DataKey("Placa")
|
|
TxtEspecificacionNuevo.Text = GvRow.DataKey("Especificacion")
|
|
|
|
DdlConfigAuto.SelectedValueExist(GvRow.DataKey("CveConfigAutoTransporte"))
|
|
|
|
TxtAnio.Text = GvRow.DataKey("Anio")
|
|
DdlTipoPermisoSCT.SelectedValueExist(GvRow.DataKey("CveTipoPermisoSCT"))
|
|
TxtNumermisoSCT.Text = GvRow.DataKey("NumPermisoSCT")
|
|
TxtNombreAseguradora.Text = GvRow.DataKey("NombreAseguradora")
|
|
TxtNumPolizaSeguro.Text = GvRow.DataKey("NumPolizaSeguro")
|
|
|
|
TxtNombreAseguradoraMedioAmbiente.Text = GvRow.DataKey("NombreAseguradoraMedioAmbiente")
|
|
TxtNumPolizaSeguroMedioAmbiente.Text = GvRow.DataKey("NumPolizaSeguroMedioAmbiente")
|
|
TxtNombreAseguradoraCarga.Text = GvRow.DataKey("NombreAseguradoraCarga")
|
|
TxtNumPolizaSeguroCarga.Text = GvRow.DataKey("NumPolizaSeguroCarga")
|
|
|
|
DdlTiposRemolque.SelectedValueExist(CveTipoRemolque)
|
|
|
|
TxtNumeroTrailer.Text = GvRow.DataKey("NumeroTrailer")
|
|
TxtLongitudCaja.Text = GvRow.DataKey("LongitudCaja")
|
|
TxtLineaTransportacion.Text = GvRow.DataKey("LineaTransportacion")
|
|
TxtSCAC.Text = GvRow.DataKey("SCAC")
|
|
TxtCAAT.Text = GvRow.DataKey("CAAT")
|
|
|
|
'ChkesRemolque.Checked = (GvRow.DataKey("CveTipoCamion") = "2")
|
|
|
|
RdTipoUnidad.SelectedValue = GvRow.DataKey("CveTipoCamion")
|
|
|
|
LtlTituloModal.Text = "Actualizar Unidad"
|
|
|
|
RdTipoUnidad_SelectedIndexChanged(Nothing, Nothing)
|
|
|
|
|
|
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()
|
|
|
|
Using 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
|
|
End Using
|
|
|
|
|
|
If Not ErrorAlElimiar Then
|
|
GlobalDTInvCamiones(UsuarioActual.CveEmpresa) = Nothing
|
|
CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnAgregarCamion_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim ErrorPrceso As Boolean = False
|
|
|
|
Dim CveTipoCamion As Integer = RdTipoUnidad.SelectedValue.ToEntero
|
|
Using ObjInventarios As New ClsInventarios
|
|
|
|
If CveCamion <= 0 Then
|
|
If ObjInventarios.AddCamiones(TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, UsuarioActual.CveEmpresa, DdlConfigAuto.SelectedValue.ToEntero, TxtAnio.Text.ToEntero(), DdlTipoPermisoSCT.SelectedValue.ToEntero(), TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario,
|
|
TxtNombreAseguradoraMedioAmbiente.Text, TxtNumPolizaSeguroMedioAmbiente.Text, TxtNombreAseguradoraCarga.Text, TxtNumPolizaSeguroCarga.Text, CveTipoCamion, TxtLongitudCaja.Text, TxtLineaTransportacion.Text, TxtSCAC.Text, TxtCAAT.Text, DdlTiposRemolque.SelectedValue.ToEntero(), TxtNumeroTrailer.Text) Then
|
|
Alert("Unidad agregada correctamente")
|
|
Else
|
|
ErrorPrceso = True
|
|
End If
|
|
Else
|
|
If ObjInventarios.UpdateCamiones(CveCamion, TxtPlacaNuevo.Text, TxtEspecificacionNuevo.Text, DdlConfigAuto.SelectedValue.ToEntero, TxtAnio.Text.ToEntero(), DdlTipoPermisoSCT.SelectedValue.ToEntero(), TxtNumermisoSCT.Text, TxtNombreAseguradora.Text, TxtNumPolizaSeguro.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
|
TxtNombreAseguradoraMedioAmbiente.Text, TxtNumPolizaSeguroMedioAmbiente.Text, TxtNombreAseguradoraCarga.Text, TxtNumPolizaSeguroCarga.Text, CveTipoCamion, TxtLongitudCaja.Text, TxtLineaTransportacion.Text, TxtSCAC.Text, TxtCAAT.Text, DdlTiposRemolque.SelectedValue.ToEntero(), TxtNumeroTrailer.Text) Then
|
|
Alert("Unidad actualizada correctamente")
|
|
Else
|
|
ErrorPrceso = True
|
|
End If
|
|
End If
|
|
End Using
|
|
|
|
|
|
If Not ErrorPrceso Then
|
|
GlobalDTInvCamiones(UsuarioActual.CveEmpresa) = Nothing
|
|
CargaDatos()
|
|
End If
|
|
|
|
UpDatos.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarUnidad"))
|
|
|
|
End Sub
|
|
|
|
|
|
Protected Sub RdTipoUnidad_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
|
|
If RdTipoUnidad.SelectedValue.ToEntero = 1 Then
|
|
|
|
DVAnio.Visible = True
|
|
DVConfigAuto.Visible = True
|
|
DVTipoPermisoSCT.Visible = True
|
|
DVNumermisoSCT.Visible = True
|
|
DVNombreAseguradora.Visible = True
|
|
DVNombreAseguradoraMedioAmbiente.Visible = True
|
|
DVNumPolizaSeguroMedioAmbient.Visible = True
|
|
|
|
'DVLineaTransportacion.Visible = True
|
|
'DVSCACCAAT.Visible = True
|
|
|
|
DVTiposRemolque.Visible = False
|
|
'DVLongitudCaja.Visible = False
|
|
|
|
|
|
DVTiposRemolque.Visible = False
|
|
Else
|
|
DVAnio.Visible = False
|
|
DVConfigAuto.Visible = False
|
|
DVTipoPermisoSCT.Visible = False
|
|
DVNumermisoSCT.Visible = False
|
|
DVNombreAseguradora.Visible = False
|
|
DVNombreAseguradoraMedioAmbiente.Visible = False
|
|
DVNumPolizaSeguroMedioAmbient.Visible = False
|
|
|
|
'DVLineaTransportacion.Visible = False
|
|
'DVSCACCAAT.Visible = False
|
|
|
|
DVTiposRemolque.Visible = True
|
|
'DVLongitudCaja.Visible = True
|
|
|
|
|
|
DVTiposRemolque.Visible = True
|
|
|
|
End If
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then
|
|
DvNumeroTrailler.Visible = True
|
|
DVLongitudCaja.Visible = True
|
|
DVLineaTransportacion.Visible = True
|
|
DVSCACCAAT.Visible = True
|
|
Else
|
|
DvNumeroTrailler.Visible = False
|
|
DVLongitudCaja.Visible = False
|
|
DVLineaTransportacion.Visible = False
|
|
DVSCACCAAT.Visible = False
|
|
End If
|
|
|
|
|
|
|
|
UpModalUnidades.Update()
|
|
|
|
End Sub
|
|
End Class
|