validacion de la cantidad existente en los movimientos de almacen
This commit is contained in:
@@ -618,7 +618,7 @@
|
|||||||
|
|
||||||
<asp:UpdatePanel runat="server" ID="UpDatosRecepcion" UpdateMode="Conditional">
|
<asp:UpdatePanel runat="server" ID="UpDatosRecepcion" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:GridView ID="GvDatosRecepcion" DataKeyNames="CveMovimiento,CveUM,CvePS,PS,CveAF,CodigoBarras,CveAlmacen,CveAlmacenDestino,AplicaSerieLote,CveMovimientoDetalle,PU,CveAlmacenSalida,CveMovimientoSalida,SerieLote,Lote,Batch,Cantidad, GastoIndirectoSalida, Importe" runat="server" AutoGenerateColumns="False" EmptyDataText="No hay movimientos pendientes" ToolTip="Listado de Movimientos" CssClass="table table-hover Widthall" GridLines="None">
|
<asp:GridView ID="GvDatosRecepcion" DataKeyNames="CveMovimiento,CveUM,CvePS,PS,CveAF,CodigoBarras,CveAlmacen,CveAlmacenDestino,AplicaSerieLote,CveMovimientoDetalle,PU,CveAlmacenSalida,CveMovimientoSalida,SerieLote,Lote,Batch,Cantidad, GastoIndirectoSalida, Importe,Codigo" runat="server" AutoGenerateColumns="False" EmptyDataText="No hay movimientos pendientes" ToolTip="Listado de Movimientos" CssClass="table table-hover Widthall" GridLines="None">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
|
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
|
||||||
<%--<HeaderTemplate>
|
<%--<HeaderTemplate>
|
||||||
|
|||||||
@@ -168,6 +168,14 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
ViewState("TipoSeccionAlmacen") = value
|
ViewState("TipoSeccionAlmacen") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
Private Property FolioBusqueda As Integer
|
||||||
|
Get
|
||||||
|
Return CType(ViewState("FolioBusqueda"), Integer)
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
ViewState("FolioBusqueda") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
@@ -1289,14 +1297,16 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
Dim ObjInventarios As New ClsInventarios
|
Dim ObjInventarios As New ClsInventarios
|
||||||
Dim Dtt As DataTable = Nothing
|
Dim Dtt As DataTable = Nothing
|
||||||
|
|
||||||
If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, If(TxtFolioRecepcion.Text = "", -1, TxtFolioRecepcion.Text.ToEntero), UsuarioActual.CveEmpresa) Then
|
FolioBusqueda = If(TxtFolioRecepcion.Text = "", -1, TxtFolioRecepcion.Text.ToEntero)
|
||||||
|
|
||||||
|
If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then
|
||||||
Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"))
|
Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"))
|
||||||
If TxtFolioRecepcion.Text.Trim <> "" Then
|
If TxtFolioRecepcion.Text.Trim <> "" Then
|
||||||
CveMovimientoSalida = ObjInventarios.DtResultados.FiltroPrimeroValor("CveMovimiento", "").ToEntero
|
CveMovimientoSalida = ObjInventarios.DtResultados.FiltroPrimeroValor("CveMovimiento", "").ToEntero
|
||||||
|
|
||||||
End If
|
End If
|
||||||
'CveAlmacenDestino = DdlAlmacenRecepcion.SelectedValue.ToEntero
|
CveAlmacenDestino = DdlAlmacenRecepcion.SelectedValue.ToEntero
|
||||||
'CveAlmacenTransitorio = DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero
|
CveAlmacenTransitorio = DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero
|
||||||
'CveUsuarioResponsable = DdlResponsableRecepcion.SelectedValue.ToEntero
|
'CveUsuarioResponsable = DdlResponsableRecepcion.SelectedValue.ToEntero
|
||||||
Else
|
Else
|
||||||
Alert("Ocurrió un error al consultar los movimientos transitorios. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
Alert("Ocurrió un error al consultar los movimientos transitorios. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||||
@@ -1435,7 +1445,14 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
|
|
||||||
Protected Sub BtnRecibir_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnRecibir_Click(sender As Object, e As EventArgs)
|
||||||
If GvDatosRecepcion.Rows.Count > 0 Then
|
If GvDatosRecepcion.Rows.Count > 0 Then
|
||||||
|
Dim ObjInventarios As New ClsInventarios
|
||||||
|
Dim Dtt As DataTable = Nothing
|
||||||
|
|
||||||
|
If ObjInventarios.GetMovimientosTransitorios(CveAlmacenDestino, -1, CveAlmacenTransitorio, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then
|
||||||
|
Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"), "", {"Codigo", "Cantidad"})
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjInventarios.Dispose()
|
||||||
'Valida Movimientos
|
'Valida Movimientos
|
||||||
Dim ValidaMovtos = 0.0
|
Dim ValidaMovtos = 0.0
|
||||||
For Each gvr As GridViewRow In GvDatosRecepcion.Rows
|
For Each gvr As GridViewRow In GvDatosRecepcion.Rows
|
||||||
@@ -1480,7 +1497,18 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
Dim CveMovimientoDetalleEntrada As Integer = 0
|
Dim CveMovimientoDetalleEntrada As Integer = 0
|
||||||
Dim Cont As Integer = 0
|
Dim Cont As Integer = 0
|
||||||
For Each gvr As GridViewRow In GvDatosRecepcion.Rows
|
For Each gvr As GridViewRow In GvDatosRecepcion.Rows
|
||||||
If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
|
Dim dataRowAux As DataRow = Dtt.FiltroPrimero(String.Format("Codigo = '{0}'", If(gvr.DataKey("Codigo").ToString = "", "0", gvr.DataKey("Codigo").ToString)))
|
||||||
|
Dim cantidadDisponibleValidacion As Decimal = 0
|
||||||
|
|
||||||
|
If gvr.DataKey("Codigo").ToString IsNot "" Then
|
||||||
|
If dataRowAux IsNot Nothing Then
|
||||||
|
cantidadDisponibleValidacion = dataRowAux.Item("Cantidad").ToString.ToDecimal - gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
|
||||||
|
Else
|
||||||
|
cantidadDisponibleValidacion = -1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 AndAlso cantidadDisponibleValidacion >= 0 Then
|
||||||
CveMovimientoDetalleEntrada = gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero
|
CveMovimientoDetalleEntrada = gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero
|
||||||
|
|
||||||
If CveMovimientoDetalleEntrada <= 0 Then
|
If CveMovimientoDetalleEntrada <= 0 Then
|
||||||
@@ -1504,7 +1532,9 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
ElseIf cantidadDisponibleValidacion < 0 Then
|
||||||
|
TextoError = String.Format("Se exceden la cantidad disponibles para {0}", gvr.DataKey("PS").ToString)
|
||||||
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
Cont += 1
|
Cont += 1
|
||||||
Next
|
Next
|
||||||
|
|||||||
Reference in New Issue
Block a user