From a2e512deac3b0276c2ab6c8ed9a2091f627fe8d1 Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Wed, 31 Jan 2024 01:06:45 -0700 Subject: [PATCH] =?UTF-8?q?--Se=20agregan=20propiedades=20para=20los=20cam?= =?UTF-8?q?pos=20de=20pesos,=20d=C3=B3lares=20y=20anticipo=20de=20contrato?= =?UTF-8?q?s=20en=20CalendarEvent.vb.=20=20Se=20modifica=20UpdateContratos?= =?UTF-8?q?=20para=20agregarle=20CveChofer=20y=20CveTipoAF=20junto=20a=20l?= =?UTF-8?q?a=20tabla=20Con=5FContratos=20y=20los=20PA=20relacionado.=20Se?= =?UTF-8?q?=20agregan=20a=20CargaEventos=20las=20variables=20relacionadas?= =?UTF-8?q?=20a=20contratos.=20Se=20vuelve=20GetActivosFijos=20a=2013=20pa?= =?UTF-8?q?ra=20que=20despliegue=20una=20lista=20como=20prueba,=20=20se=20?= =?UTF-8?q?mueven=20las=20condiciones=20para=20hacer=20el=20commit=20tanto?= =?UTF-8?q?=20en=20agregar=20como=20actualizar=20y=20se=20agrega=20el=20Vi?= =?UTF-8?q?ewState("CveContrato")=20como=20referencia=20para=20actualizar?= =?UTF-8?q?=20el=20contrato.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/CalendarEvent.vb | 4 + App_Code/ClsContratos.vb | 10 +- Ashx/CargaEventos.ashx | 16 +- Transportes/RepContratos.aspx | 4 +- Transportes/RepContratos.aspx.vb | 27 ++-- Transportes/RepContratosCalendario.aspx | 176 ++++++++++++--------- Transportes/RepContratosCalendario.aspx.vb | 69 +++++++- 7 files changed, 203 insertions(+), 103 deletions(-) diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index f048b5d51..35dfa7999 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -54,6 +54,10 @@ Public Class CalendarEvent Public Property MovimientoFolio As String Public Property CveIE As Integer Public Property FolioIE As String + Public Property Pesos As Double + Public Property Dolares As Double + Public Property Anticipo As Double + End Class diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index a320e3875..79056fcde 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -404,7 +404,7 @@ Public Class ClsContratos Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, - Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "") As Boolean + Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_ContratosUpdate") @@ -426,17 +426,16 @@ Public Class ClsContratos .Add("@PorAnticipo", SqlDbType.Float).Value = PorAnticipo .Add("@PorAmortizacionAnticipo", SqlDbType.Float).Value = PorAmortizacionAnticipo .Add("@PorGarantia", SqlDbType.Float).Value = PorGarantia - '.Add("@EstatusContrato", SqlDbType.Bit).Value = EstatusContrato .Add("@Archivo", SqlDbType.VarChar).Value = Archivo .Add("@Geom", SqlDbType.VarChar).Value = Geom .Add("@CveContratoPadre", SqlDbType.Int).Value = CveContratoPadre .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@EsPresupuestal", SqlDbType.Int).Value = EsPresupuestal + .Add("@EsPresupuestal", SqlDbType.Int).Value = EsPresupuestal + .Add("@CveContratoTipo", SqlDbType.SmallInt).Value = CveContratoTipo .Add("@ImporteMin", SqlDbType.Money).Value = Minimo .Add("@ImporteMax", SqlDbType.Money).Value = Maximo .Add("@Importe", SqlDbType.Money).Value = Importe - .Add("@CveContratoTipo", SqlDbType.SmallInt).Value = CveContratoTipo .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda .Add("@TipoCambio", SqlDbType.Money).Value = TipoCambio .Add("@ModalidadDetalle", SqlDbType.TinyInt).Value = ModalidadDetalle @@ -460,7 +459,8 @@ Public Class ClsContratos .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales - + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + .Add("@CveChofer", SqlDbType.Int).Value = CveChofer End With Try diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index 87bd53ebf..6b930730f 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -464,7 +464,13 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) 'Agregar una hora, fecha final como default cevent.allDay = False - cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero + cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.CveCliente = dr("CveCliente").ToString.ToEntero + cevent.CveActivoFijo = dr("CveTipoAF").ToString.ToEntero + cevent.CvePersonal = dr("CveChofer").ToString.ToEntero + cevent.Dolares = dr("Importe").ToString.ToDecimal + cevent.Pesos = dr("ImporteMax").ToString.ToDecimal + cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal If Not cevent.recurrenciatipo > 0 Then @@ -520,7 +526,11 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) cevent.allDay = False - cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero + cevent.CveCliente = dr("CveCliente").ToString.ToEntero + cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.CveActivoFijo = dr("CveTipoAF").ToString.ToEntero + cevent.CvePersonal = dr("CveChofer").ToString.ToEntero + '11/05/2018 - Evento Gasto Recurrente cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero @@ -543,6 +553,8 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.description = dr("DescripcionContrato").ToString cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) + cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.allDay = False 'cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero 'cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 4e1425160..dd24516c0 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -63,7 +63,7 @@ + data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax,CveChofer "> @@ -145,7 +145,7 @@
- +
diff --git a/Transportes/RepContratos.aspx.vb b/Transportes/RepContratos.aspx.vb index c1d523215..81382b502 100644 --- a/Transportes/RepContratos.aspx.vb +++ b/Transportes/RepContratos.aspx.vb @@ -16,6 +16,7 @@ Partial Class ListadoContratos End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then + ViewState("CveContrato") = 0 InicializaCombos() CargaDatos() End If @@ -23,7 +24,7 @@ Partial Class ListadoContratos Private Sub InicializaCombos() 'Lista Activos Fijos' Dim ObjAF As New ClsAF() - If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then + 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", "")) @@ -93,21 +94,20 @@ Partial Class ListadoContratos '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, CveChofer:=DdlChofer.SelectedValue.ToEntero) - End If - - If CveContratoHijo > 0 Then - ObjContratos.Commit() - Alert("Agregado Correctamente.") + If CveContratoHijo > 0 Then + ObjContratos.Commit() + Alert("Agregado Correctamente.") + End If End If 'Actualizar contrato If BtnGuardar.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 + 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, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero) - If retorno Then - ObjContratos.Commit() - Alert("Actualizado Correctamente.") + If retorno Then + ObjContratos.Commit() + Alert("Actualizado Correctamente.") + End If End If TxtDescripcion.Text = "" @@ -117,6 +117,7 @@ Partial Class ListadoContratos TxtUbicacion.Text = "" DdlClientes.SelectedText = "" DdlTransporte.SelectedValue = "" + DdlChofer.SelectedValue = "" TxtDolares.Text = "" TxtPesos.Text = "" TxtAnticipo.Text = "" @@ -127,13 +128,13 @@ Partial Class ListadoContratos Finally ObjContratos.Dispose() CargaDatos() - End Try + End Sub Protected Sub UpdateContrato(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - + ViewState("CveContrato") = GvRow.DataKey("CveContrato") 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 diff --git a/Transportes/RepContratosCalendario.aspx b/Transportes/RepContratosCalendario.aspx index f774cdb60..47ed3976b 100644 --- a/Transportes/RepContratosCalendario.aspx +++ b/Transportes/RepContratosCalendario.aspx @@ -20,99 +20,99 @@ - - <%--Calendario Tab--%> - + + <%--Calendario Tab--%> + - - -
-
-
-
-
-

Tipo de Vista

-
- - - - + + +
+
+
+
+
+

Tipo de Vista

+ + + + +
-
-
-
+
+
+
- - + + <%--Contratos Tab--%> - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - Fecha
- Salida -
- - - -
+ + + Fecha
+ Salida +
+ + + +
- - - Fecha
- Regreso -
- - - -
+ + + Fecha
+ Regreso +
+ + + +
-
-
-
-
- -
+ + + +
+ + @@ -271,6 +271,13 @@
+
@@ -283,7 +290,7 @@ - +
@@ -309,8 +316,19 @@ } function updateEvent(event, element) { - console.log(event) - $('#<%=BtnActualizar.ClientID%>').click(); + $('#<%=TxtObservaciones.ClientID%>').val(event.title); + $('#<%=TxtDescripcion.ClientID%>').val(event.title); + $('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento); + $('#<%=TxtFechaSalida.ClientID.ToString%>').val(event.start._i); + $('#<%=TxtFechaRegreso.ClientID.ToString%>').val(event.end._i); + $('#<%=DdlClientes.ClientID%>').val(event.CveCliente); + $('#<%=DdlTransporte.ClientID%>').val(event.CveActivoFijo); + $('#<%=DdlChofer.ClientID%>').val(event.CvePersonal); + $('#<%=TxtDolares.ClientID%>').val(event.Dolares); + $('#<%=TxtPesos.ClientID%>').val(event.Pesos); + $('#<%=TxtAnticipo.ClientID%>').val(event.Anticipo); + + $('#<%=BtnModal.ClientID%>').click(); } function RadionButtonSelectedValueSet(name, SelectdValue) { diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index 53facc378..fdd4510e7 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -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