diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb
index ede60a241..12c73fb0e 100644
--- a/Inventarios/RecepcionAlmacen.aspx.vb
+++ b/Inventarios/RecepcionAlmacen.aspx.vb
@@ -948,7 +948,7 @@ Partial Class Inventarios_RecepcionAlmacen
'Existencias
If TipoMovimiento = 2 Then
If ObjInventario.ComprasDevolucionExistenciasGet(CveCompraSurtir) Then
- DtExistencias = DtRecepcion
+ DtExistencias = ObjInventario.DtResultados.Copy
Else
Alert("No se pudieron cargar las existencias del movimiento de entrada, por lo cual no se podra hacer la devolución.", TipoMensaje.MsgError)
BtnGuardar.Enabled = False
@@ -2030,9 +2030,9 @@ Partial Class Inventarios_RecepcionAlmacen
Dim ObjContaAC As ClsContPAQi = Nothing
Dim ObjContaContPAQ As ClsContPAQi = Nothing
- 'ENTREGA DIRECTA
- Dim CveMovtoSalidaDirecta = -1
- Dim FolioSalidaDirecta = -1
+ 'ENTREGA DIRECTA
+ Dim MovtosSalidaDirecta As New List(Of Integer)
+ Dim FoliosSalidaDirecta As New List(Of Integer)
'APARTADOS
Dim MovtosSalida As New List(Of Integer)
@@ -2160,33 +2160,53 @@ Partial Class Inventarios_RecepcionAlmacen
'ENTREGA DIRECTA
If EntregaDirecta Then
If Not ErrorMovInv Then
- Dim CveVenta As Integer = 0
+
Dim Dt As DataTable = Nothing
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
Dt = ObjInventario.DtResultados
- CveVenta = ObjInventario.DtResultados.Rows(0)("CveVenta").ToString.ToEntero
End If
End If
- CveMovtoSalidaDirecta = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1,
- CveVenta, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio),
- MovimientoFijo:=True, CveMovimientoRelacionado:=CveMovimiento, Remision:=TxtRemision.Text, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:="RA/G")
- FolioSalidaDirecta = ObjInventario.Folio
+ 'GENERA UN MOVIMIENTO POR CADA VENTA
+ For Each DrVenta As DataRow In Dt.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
+ Dim CveMovtoSalidaDirecta As Integer = -1
+ Dim FolioSalidaDirecta As Integer = -1
- If Not CveMovtoSalidaDirecta > 0 Then
- ErrorMovInv = True
- End If
+ Dim CveVenta As Integer = DrVenta("CveVenta").ToString().ToEntero()
- If Not ErrorMovInv AndAlso Dt IsNot Nothing Then
- For Each Dr As DataRow In Dt.Rows
- If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaDirecta, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
+ CveMovtoSalidaDirecta = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1,
+ CveVenta, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio),
+ MovimientoFijo:=True, CveMovimientoRelacionado:=CveMovimiento, Remision:=TxtRemision.Text, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:="RA/G")
+ FolioSalidaDirecta = ObjInventario.Folio
+
+ If Not CveMovtoSalidaDirecta > 0 Then
+ ErrorMovInv = True
+ Exit For
+ End If
+
+ If Not ErrorMovInv AndAlso Dt IsNot Nothing Then
+ For Each Dr As DataRow In Dt.FiltraParametros($"CveVenta={CveVenta}").Rows
+ If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaDirecta, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
+ ErrorMovInv = True
+ Exit For
+ End If
+ Next
+ End If
+
+ If Not ErrorMovInv Then
+ If Not GeneraPrePolizaSalidaEntregaDirecta(CveMovtoSalidaDirecta, ObjInventario, ObjConta, ObjContaContPAQ) Then
ErrorMovInv = True
Exit For
End If
- Next
- End If
+ End If
+
+ If Not ErrorMovInv Then
+ MovtosSalidaDirecta.Add(CveMovtoSalidaDirecta)
+ FoliosSalidaDirecta.Add(FolioSalidaDirecta)
+ End If
+ Next
If Not ErrorMovInv Then
If Not ObjInventario.LimpiaEntregaDirecta(CveMovimiento) Then
@@ -2194,12 +2214,6 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
- If Not ErrorMovInv Then
- If Not GeneraPrePolizaSalidaEntregaDirecta(CveMovtoSalidaDirecta, ObjInventario, ObjConta, ObjContaContPAQ) Then
- ErrorMovInv = True
- End If
- End If
-
End If
End If
@@ -2743,13 +2757,21 @@ Partial Class Inventarios_RecepcionAlmacen
Dim Msg As New StringBuilder
Dim link As String = String.Format("{1}", CveMovimiento, InvFolio)
Msg.AppendFormat("Movimiento Registrado: Folio: {0}", link)
- Msg.AppendFormat("
Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
-
- 'ENTREGA DIRECTA
- If CveMovtoSalidaDirecta > 0 Then
+ Msg.AppendFormat("
Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
+
+ 'If CveMovtoSalidaDirecta > 0 Then
+ ' Msg.AppendFormat("
Movimientos de control:
")
+ ' link = String.Format("{1}", CveMovtoSalidaDirecta, FolioSalidaDirecta)
+ ' Msg.AppendFormat("Movimiento de Salida Folio: {0}", link)
+ 'End If
+
+ 'ENTREGA DIRECTA
+ If MovtosSalidaDirecta.Count > 0 Then
Msg.AppendFormat("
Movimientos de control:
")
- link = String.Format("{1}", CveMovtoSalidaDirecta, FolioSalidaDirecta)
- Msg.AppendFormat("Movimiento de Salida Folio: {0}", link)
+ For index = 0 To MovtosSalidaDirecta.Count - 1
+ link = String.Format("{1}", MovtosSalidaDirecta(index), FoliosSalidaDirecta(index))
+ Msg.AppendFormat("
Movimiento de Salida Folio: {0}", link)
+ Next
End If
'APARTADO