-- 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 HttpContext.Current.Application(AppNombre) = value
End Set End Set
End Property 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 Property GlobalDTEstatusOrdenCompra() As DataTable
Get Get
GlobalDTEstatusOrdenCompra = DirectCast(Application("GlobalDTEstatusOrdenCompra"), DataTable) 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($"<img src='http://sms.adssistemas.mx/Empresas/186/Logo.png' style='width:200px'></img>")
'Contenido.Append("</div>") 'Contenido.Append("</div>")
Select Case Tipo 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 Case 6
Asunto = "Tu pedido ha sido entregado" 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) 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 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) 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 Case 12
Asunto = "Remisión por facturar ### (folio de Remisión)" Asunto = "Remisión por facturar:" & Folio
Contenido.AppendFormat("Remisión: <a href='https://sms.adssistemas.mx/Ventas/Vetas.aspx?CveVenta={0}'>{1}</a><br/>", CveOS, Folio) Contenido.AppendFormat("Remisión: <a href='https://sms.adssistemas.mx/Ventas/Ventas.aspx?CveVenta={0}'>{1}</a><br/>", CveOS, Folio)
End Select End Select
Contenido.AppendFormat("Fecha y hora de cx: {0}<br/>", FechaCirugía.ToString("dd/MM/yyyy HH:mm")) 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("Hospital: {0}<br/>", Hospital)
Contenido.AppendFormat("Médico: {0}<br/>", Medico) If Medico <> "" Then Contenido.AppendFormat("Médico: {0}<br/>", Medico)
Contenido.AppendFormat("Procedimiento: {0}<br/>", Procedimiento) If Procedimiento <> "" Then Contenido.AppendFormat("Procedimiento: {0}<br/>", Procedimiento)
If Tecnico <> "" Then Contenido.AppendFormat("Técnico: {0}<br/>", Tecnico) If Tecnico <> "" Then Contenido.AppendFormat("Técnico: {0}<br/>", Tecnico)
Contenido.AppendFormat("Vendedor: {0}<br/>", Vendedor) If Vendedor <> "" Then Contenido.AppendFormat("Vendedor: {0}<br/>", Vendedor)
Contenido.AppendFormat("Remisión: {0}<br/>", Remision) If Remision <> "" Then Contenido.AppendFormat("Remisión: {0}<br/>", Remision)
If ListaPS.Count > 0 Then If ListaPS IsNot Nothing Then
Contenido.Append(" <div style='width:100%;text-align:left'>") If ListaPS.Count > 0 Then
Contenido.Append(" <table style='width:100%;font-family:Segoe UI Semibold;font-size:12pt'>") Contenido.Append(" <div style='width:100%;text-align:left'>")
Contenido.AppendFormat("<b>Productos.</b><br/>", Remision) Contenido.Append(" <table style='width:100%;font-family:Segoe UI Semibold;font-size:12pt'>")
For Each ps As GenericaCantidadProducto In ListaPS Contenido.AppendFormat("<b>Productos.</b><br/>", Remision)
Contenido.AppendFormat("<tr><td style='width:25%'>{0}</td><td style='width:75%'>{1}</td></tr>", ps.Cantidad.FormatoNumero(0), ps.Producto) For Each ps As GenericaCantidadProducto In ListaPS
Next Contenido.AppendFormat("<tr><td style='width:25%'>{0}</td><td style='width:75%'>{1}</td></tr>", ps.Cantidad.FormatoNumero(0), ps.Producto)
Contenido.Append(" </table>") Next
Contenido.Append(" </div>") Contenido.Append(" </table>")
Else Contenido.Append(" </div>")
Contenido.AppendFormat("<b>Sin material sobrante.</b><br/>", Remision) Else
Contenido.AppendFormat("<b>Sin material sobrante.</b><br/>", Remision)
End If
End If End If
Contenido.AppendFormat("Remisión: {0}<br/>", Remision)
Contenido.Append(" </body>") Contenido.Append(" </body>")
Contenido.Append("</html>") Contenido.Append("</html>")
If ObjMail.SendMail(tEmpresa, CorreoDestino, Asunto, Contenido.ToString) Then If ObjMail.SendMail(tEmpresa, CorreoDestino, Asunto, Contenido.ToString) Then
End If End If
End Sub End Sub
End Class 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. ") 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
End If End If
GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO
End If End If
End If 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 RBLTipoVenta.SelectedValue.Contiene("1", "2") Then
If DdlTipoComprobante.SelectedValue.Contiene("DPe", "Ped") Then Dim ListMateriales As New List(Of GenericaCantidadProducto)
If Not String.IsNullOrEmpty(CorreoNotificacionPedDev) Then Dim DetalleTable As String = ""
EnviarCorreoDevPed() 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
End If End If
@@ -38240,10 +38253,14 @@ Partial Class Ventas
Protected Sub LBAplicaDevolucion_Click(sender As Object, e As EventArgs) Protected Sub LBAplicaDevolucion_Click(sender As Object, e As EventArgs)
Dim SaldoAlmacen As Decimal = 0 Dim SaldoAlmacen As Decimal = 0
Dim PermiteCancelar As Boolean = True 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 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 If ObjVentas.DtResultados.Rows.Count > 0 Then
Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0) Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal() SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal()
@@ -38267,19 +38284,12 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
DivMotivoDevolucion.Visible = True DivMotivoDevolucion.Visible = True
DdlMotivoDevolucion.DataSource = GlobalDTVentasMotivosDevolucion(UsuarioActual.CveEmpresa)
Using ObjVenta As New ClsVentas DdlMotivoDevolucion.DataBind()
If ObjVenta.GetMotivoDevolucion(-1, 1, UsuarioActual.CveEmpresa) Then DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlMotivoDevolucion.DataSource = ObjVenta.DtResultados.Copy()
End If
DdlMotivoDevolucion.DataBind()
DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Using
UpDevolucion.Update() UpDevolucion.Update()
End If End If
RegistraScript("$('#DivAplicaDevolucion').modal('show');") RegistraScript("$('#DivAplicaDevolucion').modal('show');")
End If End If