Refacturacion sin aceptacion

This commit is contained in:
2019-09-09 16:20:54 -07:00
parent e259e7d7e8
commit f9aa4b899f
5 changed files with 110 additions and 109 deletions

View File

@@ -667,7 +667,7 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function UpdateCancelaVenta(CveVenta As Integer, FechaCancelacion As DateTime, SelloCancelacionSAT As String, CveEmpresa As Integer, Optional CvePAC As Integer = -1) As Boolean
Public Function UpdateCancelaVenta(CveVenta As Integer, FechaCancelacion As DateTime, SelloCancelacionSAT As String, CveEmpresa As Integer, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasCancelacion")
@@ -678,6 +678,7 @@ Public Class ClsVentas
.Add("@SelloDigitalSAT", SqlDbType.VarChar).Value = SelloCancelacionSAT
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC
.Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion
End With
Try

View File

@@ -4297,7 +4297,7 @@ Namespace Modelos
End Select
If CveEstatus.Contiene(4, 5) Then
If Not ObjVentas.UpdateCancelaVenta(CveVenta, CancelacionFecha, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion) Then
If Not ObjVentas.UpdateCancelaVenta(CveVenta, CancelacionFecha, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion, CveEstatusRefacturacion) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
End If

View File

@@ -601,112 +601,112 @@
End If
End If
ObjGPS.Dispose()
If EsProduccion = "1" Then
RegisterNotification()
End If
'-----------------
AspMap.License.SetLicenseKey("ccfecfcegknepnhmjighpjjpmpmbajfejhnladegmeanci")
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
GlobalConfiguration.Configuration.EnsureInitialized()
End Sub
Sub Application_End(sender As Object, e As EventArgs)
If EsProduccion = "1" Then
SqlDependency.Stop(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString)
End If
' Code that runs on application shutdown
End Sub
Sub Application_Error(sender As Object, e As EventArgs)
' Code that runs when an unhandled error occurs
Dim CveUsuario As String = ""
Dim Nombre As String = ""
Try
Dim user As Usuario = ADSSessionConfig.sessionUser
If Not IsNothing(user) Then
CveUsuario = user.CveUsuario.ToString()
Nombre = user.Nombre
End If
Catch ex As Exception
Usuario.CerrarSession()
End Try
Dim InfoAdicional As String = vbCrLf & "CveUsuario: " & CveUsuario & "; Nombre: " & Nombre & vbCrLf & "Ruta: " & Context.Request.RawUrl & " "
OnError("Ocurrió un error en la página.", Context.Error, InfoAdicional)
End Sub
Sub Session_Start(sender As Object, e As EventArgs)
' Code that runs when a new session is started
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'If sessionData.Keys.Contains(HttpContext.Current.Session.SessionID) Then
' sessionData.Remove(HttpContext.Current.Session.SessionID)
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'Else
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'End If
'Application("s") = sessionData
End Sub
Sub Session_End(sender As Object, e As EventArgs)
Dim objsession As Object = ADSSessionConfig.SessionManager(OpcionSession.removerSession, Nothing, -1, Session.SessionID)
If Not IsNothing(objsession) Then
'MyHub.RemoveConexiones(DirectCast(objsession, ADSSessionObj).CveUsuario)
End If
'Code that runs when a session ends.
' Note: The Session_End event Is raised only when the sessionstate mode
' Is set to InProc in the Web.config file. If session mode Is set to StateServer
'' or SQLServer, the event is not raised.
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'sessionData.Remove(HttpContext.Current.Session.SessionID)
'Application("s") = sessionData
End Sub
ObjGPS.Dispose()
'If EsProduccion = "1" Then
' RegisterNotification()
'End If
'-----------------
AspMap.License.SetLicenseKey("ccfecfcegknepnhmjighpjjpmpmbajfejhnladegmeanci")
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
GlobalConfiguration.Configuration.EnsureInitialized()
End Sub
Sub Application_End(sender As Object, e As EventArgs)
If EsProduccion = "1" Then
SqlDependency.Stop(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString)
End If
' Code that runs on application shutdown
End Sub
Sub Application_Error(sender As Object, e As EventArgs)
' Code that runs when an unhandled error occurs
Dim CveUsuario As String = ""
Dim Nombre As String = ""
Try
Dim user As Usuario = ADSSessionConfig.sessionUser
If Not IsNothing(user) Then
CveUsuario = user.CveUsuario.ToString()
Nombre = user.Nombre
End If
Catch ex As Exception
Usuario.CerrarSession()
End Try
Dim InfoAdicional As String = vbCrLf & "CveUsuario: " & CveUsuario & "; Nombre: " & Nombre & vbCrLf & "Ruta: " & Context.Request.RawUrl & " "
OnError("Ocurrió un error en la página.", Context.Error, InfoAdicional)
End Sub
Sub Session_Start(sender As Object, e As EventArgs)
' Code that runs when a new session is started
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'If sessionData.Keys.Contains(HttpContext.Current.Session.SessionID) Then
' sessionData.Remove(HttpContext.Current.Session.SessionID)
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'Else
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'End If
'Application("s") = sessionData
End Sub
Sub Session_End(sender As Object, e As EventArgs)
Dim objsession As Object = ADSSessionConfig.SessionManager(OpcionSession.removerSession, Nothing, -1, Session.SessionID)
If Not IsNothing(objsession) Then
'MyHub.RemoveConexiones(DirectCast(objsession, ADSSessionObj).CveUsuario)
End If
'Code that runs when a session ends.
' Note: The Session_End event Is raised only when the sessionstate mode
' Is set to InProc in the Web.config file. If session mode Is set to StateServer
'' or SQLServer, the event is not raised.
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'sessionData.Remove(HttpContext.Current.Session.SessionID)
'Application("s") = sessionData
End Sub
#Region "S Q L D E P E N D E N C Y"
Public Sub RegisterNotification()
Try
'Get the connection string from the Web.Config file. Make sure that the key exists and it is the connection string for the Notification Database and the NotificationList Table that we created
Dim connectionString As String = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
'We have selected the entire table as the command, so SQL Server executes this script and sees if there is a change in the result, raise the event
Dim commandText As String = "SELECT [FechaNotificacion] FROM dbo.Sis_NotificacionesActualizaciones"
'Start the SQL Dependency
SqlDependency.Start(connectionString)
Using connection As New SqlConnection(connectionString)
Using command As New SqlCommand(commandText, connection)
connection.Open()
Dim sqlDependency = New SqlDependency(command)
AddHandler sqlDependency.OnChange, AddressOf sqlDependency_OnChange
' NOTE: You have to execute the command, or the notification will never fire.
Using reader As SqlDataReader = command.ExecuteReader()
End Using
End Using
End Using
Catch ex As Exception
End Try
End Sub
Private Sub sqlDependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
If e.Info = SqlNotificationInfo.Update Then
Try
Dim ObjNotificaciones As New ClsSisNotificaciones
ObjNotificaciones.ObtenerNotificaciones()
ObjNotificaciones.Dispose()
'System.Threading.Thread.Sleep(5000)
RegisterNotification()
Catch ex As Exception
End Try
End If
'Call the RegisterNotification method again
End Sub
'Public Sub RegisterNotification()
' Try
' 'Get the connection string from the Web.Config file. Make sure that the key exists and it is the connection string for the Notification Database and the NotificationList Table that we created
' Dim connectionString As String = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
' 'We have selected the entire table as the command, so SQL Server executes this script and sees if there is a change in the result, raise the event
' Dim commandText As String = "SELECT [FechaNotificacion] FROM dbo.Sis_NotificacionesActualizaciones"
' 'Start the SQL Dependency
' SqlDependency.Start(connectionString)
' Using connection As New SqlConnection(connectionString)
' Using command As New SqlCommand(commandText, connection)
' connection.Open()
' Dim sqlDependency = New SqlDependency(command)
' AddHandler sqlDependency.OnChange, AddressOf sqlDependency_OnChange
' ' NOTE: You have to execute the command, or the notification will never fire.
' Using reader As SqlDataReader = command.ExecuteReader()
' End Using
' End Using
' End Using
' Catch ex As Exception
' End Try
'End Sub
'Private Sub sqlDependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
' If e.Info = SqlNotificationInfo.Update Then
' Try
' Dim ObjNotificaciones As New ClsSisNotificaciones
' ObjNotificaciones.ObtenerNotificaciones()
' ObjNotificaciones.Dispose()
' 'System.Threading.Thread.Sleep(5000)
' RegisterNotification()
' Catch ex As Exception
' End Try
' End If
' 'Call the RegisterNotification method again
'End Sub
#End Region
</script>

View File

@@ -50,7 +50,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
ObjVentas.Dispose();
GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0");
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion = 1");
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)");
if (DtRefacturar.Rows.Count > 0)
{
DivRefacturar.Visible = true;

View File

@@ -15529,7 +15529,7 @@ Partial Class Ventas
CancelarDocumento(True)
End Sub
Private Sub BtnRefacturacionConfirmarAceptacion_Click(sender As Object, e As System.EventArgs) Handles BtnRefacturacionConfirmarAceptacion.Click
Response.Redirect(String.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta))
CancelarDocumento(True)
End Sub
Private Sub BtnContabilizar_Click(sender As Object, e As System.EventArgs) Handles BtnContabilizar.Click
'Dim ObjMov As New ClsContabilidad