--Se agregó chofer a la tabla de Con_Contratos, y se modificó para que pudiera aceptar CveChofer y mostrarlo en gridview. Se agregó tab de calendario y contratos a RepContratosCalendarios.

This commit is contained in:
AbrahamCastilloV
2024-01-29 17:47:34 -07:00
parent 1a06e0bd2a
commit 1dacf2c7bc
7 changed files with 533 additions and 299 deletions

View File

@@ -16,7 +16,6 @@ Partial Class ListadoContratos
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
DdlClientes.setEsWebService(True)
InicializaCombos()
CargaDatos()
End If
@@ -51,20 +50,22 @@ Partial Class ListadoContratos
UpTitulos.Update()
End Sub
Protected Sub MostrarModal()
TxtDescripcion.Text = ""
TxtFechaSalida.Text = ""
TxtFechaRegreso.Text = ""
TxtObservaciones.Text = ""
TxtUbicacion.Text = ""
DdlTransporte.SelectedValue = ""
DdlClientes.SelectedText = ""
TxtDolares.Text = ""
TxtPesos.Text = ""
TxtAnticipo.Text = ""
BtnGuardar.Text = "Guardar"
myModalLabel.InnerHtml = "Agregar Contrato"
Protected Sub MostrarModal(Optional Descripcion As String = "", Optional FechaSalida As String = "", Optional FechaRegreso As String = "", Optional Observaciones As String = "", Optional Ubicacion As String = "", Optional Transporte As String = "", Optional Cliente As String = "", Optional Dolares As String = "", Optional Pesos As String = "", Optional Anticipo As String = "", Optional Boton As String = "Guardar", Optional Chofer As String = "")
TxtDescripcion.Text = Descripcion
TxtFechaSalida.Text = FechaSalida
TxtFechaRegreso.Text = FechaRegreso
TxtObservaciones.Text = Observaciones
TxtUbicacion.Text = Ubicacion
DdlTransporte.SelectedValue = Transporte
DdlClientes.SelectedText = Cliente
DdlChofer.SelectedValue = Chofer
TxtDolares.Text = Dolares
TxtPesos.Text = Pesos
TxtAnticipo.Text = Anticipo
BtnGuardar.Text = Boton
myModalLabel.InnerHtml = $"{Boton} Contrato"
UpModal.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
Private Sub LBAgregarContrato_Click(sender As Object, e As EventArgs) Handles LBAgregarContrato.Click
@@ -81,7 +82,6 @@ Partial Class ListadoContratos
ObjContratos.IniciaTransacSQL()
Try
Dim CveEstatusInicial As Integer = 10
Dim CveContratoHijo As Integer = -1
Dim CveContratoTipo As Integer = 2
@@ -92,7 +92,7 @@ Partial Class ListadoContratos
End If
'Agregar contrato
If BtnGuardar.Text = "Guardar" Then
CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, 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, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, 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, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero)
End If
If CveContratoHijo > 0 Then
@@ -132,33 +132,10 @@ Partial Class ListadoContratos
End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim fechaInicial As DateTime
Dim fechaFinal As DateTime
CveContrato = GvRow.DataKey("CveContrato").ToEntero
DdlClientes.SelectedValue = GvRow.DataKey("CveCliente")
If GvRow.DataKey("CveCliente").ToEntero > 0 Then
DdlClientes.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=GvRow.DataKey("CveCliente").ToEntero).FiltroPrimeroValor("NombreComercial")
End If
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
TxtObservaciones.Text = GvRow.DataKey("DescripcionContrato")
TxtUbicacion.Text = GvRow.DataKey("Ubicacion")
DdlTransporte.SelectedValue = GvRow.DataKey("CveTipoAF")
TxtDolares.Text = GvRow.DataKey("Importe")
TxtPesos.Text = GvRow.DataKey("ImporteMax")
TxtAnticipo.Text = GvRow.DataKey("ImporteMin")
If DateTime.TryParse(GvRow.DataKey("FechaInicial").ToString, fechaInicial) And DateTime.TryParse(GvRow.DataKey("FechaFinal").ToString, fechaFinal) Then
TxtFechaSalida.Text = fechaInicial.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
TxtFechaRegreso.Text = fechaFinal.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
End If
BtnGuardar.Text = "Editar"
myModalLabel.InnerHtml = "Editar Contrato"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
MostrarModal(
Descripcion:=GvRow.DataKey("DescripcionContrato"), FechaSalida:=GvRow.DataKey("FechaInicial").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"), FechaRegreso:=GvRow.DataKey("FechaFinal").ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T"), Observaciones:=GvRow.DataKey("DescripcionContrato"), Ubicacion:=GvRow.DataKey("Ubicacion"), Transporte:=GvRow.DataKey("CveTipoAF"), Cliente:=GvRow.DataKey("CveCliente"), Dolares:=GvRow.DataKey("Importe"), Pesos:=GvRow.DataKey("ImporteMax"), Anticipo:=GvRow.DataKey("ImporteMin"), Boton:="Editar", Chofer:=GvRow.DataKey("CveChofer"))
End Sub
Protected Sub RemoveContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
@@ -169,7 +146,6 @@ Partial Class ListadoContratos
CargaDatos()
End If
ObjContratos.Dispose()
End Sub
Protected Sub LBExcel_Click(sender As Object, e As EventArgs) Handles LBExcel.Click