Correciones en cancelación.
-saldo correcto de remisiones -totales de cancelacion coinciden con la factura
This commit is contained in:
@@ -3186,8 +3186,9 @@ Namespace Modelos
|
||||
Next
|
||||
End If
|
||||
|
||||
'Si es Facturacion de una remision cancelamos, traspasamos saldos y agregamos evento a la bitacora
|
||||
If (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) OrElse ObjFactura.RemisionesLista.Count > 0 Then
|
||||
'SI ES FACTURACION DE UNA REMISION CANCELAMOS, TRASPASAMOS SALDOS Y AGREGAMOS EVENTO A LA BITACORA
|
||||
'NO DEBE ENTRAR SI SE ESTA CANCELANDO UNA FACTURA
|
||||
If ValorMultiplicador <> -1 AndAlso (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) OrElse ObjFactura.RemisionesLista.Count > 0 Then
|
||||
|
||||
If Not ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
ErrorPrepoliza = True
|
||||
|
||||
@@ -19197,49 +19197,56 @@ Partial Class Ventas
|
||||
CancelarRefacturada()
|
||||
End If
|
||||
|
||||
CreaObjetosVenta(EsCancelacion:=True)
|
||||
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=True)
|
||||
Try
|
||||
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
||||
|
||||
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
||||
If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then
|
||||
|
||||
If ObjFactura IsNot Nothing AndAlso ObjFactura.CveVenta > 0 Then
|
||||
If EsRefacturacion Then
|
||||
resp = ObjFacturaCancelacion.CancelarPorRefacturacion()
|
||||
Else
|
||||
Dim ListaRemisionesCancelar As New List(Of Integer)
|
||||
If ChkCanRem.Checked Then
|
||||
For Each Gvr As GridViewRow In GvCancelarRemisiones.Rows
|
||||
If Gvr.FCCheckBox("ChkCancelarRemision").Checked Then
|
||||
ListaRemisionesCancelar.Add(Gvr.DataKey("CveVenta").ToEntero)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If EsRefacturacion Then
|
||||
resp = ObjFactura.CancelarPorRefacturacion()
|
||||
Else
|
||||
Dim ListaRemisionesCancelar As New List(Of Integer)
|
||||
If ChkCanRem.Checked Then
|
||||
For Each Gvr As GridViewRow In GvCancelarRemisiones.Rows
|
||||
If Gvr.FCCheckBox("ChkCancelarRemision").Checked Then
|
||||
ListaRemisionesCancelar.Add(Gvr.DataKey("CveVenta").ToEntero)
|
||||
End If
|
||||
Next
|
||||
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
|
||||
|
||||
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar)
|
||||
End If
|
||||
|
||||
ObjFactura.CveAlmacenDevolucion = CveAlmacenDevolucion
|
||||
|
||||
resp = ObjFactura.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar)
|
||||
End If
|
||||
|
||||
If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
||||
Else
|
||||
If EsRefacturacion Then
|
||||
If resp.CveEstatus = 20 Then
|
||||
Response.Redirect($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}")
|
||||
ElseIf resp.CveEstatus.Contiene(4, 5) Then
|
||||
Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
|
||||
If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
||||
Else
|
||||
If EsRefacturacion Then
|
||||
If resp.CveEstatus = 20 Then
|
||||
ObjFacturaCancelacion.Dispose()
|
||||
Response.Redirect($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}")
|
||||
ElseIf resp.CveEstatus.Contiene(4, 5) Then
|
||||
ObjFacturaCancelacion.Dispose()
|
||||
Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
|
||||
Else
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||
End If
|
||||
Else
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||
End If
|
||||
Else
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjFactura.CveAlmacen = -1
|
||||
Else
|
||||
Alert("Ocurrió un error al generar la cancelación", TipoMensaje.MsgError)
|
||||
End If
|
||||
ObjFacturaCancelacion.CveAlmacen = -1
|
||||
Else
|
||||
Alert("Ocurrió un error al generar la cancelación", TipoMensaje.MsgError)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrío un error al cancelar", ex)
|
||||
End Try
|
||||
ObjFacturaCancelacion.Dispose()
|
||||
|
||||
|
||||
UpEstatus.Update()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user