+
+
+
+
+
+
+
+
+
+
diff --git a/Acumuladores/RepPolizasVirtuales.aspx.vb b/Acumuladores/RepPolizasVirtuales.aspx.vb
new file mode 100644
index 000000000..314611829
--- /dev/null
+++ b/Acumuladores/RepPolizasVirtuales.aspx.vb
@@ -0,0 +1,60 @@
+Imports System.Data
+Imports Extensiones
+Partial Class Acumuladores_RepPolizasVirtuales
+ Inherits ClsPaginas
+
+
+
+ Private Sub Acumuladores_RepPolizasVirtuales_Load(sender As Object, e As EventArgs) Handles Me.Load
+ If Not Page.IsPostBack Then
+ CargaCombos()
+ End If
+ End Sub
+
+ Private Sub CargaCombos()
+
+ CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto:=LblSubProyecto)
+
+
+ End Sub
+
+ Public Sub CargaDatos()
+
+ LnkExportarExcel.Visible = False
+
+ Dim ObjAcum As New ClsAcumuladores
+
+ Dim FI As Date = If(txtFechaI.Text.Length > 0, txtFechaI.Text.ToDate, MinFecha)
+ Dim FF As Date = If(txtFechaF.Text.Length > 0, txtFechaF.Text.ToDate, MaxFecha)
+
+ If ObjAcum.GetPolizaVirtualRep(FI, FF, DdlOpcion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.Toentero, UsuarioActual.CveUsuario) Then
+ GvDatos.DataSource = ObjAcum.DtResultados
+
+ If ObjAcum.DtResultados.Rows.Count > 0 Then
+ LnkExportarExcel.Visible = True
+ End If
+
+ Else
+ GvDatos.DataSource = Nothing
+ End If
+ ObjAcum.Dispose()
+
+ GvDatos.DataBind()
+ UpDatos.Update()
+ UpAcciones.Update()
+
+ End Sub
+
+
+
+
+
+ Protected Sub BtnBuscar_Click(sender As Object, e As EventArgs)
+ CargaDatos()
+ End Sub
+
+
+ Protected Sub LnkExportarExcel_Click(sender As Object, e As EventArgs)
+ GvDatos.ExportToExcel2($"RepPolizasVirtuales.xlsx")
+ End Sub
+End Class
diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb
index 6a8a46e45..c9886a914 100644
--- a/App_Code/ClsAcumuladores.vb
+++ b/App_Code/ClsAcumuladores.vb
@@ -1135,7 +1135,7 @@ Public Class ClsAcumuladores
End Function
- Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean
+ Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
@@ -1145,6 +1145,7 @@ Public Class ClsAcumuladores
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
@@ -1162,7 +1163,7 @@ Public Class ClsAcumuladores
Return Retorno
End Function
- Public Function GetRepIndicadorDiarioDetalle(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean
+ Public Function GetRepIndicadorDiarioDetalle(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
@@ -1173,6 +1174,7 @@ Public Class ClsAcumuladores
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@Opcion", SqlDbType.Int).Value = Opcion
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
@@ -1278,6 +1280,32 @@ Public Class ClsAcumuladores
End Function
+ Public Function GetPolizaVirtualRep(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, CveUsuario As Integer) As Boolean
+ Dim Retorno As Boolean = False
+
+ SqlDataAdapter("PA_Vta_PolizaVirtualRepGet")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
+ .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
+ .Add("@Opcion", SqlDbType.Int).Value = Opcion
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As SqlException
+ OnError("Ocurrió un error al las polizas virtuales. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+
+ Return Retorno
+ End Function
+
+
#Region " IDisposable Support "
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb
index 40bcd70e1..95802d410 100644
--- a/App_Code/ClsCompras.vb
+++ b/App_Code/ClsCompras.vb
@@ -2457,6 +2457,33 @@ Public Class ClsCompras
End Function
+
+ Public Function GetComplementoTrasladoRep(CveEmpresa As Integer, CveProveedor As Integer, CveTipoProveedor As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveUsuarioRegistro As Integer, CveSubProyecto As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Comp_ComplementoTrasladoRepGet")
+ With SqlAdapter.SelectCommand.Parameters
+
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
+ .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor
+ .Add("@FechaI", SqlDbType.Date).Value = FechaI
+ .Add("@FechaF", SqlDbType.Date).Value = FechaF
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@CveUsuarioRegistro", SqlDbType.Int).Value = CveUsuarioRegistro
+ .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
+
+
+
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error obtener las vinculaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return Retorno
+ End Function
+
Public Function AddVincularPago(CveFactura As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Comp_VincularPagoAdd")
diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb
index 16e26a4a7..6c2279434 100644
--- a/App_Code/ClsGenerales.vb
+++ b/App_Code/ClsGenerales.vb
@@ -3608,40 +3608,8 @@ Public Class ClsGenerales
#End Region
-#Region "IDisposable Support"
- ' IDisposable
- Protected Overridable Sub Dispose(disposing As Boolean)
- If Not Me.disposedValue Then
- If disposing Then
- ' TODO: dispose managed state (managed objects).
- If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
- If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
- If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
- If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
- If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
- If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
-
- End If
-
- ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
- ' TODO: set large fields to null.
- End If
- Me.disposedValue = True
- End Sub
-
-
-
- ' This code added by Visual Basic to correctly implement the disposable pattern.
- Public Sub Dispose() Implements IDisposable.Dispose
- ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
- ConexionClose()
- Dispose(True)
- GC.SuppressFinalize(Me)
- End Sub
-#End Region
-
#Region " P O L I Z A V I R T U A L "
@@ -4138,6 +4106,63 @@ Public Class ClsGenerales
End Function
+
+
+ Public Function GetFolioFechaCancelacion(CveEmpresa As Integer, Tipo As Integer) As Boolean
+
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Gral_FolioFechaCancelacionGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@Tipo", SqlDbType.Int).Value = Tipo
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError($"Ocurrió un error al obtener los datos de fechas de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+
+
+#Region "IDisposable Support"
+
+
+ ' IDisposable
+ Protected Overridable Sub Dispose(disposing As Boolean)
+ If Not Me.disposedValue Then
+ If disposing Then
+ ' TODO: dispose managed state (managed objects).
+ If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
+ If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
+ If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
+ If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
+ If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
+ If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
+
+ End If
+
+ ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
+ ' TODO: set large fields to null.
+ End If
+ Me.disposedValue = True
+ End Sub
+
+
+
+ ' This code added by Visual Basic to correctly implement the disposable pattern.
+ Public Sub Dispose() Implements IDisposable.Dispose
+ ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
+ ConexionClose()
+ Dispose(True)
+ GC.SuppressFinalize(Me)
+ End Sub
+#End Region
+
+
End Class
diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb
index e08b9b811..7cf26beb7 100644
--- a/App_Code/ClsNominas.vb
+++ b/App_Code/ClsNominas.vb
@@ -2429,7 +2429,7 @@ Public Class ClsNominas
retorno = RunQuery("Ocurrió un error al obtener el PA_Nom_CalculoISRAnual.")
Return retorno
End Function
- Public Function GetNominaAcumulado(Ejercicio As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodoI As Integer, CvePeriodoF As Integer, CveEmpresa As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1) As Boolean
+ Public Function GetNominaAcumulado(Ejercicio As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodoI As Integer, CvePeriodoF As Integer, CveEmpresa As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1, Optional CveTipoPeriodo As Integer = -1) As Boolean
Dim retorno As Boolean = False
Try
@@ -2445,6 +2445,7 @@ Public Class ClsNominas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@RegimenContratacion", SqlDbType.Int).Value = RegimenContratacion
.Add("@CvePersonal", SqlDbType.Decimal).Value = CvePersonal
+ .Add("@CveTipoPeriodo", SqlDbType.Decimal).Value = CveTipoPeriodo
End With
SqlAdapter.Fill(DTSet)
retorno = True
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 062a5f89d..5f01455d4 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -4344,6 +4344,11 @@ Public Class ClsPaginas
PaginaDict.Add("/General/JAMComparativos.aspx".ToUpper(), 643)
PaginaDict.Add("/General/CatMotivoRechazoGuias.aspx".ToUpper(), 729)
+ PaginaDict.Add("/General/FolioFechaCancelacion.aspx".ToUpper(), -1)
+
+
+
+
'-------------------------------------------Q U I T A R----------------------------------
#Region "Q U I T A R"
@@ -4755,6 +4760,11 @@ Public Class ClsPaginas
PaginaDict.Add("/OI/CircularDetalleB.aspx".ToUpper(), 757)
PaginaDict.Add("/Compras/CatTipoGasto.aspx".ToUpper(), 759)
+ PaginaDict.Add("/Compras/RepCartaPorteTraslados.aspx".ToUpper(), 1323)
+
+
+
+
#End Region
'CONTABILIDAD
@@ -5645,6 +5655,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Acumuladores/RepIndicadorDiarioDetalle.aspx".ToUpper(), 730)
PaginaDict.Add("/Acumuladores/RepEntradasUsadosClientes.aspx".ToUpper(), 543)
PaginaDict.Add("/Acumuladores/EntradasUsadosResumenRep.aspx".ToUpper(), 1032)
+ PaginaDict.Add("/Acumuladores/RepPolizasVirtuales.aspx".ToUpper(), 1322)
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index 1e17d5ae3..eb05b55d1 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -3345,7 +3345,9 @@ Public Class ClsVentas
'SOLO SI ESTA CANCELADA ANTE SAT EN SIG SE INTENTARA CANCELAR DE NUEVO CONTRA EL SAT
If CveEstatus = 5 Then
- If ObjCancelacion.CFDICancelar(Usuario.Empresa, FolioFiscal, Total, RFCReceptor, Usuario.Empresa.RFC) Then
+ Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(Usuario.Empresa, FolioFiscal, Total, RFCReceptor, Usuario.Empresa.RFC)
+ If Resp.Verificado Then
+
If Not ObjVentas.UpdateEstatusFactura(5, FolioFiscal, ObjCancelacion.CancelacionAcuse, Now, PCveVenta.ToEntero, -1, CvePAC:=Usuario.Empresa.CvePAC) Then
CveVentasError.Add(PCveVenta.ToEntero)
End If
diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index e71e7f447..92d95b07b 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -394,9 +394,14 @@ Namespace Modelos
SetSubProyecto()
SetSubProyectoMatriz()
SetCliente()
+ If ObjVentas.DtResultados.Rows(0)("IEPS").ToString.ToDecimal <= 0 Then
+ Me.VentaDesglosaIEPS = False
+ Else
+ Me.VentaDesglosaIEPS = True
+ End If
SetTotales(ObjVentas.DtResultados, ObjVentas)
+ End If
End If
- End If
If ObjVentas.GetVentaDetalle(CveVenta) Then
Me.DtDetalle = ObjVentas.DtResultados.Copy()
End If
@@ -4902,7 +4907,8 @@ Namespace Modelos
'SI NO SE PUDO OBTENER DEL SERVICIO, UTILIZA EL METODO DE CANCELACION PARA OBTENER EL ACUSE
If CancelacionAcuse = "" Then
- If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then
+ Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion)
+ If Resp.Verificado Then
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
If RequiereAceptacion Then
CancelacionFecha = Now.Date
@@ -4981,15 +4987,18 @@ Namespace Modelos
If Not ObtenerAcuse Then
If ContinuarCancelacion Then
- If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion:=CvePACCancelacion, ValidaFactura:=ValidarSAT, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then
+ Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion:=CvePACCancelacion, ValidaFactura:=ValidarSAT, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion)
+ If Resp.Verificado Then
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
- If RequiereAceptacion Then
- CancelacionFecha = Now.Date
- CveEstatus = 20
- Else
- CancelacionFecha = ObjCancelacion.CancelacionFecha
- CveEstatus = 5
- End If
+ 'If Resp.cve Then
+ ' CancelacionFecha = Now.Date
+ ' CveEstatus = 20
+ 'Else
+ ' CancelacionFecha = ObjCancelacion.CancelacionFecha
+ ' CveEstatus = 5
+ 'End If
+ CveEstatus = Resp.CveEstatus
+ CancelacionFecha = Resp.CancelacionFecha
CancelacionAcuse = ObjCancelacion.CancelacionAcuse
Else
Retorno.Mensaje = "Los servicios de cancelación del SAT no se encuentran disponibles o presentan time out. Intente de nuevo en unos minutos. Origen del error: WebService www.sat.gob.mx"
@@ -5091,7 +5100,7 @@ Namespace Modelos
If Not AplicaRefacturacionConPagos AndAlso ((((ObjFactura.Saldo > 0 AndAlso (CveEstatus > 0 AndAlso Not CveEstatus.Contiene(20, 23))) OrElse (ObjFactura.Total = 0 AndAlso UsuarioActual.CveEmpresa.Contiene(72) AndAlso ObjFactura.TipoDocto.Contiene("Ing"))) AndAlso CveEstatus.Contiene(4, 5)) OrElse (CvePlantillaPoliza = 7 AndAlso (CveEstatus > 0 AndAlso Not CveEstatus.Contiene(20, 23)))) Then
'CUANDO SE CANCELA, LA PÓLIZA DEBE DE SER DE DIARIO
- CvePrePoliza = ObjConta.AddPrePolizas("Modelos/CancelarDocumento", CvePlantillaPoliza, ObjFactura.Total, ObjFactura.Total, ObjFactura.CveMoneda, Now, ObjFactura.Cliente.Nombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
+ CvePrePoliza = ObjConta.AddPrePolizas("Modelos/CancelarDocumento", CvePlantillaPoliza, ObjFactura.Total, ObjFactura.Total, ObjFactura.CveMoneda, CancelacionFecha, ObjFactura.Cliente.Nombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
ObjFactura.CvePrePoliza = CvePrePoliza
If ObjFactura.CvePrePoliza <= 0 Then
@@ -6121,7 +6130,9 @@ Namespace Modelos
ErrorCancelar = True
End If
- If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC) Then
+ Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC)
+
+ If Resp.Verificado Then
'falta verificar traer el acuse y reenviarlo
If UsuarioActual.Empresa.UsaAC Then
Dim Pol As Modelos.RetornoPolizaConta = GenerarPolizaAC(Me, ObjAC, True)
diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb
index a5580d3f9..ddb391a94 100644
--- a/App_Code/Timbrado.vb
+++ b/App_Code/Timbrado.vb
@@ -111,7 +111,8 @@ Public Class Timbrado
End If
solicitud = Nothing
Else
- If CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then
+ Dim Resp As RespuestaCancelacionSAT = CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion)
+ If Resp.Verificado Then
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
CancelacionFecha = Me.CancelacionFecha
CancelacionAcuse = Me.CancelacionAcuse
@@ -206,8 +207,8 @@ Public Class Timbrado
Return Retorno
End Function
- Public Function CFDICancelar(Empresa As Empresa, FolioFiscal As String, Total As Decimal, RFCReceptor As String, RFCEmisor As String, Optional CvePACCancelacion As Integer = 2, Optional ValidaFactura As Boolean = True, Optional CveSATMotivoCancelacion As Integer = -1, Optional FolioSustitucion As String = "") As Boolean
- Dim Retorno As Boolean = False
+ Public Function CFDICancelar(Empresa As Empresa, FolioFiscal As String, Total As Decimal, RFCReceptor As String, RFCEmisor As String, Optional CvePACCancelacion As Integer = 2, Optional ValidaFactura As Boolean = True, Optional CveSATMotivoCancelacion As Integer = -1, Optional FolioSustitucion As String = "") As RespuestaCancelacionSAT
+ Dim Retorno As New RespuestaCancelacionSAT
Dim MsgCancelacion As New StringBuilder
If CvePACCancelacion = 3 Then
@@ -219,10 +220,14 @@ Public Class Timbrado
Dim Vigencia = VerificarVigenciaSAT(FolioFiscal, RFCEmisor, RFCReceptor, Total.ToString(), True)
If Vigencia IsNot Nothing Then
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
- Return False
+ Retorno.Estado = "NO CANCELABLE"
+ Retorno.Verificado = False
+ Return Retorno
End If
Else
- Return False
+ Retorno.Estado = "NO VALIDADO"
+ Retorno.Verificado = False
+ Return Retorno
End If
End If
End If
@@ -277,7 +282,10 @@ Public Class Timbrado
Catch ex As Exception
CancelacionFecha = xmlDoc.GetElementsByTagName("CancelaCFDResult")(0).Attributes("Fecha").Value.ToDate
End Try
- Retorno = True
+
+ Retorno.Verificado = True
+ Retorno.CancelacionFecha = CancelacionFecha
+ Retorno.CancelacionAcuse = CancelacionAcuse
End If
'End If
@@ -324,15 +332,15 @@ Public Class Timbrado
#Region "Valida"
If Not File.Exists(ArchivoCertificado) Then
Alert("El archivo de certificado no existe", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
If Not File.Exists(ArchivoLLave) Then
Alert("El archivo de llave privada no existe", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
If Empresa.ContraseñaKey = "" Then
Alert("La clave no puede ser vacía", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
#End Region
@@ -351,7 +359,7 @@ Public Class Timbrado
llaveBase64 = Convert.ToBase64String(llaveByte)
Catch ex As Exception
Alert($"Error al leer la llave privada: {ex.Message}", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End Try
@@ -360,8 +368,7 @@ Public Class Timbrado
certBase64 = Convert.ToBase64String(certByte)
Catch ex As Exception
Alert($"Error al leer el certificado: {ex.Message}", TipoMensaje.MsgError)
- Return False
-
+ Retorno.Verificado = False
End Try
#End Region
@@ -430,10 +437,14 @@ Public Class Timbrado
CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText
CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate
- Retorno = True
+ Retorno.Verificado = True
+ Retorno.CancelacionFecha = CancelacionFecha
+ Retorno.CancelacionAcuse = CancelacionAcuse
Else
CancelacionAcuse = resp.MensajeDeError
- Retorno = False
+ Retorno.Verificado = True
+ Retorno.CancelacionFecha = CancelacionFecha
+ Retorno.CancelacionAcuse = CancelacionAcuse
End If
solicitud = Nothing
Case 4
@@ -456,10 +467,13 @@ Public Class Timbrado
CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText
CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate
- Retorno = True
+ Retorno.Verificado = True
+ Retorno.CancelacionFecha = CancelacionFecha
+ Retorno.CancelacionAcuse = CancelacionAcuse
Else
CancelacionAcuse = resp.Descripcion
- Retorno = False
+ Retorno.Verificado = True
+ Retorno.CancelacionAcuse = CancelacionAcuse
End If
solicitud = Nothing
End Select
@@ -468,7 +482,7 @@ Public Class Timbrado
End If
Catch ex As Exception
CancelacionMensaje += $" | ex: {ex}"
- Retorno = False
+ Retorno.Verificado = False
End Try
'Libera memoria
@@ -503,15 +517,15 @@ Public Class Timbrado
#Region "Valida"
If Not File.Exists(ArchivoCertificado) Then
Alert("El archivo de certificado no existe", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
If Not File.Exists(ArchivoLLave) Then
Alert("El archivo de llave privada no existe", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
If Empresa.ContraseñaKey = "" Then
Alert("La clave no puede ser vacía", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
#End Region
@@ -561,16 +575,19 @@ Public Class Timbrado
MsgCancelacion.AppendFormat("-3.4.3")
CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText
CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate
+ Retorno.CancelacionAcuse = CancelacionAcuse
+ Retorno.CancelacionFecha = CancelacionFecha
+
Else
CancelacionFecha = Now
End If
+ Retorno.Verificado = True
- Retorno = True
Else
MsgCancelacion.AppendFormat("-3.5")
CancelacionAcuse = resp.NumeroError
CancelacionMensaje = resultadoCancelacion.Descripcion
- Retorno = False
+ Retorno.Verificado = True
End If
Case 4
@@ -599,15 +616,15 @@ Public Class Timbrado
#Region "Valida"
If Not File.Exists(ArchivoCertificado) Then
Alert("El archivo de certificado no existe", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
If Not File.Exists(ArchivoLLave) Then
Alert("El archivo de llave privada no existe", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
If Empresa.ContraseñaKey = "" Then
Alert("La clave no puede ser vacía", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End If
#End Region
@@ -627,7 +644,7 @@ Public Class Timbrado
llaveBase64 = Convert.ToBase64String(llaveByte)
Catch ex As Exception
Alert($"Error al leer la llave privada: {ex.Message}", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End Try
@@ -636,8 +653,7 @@ Public Class Timbrado
certBase64 = Convert.ToBase64String(certByte)
Catch ex As Exception
Alert($"Error al leer el certificado: {ex.Message}", TipoMensaje.MsgError)
- Return False
-
+ Retorno.Verificado = False
End Try
#End Region
objCan.CancelacionCfdi = True
@@ -662,7 +678,9 @@ Public Class Timbrado
CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText
CancelacionFecha = xmlDoc.DocumentElement.Attributes("Fecha").Value.ToDate
- Retorno = True
+ Retorno.Verificado = True
+ Retorno.CancelacionAcuse = CancelacionAcuse
+ Retorno.CancelacionFecha = CancelacionFecha
MsgCancelacion.AppendFormat("4.5.2-")
End If
@@ -671,7 +689,6 @@ Public Class Timbrado
Case 5
CancelacionAcuse = ""
- Retorno = False
MsgCancelacion.AppendFormat("5.1-")
Dim TimbraProduccion As Boolean = True
@@ -700,7 +717,7 @@ Public Class Timbrado
llaveBase64 = Convert.ToBase64String(llaveByte)
Catch ex As Exception
Alert($"Error al leer la llave privada: {ex.Message}", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End Try
Try
@@ -708,7 +725,7 @@ Public Class Timbrado
certBase64 = Convert.ToBase64String(certByte)
Catch ex As Exception
Alert($"Error al leer el certificado: {ex.Message}", TipoMensaje.MsgError)
- Return False
+ Retorno.Verificado = False
End Try
Dim Contrato As String = "72330711-cac6-4106-8051-cbcda1aef495"
@@ -734,8 +751,11 @@ Public Class Timbrado
'EN PROCESO, CANCELABLE SIN ACEPTACION,CANCEALDO PREVIAMENTE
If cancelacion.codigo.Contiene("96", "201", "202") Then
CancelacionFecha = Now
- Retorno = True
+
CancelacionAcuse = result.acuseCancelBase64
+ Retorno = True
+ Retorno.CancelacionAcuse = CancelacionAcuse
+ Retorno.CancelacionFecha = CancelacionFecha
End If
CancelacionMensaje = cancelacion.mensaje
Else
@@ -750,10 +770,29 @@ Public Class Timbrado
Else
Retorno = False
End If
+
+ Retorno.Verificado = Retorno
End Select
+ 'valida que si se halla cancelado
+ Dim VigenciaExtra = VerificarVigenciaSAT(FolioFiscal, RFCEmisor, RFCReceptor, Total.ToString(), True)
+ If Retorno.Verificado AndAlso VigenciaExtra IsNot Nothing Then
+ If VigenciaExtra.Estado.ToUpper = "VIGENTE" AndAlso Not VigenciaExtra.EstatusCancelacion.ToUpper.Contiene("EN PROCESO") Then
+ Retorno.Estado = "VIGENTE"
+ Retorno.CveEstatus = 23
+ End If
+ If VigenciaExtra.Estado.ToUpper = "VIGENTE" AndAlso VigenciaExtra.EstatusCancelacion.ToUpper.Contiene("EN PROCESO") Then
+ Retorno.Estado = "EN PROCESO"
+ Retorno.CveEstatus = 20
+ End If
+ If VigenciaExtra.Estado.ToUpper = "CANCELADO" Then
+ Retorno.Estado = "CANCELADO"
+ Retorno.CveEstatus = 5
+ End If
- If Not Retorno Then
+ End If
+
+ If Not Retorno.Verificado Then
GuardaLog($"****** Error al cancelar factura ****** Estatus: {CancelacionState} | Mensaje: {CancelacionMensaje} | Mensaje SAT: {MsgCancelacion.ToString} ")
End If
@@ -1021,7 +1060,7 @@ Public Class Timbrado
Case 3
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
- Retorno = TimbrarFacturaProFactV40(UsuarioActual, Ventas)
+ Retorno = TimbrarFacturaProFactv40(UsuarioActual, Ventas)
Else
Retorno = TimbrarFacturaProFact(UsuarioActual, Ventas)
End If
@@ -5354,9 +5393,12 @@ Public Class Timbrado
Try
Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg"
- 'temp
- 'Dim b As Byte() = cfdi. .QrCode($"?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}")
- 'File.WriteAllBytes(RutaCBB, b)
+ Dim qrCode As New GoFac.QrCode()
+ 'String cadenaqrCode = qrCode.GenerarCadenaQrCode(txtXml.Text)
+
+ Dim bCBB As Byte() = qrCode.GenerarQrCode($"{LigaVerificacionSAT}?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}&fe=ELleDg==")
+ File.WriteAllBytes(RutaCBB, bCBB)
+ bCBB = Nothing
Catch ex As Exception
OnError("Ocurrió un error al generar el QR", ex)
End Try
diff --git a/App_Code/Timbres.vb b/App_Code/Timbres.vb
index c5fe74c5b..654f5ae7f 100644
--- a/App_Code/Timbres.vb
+++ b/App_Code/Timbres.vb
@@ -85,12 +85,8 @@ Public Class Timbres
Timbre.Comprobante.Descuentos = Obj.Descuento
Timbre.Comprobante.Moneda = "XXX"
Timbre.Comprobante.TipoCambio = "" ' CONDICIÓN SI LA MONEDA ES 'XXX'
-
- Timbre.Receptor.RFC = UsuarioActual.Empresa.RFC
- Timbre.Receptor.Nombre = UsuarioActual.Empresa.Empresa
Timbre.Receptor.UsoCFDI = "P01"
-
Dim totSubTotal As Decimal = Obj.SubTotal
Dim totIVA As Decimal = Obj.IVA
Dim totRetIVA As Decimal = Obj.RetIVA
@@ -124,9 +120,11 @@ Public Class Timbres
If ObjGrales.DtResultados.Rows.Count = 1 Then
Dim DtMovimientos As DataTable = Nothing
-
Dim drT As DataRow = ObjGrales.DtResultados.Rows(0)
+ Timbre.Receptor.RFC = drT("DestinatarioRFC").ToString
+ Timbre.Receptor.Nombre = drT("DestinatarioNombre").ToString
+
CveMovimiento = drT("CveMovimientoAlmacen").ToString.ToEntero
FechaSalida = drT("FechaEntrega").ToString.ToDateTime
FechaLlegada = drT("FechaLlegada").ToString.ToDateTime
diff --git a/App_Code/WsSIGWeb.vb b/App_Code/WsSIGWeb.vb
index d8e3a40da..cee8000b4 100644
--- a/App_Code/WsSIGWeb.vb
+++ b/App_Code/WsSIGWeb.vb
@@ -67,8 +67,9 @@ Public Class WsSIGWeb
'SOLO SI ESTA CANCELADA ANTE SAT EN SIG SE INTENTARA CANCELAR DE NUEVO CONTRA EL SAT
If CveEstatus = 5 Then
- If ObjCancelacion.CFDICancelar(Usuario.Empresa, FolioFiscal, Total, RFCReceptor, Usuario.Empresa.RFC) Then
- If ObjVentas.UpdateEstatusFactura(5, FolioFiscal, ObjCancelacion.CancelacionAcuse, Now, PCveVenta.ToEntero, -1, CvePAC:=Usuario.Empresa.CvePAC) Then
+ Dim Resp As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(Usuario.Empresa, FolioFiscal, Total, RFCReceptor, Usuario.Empresa.RFC)
+ If Resp.Verificado Then
+ If ObjVentas.UpdateEstatusFactura(5, FolioFiscal, ObjCancelacion.CancelacionAcuse, Resp.CancelacionFecha, PCveVenta.ToEntero, -1, CvePAC:=Usuario.Empresa.CvePAC) Then
Retorno = True
Else
MensajeError = $"Ocurrió un error al actualizar la cancelación la CveVenta {PCveVenta}"
diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb
index bb6c90d07..14b8818a4 100644
--- a/App_Code/modExtensiones.vb
+++ b/App_Code/modExtensiones.vb
@@ -147,6 +147,16 @@ Namespace Extensiones
End If
End Function
+ Public Class RespuestaCancelacionSAT
+ Public Property Verificado As Boolean = False
+ Public Property CveEstatus As Integer = 0
+ Public Property Estado As String = ""
+ Public Property EstatusCancelacion As String = ""
+ Public Property CancelacionFecha As Date
+ Public Property CancelacionAcuse As String = ""
+ End Class
+
+
#Region "Log"
@@ -952,11 +962,21 @@ Namespace Extensiones
(Mid(entero, 8, 1) = "0" And Mid(entero, 7, 1) = "0" And Mid(entero, 6, 1) = "0" And Mid(entero, 5, 1) = "0" And Mid(entero, 4, 1) = "0" And Len(entero) < 8) Or
(Mid(entero, 3, 1) <> "0" And Len(entero) = 7) Or
(Mid(entero, 3, 1) <> "0" And Len(entero) = 8) Or
- (Mid(entero, 8, 1) = "0" And Mid(entero, 8, 1) = "0" And Mid(entero, 7, 1) = "0" And Mid(entero, 6, 1) = "0" And Mid(entero, 5, 1) = "0" And Mid(entero, 4, 1) = "0" And Len(entero) = 9) Then
-
- palabras.Append("mil ")
- 'Else
- ' palabras.Append("mil ")
+ (Mid(entero, 8, 1) = "0" And Mid(entero, 8, 1) = "0" And Mid(entero, 7, 1) = "0" And Mid(entero, 6, 1) = "0" And Mid(entero, 5, 1) = "0" And Mid(entero, 4, 1) = "0" And Len(entero) = 9) Then
+
+
+ Dim tmp As String = Mid(entero, 2, 6)
+ If entero.ToString.Length >= 7 And tmp = "000000" Then
+ If entero.ToString.Length = 7 And tmp = "000000" Then
+ palabras.Append("de ")
+ End If
+ Else
+ palabras.Append("mil ")
+ End If
+
+
+ 'Else
+ ' palabras.Append("mil ")
End If
End If
diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb
index 7da7e124b..afd3989c3 100644
--- a/Bancos/IE.aspx.vb
+++ b/Bancos/IE.aspx.vb
@@ -1189,6 +1189,11 @@ Partial Class Bancos_IE
If ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001" Then TrFechaIngCancelacion.Visible = False
End If
+
+ If ObjIE.CveIECancelacion > 0 Then
+ CveIECancelacion = ObjIE.CveIECancelacion
+ End If
+
UpCancelacion.Update()
'OTROS DATOS - DATOS COMPLEMENTO SUSTITUCION
@@ -4805,7 +4810,7 @@ Partial Class Bancos_IE
End Sub
Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) Handles LnkEliminar.Click
- If CveIECancelado > 0 Then
+ If CveIECancelado > 0 Or CveIECancelacion > 0 Then
Alert("El Movimiento no se puede eliminar porque tiene una cancelación relacionada, se tiene que eliminar primero la cancelación", TipoMensaje.MsgAdvertencia)
Else
RegistraScript(String.Format("$('#{0}').modal('show');", "divDescripcion"))
diff --git a/Bancos/PagoElectronicoGrupos.aspx.vb b/Bancos/PagoElectronicoGrupos.aspx.vb
index 0a49c92e3..c7cedb378 100644
--- a/Bancos/PagoElectronicoGrupos.aspx.vb
+++ b/Bancos/PagoElectronicoGrupos.aspx.vb
@@ -656,7 +656,7 @@ Partial Class Bancos_PagoElectronicoGrupos
Dim NombreDelArchivo As String = GvRow.DataKey("Archivo")
Dim ObjBancos As New ClsBancos
- If ObjBancos.GetLayoutPagos(DdlCuentaEnviados.SelectedValue.ToEntero, CveBLE, "-1", PorGrupos:=True) Then
+ If ObjBancos.GetLayoutPagos(DdlCuentaEnviados.SelectedValue.ToEntero, CveBLE, DdlTipoGeneracionEnviados.SelectedValue, PorGrupos:=True) Then
DtRegenerar = ObjBancos.DtResultados
Else
DtRegenerar = Nothing
diff --git a/Bin/GoCfdi.dll b/Bin/GoCfdi.dll
index 84f2dafe4..6f700aebb 100644
Binary files a/Bin/GoCfdi.dll and b/Bin/GoCfdi.dll differ
diff --git a/Bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll b/Bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
index 905ef1009..4d638b3df 100644
Binary files a/Bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll and b/Bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll differ
diff --git a/Bin/roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll b/Bin/roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll
index 2fd00f137..4aca434ef 100644
Binary files a/Bin/roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll and b/Bin/roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll differ
diff --git a/Bin/roslyn/Microsoft.CSharp.Core.targets b/Bin/roslyn/Microsoft.CSharp.Core.targets
index faeeafeb7..65629e5e5 100644
--- a/Bin/roslyn/Microsoft.CSharp.Core.targets
+++ b/Bin/roslyn/Microsoft.CSharp.Core.targets
@@ -19,7 +19,7 @@
@(_DebugSymbolsIntermediatePath);
$(NonExistentFile);
@(CustomAdditionalCompileOutputs)"
- Returns="@(CscCommandLineArgs)"
+ Returns=""
DependsOnTargets="$(CoreCompileDependsOn)"
>