-
This commit is contained in:
@@ -1868,112 +1868,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
' TERMINA: GARANTIAS
|
||||
|
||||
' COMIENZA: VIRTUAL
|
||||
If TipoDocto.Contiene("Ing") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
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 = -1
|
||||
Dim ValidaVirtual As Boolean = False
|
||||
|
||||
If TipoMovimiento = 1 Then
|
||||
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If GvRow.datakey("CveTamaño").tostring.toentero > 0 Then
|
||||
ValidaVirtual = True ' si tiene tamaño, debe de tener virtual
|
||||
Dim drr As DataRow = DtTamanios.FiltroPrimero(String.Format("CveTamaño={0}", GvRow.DataKey("CveTamaño")))
|
||||
If drr IsNot Nothing Then
|
||||
|
||||
Dim CvePSCargo = drr("CvePSCargo").ToString().ToEntero()
|
||||
Dim Row As DataRow = DtPSVirtual.NewRow()
|
||||
Row("CvePS") = CvePSCargo
|
||||
Row("Cantidad") = GvRow.FCTextBox("TbCantidadF").Text.ToDecimal()
|
||||
Row("PU") = 0
|
||||
Row("CveUM") = GvRow.DataKey("CveUM").ToEntero()
|
||||
|
||||
DtPSVirtual.Rows.Add(Row)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
CveConceptoMovimientoVirtual = 3
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
ElseIf TipoMovimiento = 2 Then
|
||||
ValidaVirtual = True
|
||||
Dim CveMovimientoSalidaDev As Integer = -1
|
||||
If ObjInventario.GetInv_Mov(CveVentaSurtir, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 24 AND CveConcepto = 3 AND CveVenta > 0")
|
||||
CveMovimientoSalidaDev = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
CveAlmacenVirtual = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||
CveMovimientoRelacionadoVirtual = CveMovimientoSalidaDev
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar el movimiento. Por favor vuelva a intentar."
|
||||
End If
|
||||
|
||||
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDev, UsuarioActual.CveEmpresa) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los movimientos de devolución. Por favor vuelva a intentar."
|
||||
End If
|
||||
CveConceptoMovimientoVirtual = 18
|
||||
End If
|
||||
|
||||
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,
|
||||
Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="RE/G6")
|
||||
FolioVirtual = ObjInventario.Folio
|
||||
|
||||
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 Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
Else
|
||||
If ValidaVirtual Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar el movimiento en almacen virtual. Por favor vuelva a intentar."
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "No se tienen productos para el almacen virtual."
|
||||
End If
|
||||
End If
|
||||
|
||||
' TERMINA: VIRTUAL
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
Dim ConceptoMovimiento = 3
|
||||
@@ -2316,8 +2211,81 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
End If
|
||||
|
||||
'AGREGA BITACORA A VENTA
|
||||
If Not ErrorMovInv Then
|
||||
' COMIENZA: VIRTUAL
|
||||
If TipoDocto.Contiene("Ing", "Dev") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso CveMovimiento > 0 Then
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
|
||||
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
|
||||
|
||||
If TipoMovimiento = 1 Then
|
||||
CveConceptoMovimientoVirtual = 36
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
ElseIf TipoMovimiento = 2 Then
|
||||
ValidaVirtual = True
|
||||
CveConceptoMovimientoVirtual = 37
|
||||
End If
|
||||
|
||||
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,
|
||||
Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="RE/G6")
|
||||
FolioVirtual = ObjInventario.Folio
|
||||
|
||||
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 Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
Else
|
||||
If ValidaVirtual Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar el movimiento en almacen virtual. Por favor vuelva a intentar."
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "No se tienen productos para el almacen virtual."
|
||||
End If
|
||||
End If
|
||||
|
||||
' TERMINA: VIRTUAL
|
||||
|
||||
|
||||
'AGREGA BITACORA A VENTA
|
||||
If Not ErrorMovInv Then
|
||||
Dim MensajeBitacora = If(TipoMovimiento = 1, "Surtida", "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:=CveVentaSurtir) Then
|
||||
ErrorMovInv = True
|
||||
|
||||
Reference in New Issue
Block a user