--Se agregan propiedades para los campos de pesos, dólares y anticipo de contratos en CalendarEvent.vb. Se modifica UpdateContratos para agregarle CveChofer y CveTipoAF junto a la tabla Con_Contratos y los PA relacionado. Se agregan a CargaEventos las variables relacionadas a contratos. Se vuelve GetActivosFijos a 13 para que despliegue una lista como prueba, se mueven las condiciones para hacer el commit tanto en agregar como actualizar y se agrega el ViewState("CveContrato") como referencia para actualizar el contrato.

This commit is contained in:
AbrahamCastilloV
2024-01-31 01:06:45 -07:00
parent e2a70ea368
commit a2e512deac
7 changed files with 203 additions and 103 deletions

View File

@@ -1,11 +1,20 @@
Option Explicit On
Option Strict On
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
Partial Class RepContratosCalendario
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property CveContrato As Integer
Get
Return ViewState("CveContrato").ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveContrato") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -27,15 +36,71 @@ 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()
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(185)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione", ""))
RegistraScript("InitCalendar();")
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
End Sub
Protected Sub ActualizarContrato(sender As Object, e As System.EventArgs)
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
RegistraScript("$('#ModalActualizar').modal('show');")
End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
If DdlClientes.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Try
Dim CveEstatusInicial As Integer = 10
Dim CveContratoHijo As Integer = -1
Dim CveContratoTipo As Integer = 2
Dim retorno As Boolean = False
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
End If
'Actualizar contrato
If BtnActualizar.Text = "Editar" Then
retorno = ObjContratos.UpdateContratos(CveContrato, "", 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)
End If
If retorno Then
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
End If
Catch ex As Exception
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
ObjContratos.RollBack()
Finally
ObjContratos.Dispose()
CargaDatos()
End Try
End Sub
End Class