Error al hacer devolucion

This commit is contained in:
2020-02-25 17:50:34 -07:00
parent 54fa4598c9
commit db3b877b45

View File

@@ -948,7 +948,7 @@ Partial Class Inventarios_RecepcionAlmacen
'Existencias 'Existencias
If TipoMovimiento = 2 Then If TipoMovimiento = 2 Then
If ObjInventario.ComprasDevolucionExistenciasGet(CveCompraSurtir) Then If ObjInventario.ComprasDevolucionExistenciasGet(CveCompraSurtir) Then
DtExistencias = DtRecepcion DtExistencias = ObjInventario.DtResultados.Copy
Else Else
Alert("No se pudieron cargar las existencias del movimiento de entrada, por lo cual no se podra hacer la devolución.", TipoMensaje.MsgError) 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 BtnGuardar.Enabled = False
@@ -2031,8 +2031,8 @@ Partial Class Inventarios_RecepcionAlmacen
Dim ObjContaContPAQ As ClsContPAQi = Nothing Dim ObjContaContPAQ As ClsContPAQi = Nothing
'ENTREGA DIRECTA 'ENTREGA DIRECTA
Dim CveMovtoSalidaDirecta = -1 Dim MovtosSalidaDirecta As New List(Of Integer)
Dim FolioSalidaDirecta = -1 Dim FoliosSalidaDirecta As New List(Of Integer)
'APARTADOS 'APARTADOS
Dim MovtosSalida As New List(Of Integer) Dim MovtosSalida As New List(Of Integer)
@@ -2160,33 +2160,53 @@ Partial Class Inventarios_RecepcionAlmacen
'ENTREGA DIRECTA 'ENTREGA DIRECTA
If EntregaDirecta Then If EntregaDirecta Then
If Not ErrorMovInv Then If Not ErrorMovInv Then
Dim CveVenta As Integer = 0
Dim Dt As DataTable = Nothing Dim Dt As DataTable = Nothing
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then If ObjInventario.DtResultados.Rows.Count > 0 Then
Dt = ObjInventario.DtResultados Dt = ObjInventario.DtResultados
CveVenta = ObjInventario.DtResultados.Rows(0)("CveVenta").ToString.ToEntero
End If End If
End If End If
CveMovtoSalidaDirecta = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, 'GENERA UN MOVIMIENTO POR CADA VENTA
CveVenta, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio), For Each DrVenta As DataRow In Dt.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
MovimientoFijo:=True, CveMovimientoRelacionado:=CveMovimiento, Remision:=TxtRemision.Text, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:="RA/G") Dim CveMovtoSalidaDirecta As Integer = -1
FolioSalidaDirecta = ObjInventario.Folio Dim FolioSalidaDirecta As Integer = -1
If Not CveMovtoSalidaDirecta > 0 Then Dim CveVenta As Integer = DrVenta("CveVenta").ToString().ToEntero()
ErrorMovInv = True
End If
If Not ErrorMovInv AndAlso Dt IsNot Nothing Then CveMovtoSalidaDirecta = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1,
For Each Dr As DataRow In Dt.Rows CveVenta, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio),
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 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 ErrorMovInv = True
Exit For Exit For
End If 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 ErrorMovInv Then
If Not ObjInventario.LimpiaEntregaDirecta(CveMovimiento) Then If Not ObjInventario.LimpiaEntregaDirecta(CveMovimiento) Then
@@ -2194,12 +2214,6 @@ Partial Class Inventarios_RecepcionAlmacen
End If End If
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
End If End If
@@ -2745,11 +2759,19 @@ Partial Class Inventarios_RecepcionAlmacen
Msg.AppendFormat("Movimiento Registrado: Folio: <b>{0}</b>", link) Msg.AppendFormat("Movimiento Registrado: Folio: <b>{0}</b>", link)
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
'If CveMovtoSalidaDirecta > 0 Then
' Msg.AppendFormat("<br/><br/> Movimientos de control:<br/>")
' link = String.Format("<a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovtoSalidaDirecta, FolioSalidaDirecta)
' Msg.AppendFormat("Movimiento de Salida Folio: <b>{0}</b>", link)
'End If
'ENTREGA DIRECTA 'ENTREGA DIRECTA
If CveMovtoSalidaDirecta > 0 Then If MovtosSalidaDirecta.Count > 0 Then
Msg.AppendFormat("<br/><br/> Movimientos de control:<br/>") Msg.AppendFormat("<br/><br/> Movimientos de control:<br/>")
link = String.Format("<a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovtoSalidaDirecta, FolioSalidaDirecta) For index = 0 To MovtosSalidaDirecta.Count - 1
Msg.AppendFormat("Movimiento de Salida Folio: <b>{0}</b>", link) link = String.Format("<a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", MovtosSalidaDirecta(index), FoliosSalidaDirecta(index))
Msg.AppendFormat("<br/>Movimiento de Salida Folio: <b>{0}</b>", link)
Next
End If End If
'APARTADO 'APARTADO