Generacion automatica del virtual
This commit is contained in:
@@ -1908,12 +1908,26 @@ Partial Class Inventarios_EntradasSalidas
|
|||||||
' End If
|
' End If
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
|
Dim RetornoVirtual As MMovimientoVirtual = Nothing
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
|
RetornoVirtual = GenerarMovimientoVirtual(CveMovimiento, ObjInventario)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If RetornoVirtual IsNot Nothing Then
|
||||||
|
ErrorMovInv = RetornoVirtual.TieneError
|
||||||
|
End If
|
||||||
|
|
||||||
If Not ErrorAC And Not ErrorMovInv Then
|
If Not ErrorAC And Not ErrorMovInv Then
|
||||||
Dim Msg As New StringBuilder
|
Dim Msg As New StringBuilder
|
||||||
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
|
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
|
||||||
Msg.AppendFormat("<br/><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/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
||||||
|
|
||||||
|
If RetornoVirtual IsNot Nothing Then
|
||||||
|
If RetornoVirtual.CveMovimientoVirtual > 0 Then
|
||||||
|
Msg.AppendFormat("<br/><br/>Se generó el movimiento virtual con el folio: <b><a class=""Texto"" target='_blank' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">{1}</a></b>", RetornoVirtual.CveMovimientoVirtual, RetornoVirtual.FolioVirtual)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza)
|
If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza)
|
||||||
If IDPoliza > 0 Then Msg = Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza)
|
If IDPoliza > 0 Then Msg = Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza)
|
||||||
|
|
||||||
@@ -5039,16 +5053,36 @@ Partial Class Inventarios_EntradasSalidas
|
|||||||
|
|
||||||
Protected Sub LnkGenerarVirtual_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkGenerarVirtual_Click(sender As Object, e As EventArgs)
|
||||||
If CveMovimiento > 0 Then
|
If CveMovimiento > 0 Then
|
||||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
Dim ObjInventario As New ClsInventarios
|
||||||
|
ObjInventario.IniciaTransacSQL()
|
||||||
|
|
||||||
|
Dim Retorno = GenerarMovimientoVirtual(Me.CveMovimiento, ObjInventario)
|
||||||
|
|
||||||
|
If Retorno.TieneError Then
|
||||||
|
ObjInventario.RollBack()
|
||||||
|
Else
|
||||||
|
ObjInventario.Commit()
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjInventario.Dispose()
|
||||||
|
|
||||||
|
If Retorno.CveMovimientoVirtual > 0 AndAlso Not Retorno.TieneError Then
|
||||||
|
Alert($"Se generó el movimiento virtual con el folio:<b>{Retorno.FolioVirtual}<b/>")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Function GenerarMovimientoVirtual(CveMovimiento As Integer, ObjInventario As ClsInventarios) As MMovimientoVirtual
|
||||||
Dim ErrorMovInv As Boolean = False
|
Dim ErrorMovInv As Boolean = False
|
||||||
|
|
||||||
|
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||||
Dim CveMovimientoVirtual As Integer = -1
|
Dim CveMovimientoVirtual As Integer = -1
|
||||||
Dim FolioVirtual As Integer = -1
|
Dim FolioVirtual As Integer = -1
|
||||||
|
|
||||||
Dim tCveAlmacen As Integer = -1
|
Dim tCveAlmacen As Integer = -1
|
||||||
Dim tOrigen As Integer = -1
|
Dim tOrigen As Integer = -1
|
||||||
Dim ObjInventario As New ClsInventarios
|
|
||||||
ObjInventario.IniciaTransacSQL()
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||||
@@ -5080,32 +5114,15 @@ Partial Class Inventarios_EntradasSalidas
|
|||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Else
|
|
||||||
ErrorMovInv = True
|
|
||||||
Alert("No hay usados para generar el virtual", TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
End If
|
||||||
Else
|
|
||||||
ErrorMovInv = True
|
|
||||||
Alert("El almacen no tiene vinculado un almacen virtual", TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
If ErrorMovInv Then
|
Return New MMovimientoVirtual With {.TieneError = ErrorMovInv, .CveMovimientoVirtual = CveMovimientoVirtual, .FolioVirtual = FolioVirtual.ToString()}
|
||||||
ObjInventario.RollBack()
|
End Function
|
||||||
Else
|
|
||||||
ObjInventario.Commit()
|
|
||||||
End If
|
|
||||||
|
|
||||||
ObjInventario.Dispose()
|
|
||||||
|
|
||||||
If CveMovimientoVirtual > 0 AndAlso Not ErrorMovInv Then
|
|
||||||
Alert($"Se generó el movimiento virtual con el folio:<b>{FolioVirtual}<b/>")
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
|
|
||||||
Protected Sub LnkGenerarPDF_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkGenerarPDF_Click(sender As Object, e As EventArgs)
|
||||||
@@ -5299,5 +5316,9 @@ Partial Class Inventarios_EntradasSalidas
|
|||||||
Next
|
Next
|
||||||
Return Timbre
|
Return Timbre
|
||||||
End Function
|
End Function
|
||||||
|
Private Class MMovimientoVirtual
|
||||||
|
Public Property CveMovimientoVirtual As Integer
|
||||||
|
Public Property FolioVirtual As String
|
||||||
|
Public Property TieneError As Boolean
|
||||||
|
End Class
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user