SIG. Mejoras en proceso de cancelacion. Reforma fiscal 2022
This commit is contained in:
@@ -269,7 +269,39 @@ Public Class ClsGenerales
|
|||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
retorno = True
|
retorno = True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error al obtener los mptivos de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
OnError("Ocurrió un error al obtener los motivos de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
Return retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GetMotivosCancelacionEmpresa(CveEmpresa As Integer, Optional CveMotivoCancelacion As Integer = -1, Optional CveSATMotivoCancelacion As Integer = -1) As Boolean
|
||||||
|
Dim retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Gral_MotivosCancelacionGet")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
.Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion
|
||||||
|
.Add("@CveSATMotivoCancelacion", SqlDbType.Int).Value = CveSATMotivoCancelacion
|
||||||
|
End With
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener los motivos de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
Return retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GenerarMotivosCancelacionEmpresaDefault(CveEmpresa As Integer) As Boolean
|
||||||
|
Dim retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Gral_MotivosCancelacionDefaultAdd")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
End With
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al agregar los motivos de cancelacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End Try
|
End Try
|
||||||
Return retorno
|
Return retorno
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -1141,7 +1141,7 @@ Public Class ClsPaginas
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Shared Property GlobalDTSATMotivosCancelacion(Optional CveMotivoCancelacion As Integer = -1, Optional CodigoSAT As String = "-1") As DataTable
|
Public Shared Property GlobalDTSATMotivosCancelacion(Optional CveSATMotivoCancelacion As Integer = -1, Optional CodigoSAT As String = "-1") As DataTable
|
||||||
Get
|
Get
|
||||||
If HttpContext.Current.Application("GlobalDTSATMotivosCancelacion") Is Nothing Then
|
If HttpContext.Current.Application("GlobalDTSATMotivosCancelacion") Is Nothing Then
|
||||||
Using ObjGral As New ClsGenerales
|
Using ObjGral As New ClsGenerales
|
||||||
@@ -1151,13 +1151,13 @@ Public Class ClsPaginas
|
|||||||
End Using
|
End Using
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveMotivoCancelacion <> -1 OrElse CodigoSAT <> "-1" Then
|
If CveSATMotivoCancelacion <> -1 OrElse CodigoSAT <> "-1" Then
|
||||||
Dim StrSQL As New StringBuilder
|
Dim StrSQL As New StringBuilder
|
||||||
StrSQL.Append("1=1")
|
StrSQL.Append("1=1")
|
||||||
If CveMotivoCancelacion <> -1 Then StrSQL.AppendFormat(" AND CveMotivoCancelacion = {0}", CveMotivoCancelacion)
|
If CveSATMotivoCancelacion <> -1 Then StrSQL.AppendFormat(" AND CveSATMotivoCancelacion = {0}", CveSATMotivoCancelacion)
|
||||||
If CodigoSAT <> "-1" Then StrSQL.AppendFormat(" AND CodigoSAT = '{0}'", CodigoSAT)
|
If CodigoSAT <> "-1" Then StrSQL.AppendFormat(" AND CodigoSAT = '{0}'", CodigoSAT)
|
||||||
|
|
||||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSATMotivosCancelacion"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), " CveMotivoCancelacion", DataViewRowState.CurrentRows)
|
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSATMotivosCancelacion"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), " CveSATMotivoCancelacion", DataViewRowState.CurrentRows)
|
||||||
GlobalDTSATMotivosCancelacion = Dv.ToTable
|
GlobalDTSATMotivosCancelacion = Dv.ToTable
|
||||||
Dv.Dispose()
|
Dv.Dispose()
|
||||||
Else
|
Else
|
||||||
@@ -1169,6 +1169,47 @@ Public Class ClsPaginas
|
|||||||
HttpContext.Current.Application("GlobalDTSATMotivosCancelacion") = value
|
HttpContext.Current.Application("GlobalDTSATMotivosCancelacion") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public Shared Property GlobalDTMotivosCancelacionEmpresa(CveEmpresa As Integer, Optional CveMotivoCancelacion As Integer = -1, Optional CveSATMotivoCancelacion As Integer = -1) As DataTable
|
||||||
|
Get
|
||||||
|
Dim AppNombre As String = String.Format("GlobalDTMotivosCancelacionEmpresa-{0}", CveEmpresa)
|
||||||
|
'sino existe, recarga los datos
|
||||||
|
If HttpContext.Current.Application(AppNombre) Is Nothing Then
|
||||||
|
Dim ObjGral As New ClsGenerales()
|
||||||
|
If ObjGral.GetMotivosCancelacionEmpresa(CveEmpresa) Then
|
||||||
|
'SI NO TIENE, GENERA LOS MOTIVOS
|
||||||
|
If ObjGral.DtResultados.Rows.Count = 0 Then
|
||||||
|
If ObjGral.GenerarMotivosCancelacionEmpresaDefault(CveEmpresa) Then
|
||||||
|
If ObjGral.GetMotivosCancelacionEmpresa(CveEmpresa) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
||||||
|
HttpContext.Current.Application(AppNombre) = ObjGral.DtResultados
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
HttpContext.Current.Application(AppNombre) = ObjGral.DtResultados
|
||||||
|
End If
|
||||||
|
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)
|
||||||
|
If CveSATMotivoCancelacion > 0 Then Str.AppendFormat(" AND CveSATMotivoCancelacion = {0}", CveSATMotivoCancelacion)
|
||||||
|
|
||||||
|
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
|
||||||
|
GlobalDTMotivosCancelacionEmpresa = Dv.ToTable
|
||||||
|
Dv.Dispose()
|
||||||
|
Else
|
||||||
|
GlobalDTMotivosCancelacionEmpresa = Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
Dim AppNombre As String = String.Format("GlobalDTMotivosCancelacionEmpresa-{0}", 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)
|
||||||
|
|||||||
@@ -241,6 +241,26 @@ Public Class ClsVentas
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function GetVentasPendientesCancelacion(CveEmpresa As Integer, CveUsuarioConsulta As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Vta_VentasPendientesCancelacionGet")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener las Ventas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function GetVentaComplementos() As Boolean
|
Public Function GetVentaComplementos() As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Vta_ComplementosGet")
|
DataAdapter("PA_Vta_ComplementosGet")
|
||||||
|
|||||||
@@ -4585,7 +4585,7 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
|
|
||||||
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=Me.RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusFacturaAsignado:=CveEstatus, FechaCancelacion:=FechaCancelacion.ToString("dd/MM/yyyy hh:mm:ss"), AcuseCancelacion:=AcuseCancelacion)
|
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=Me.RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusFacturaAsignado:=CveEstatus, FechaCancelacion:=FechaCancelacion.ToString("dd/MM/yyyy hh:mm:ss"), AcuseCancelacion:=AcuseCancelacion, CveMotivoCancelacion:=Me.CveMotivoCancelacion, MotivoCancelacion:=Me.MotivoCancelacion)
|
||||||
End Function
|
End Function
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Cancela la factura para poder realizar la refacturacion
|
''' Cancela la factura para poder realizar la refacturacion
|
||||||
@@ -4600,9 +4600,9 @@ Namespace Modelos
|
|||||||
''' <param name="RealizarDevolucionAlmacen"></param>
|
''' <param name="RealizarDevolucionAlmacen"></param>
|
||||||
''' <param name="ListaRemisionesCancelar"></param>
|
''' <param name="ListaRemisionesCancelar"></param>
|
||||||
''' <returns></returns>
|
''' <returns></returns>
|
||||||
Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional Motivo As String = "") As MCancelacionVentaMensaje
|
Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "") As MCancelacionVentaMensaje
|
||||||
'Comprobante emitido con errores sin relación
|
'Comprobante emitido con errores sin relación
|
||||||
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=2, MotivoCancelacion:=Motivo)
|
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False,
|
Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False,
|
||||||
@@ -4785,6 +4785,15 @@ Namespace Modelos
|
|||||||
Dim RequiereAceptacion As Boolean = False
|
Dim RequiereAceptacion As Boolean = False
|
||||||
Dim Mensaje As String = ""
|
Dim Mensaje As String = ""
|
||||||
|
|
||||||
|
Dim CveSATMotivoCancelacion As Integer = -1
|
||||||
|
|
||||||
|
If CveMotivoCancelacion > 0 Then
|
||||||
|
Dim Row As DataRow = ClsPaginas.GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveMotivoCancelacion:=CveMotivoCancelacion).FiltroPrimero("")
|
||||||
|
If Row IsNot Nothing Then
|
||||||
|
CveSATMotivoCancelacion = Row("CveSATMotivoCancelacion").ToString().ToEntero()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'SI YA ESTA TIMBRADA, NUEVO PROCESO REFACTURACION, ASIGNA LA CANCELACION PENDIENTE
|
'SI YA ESTA TIMBRADA, NUEVO PROCESO REFACTURACION, ASIGNA LA CANCELACION PENDIENTE
|
||||||
If EsRefacturacion AndAlso Me.CveEstatusFactura = 3 AndAlso CveMotivoCancelacion > 0 Then
|
If EsRefacturacion AndAlso Me.CveEstatusFactura = 3 AndAlso CveMotivoCancelacion > 0 Then
|
||||||
CveEstatusFacturaAsignado = 23
|
CveEstatusFacturaAsignado = 23
|
||||||
@@ -4792,7 +4801,7 @@ Namespace Modelos
|
|||||||
|
|
||||||
If CveEstatusFacturaAsignado <= 0 Then
|
If CveEstatusFacturaAsignado <= 0 Then
|
||||||
Try
|
Try
|
||||||
If ObjFactura.FolioFiscal <> "" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
|
If ObjFactura.FolioFiscal <> "" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then
|
||||||
If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||||
|
|
||||||
'VERIFICA SI DEBE VALIDAR ANTE EL SAT
|
'VERIFICA SI DEBE VALIDAR ANTE EL SAT
|
||||||
@@ -4872,7 +4881,7 @@ Namespace Modelos
|
|||||||
|
|
||||||
If Not ObtenerAcuse Then
|
If Not ObtenerAcuse Then
|
||||||
If ContinuarCancelacion Then
|
If ContinuarCancelacion Then
|
||||||
If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveMotivoCancelacion:=CveMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then
|
If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then
|
||||||
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
|
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
|
||||||
If RequiereAceptacion Then
|
If RequiereAceptacion Then
|
||||||
CancelacionFecha = Now.Date
|
CancelacionFecha = Now.Date
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ Public Class Timbrado
|
|||||||
End Using
|
End Using
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
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 CveMotivoCancelacion As Integer = -1, Optional FolioSustitucion As String = "") As Boolean
|
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
|
Dim Retorno As Boolean = False
|
||||||
Dim MsgCancelacion As New StringBuilder
|
Dim MsgCancelacion As New StringBuilder
|
||||||
|
|
||||||
@@ -80,9 +80,9 @@ Public Class Timbrado
|
|||||||
|
|
||||||
Dim CodigoSATMotivoCancelacion As String = ""
|
Dim CodigoSATMotivoCancelacion As String = ""
|
||||||
|
|
||||||
If CveMotivoCancelacion > 0 Then
|
If CveSATMotivoCancelacion > 0 Then
|
||||||
If ClsPaginas.GlobalDTSATMotivosCancelacion(CveMotivoCancelacion) IsNot Nothing AndAlso ClsPaginas.GlobalDTSATMotivosCancelacion(CveMotivoCancelacion).Rows.Count > 0 Then
|
If ClsPaginas.GlobalDTSATMotivosCancelacion(CveSATMotivoCancelacion) IsNot Nothing AndAlso ClsPaginas.GlobalDTSATMotivosCancelacion(CveSATMotivoCancelacion).Rows.Count > 0 Then
|
||||||
CodigoSATMotivoCancelacion = ClsPaginas.GlobalDTSATMotivosCancelacion(CveMotivoCancelacion).Rows(0)("CodigoSAT").ToString()
|
CodigoSATMotivoCancelacion = ClsPaginas.GlobalDTSATMotivosCancelacion(CveSATMotivoCancelacion).Rows(0)("CodigoSAT").ToString()
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -423,12 +423,12 @@ Public Class Timbrado
|
|||||||
UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
||||||
|
|
||||||
If Not Empresa.FacturaProduccion Then
|
If Not Empresa.FacturaProduccion Then
|
||||||
ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_AAA010101AAA.key"
|
ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key"
|
||||||
ArchivoCertificado = $"{Empresa.Ruta}Certificados\CSD01_AAA010101AAA.cer"
|
ArchivoCertificado = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.cer"
|
||||||
|
|
||||||
UsuarioServicio = "UserTest"
|
UsuarioServicio = "UserTest"
|
||||||
ClaveServicio = "1234567890"
|
ClaveServicio = "1234567890"
|
||||||
UrlServicio = "http://juancalderon-001-site6.ftempurl.com/cancelacion.asmx?WSDL"
|
'UrlServicio = "http://juancalderon-001-site6.ftempurl.com/cancelacion.asmx?WSDL"
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
@@ -6622,8 +6622,9 @@ Partial Class Bancos_IE
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
Dim CveSATMotivoCancelacion As Integer = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveSATMotivoCancelacion:=2).FiltroPrimeroValor("CveSATMotivoCancelacion").ToEntero()
|
||||||
|
|
||||||
If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then
|
If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Then
|
||||||
|
|
||||||
If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then
|
If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
|
<asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
|
||||||
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente"
|
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente,FolioFiscalSustitucion"
|
||||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound">
|
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
|
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
|
||||||
@@ -116,10 +116,17 @@
|
|||||||
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" />
|
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" />
|
||||||
<asp:BoundField HeaderText="Fecha Cancelacion" DataField="FechaCancelacion" ItemStyle-Width="160px" />
|
<asp:BoundField HeaderText="Fecha Cancelacion" DataField="FechaCancelacion" ItemStyle-Width="160px" />
|
||||||
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
||||||
|
<asp:BoundField HeaderText="Serie Folio Nuevo" DataField="SerieFolioSustitucion" ItemStyle-Width="25%" />
|
||||||
|
<asp:BoundField HeaderText="Folio Sustitucion" DataField="FolioFiscalSustitucion" ItemStyle-Width="25%" />
|
||||||
<asp:BoundField HeaderText="Motivo" DataField="MotivoCancelacion" ItemStyle-Width="25%" />
|
<asp:BoundField HeaderText="Motivo" DataField="MotivoCancelacion" ItemStyle-Width="25%" />
|
||||||
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:LinkButton runat="server" OnClick="BtnValidarRefacturacion_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
<asp:LinkButton ID="LnkValidarRefac" runat="server" OnClick="BtnValidarRefacturacion_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Cancelar">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:LinkButton ID="LnkCancelar" Visible="false" runat="server" OnClick="BtnCancelarDocumento_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si"></asp:LinkButton>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
|
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
|
||||||
|
|||||||
@@ -41,7 +41,19 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ObjVentas = new ClsVentas();
|
var ObjVentas = new ClsVentas();
|
||||||
if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario))
|
//if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0)
|
||||||
|
// {
|
||||||
|
// DtVentas = ObjVentas.DtResultados.FiltraParametros($"CveVenta={Request["CveVenta"].ToString().ToEntero()}");
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// DtVentas = ObjVentas.DtResultados.Copy();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if (ObjVentas.GetVentasPendientesCancelacion(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0)
|
if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0)
|
||||||
@@ -55,7 +67,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObjVentas.Dispose();
|
ObjVentas.Dispose();
|
||||||
GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura IN(20,23) AND CveEstatusRefacturacion = 0");
|
GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0");
|
||||||
|
|
||||||
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)");
|
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)");
|
||||||
if (DtRefacturar != null && DtRefacturar.Rows.Count > 0)
|
if (DtRefacturar != null && DtRefacturar.Rows.Count > 0)
|
||||||
@@ -89,7 +101,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total);
|
var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total);
|
||||||
if (resp.EnviarAcuse)
|
if (resp.EnviarAcuse)
|
||||||
{
|
{
|
||||||
Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();",TextoConfirmacion:"Enviar",TextoSegundoBoton:"Cancelar");
|
Alert(resp.Mensaje, TipoMensaje.MsgConfirmacion, "BtnEnviarMailCancelacion();", TextoConfirmacion: "Enviar", TextoSegundoBoton: "Cancelar");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -115,20 +127,20 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
string Folio = GvRow.DataKey("Folio");
|
string Folio = GvRow.DataKey("Folio");
|
||||||
string TipoDocto = GvRow.DataKey("TipoDocto");
|
string TipoDocto = GvRow.DataKey("TipoDocto");
|
||||||
string Nombre = GvRow.DataKey("Nombre");
|
string Nombre = GvRow.DataKey("Nombre");
|
||||||
|
string FolioSustitucion = GvRow.DataKey("FolioFiscalSustitucion");
|
||||||
|
|
||||||
if (CveVenta > 0 && Uuid != "")
|
if (CveVenta > 0 && Uuid != "")
|
||||||
{
|
{
|
||||||
var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true);
|
var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true, FolioSustitucion);
|
||||||
CargaDatos();
|
CargaDatos();
|
||||||
if (respuesta.CveEstatus.Contiene(4,5))
|
if (respuesta.CveEstatus.Contiene(4, 5))
|
||||||
{
|
{
|
||||||
HdnLigaRefacturar.Value = respuesta.LigaRefacturacion;
|
HdnLigaRefacturar.Value = respuesta.LigaRefacturacion;
|
||||||
Alert(respuesta.Mensaje, JSBtnAceptar: $"RefacturarDocumento();");
|
Alert(respuesta.Mensaje, JSBtnAceptar: $"RefacturarDocumento();");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Alert(respuesta.Mensaje,TipoMensaje.MsgAdvertencia);
|
Alert(respuesta.Mensaje, TipoMensaje.MsgAdvertencia);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (respuesta.IrARefacturar)
|
//if (respuesta.IrARefacturar)
|
||||||
@@ -144,7 +156,76 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
UPDatos.Update();
|
UPDatos.Update();
|
||||||
|
|
||||||
}
|
}
|
||||||
private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false)
|
|
||||||
|
protected void BtnCancelarDocumento_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.HdnLigaRefacturar.Value = "";
|
||||||
|
this.CveVenta = -1;
|
||||||
|
|
||||||
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||||
|
this.CveVenta = GvRow.DataKey("CveVenta").ToEntero();
|
||||||
|
|
||||||
|
int CveCliente = GvRow.DataKey("CveCliente").ToEntero();
|
||||||
|
string Total = GvRow.DataKey("Total");
|
||||||
|
string SubTotal = GvRow.DataKey("SubTotal");
|
||||||
|
string Uuid = GvRow.DataKey("FolioFiscal");
|
||||||
|
string RFCCliente = GvRow.DataKey("RFCCliente");
|
||||||
|
string Folio = GvRow.DataKey("Folio");
|
||||||
|
string TipoDocto = GvRow.DataKey("TipoDocto");
|
||||||
|
string Nombre = GvRow.DataKey("Nombre");
|
||||||
|
string FolioSustitucion = GvRow.DataKey("FolioFiscalSustitucion");
|
||||||
|
|
||||||
|
if (CveVenta > 0 && Uuid != "")
|
||||||
|
{
|
||||||
|
var respCancelacion = CancelarDocumento(CveVenta, -1, CveCliente, Folio, Uuid, "", DateTime.Now, TipoDocto, Total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: true, FolioSustitucion: FolioSustitucion, CveEstatusRefacturacion: 2);
|
||||||
|
|
||||||
|
if (!respCancelacion.HuboError)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
var EnviarAcuse = false;
|
||||||
|
if (respCancelacion.CveEstatus > 0)
|
||||||
|
{
|
||||||
|
EnviarAcuse = true;
|
||||||
|
var CveEstatus = respCancelacion.CveEstatus;
|
||||||
|
var ObjVentas = new ClsVentas();
|
||||||
|
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||||
|
{
|
||||||
|
sb.Append("El estatus de la factura fue cambiado a 'Cancelada'.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
|
||||||
|
}
|
||||||
|
ObjVentas.Dispose();
|
||||||
|
sb.Append("El documento se canceló correctamente.");
|
||||||
|
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
|
||||||
|
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append(respCancelacion.Mensaje);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EnviarAcuse)
|
||||||
|
{
|
||||||
|
Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, "BtnEnviarMailCancelacion();", TextoConfirmacion: "Enviar", TextoSegundoBoton: "Cancelar");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert(respCancelacion.Mensaje, TipoMensaje.MsgError);
|
||||||
|
}
|
||||||
|
|
||||||
|
CargaDatos();
|
||||||
|
}
|
||||||
|
UPDatos.Update();
|
||||||
|
|
||||||
|
}
|
||||||
|
private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false, string FolioSustitucion = "")
|
||||||
{
|
{
|
||||||
HdnLigaRefacturar.Value = "";
|
HdnLigaRefacturar.Value = "";
|
||||||
|
|
||||||
@@ -183,7 +264,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
|
|
||||||
if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test")))
|
if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test")))
|
||||||
{
|
{
|
||||||
var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion);
|
var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion, FolioSustitucion: FolioSustitucion);
|
||||||
|
|
||||||
//sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
|
//sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
|
||||||
if (!respCancelacion.HuboError)
|
if (!respCancelacion.HuboError)
|
||||||
@@ -218,7 +299,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
{
|
{
|
||||||
CveEstatus = 5;
|
CveEstatus = 5;
|
||||||
|
|
||||||
var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion);
|
var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion, FolioSustitucion: FolioSustitucion);
|
||||||
|
|
||||||
//sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
|
//sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
|
||||||
if (!respCancelacion.HuboError)
|
if (!respCancelacion.HuboError)
|
||||||
@@ -308,13 +389,17 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
retorno.Mensaje = sb.ToString();
|
retorno.Mensaje = sb.ToString();
|
||||||
return retorno;
|
return retorno;
|
||||||
}
|
}
|
||||||
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false)
|
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false, string FolioSustitucion = "", int CveEstatusRefacturacion = -1)
|
||||||
{
|
{
|
||||||
Modelos.Factura.MCancelacionVentaMensaje retorno = null;
|
Modelos.Factura.MCancelacionVentaMensaje retorno = null;
|
||||||
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:true);
|
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion: true);
|
||||||
if (EsRefacturacion)
|
if (EsRefacturacion)
|
||||||
{
|
{
|
||||||
retorno = factura.CancelarPorRefacturacion(1,"");
|
if (CveEstatusRefacturacion > 0)
|
||||||
|
{
|
||||||
|
factura.CveEstatusRefacturacion = CveEstatusRefacturacion;
|
||||||
|
}
|
||||||
|
retorno = factura.CancelarPorRefacturacion(factura.CveMotivoCancelacion, factura.MotivoCancelacion, FolioSustitucion: FolioSustitucion);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -372,7 +457,18 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
{
|
{
|
||||||
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0)
|
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0)
|
||||||
{
|
{
|
||||||
e.Row.Cells[10].Text = "";
|
e.Row.Cells[14].Text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
|
||||||
|
{
|
||||||
|
e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23 && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0)
|
||||||
|
{
|
||||||
|
e.Row.FCLinkButton("LnkCancelar").Visible = true;
|
||||||
|
e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -485,7 +581,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Alert("El acuse de cancelación no pudo ser enviado.",TipoMensaje.MsgError);
|
Alert("El acuse de cancelación no pudo ser enviado.", TipoMensaje.MsgError);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7076,6 +7076,25 @@
|
|||||||
<asp:Label ID="LbCancelarDescripcion" runat="server"></asp:Label>
|
<asp:Label ID="LbCancelarDescripcion" runat="server"></asp:Label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Motivo:</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<asp:DropDownList ID="DdlMotivoCancelacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoCancelacion" DataValueField="CveMotivoCancelacion">
|
||||||
|
</asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVMotivoCancelacion" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoCancelacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalCancelarDocumento"></asp:RequiredFieldValidator>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Descripción:</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<asp:TextBox ID="TxtMotivoCancelacion" runat="server" Height="100" Width="100%" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVDescripcionCancelacion" runat="server" CssClass="help-block errorimput" Display="Dynamic" ControlToValidate="TxtMotivoCancelacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripción''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalCancelarDocumento"></asp:RequiredFieldValidator>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="DivCanRem" runat="server" visible="false">
|
<div id="DivCanRem" runat="server" visible="false">
|
||||||
<h5>
|
<h5>
|
||||||
<asp:CheckBox ID="ChkCanRem" runat="server" AutoPostBack="true" OnCheckedChanged="ChkCanRem_CheckedChanged" /><asp:Label ID="LblChkCanRem" Text="Cancelar la Remisión" runat="server"></asp:Label>
|
<asp:CheckBox ID="ChkCanRem" runat="server" AutoPostBack="true" OnCheckedChanged="ChkCanRem_CheckedChanged" /><asp:Label ID="LblChkCanRem" Text="Cancelar la Remisión" runat="server"></asp:Label>
|
||||||
@@ -7095,7 +7114,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="DivDevAlm" runat="server" class="row" visible="false">
|
<div id="DivDevAlm" runat="server" visible="false">
|
||||||
<h5>
|
<h5>
|
||||||
<asp:CheckBox ID="ChkDevAlm" AutoPostBack="true" runat="server" OnCheckedChanged="ChkDevAlm_CheckedChanged" /><asp:Label ID="LblDevAlm" Text="Devolución Almacen" runat="server"></asp:Label>
|
<asp:CheckBox ID="ChkDevAlm" AutoPostBack="true" runat="server" OnCheckedChanged="ChkDevAlm_CheckedChanged" /><asp:Label ID="LblDevAlm" Text="Devolución Almacen" runat="server"></asp:Label>
|
||||||
</h5>
|
</h5>
|
||||||
@@ -7721,7 +7740,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="DivMotivoRefacturacion" class="modal ADS fade" role="dialog">
|
<div id="DivMotivoRefacturacion" class="modal ADS fade" role="dialog">
|
||||||
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpRefac" UpdateMode="Conditional">
|
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpMotivoRefac" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -7731,20 +7750,31 @@
|
|||||||
<h4 class="modal-title" id="H1" runat="server">Motivo</h4>
|
<h4 class="modal-title" id="H1" runat="server">Motivo</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-center">
|
||||||
|
<h4>
|
||||||
|
<asp:Label ID="LblEstatusRefacturacion" runat="server"></asp:Label>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<label>Motivo:</label>
|
<label>Motivo:</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-10">
|
||||||
<asp:DropDownList ID="DdlMotivoCancelacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="CodigoSATDescripcion" DataValueField="CveMotivoCancelacion">
|
<asp:DropDownList ID="DdlMotivoRefacturacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoCancelacion" DataValueField="CveMotivoCancelacion">
|
||||||
</asp:DropDownList>
|
</asp:DropDownList>
|
||||||
<asp:RequiredFieldValidator ID="RFVDdlMotivo" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlMotivoCancelacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
<asp:RequiredFieldValidator ID="RFVDdlMotivoRefac" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoRefacturacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="row">
|
||||||
<label>Descripción:</label>
|
<div class="col-md-2">
|
||||||
<asp:TextBox ID="TxtMotivoRefac" runat="server" Height="100" Width="600" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
<label>Descripción:</label>
|
||||||
<asp:RequiredFieldValidator ID="RFVTxtMotivoRefac" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtMotivoRefac" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<asp:TextBox ID="TxtMotivoRefac" runat="server" Height="100" Width="100%" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVTxtMotivoRefac" runat="server" Display="Dynamic" CssClass="help-block errorimput" ControlToValidate="TxtMotivoRefac" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripción''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
@@ -5496,9 +5496,14 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaMotivosCancelacion()
|
Private Sub CargaMotivosCancelacion()
|
||||||
DdlMotivoCancelacion.DataSource = GlobalDTSATMotivosCancelacion()
|
|
||||||
|
DdlMotivoRefacturacion.DataSource = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveSATMotivoCancelacion:=1)
|
||||||
|
DdlMotivoRefacturacion.DataBind()
|
||||||
|
|
||||||
|
DdlMotivoCancelacion.DataSource = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltraParametros("CveSATMotivoCancelacion IN (2,3)")
|
||||||
DdlMotivoCancelacion.DataBind()
|
DdlMotivoCancelacion.DataBind()
|
||||||
|
|
||||||
|
DdlMotivoRefacturacion.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||||
DdlMotivoCancelacion.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
DdlMotivoCancelacion.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaTiposRelacion()
|
Private Sub CargaTiposRelacion()
|
||||||
@@ -8736,7 +8741,7 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then
|
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then
|
||||||
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
|
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then
|
||||||
|
|
||||||
'FACTURA INGRESO/EGRESO
|
'FACTURA INGRESO/EGRESO
|
||||||
Dim ObjTimbrado As New Timbrado
|
Dim ObjTimbrado As New Timbrado
|
||||||
@@ -8788,8 +8793,10 @@ Partial Class Ventas
|
|||||||
Alert(ObjTimbrado.MensajeErrorCFDI, TipoMensaje.MsgError)
|
Alert(ObjTimbrado.MensajeErrorCFDI, TipoMensaje.MsgError)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'CANCELAR FACTURA ANTERIOR
|
||||||
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
|
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
|
||||||
If Me.ObjFacturaNC IsNot Nothing Then
|
If Me.ObjFacturaNC IsNot Nothing Then
|
||||||
|
Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA
|
||||||
Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, ObjTimbrado.UUID)
|
Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, ObjTimbrado.UUID)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -11734,13 +11741,13 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Actualiar el estatus de la venta refacturada
|
'Actualiar el estatus de la venta refacturada
|
||||||
If ObjVentas.CveVenta > 0 AndAlso NuevaFactura = 1 AndAlso CveDevolucion > 0 Then
|
'If ObjVentas.CveVenta > 0 AndAlso NuevaFactura = 1 AndAlso CveDevolucion > 0 Then
|
||||||
|
|
||||||
'If CveEstatusRefacturacion = 1 Then CveEstatusRefacturacion = 2 'cuando viene del proceso de refacturación con aceptació
|
' 'If CveEstatusRefacturacion = 1 Then CveEstatusRefacturacion = 2 'cuando viene del proceso de refacturación con aceptació
|
||||||
If Not ObjVentas.UpdateEstatusRefacturacion(CveDevolucion, 2) Then ' se marca como refacturada
|
' If Not ObjVentas.UpdateEstatusRefacturacion(CveDevolucion, 2) Then ' se marca como refacturada
|
||||||
ErrorList.Add("Ocurrió un error al actualizar el estatus de la refacturacion")
|
' ErrorList.Add("Ocurrió un error al actualizar el estatus de la refacturacion")
|
||||||
End If
|
' End If
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
'Pedido2'
|
'Pedido2'
|
||||||
If ObjVentas.CveVenta > 0 And CvePedido2 > 0 And DdlTipoComprobante.SelectedValue.Contiene("Rem", "PA") Then
|
If ObjVentas.CveVenta > 0 And CvePedido2 > 0 And DdlTipoComprobante.SelectedValue.Contiene("Rem", "PA") Then
|
||||||
@@ -20321,28 +20328,32 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If Vigencia.EsCancelable = "Cancelable sin aceptación" Then
|
If Vigencia.EsCancelable = "Cancelable sin aceptación" Then
|
||||||
script = "BtnRefacturacionConfirmarAceptacion();"
|
'script = "BtnRefacturacionConfirmarAceptacion();"
|
||||||
sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
|
sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
|
||||||
sb.Append("Está seguro de realizar la refacturación?.")
|
sb.Append("Está seguro de realizar la refacturación?.")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Vigencia.EsCancelable = "Cancelable con aceptación" OrElse String.IsNullOrEmpty(Vigencia.EsCancelable) Then
|
If Vigencia.EsCancelable = "Cancelable con aceptación" OrElse String.IsNullOrEmpty(Vigencia.EsCancelable) Then
|
||||||
script = "BtnRefacturacionConfirmar();"
|
'script = "BtnRefacturacionConfirmar();"
|
||||||
sb.AppendFormat("<b>{0}</b> <br/>", "Cancelable con aceptación")
|
sb.AppendFormat("<b>{0}</b> <br/>", "Cancelable con aceptación")
|
||||||
sb.Append("Está seguro de cancelar el documento para realizar la refacturación?.")
|
sb.Append("Está seguro de cancelar el documento para realizar la refacturación?.")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If Not UsuarioActual.Empresa.FacturaProduccion Then
|
'If Not UsuarioActual.Empresa.FacturaProduccion Then
|
||||||
script = "BtnRefacturacionConfirmar();"
|
' script = "BtnRefacturacionConfirmar();"
|
||||||
End If
|
'End If
|
||||||
sb.Append("<b>No encontrado</b> <br/>")
|
sb.Append("<b>No encontrado</b> <br/>")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
sb.Append("¿Desea realizar la refacturación?<br/>")
|
'sb.Append("¿Desea realizar la refacturación?<br/>")
|
||||||
script = "BtnRefacturacionConfirmarAceptacion();"
|
script = "BtnRefacturacionConfirmarAceptacion();"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:=script, TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
LblEstatusRefacturacion.Text = sb.ToString()
|
||||||
|
UpMotivoRefac.Update()
|
||||||
|
|
||||||
|
RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1")
|
||||||
|
'Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:=script, TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -20351,18 +20362,18 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
'BtnRefacturacionConfirmar
|
'BtnRefacturacionConfirmar
|
||||||
Private Sub BtnRefacturacionConfirmar_Click(sender As Object, e As System.EventArgs) Handles BtnRefacturacionConfirmar.Click
|
Private Sub BtnRefacturacionConfirmar_Click(sender As Object, e As System.EventArgs) Handles BtnRefacturacionConfirmar.Click
|
||||||
DdlMotivoCancelacion.SelectedValueExist(1)
|
' DdlMotivoRefactura.SelectedValueExist(1)
|
||||||
DdlMotivoCancelacion.Enabled = False
|
' DdlMotivoCancelacion.Enabled = False
|
||||||
|
|
||||||
UpRefac.Update()
|
'UpRefac.Update()
|
||||||
RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1")
|
RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1")
|
||||||
'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
|
||||||
DdlMotivoCancelacion.SelectedValueExist(1)
|
'DdlMotivoCancelacion.SelectedValueExist(1)
|
||||||
DdlMotivoCancelacion.Enabled = False
|
'DdlMotivoCancelacion.Enabled = False
|
||||||
|
|
||||||
UpRefac.Update()
|
'UpRefac.Update()
|
||||||
RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1")
|
RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1")
|
||||||
'CancelarDocumento(True)
|
'CancelarDocumento(True)
|
||||||
End Sub
|
End Sub
|
||||||
@@ -23050,7 +23061,7 @@ Partial Class Ventas
|
|||||||
'ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
|
'ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
|
||||||
'ObjE.Dispose()
|
'ObjE.Dispose()
|
||||||
|
|
||||||
resp = ObjFacturaCancelacion.CancelarPorRefacturacion(DdlMotivoCancelacion.SelectedValue.ToEntero(), TxtMotivoRefac.Text)
|
resp = ObjFacturaCancelacion.CancelarPorRefacturacion(DdlMotivoRefacturacion.SelectedValue.ToEntero(), TxtMotivoRefac.Text.Trim())
|
||||||
Else
|
Else
|
||||||
Dim ListaRemisionesCancelar As New List(Of Integer)
|
Dim ListaRemisionesCancelar As New List(Of Integer)
|
||||||
If ChkCanRem.Checked Then
|
If ChkCanRem.Checked Then
|
||||||
@@ -23063,7 +23074,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
|
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
|
||||||
|
|
||||||
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar)
|
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim())
|
||||||
End If
|
End If
|
||||||
|
|
||||||
SWatch.Stop()
|
SWatch.Stop()
|
||||||
|
|||||||
Reference in New Issue
Block a user