-- Activación de GlobalDtVentasMotivoDevolución

This commit is contained in:
2024-10-11 15:24:51 -07:00
parent 1335590a96
commit b934422f03
2 changed files with 85 additions and 37 deletions

View File

@@ -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($"<img src='http://sms.adssistemas.mx/Empresas/186/Logo.png' style='width:200px'></img>")
'Contenido.Append("</div>")
Select Case Tipo
Case 3
Asunto = $"Nuevo Pedido:{FechaCirugía.ToString("dd/MM/yyyy HH:mm")}"
Contenido.AppendFormat("Pedido: <a href='https://sms.adssistemas.mx/Ventas/Ventas.aspx?CveVenta={0}'>{1}</a><br/>", CveOS, Folio)
Case 4
Asunto = $"Nuevo Pedido:{Remision}"
Contenido.AppendFormat("Pedido: <a href='https://sms.adssistemas.mx/Ventas/Vetas.aspx?CveVenta={0}'>{1}</a><br/>", CveOS, Folio)
Case 5
Asunto = "Cirugía de Urgencia"
Contenido.AppendFormat("Pedido: <a href='https://sms.adssistemas.mx/Ventas/Ventas.aspx?CveVenta={0}'>{1}</a><br/>", CveOS, Folio)
Case 6
Asunto = "Tu pedido ha sido entregado"
Contenido.AppendFormat(" <p style='width:100%;text-align:center;font-family:Segoe UI Semibold;font-size:12pt'>OS: <a href='https://sms.adssistemas.mx/OS/OrdenesServicios.aspx?CveOS={0}'>{1}</a><br/></p>", CveOS, Folio)
@@ -11050,37 +11087,38 @@ Public Class ClsPaginas
Asunto = "Sin material por recolectar ; Remisión " & Remision
Contenido.AppendFormat(" <p style='width:100%;text-align:center;font-family:Segoe UI Semibold;font-size:12pt'>OS: <a href='https://sms.adssistemas.mx/OS/OrdenesServicios.aspx?CveOS={0}'>{1}</a><br/></p>", CveOS, Folio)
Case 12
Asunto = "Remisión por facturar ### (folio de Remisión)"
Contenido.AppendFormat("Remisión: <a href='https://sms.adssistemas.mx/Ventas/Vetas.aspx?CveVenta={0}'>{1}</a><br/>", CveOS, Folio)
Asunto = "Remisión por facturar:" & Folio
Contenido.AppendFormat("Remisión: <a href='https://sms.adssistemas.mx/Ventas/Ventas.aspx?CveVenta={0}'>{1}</a><br/>", CveOS, Folio)
End Select
Contenido.AppendFormat("Fecha y hora de cx: {0}<br/>", FechaCirugía.ToString("dd/MM/yyyy HH:mm"))
Contenido.AppendFormat("Hospital: {0}<br/>", Hospital)
Contenido.AppendFormat("Médico: {0}<br/>", Medico)
Contenido.AppendFormat("Procedimiento: {0}<br/>", Procedimiento)
If Medico <> "" Then Contenido.AppendFormat("Médico: {0}<br/>", Medico)
If Procedimiento <> "" Then Contenido.AppendFormat("Procedimiento: {0}<br/>", Procedimiento)
If Tecnico <> "" Then Contenido.AppendFormat("Técnico: {0}<br/>", Tecnico)
Contenido.AppendFormat("Vendedor: {0}<br/>", Vendedor)
Contenido.AppendFormat("Remisión: {0}<br/>", Remision)
If Vendedor <> "" Then Contenido.AppendFormat("Vendedor: {0}<br/>", Vendedor)
If Remision <> "" Then Contenido.AppendFormat("Remisión: {0}<br/>", Remision)
If ListaPS.Count > 0 Then
Contenido.Append(" <div style='width:100%;text-align:left'>")
Contenido.Append(" <table style='width:100%;font-family:Segoe UI Semibold;font-size:12pt'>")
Contenido.AppendFormat("<b>Productos.</b><br/>", Remision)
For Each ps As GenericaCantidadProducto In ListaPS
Contenido.AppendFormat("<tr><td style='width:25%'>{0}</td><td style='width:75%'>{1}</td></tr>", ps.Cantidad.FormatoNumero(0), ps.Producto)
Next
Contenido.Append(" </table>")
Contenido.Append(" </div>")
Else
Contenido.AppendFormat("<b>Sin material sobrante.</b><br/>", Remision)
If ListaPS IsNot Nothing Then
If ListaPS.Count > 0 Then
Contenido.Append(" <div style='width:100%;text-align:left'>")
Contenido.Append(" <table style='width:100%;font-family:Segoe UI Semibold;font-size:12pt'>")
Contenido.AppendFormat("<b>Productos.</b><br/>", Remision)
For Each ps As GenericaCantidadProducto In ListaPS
Contenido.AppendFormat("<tr><td style='width:25%'>{0}</td><td style='width:75%'>{1}</td></tr>", ps.Cantidad.FormatoNumero(0), ps.Producto)
Next
Contenido.Append(" </table>")
Contenido.Append(" </div>")
Else
Contenido.AppendFormat("<b>Sin material sobrante.</b><br/>", Remision)
End If
End If
Contenido.AppendFormat("Remisión: {0}<br/>", Remision)
Contenido.Append(" </body>")
Contenido.Append("</html>")
If ObjMail.SendMail(tEmpresa, CorreoDestino, Asunto, Contenido.ToString) Then
End If
End Sub
End Class

View File

@@ -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