Precio unitario correcto en entradas/devoluciones virtuales
This commit is contained in:
@@ -1240,7 +1240,14 @@ Public Class ClsInventarios
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Obtiene los valores para asignar a los movimientos virtuales
|
||||
''' </summary>
|
||||
''' <param name="CveMovimiento">Debe ser un movimiento de Salida o Entrada de almacen (2,3,18)</param>
|
||||
''' <param name="CveEmpresa"></param>
|
||||
''' <param name="CveCompra"></param>
|
||||
''' <param name="CveMovimientoRelacionado">Cuando sea cancelacion/devolucion hay que mandar este dato que seria la salida de almacen</param>
|
||||
''' <returns></returns>
|
||||
Public Function GetMovimientosDetalleVirtual(CveMovimiento As Integer, CveEmpresa As Integer, Optional CveCompra As Integer = -1, Optional CveMovimientoRelacionado As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Inv_MovimientosDetalleVirtualGet")
|
||||
|
||||
@@ -4537,6 +4537,13 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
|
||||
If Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowMovimiento("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||
End If
|
||||
|
||||
'AGREGA BITACORA A VENTA
|
||||
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimientoDevolucion > 0 Then
|
||||
Dim MensajeBitacora = "Devuelta"
|
||||
@@ -4580,12 +4587,6 @@ Namespace Modelos
|
||||
Next
|
||||
End If
|
||||
|
||||
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
|
||||
If Not GeneraMovimientosVirtuales(CveVenta, ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||
End If
|
||||
|
||||
'VERIFICAR MOVIMIENTOS DE APARTADOS
|
||||
If Not ErrorCancelar Then
|
||||
If Not GeneraMovimientosApartados(ObjInventario) Then
|
||||
@@ -4809,41 +4810,36 @@ Namespace Modelos
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Private Function GeneraMovimientosVirtuales(CveVenta As Integer, ByRef ObjInventario As ClsInventarios) As Boolean
|
||||
Private Function GeneraMovimientosVirtuales(CveVenta As Integer, CveMovimiento As Integer, CveMovimientoRelacionado As Integer, ByRef ObjInventario As ClsInventarios) As Boolean
|
||||
Dim ErrorCancelar As Boolean = False
|
||||
Try
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
Dim CveMovimientoSalida As Integer = -1
|
||||
Dim CveAlmacenVirutal As Integer = -1
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
Dim ValidaVirtual = True
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
|
||||
Dim DtMovtosDev As DataTable = Nothing
|
||||
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 24 AND CveConcepto = 3 AND CveVenta > 0")
|
||||
CveMovimientoSalida = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
CveAlmacenVirutal = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoRelacionado) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados
|
||||
End If
|
||||
|
||||
If CveMovimientoSalida > 0 Then
|
||||
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
DtMovtosDev = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
Dim CveConceptoMovimientoVirtual As Integer = 36
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
|
||||
|
||||
If DtMovtosDev IsNot Nothing AndAlso DtMovtosDev.Rows.Count > 0 Then
|
||||
Dim CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenVirutal, 18, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalida)
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
For Each RowUsado As DataRow In DtMovtosDev.Rows
|
||||
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1,
|
||||
Observaciones:="", Guia:="", CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="Modelos/CancelarVirtual")
|
||||
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal()
|
||||
Dim PU As Decimal = RowUsado("PUOriginal").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -4851,7 +4847,14 @@ Namespace Modelos
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
Else
|
||||
If ValidaVirtual Then
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -4861,6 +4864,7 @@ Namespace Modelos
|
||||
|
||||
Return Not ErrorCancelar
|
||||
End Function
|
||||
|
||||
Private Function GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento As Integer, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, ByRef DtDevRem As DataTable, ByRef ListaRemisionesCancelar As List(Of Integer)) As Boolean
|
||||
Dim ErrorCancelar As Boolean = False
|
||||
|
||||
|
||||
@@ -2355,36 +2355,34 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
' COMIENZA: VIRTUAL
|
||||
If Not ErrorMovInv AndAlso TipoDocto.Contiene("Ing", "Dev") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso CveMovimiento > 0 Then
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
Dim CveConceptoMovimientoVirtual As Integer = -1
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
|
||||
Dim ValidaVirtual As Boolean = False
|
||||
|
||||
If TipoMovimiento = 1 Then
|
||||
CveConceptoMovimientoVirtual = 37
|
||||
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados
|
||||
End If
|
||||
|
||||
'
|
||||
'DtPSVirtual.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
'DtPSVirtual.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
|
||||
'DtPSVirtual.Columns.Add(New DataColumn("PU", GetType(Decimal)))
|
||||
'DtPSVirtual.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
|
||||
|
||||
'Dim DtTamanios As DataTable = Nothing
|
||||
|
||||
'If ObjAcumuladores.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
' DtTamanios = ObjAcumuladores.DtResultados.Copy()
|
||||
'End If
|
||||
|
||||
Dim CveConceptoMovimientoVirtual As Integer = -1
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
|
||||
Dim ValidaVirtual As Boolean = False
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
If TipoMovimiento = 1 Then
|
||||
CveConceptoMovimientoVirtual = 37
|
||||
|
||||
ElseIf TipoMovimiento = 2 Then
|
||||
ValidaVirtual = True
|
||||
CveConceptoMovimientoVirtual = 36
|
||||
|
||||
If ObjInventario.GetInv_Mov(CveVentaSurtir, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 1 AND CveConcepto IN(3,40) AND CveVenta > 0")
|
||||
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=RowMovimiento("CveMovimiento").ToString().ToEntero()) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados
|
||||
End If
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
End If
|
||||
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1,
|
||||
@@ -2395,7 +2393,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal()
|
||||
Dim PU As Decimal = RowUsado("PUOriginal").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
|
||||
@@ -665,6 +665,29 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
End If
|
||||
End If
|
||||
|
||||
'Inicia la transacción
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
||||
Dim CveMovimientoSalida = 0
|
||||
Dim CveMovimientoEntrada = 0
|
||||
Dim IDPoliza As Integer = 0
|
||||
Dim FolioSalida = 0
|
||||
Dim CveMovimientoVirtualEntrada As Integer = 0
|
||||
Dim CveMovimientoVirtualSalida As Integer = 0
|
||||
Dim FolioVirtualEntrada As Integer = 0
|
||||
Dim FolioVirtualSalida As Integer = 0
|
||||
Dim FolioEntrada = 0
|
||||
Dim AlmacenEntrada = -1
|
||||
Dim Fecha As Date = TxtFecha.Text.ToDate
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
Dim ErrorAC As Boolean = False
|
||||
Dim TextoError = ""
|
||||
Dim TipoMovimientoSalida As Integer = 26 'If(ChkTransitorio.Checked, 26, If(TipoAlmacenOrigen = 24, 26, 26))
|
||||
|
||||
Dim ErrorExistencia = False
|
||||
Dim TextoExistencia As StringBuilder = New StringBuilder
|
||||
|
||||
Try
|
||||
'VALIDA ALMACEN DISTINTA SUCURSAL DEBE SER TRANSITORIO
|
||||
If Not UsuarioActual.CveEmpresa.Contiene(7, 140) Then '[IPP] EMPRESA VIGILANCIA NO OCUPA TRANSITORIOS - TIENEN MIL SUCURSALES Xd
|
||||
If Not ChkTransitorio.Checked Then
|
||||
@@ -699,11 +722,10 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
|
||||
|
||||
'VALIDA LA EXISTENCIA DEL ALMACEN DE ORIGEN
|
||||
Dim ErrorExistencia = False
|
||||
Dim TextoExistencia As StringBuilder = New StringBuilder
|
||||
|
||||
Dim Existencia As Double
|
||||
TextoExistencia.Append("Los siguiente productos se ajustaron por falta de exitencia:<br/>")
|
||||
If Not CargadoDeMov Then
|
||||
@@ -763,23 +785,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
' ConsumoInterno(TipoAlmacenOrigen, TipoAlmacenDestino)
|
||||
'End If
|
||||
|
||||
'Inicia la transacción
|
||||
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
||||
Dim CveMovimientoSalida = 0
|
||||
Dim CveMovimientoEntrada = 0
|
||||
Dim IDPoliza As Integer = 0
|
||||
Dim FolioSalida = 0
|
||||
Dim CveMovimientoVirtualEntrada As Integer = 0
|
||||
Dim CveMovimientoVirtualSalida As Integer = 0
|
||||
Dim FolioVirtualEntrada As Integer = 0
|
||||
Dim FolioVirtualSalida As Integer = 0
|
||||
Dim FolioEntrada = 0
|
||||
Dim AlmacenEntrada = -1
|
||||
Dim Fecha As Date = TxtFecha.Text.ToDate
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
Dim ErrorAC As Boolean = False
|
||||
Dim TextoError = ""
|
||||
Dim TipoMovimientoSalida As Integer = 26 'If(ChkTransitorio.Checked, 26, If(TipoAlmacenOrigen = 24, 26, 26))
|
||||
|
||||
|
||||
'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
|
||||
@@ -828,7 +834,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Dim dtvirtual As DataTable = Nothing
|
||||
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
dtvirtual = ObjInventario.DtResultados
|
||||
dtvirtual = ObjInventario.DtResultados.Copy()
|
||||
For Each RowVirtual As DataRow In dtvirtual.Rows
|
||||
Dim CvePS = RowVirtual("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble()
|
||||
@@ -840,6 +846,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
dtvirtual.Dispose()
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
@@ -890,12 +897,12 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
FolioVirtualEntrada = ObjInventario.Folio
|
||||
Dim dtvirtual As DataTable = Nothing
|
||||
|
||||
If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then
|
||||
dtvirtual = ObjInventario.DtResultados
|
||||
If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoSalida) Then
|
||||
dtvirtual = ObjInventario.DtResultados.Copy()
|
||||
For Each RowVirtual As DataRow In dtvirtual.Rows
|
||||
Dim CvePS = RowVirtual("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Decimal = RowVirtual("PU").ToString().ToDecimal()
|
||||
Dim PU As Decimal = RowVirtual("PUOriginal").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
@@ -903,6 +910,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
dtvirtual.Dispose()
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
@@ -964,6 +972,11 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
' End If
|
||||
'End If
|
||||
|
||||
Catch ex As Exception
|
||||
ErrorMovInv = True
|
||||
OnError("Ocurrió un error al realizar el traspaso", ex)
|
||||
End Try
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
DtTraslado = DtMovimientos.Copy
|
||||
ObjInventario.Commit()
|
||||
@@ -1614,7 +1627,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Dim dtvirtual As DataTable = Nothing
|
||||
|
||||
If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoSalida) Then
|
||||
dtvirtual = ObjInventario.DtResultados
|
||||
dtvirtual = ObjInventario.DtResultados.Copy()
|
||||
For Each RowVirtual As DataRow In dtvirtual.Rows
|
||||
Dim CvePS = RowVirtual("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString().ToDecimal()
|
||||
@@ -1627,6 +1640,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
dtvirtual.Dispose()
|
||||
Else
|
||||
TextoError = "No se pudo registrar el movimiento virtual"
|
||||
ErrorMovInv = True
|
||||
@@ -1737,7 +1751,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
'REGISTRA LA SALIDA Y ENTRADA (TRASPASO)
|
||||
ObjInventario.IniciaTransacSQL() 'Inicia la transacción
|
||||
Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate
|
||||
|
||||
Dim CveMovimientoReferencia As Integer = -1
|
||||
'AGREGAMOS LA ENTRADA
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
|
||||
Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G1")
|
||||
@@ -1751,6 +1765,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Dim CveMovimientoDetalleEntrada As Integer = 0
|
||||
Dim Cont As Integer = 0
|
||||
For Each gvr As GridViewRow In GvDatosRecepcion.Rows
|
||||
CveMovimientoReferencia = gvr.DataKey("CveMovimiento").ToEntero()
|
||||
|
||||
Dim dataRowAux As DataRow = Dtt.FiltroPrimero(String.Format(" CveMovimientoDetalle = '{0}'", If(gvr.DataKey("CveMovimientoDetalle").ToString = "", "0", gvr.DataKey("CveMovimientoDetalle").ToString)))
|
||||
Dim cantidadDisponibleValidacion As Decimal = 0
|
||||
@@ -1825,16 +1840,16 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
|
||||
If CveAlmacenVirtual > 0 Then
|
||||
|
||||
CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 2, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S2")
|
||||
CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 36, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/S2")
|
||||
FolioVirtualEntrada = ObjInventario.Folio
|
||||
Dim dtvirtual As DataTable = Nothing
|
||||
|
||||
If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
dtvirtual = ObjInventario.DtResultados
|
||||
If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalida, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoReferencia) Then
|
||||
dtvirtual = ObjInventario.DtResultados.Copy()
|
||||
For Each RowVirtual As DataRow In dtvirtual.Rows
|
||||
Dim CvePS = RowVirtual("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString().ToDecimal()
|
||||
Dim PU As Decimal = RowVirtual("PU").ToString().ToDecimal()
|
||||
Dim PU As Decimal = RowVirtual("PUOriginal").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
@@ -1842,6 +1857,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
dtvirtual.Dispose()
|
||||
Else
|
||||
TextoError = "No se pudo registrar el movimiento virtual"
|
||||
ErrorMovInv = True
|
||||
|
||||
Reference in New Issue
Block a user