Validacion de devoluciones dobles
This commit is contained in:
@@ -3823,13 +3823,6 @@ Namespace Modelos
|
|||||||
|
|
||||||
Dim TieneAlmacen As Boolean = False
|
Dim TieneAlmacen As Boolean = False
|
||||||
|
|
||||||
'If Not EsRefacturacion AndAlso ObjFactura.SaldoAlmacen <> 0 Then
|
|
||||||
' Retorno.Mensaje = "El pedido no se puede cancelar ya que tiene movimientos de almacén.<br/>Nota: Primero hay que hacer la devolución al almacén."
|
|
||||||
' Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
|
|
||||||
|
|
||||||
' Return Retorno
|
|
||||||
'End If
|
|
||||||
|
|
||||||
'VALIDA QUE LA FACTURA NO TENGA PAGOS
|
'VALIDA QUE LA FACTURA NO TENGA PAGOS
|
||||||
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
|
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
|
||||||
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
|
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
|
||||||
@@ -4286,13 +4279,6 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
|
||||||
If Not GeneraMovimientosApartados(ObjInventario) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
||||||
If Not ErrorCancelar AndAlso RevivirRemisiones Then
|
If Not ErrorCancelar AndAlso RevivirRemisiones Then
|
||||||
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
|
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
|
||||||
@@ -4302,8 +4288,13 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
|
If Not GeneraMovimientosApartados(ObjInventario) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
|
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
|
||||||
If CveMovimiento > 0 AndAlso RealizarDevolucionAlmacen Then
|
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVenta) Then
|
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVenta) Then
|
||||||
MensajeError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar."
|
MensajeError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar."
|
||||||
@@ -4312,14 +4303,12 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'AGREGA BITACORA A VENTA
|
'AGREGA BITACORA A VENTA
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimiento > 0 Then
|
||||||
Dim MensajeBitacora = "Devuelta"
|
Dim MensajeBitacora = "Devuelta"
|
||||||
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -4432,7 +4421,7 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If Not ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, CancelacionAcuse, CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion, CveEstatusRefacturacion:=CveEstatusRefacturacion,
|
If Not ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, CancelacionAcuse, CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion, CveEstatusRefacturacion:=CveEstatusRefacturacion,
|
||||||
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd hh:mm:ss.mmm")) Then
|
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd HH:mm:ss.mmm")) 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
|
||||||
@@ -4551,7 +4540,9 @@ Namespace Modelos
|
|||||||
Dim SeCancela As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = DrMovtos("CveRem").ToString.ToEntero()))
|
Dim SeCancela As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = DrMovtos("CveRem").ToString.ToEntero()))
|
||||||
|
|
||||||
If Not SeCancela Then
|
If Not SeCancela Then
|
||||||
|
Dim ObjRem As New Modelos.Factura(UsuarioActual, DrMovtos("CveRem").ToString.ToEntero(), UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
|
If True Then ' ObjRem.SaldoAlmacen = 0
|
||||||
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
|
CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
|
||||||
|
|
||||||
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
|
If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
|
||||||
@@ -4621,6 +4612,7 @@ Namespace Modelos
|
|||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user