Surtir refacturación parcial o total
This commit is contained in:
@@ -2942,6 +2942,24 @@ Public Class ClsInventarios
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
Public Function UpdateEstatusAlmacen(CveVentaDetalle As Integer, Valor As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("Vta_UpdateDevolucionVentaDetalle")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@Valor", SqlDbType.Int).Value = Valor
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al actualizar la devolucion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
Public Function LimpiaEntregaDirecta(CveMovimiento As Integer) As Boolean
|
Public Function LimpiaEntregaDirecta(CveMovimiento As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Inv_LimpiaEntregaDirecta")
|
DataAdapter("PA_Inv_LimpiaEntregaDirecta")
|
||||||
@@ -3062,6 +3080,24 @@ Public Class ClsInventarios
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
Public Function GetSaldoVentaDetalle(CveVenta As Integer, CveEmpresa As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Vta_VentaDetalleSaldo")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener datos de almacen por detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
Public Function GetMovimientosDevoluciones(CveVenta As Integer, CveEmpresa As Integer) As Boolean
|
Public Function GetMovimientosDevoluciones(CveVenta As Integer, CveEmpresa As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Vta_VentaDetalleAlmacenDevolucion")
|
DataAdapter("PA_Vta_VentaDetalleAlmacenDevolucion")
|
||||||
|
|||||||
@@ -3201,12 +3201,12 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Factura
|
'Factura
|
||||||
If Not ObjEventos.AddEventoBitacora($"Sustituye a: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
|
If Not ObjEventos.AddEventoBitacora($"Remisión facturada: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Remision
|
'Remision
|
||||||
If Not ObjEventos.AddEventoBitacora($"Refacturacion en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
|
If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -4269,6 +4269,18 @@ Namespace Modelos
|
|||||||
Dim ObjE As New ClsOIEventos()
|
Dim ObjE As New ClsOIEventos()
|
||||||
ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
|
ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
|
||||||
ObjE.Dispose()
|
ObjE.Dispose()
|
||||||
|
Else
|
||||||
|
|
||||||
|
If CveEstatus = 5 Then
|
||||||
|
Dim ObjE As New ClsOIEventos()
|
||||||
|
ObjE.AddEventoBitacora("La cancelación de la factura fue aceptada en el SAT", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
|
||||||
|
ObjE.Dispose()
|
||||||
|
ElseIf CveEstatus = 4 Then
|
||||||
|
Dim ObjE As New ClsOIEventos()
|
||||||
|
ObjE.AddEventoBitacora("No se pudo comprobar el estatus de factura ante el SAT, solo sera cancelada en el sistema", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
|
||||||
|
ObjE.Dispose()
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'SI ES CANCELACION EN PROCESO CANCELA EL PROCESO DE LAS REMISIONES
|
'SI ES CANCELACION EN PROCESO CANCELA EL PROCESO DE LAS REMISIONES
|
||||||
|
|||||||
@@ -7003,28 +7003,36 @@ Partial Class Ventas
|
|||||||
Dim ObjNC As List(Of Object) = Nothing
|
Dim ObjNC As List(Of Object) = Nothing
|
||||||
If ErrorList.Count = 0 Then
|
If ErrorList.Count = 0 Then
|
||||||
If NuevaFactura = 1 Then
|
If NuevaFactura = 1 Then
|
||||||
'Si directamente como cancelada sin aceptación, debe de generar la cancelacion aquí
|
'SI YA ESTA MARCADA LA VENTA ANTERIOR
|
||||||
'If Me.CveEstatusRefacturacion = 0 Then ' cuando es refacturación sin aceptación debe de cancelar y reducir saldo
|
If DevolucionAlmacenNC = 2 Then
|
||||||
' ObjNC = generaNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, ObjEventos)
|
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
|
||||||
' If ObjNC Is Nothing Then
|
|
||||||
' ErrorList.Add("No se pudo Cancelar la Factura")
|
|
||||||
' End If
|
|
||||||
'End If
|
|
||||||
'Esquema viejo, evitamos que aparezca por surtir
|
|
||||||
If ErrorList.Count = 0 Then
|
|
||||||
'MARCAR VENTA ANTERIOR
|
|
||||||
If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then
|
|
||||||
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
|
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'MARCAR VENTA ANTERIOR
|
|
||||||
If VentaSaldoAlmacenNC <> 0 OrElse DevolucionAlmacenNC = 2 Then
|
|
||||||
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
|
|
||||||
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'MARCAR VENTA ANTERIOR
|
||||||
|
If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then
|
||||||
|
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
|
||||||
|
End If
|
||||||
|
|
||||||
|
'MARCA LO PENDIENTE A NIVEL DETALLE
|
||||||
|
Dim DtMovDetalles As DataTable = Nothing
|
||||||
|
If ObjInventario.GetSaldoVentaDetalle(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtMovDetalles = ObjInventario.DtResultados.Copy()
|
||||||
|
End If
|
||||||
|
|
||||||
|
If DtMovDetalles IsNot Nothing Then
|
||||||
|
For Each Row As DataRow In DtMovDetalles.Rows
|
||||||
|
Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToEntero()
|
||||||
|
If SaldoAlmacen < 0 Then
|
||||||
|
ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalle").ToString().ToEntero(), 1)
|
||||||
|
ElseIf SaldoAlmacen = 0 Then
|
||||||
|
ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalle").ToString().ToEntero(), 0)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
DtMovDetalles.Dispose()
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -11104,12 +11112,12 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Factura
|
'Factura
|
||||||
If Not ObjEventos.AddEventoBitacora($"Sustituye a: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
|
If Not ObjEventos.AddEventoBitacora($"Remisión facturada : <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Remision
|
'Remision
|
||||||
If Not ObjEventos.AddEventoBitacora($"Refacturacion en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
|
If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|||||||
Reference in New Issue
Block a user