This commit is contained in:
2024-02-07 05:20:04 -07:00
26 changed files with 5100 additions and 551 deletions

View File

@@ -1,5 +1,6 @@
Option Explicit On
Option Strict On
Imports System.Data.SqlClient
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
@@ -52,11 +53,53 @@ Partial Class RepContratosCalendario
End Sub
Private Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvContratos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim estatusContrato As String = DataBinder.Eval(e.Row.DataItem, "EstatusContrato").ToString()
Select Case estatusContrato
Case "1"
e.Row.BackColor = Drawing.Color.FromArgb(0, 165, 106)
Case "2"
e.Row.BackColor = Drawing.Color.FromArgb(43, 79, 214)
Case "3"
e.Row.BackColor = Drawing.Color.FromArgb(238, 96, 46)
End Select
End If
End Sub
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
RegistraScript("$('#ModalActualizar').modal('show');")
End Sub
Protected Sub Consultar(sender As Object, e As EventArgs)
If DdlClientesConsulta.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim cliente As Integer = DdlClientesConsulta.SelectedValue.ToEntero
Dim estatus As Integer = DdlEstatusConsulta.SelectedValue.ToEntero
Dim fechaInicial As DateTime = txtFechaI.Text.ToDate
Dim fechaFinal As DateTime = txtFechaF.Text.ToDate
Dim query As String = "SELECT *, ISNULL(Cli.NombreComercial,'') AS NombreComercial, RH.NombreCompleto AS NombreCompleto FROM Con_Contratos C LEFT JOIN Clientes Cli with(nolock) ON Cli.CveCliente = C.CveCliente LEFT JOIN RH_Personal RH with(nolock) ON C.CveChofer = RH.CvePersonal WHERE C.CveCliente = @Cliente AND EstatusContrato = @Estatus AND FechaInicial BETWEEN @FechaInicial AND @FechaFinal"
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString)
Using command As New SqlCommand(query, connection)
command.Parameters.AddWithValue("@Cliente", cliente)
command.Parameters.AddWithValue("@Estatus", estatus)
command.Parameters.AddWithValue("@FechaInicial", fechaInicial)
command.Parameters.AddWithValue("@FechaFinal", fechaFinal)
connection.Open()
Dim reader As SqlDataReader = command.ExecuteReader()
GvContratos.DataSource = reader
GvContratos.DataBind()
End Using
End Using
UpTitulos.Update()
End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
'If DdlClientes.SelectedValue = "" Then
@@ -68,16 +111,28 @@ Partial Class RepContratosCalendario
ObjContratos.IniciaTransacSQL()
If ObjContratos.UpdateContratoAF(CveContrato.Value.ToEntero, DdlAF.SelectedValue.ToEntero, DdlChofer.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
Else
ObjContratos.RollBack()
End If
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
Else
ObjContratos.RollBack()
End If
ObjContratos.Dispose()
CargaDatos()
ObjContratos.Dispose()
CargaDatos()
Protected Sub UpdateModal(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
TxtObservaciones.Text = GvRow.DataKey("Observaciones")
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
TxtUbicacion.Text = GvRow.DataKey("Ubicacion")
TxtFechaSalida.Text = GvRow.DataKey("FechaInicial").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
TxtFechaRegreso.Text = GvRow.DataKey("FechaFinal").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
DdlClientes.SelectedValue = GvRow.DataKey("CveCliente")
DdlAF.SelectedValue = GvRow.DataKey("CveAF")
DdlChofer.SelectedValue = GvRow.DataKey("CveChofer")
UpModal.Update()
RegistraScript("$('#ModalActualizar').modal('show');")
End Sub
End Class