This commit is contained in:
2024-02-07 05:12:00 -07:00
parent df3b1eeb9e
commit 573652b221
2 changed files with 101 additions and 69 deletions

View File

@@ -11,6 +11,7 @@ Partial Class RepContratosCalendario
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaCombos()
InicializaCalendar()
CargaDatos()
@@ -28,24 +29,27 @@ Partial Class RepContratosCalendario
End Sub
Private Sub InicializaCalendar()
'Lista Activos Fijos'
Dim ObjAF As New ClsAF()
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
If ObjAF.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.Items.Insert(0, New ListItem("Seleccione", ""))
End If
End If
DdlTransporte.DataBind()
ObjAF.Dispose()
RegistraScript("InitCalendar();")
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
End Sub
Private Sub CargaCombos()
DdlTipoAF.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa)
DdlTipoAF.DataBind()
DdlTipoAF.Items.Insert(0, New ListItem("-", ""))
DdlTipoAF.DataBind()
DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa)
DdlAF.DataBind()
DdlAF.Items.Insert(0, New ListItem("-", ""))
DdlTipoAF.DataBind()
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(185)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione", ""))
DdlChofer.Items.Insert(0, New ListItem("-", ""))
RegistraScript("InitCalendar();")
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
End Sub
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
@@ -55,28 +59,23 @@ Partial Class RepContratosCalendario
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
If DdlClientes.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'If DdlClientes.SelectedValue = "" Then
' Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Try
If ObjContratos.UpdateContratos(CveContrato.Value.ToEntero, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero) Then
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
End If
Catch ex As Exception
Alert("Ocurrió un error al actualizar el contrato", TipoMensaje.MsgError)
If ObjContratos.UpdateContratoAF(CveContrato.Value.ToEntero, DdlAF.SelectedValue.ToEntero, DdlChofer.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
Else
ObjContratos.RollBack()
Finally
ObjContratos.Dispose()
CargaDatos()
End Try
End If
ObjContratos.Dispose()
CargaDatos()
End Sub