No ajustar inventario al realizar el traspaso, solo mostrar existencias.
This commit is contained in:
@@ -680,7 +680,7 @@
|
|||||||
<%--<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="15%" />--%>
|
<%--<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="15%" />--%>
|
||||||
<asp:TemplateField HeaderText="Serie" ItemStyle-Width="15%" Visible="false" >
|
<asp:TemplateField HeaderText="Serie" ItemStyle-Width="15%" Visible="false" >
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:TextBox ID="TxtSerie" Width="90px" runat="server" Text='<%# Eval("Serie") %>' ></asp:TextBox>
|
<asp:TextBox ID="TxtSerie" Width="90px" runat="server" Text='<%# Eval("Serie") %>'></asp:TextBox>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:TemplateField HeaderText="Lote" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center" Visible="false" >
|
<asp:TemplateField HeaderText="Lote" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center" Visible="false" >
|
||||||
|
|||||||
@@ -941,67 +941,28 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
Dim FechaCaducidad As Date
|
Dim FechaCaducidad As Date
|
||||||
|
|
||||||
Dim TextoExistencia As StringBuilder = New StringBuilder
|
Dim TextoExistencia As StringBuilder = New StringBuilder
|
||||||
Dim Existencia As Decimal
|
TextoExistencia.Append("Los siguiente productos no tienen existencia:<br/>")
|
||||||
Dim CantidadenGrid As Decimal
|
|
||||||
TextoExistencia.Append("Los siguiente productos se ajustaron por falta de existencia:<br/>")
|
|
||||||
If Not CargadoDeMov Then
|
|
||||||
|
|
||||||
For Each dr As DataRow In DtMovimientos.Rows
|
For Each gvr As GridViewRow In GvDatos.Rows
|
||||||
CveSeccionAlmacen = If(dr("CveSeccionAlmacen").ToString = "", -1, dr("CveSeccionAlmacen").ToString.ToEntero)
|
Dim Existencia As Decimal = 0
|
||||||
Serie = If(dr("Serie").ToString = "", "-1", dr("Serie").ToString)
|
CveSeccionAlmacen = If(gvr.DataKey("CveSeccionAlmacen") = "", -1, gvr.DataKey("CveSeccionAlmacen").ToEntero)
|
||||||
Lote = If(dr("Lote").ToString = "", "-1", dr("Lote").ToString)
|
Serie = If(gvr.DataKey("Serie") = "", "-1", gvr.DataKey("Serie"))
|
||||||
FechaCaducidad = If(dr("FechaCaducidad").ToString = "", MinFecha, dr("FechaCaducidad").ToString.ToDate)
|
Lote = If(gvr.DataKey("Lote") = "", "-1", gvr.DataKey("Lote"))
|
||||||
Dim tLote As String = If(Lote <> "-1", String.Format("AND Lote = '{0}' ", Lote), "")
|
FechaCaducidad = If(gvr.DataKey("FechaCaducidad") = "", MinFecha, gvr.DataKey("FechaCaducidad").ToDate)
|
||||||
Dim tFechaCaducidad As String = If(FechaCaducidad > MinFecha, String.Format("AND FechaCaducidad = '{0}' ", FechaCaducidad), "")
|
|
||||||
|
|
||||||
Dim ExistenciaEspecificada As Decimal = 0
|
If ObjInventario.GetExistenciasProducto(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, Caducidad:=FechaCaducidad) Then
|
||||||
CantidadenGrid = DtMovimientos.SUMD("Cantidad", String.Format("CvePS = {0} AND CveUM = {1} {2} {3} {4} ", dr("CvePS"), dr("CveUM"), If(Not dr("Serie").ToString.Contiene("-1", ""), $" AND Serie = '{dr("Serie")}'", ""), tLote, tFechaCaducidad))
|
'si hay existencia en almacen costeado, lo tengo que sacar
|
||||||
If ObjInventario.GetExistenciasProducto(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, Caducidad:=FechaCaducidad) Then
|
Existencia = ObjInventario.DtResultados.FiltroPrimeroValor("ExistenciaFinal", String.Format("CveAlmacen = {0}", DdlAlmacenOrigen.SelectedValue)).ToDecimal
|
||||||
'si hay existencia en almacen costeado, lo tengo que sacar
|
End If
|
||||||
Existencia = ObjInventario.DtResultados.FiltroPrimeroValor("ExistenciaFinal", String.Format("CveAlmacen = {0}", DdlAlmacenOrigen.SelectedValue)).ToDecimal
|
Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero()
|
||||||
End If
|
|
||||||
|
|
||||||
'Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, PendientePorSurtir:=1)
|
If Existencia < 0 Then
|
||||||
Existencia -= CantidadenGrid
|
ErrorExistencia = True
|
||||||
'DtMovimientos.SUM("Cantidad", String.Format("CvePS = {0}", dr("CvePS").ToString.ToEntero))
|
|
||||||
'la primera vez valida, que la existencia global, cumpla, considerando lo pendiente por surtir
|
|
||||||
'las segunda consulta, que tenga existencia, ya con los parametros especificos
|
|
||||||
If FechaCaducidad > MinFecha OrElse (Lote <> "-1" AndAlso Lote <> "") OrElse (Serie <> "-1" AndAlso Serie <> "") Then
|
|
||||||
If ObjInventario.GetExistenciasProducto(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, Caducidad:=FechaCaducidad) Then
|
|
||||||
ExistenciaEspecificada = ObjInventario.DtResultados.FiltroPrimeroValor("Existencia", String.Format("CveAlmacen = {0}", DdlAlmacenOrigen.SelectedValue)).ToDecimal
|
|
||||||
End If
|
|
||||||
Existencia = ExistenciaEspecificada - CantidadenGrid
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Existencia < 0 Then
|
'gvr.FCTextBox("TxtCantidad2").Text = (Existencia + gvr.FCTextBox("TxtCantidad2").Text.ToEntero).ToString
|
||||||
ErrorExistencia = True
|
TextoExistencia.AppendFormat("-<b>#{0}</b> {1} {2} Existencia: <b>{3}</b><br/>", gvr.DataKey("No"), gvr.DataKey("PS"), If(gvr.DataKey("Serie").ToString().Trim().Length > 0, $" Serie: <b>{gvr.DataKey("Serie")}</b>", ""), (Existencia + gvr.FCTextBox("TxtCantidad2").Text.ToEntero))
|
||||||
dr("EstatusExistencia") = "-1"
|
End If
|
||||||
dr("Cantidad") = Existencia
|
Next
|
||||||
TextoExistencia.AppendFormat("- #{0} {1}<br/>", dr("No").ToString, dr("PS").ToString)
|
|
||||||
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Else
|
|
||||||
For Each gvr As GridViewRow In GvDatos.Rows
|
|
||||||
CveSeccionAlmacen = If(gvr.DataKey("CveSeccionAlmacen") = "", -1, gvr.DataKey("CveSeccionAlmacen").ToEntero)
|
|
||||||
Serie = If(gvr.DataKey("Serie") = "", "-1", gvr.DataKey("Serie"))
|
|
||||||
Lote = If(gvr.DataKey("Lote") = "", "-1", gvr.DataKey("Lote"))
|
|
||||||
FechaCaducidad = If(gvr.DataKey("FechaCaducidad") = "", MinFecha, gvr.DataKey("FechaCaducidad").ToDate)
|
|
||||||
|
|
||||||
If ObjInventario.GetExistenciasProducto(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, Caducidad:=FechaCaducidad) Then
|
|
||||||
'si hay existencia en almacen costeado, lo tengo que sacar
|
|
||||||
Existencia = ObjInventario.DtResultados.FiltroPrimeroValor("ExistenciaFinal", String.Format("CVeAlmacen = {0}", DdlAlmacenOrigen.SelectedValue)).ToDecimal
|
|
||||||
End If
|
|
||||||
'Existencia = ObjInventario.GetExistenciasPS(gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, PendientePorSurtir:=1)
|
|
||||||
Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero
|
|
||||||
If Existencia < 0 Then
|
|
||||||
ErrorExistencia = True
|
|
||||||
|
|
||||||
gvr.FCTextBox("TxtCantidad2").Text = (Existencia + gvr.FCTextBox("TxtCantidad2").Text.ToEntero).ToString
|
|
||||||
TextoExistencia.AppendFormat("- #{0} {1}<br/>", gvr.DataKey("No").ToString, gvr.DataKey("PS").ToString)
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ErrorExistencia Then
|
If ErrorExistencia Then
|
||||||
Alert(TextoExistencia.ToString, TipoMensaje.MsgError)
|
Alert(TextoExistencia.ToString, TipoMensaje.MsgError)
|
||||||
@@ -1809,6 +1770,11 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
e.Row.FCTextBox("TxtCaducidad").Visible = True
|
e.Row.FCTextBox("TxtCaducidad").Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
e.Row.FCTextBox("TxtSerie").ReadOnly = True
|
||||||
|
|
||||||
|
'e.Row.FCTextBox("TxtSerie").Enabled = False
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'FUNCIONALIDAD PISTOLA DE CODIGOS
|
'FUNCIONALIDAD PISTOLA DE CODIGOS
|
||||||
@@ -1819,7 +1785,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub BtnCancelarTraspaso_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnCancelarTraspaso_Click(sender As Object, e As EventArgs)
|
||||||
|
|||||||
Reference in New Issue
Block a user