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 Return Retorno
End Function 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 Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasCancelacion") DataAdapter("PA_Vta_VentasCancelacion")
@@ -678,6 +678,7 @@ Public Class ClsVentas
.Add("@SelloDigitalSAT", SqlDbType.VarChar).Value = SelloCancelacionSAT .Add("@SelloDigitalSAT", SqlDbType.VarChar).Value = SelloCancelacionSAT
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC .Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC
.Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion
End With End With
Try Try

View File

@@ -4297,7 +4297,7 @@ Namespace Modelos
End Select End Select
If CveEstatus.Contiene(4, 5) Then 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 ErrorCancelar = True
MensajeError = "Ocurrió un error al guardar el estatus de cancelación." MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
End If End If

View File

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

View File

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

View File

@@ -15529,7 +15529,7 @@ Partial Class Ventas
CancelarDocumento(True) CancelarDocumento(True)
End Sub End Sub
Private Sub BtnRefacturacionConfirmarAceptacion_Click(sender As Object, e As System.EventArgs) Handles BtnRefacturacionConfirmarAceptacion.Click 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 End Sub
Private Sub BtnContabilizar_Click(sender As Object, e As System.EventArgs) Handles BtnContabilizar.Click Private Sub BtnContabilizar_Click(sender As Object, e As System.EventArgs) Handles BtnContabilizar.Click
'Dim ObjMov As New ClsContabilidad 'Dim ObjMov As New ClsContabilidad