From b934422f03d18fa152de686a34eea7b3f4b50b2a Mon Sep 17 00:00:00 2001 From: rrene Date: Fri, 11 Oct 2024 15:24:51 -0700 Subject: [PATCH] =?UTF-8?q?--=20Activaci=C3=B3n=20de=20GlobalDtVentasMotiv?= =?UTF-8?q?oDevoluci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsPaginas.vb | 76 +++++++++++++++++++++++++++++++----------- Ventas/Ventas.aspx.vb | 46 +++++++++++++++---------- 2 files changed, 85 insertions(+), 37 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 2370b8389..43141b6c8 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1512,6 +1512,34 @@ Public Class ClsPaginas HttpContext.Current.Application(AppNombre) = value End Set End Property + + Public Shared Property GlobalDTVentasMotivosDevolucion(CveEmpresa As Integer) As DataTable + Get + Dim AppNombre As String = $"GlobalDTVentasMotivosDevolucion-{CveEmpresa}" + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjGral As New ClsVentas() + If ObjGral.GetMotivoDevolucion(-1, 1, CveEmpresa) Then + HttpContext.Current.Application(AppNombre) = ObjGral.DtResultados + End If + ObjGral.Dispose() + End If + If HttpContext.Current.Application(AppNombre) IsNot Nothing Then + Dim Str As New StringBuilder + Str.AppendFormat(" 1 = 1 ") + 'If CveMotivoCancelacion > 0 Then Str.AppendFormat(" AND CveMotivoCancelacion = {0}", CveMotivoCancelacion) + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTVentasMotivosDevolucion = Dv.ToTable + Dv.Dispose() + Else + GlobalDTVentasMotivosDevolucion = Nothing + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = $"GlobalDTVentasMotivosDevolucion-{CveEmpresa}" + HttpContext.Current.Application(AppNombre) = value + End Set + End Property Property GlobalDTEstatusOrdenCompra() As DataTable Get GlobalDTEstatusOrdenCompra = DirectCast(Application("GlobalDTEstatusOrdenCompra"), DataTable) @@ -11037,6 +11065,15 @@ Public Class ClsPaginas 'Contenido.Append($"") 'Contenido.Append("") Select Case Tipo + Case 3 + Asunto = $"Nuevo Pedido:{FechaCirugía.ToString("dd/MM/yyyy HH:mm")}" + Contenido.AppendFormat("Pedido: {1}
", CveOS, Folio) + Case 4 + Asunto = $"Nuevo Pedido:{Remision}" + Contenido.AppendFormat("Pedido: {1}
", CveOS, Folio) + Case 5 + Asunto = "Cirugía de Urgencia" + Contenido.AppendFormat("Pedido: {1}
", CveOS, Folio) Case 6 Asunto = "Tu pedido ha sido entregado" Contenido.AppendFormat("

OS: {1}

", CveOS, Folio) @@ -11050,37 +11087,38 @@ Public Class ClsPaginas Asunto = "Sin material por recolectar ; Remisión " & Remision Contenido.AppendFormat("

OS: {1}

", CveOS, Folio) Case 12 - Asunto = "Remisión por facturar ### (folio de Remisión)" - Contenido.AppendFormat("Remisión: {1}
", CveOS, Folio) + Asunto = "Remisión por facturar:" & Folio + Contenido.AppendFormat("Remisión: {1}
", CveOS, Folio) End Select Contenido.AppendFormat("Fecha y hora de cx: {0}
", FechaCirugía.ToString("dd/MM/yyyy HH:mm")) Contenido.AppendFormat("Hospital: {0}
", Hospital) - Contenido.AppendFormat("Médico: {0}
", Medico) - Contenido.AppendFormat("Procedimiento: {0}
", Procedimiento) + If Medico <> "" Then Contenido.AppendFormat("Médico: {0}
", Medico) + If Procedimiento <> "" Then Contenido.AppendFormat("Procedimiento: {0}
", Procedimiento) If Tecnico <> "" Then Contenido.AppendFormat("Técnico: {0}
", Tecnico) - Contenido.AppendFormat("Vendedor: {0}
", Vendedor) - Contenido.AppendFormat("Remisión: {0}
", Remision) + If Vendedor <> "" Then Contenido.AppendFormat("Vendedor: {0}
", Vendedor) + If Remision <> "" Then Contenido.AppendFormat("Remisión: {0}
", Remision) - If ListaPS.Count > 0 Then - Contenido.Append("
") - Contenido.Append(" ") - Contenido.AppendFormat("Productos.
", Remision) - For Each ps As GenericaCantidadProducto In ListaPS - Contenido.AppendFormat("", ps.Cantidad.FormatoNumero(0), ps.Producto) - Next - Contenido.Append("
{0}{1}
") - Contenido.Append("
") - Else - Contenido.AppendFormat("Sin material sobrante.
", Remision) + If ListaPS IsNot Nothing Then + If ListaPS.Count > 0 Then + Contenido.Append("
") + Contenido.Append(" ") + Contenido.AppendFormat("Productos.
", Remision) + For Each ps As GenericaCantidadProducto In ListaPS + Contenido.AppendFormat("", ps.Cantidad.FormatoNumero(0), ps.Producto) + Next + Contenido.Append("
{0}{1}
") + Contenido.Append("
") + Else + Contenido.AppendFormat("Sin material sobrante.
", Remision) + End If End If - Contenido.AppendFormat("Remisión: {0}
", Remision) + Contenido.Append(" ") Contenido.Append("") If ObjMail.SendMail(tEmpresa, CorreoDestino, Asunto, Contenido.ToString) Then End If - End Sub End Class diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 26a8e02ba..fdfe809ff 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -11355,17 +11355,30 @@ Partial Class Ventas MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") End If End If - GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO End If End If End If + 'ENVIAR NOTIFICACION DE SMS + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + If DdlTipoComprobante.SelectedValue.Contiene("Ped") Then + Dim CorreoDestino As String = "rene.molina@adssistemas.mx" - 'ENVIA CORREO CON DETALLE DEL CONTRATO - If DdlTipoComprobante.SelectedValue.Contiene("DPe", "Ped") Then - If Not String.IsNullOrEmpty(CorreoNotificacionPedDev) Then - EnviarCorreoDevPed() + If RBLTipoVenta.SelectedValue.Contiene("1", "2") Then + Dim ListMateriales As New List(Of GenericaCantidadProducto) + Dim DetalleTable As String = "" + For Each dRow As DataRow In TmpDT.Rows + ListMateriales.Add(New GenericaCantidadProducto With {.Cantidad = dRow("Cantidad").ToString.ToEntero, .Producto = dRow("PS").ToString}) + Next + EnviaNotificacionSMS(3, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, "", DdlVendedor.SelectedItem.Text, "", ListMateriales, CorreoDestino) + Else + EnviaNotificacionSMS(4, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, "", DdlVendedor.SelectedItem.Text, "", Nothing, CorreoDestino) + End If + 'cirugía en el mismo día o si es despues de las 9 y requiere técnico, 'jefe de técnicos + If TxtFechaOS.Text.ToDate.ToShortDateString = NowADS.ToShortDateString OrElse (NowADS.Hour > 21 OrElse ChkRequiereTecnicoModal.Checked) Then + EnviaNotificacionSMS(5, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, "", DdlVendedor.SelectedItem.Text, "", Nothing, CorreoDestino) + End If End If End If @@ -38240,10 +38253,14 @@ Partial Class Ventas Protected Sub LBAplicaDevolucion_Click(sender As Object, e As EventArgs) Dim SaldoAlmacen As Decimal = 0 - Dim PermiteCancelar As Boolean = True + Dim tCveVentaDevolucion As Integer = CveVenta + If CveVentaPadre > 0 Then + tCveVentaDevolucion = CveVentaPadre + DevolucionAlmacen = 0 + End If Using ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then + If ObjVentas.GetVenta(tCveVentaDevolucion, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0) SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal() @@ -38267,19 +38284,12 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then DivMotivoDevolucion.Visible = True - - Using ObjVenta As New ClsVentas - If ObjVenta.GetMotivoDevolucion(-1, 1, UsuarioActual.CveEmpresa) Then - DdlMotivoDevolucion.DataSource = ObjVenta.DtResultados.Copy() - End If - DdlMotivoDevolucion.DataBind() - DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Using - + DdlMotivoDevolucion.DataSource = GlobalDTVentasMotivosDevolucion(UsuarioActual.CveEmpresa) + DdlMotivoDevolucion.DataBind() + DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) UpDevolucion.Update() + End If - - RegistraScript("$('#DivAplicaDevolucion').modal('show');") End If