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:TemplateField HeaderText="Serie" ItemStyle-Width="15%" Visible="false" >
|
||||
<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>
|
||||
</asp:TemplateField>
|
||||
<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 TextoExistencia As StringBuilder = New StringBuilder
|
||||
Dim Existencia As Decimal
|
||||
Dim CantidadenGrid As Decimal
|
||||
TextoExistencia.Append("Los siguiente productos se ajustaron por falta de existencia:<br/>")
|
||||
If Not CargadoDeMov Then
|
||||
TextoExistencia.Append("Los siguiente productos no tienen existencia:<br/>")
|
||||
|
||||
For Each dr As DataRow In DtMovimientos.Rows
|
||||
CveSeccionAlmacen = If(dr("CveSeccionAlmacen").ToString = "", -1, dr("CveSeccionAlmacen").ToString.ToEntero)
|
||||
Serie = If(dr("Serie").ToString = "", "-1", dr("Serie").ToString)
|
||||
Lote = If(dr("Lote").ToString = "", "-1", dr("Lote").ToString)
|
||||
FechaCaducidad = If(dr("FechaCaducidad").ToString = "", MinFecha, dr("FechaCaducidad").ToString.ToDate)
|
||||
Dim tLote As String = If(Lote <> "-1", String.Format("AND Lote = '{0}' ", Lote), "")
|
||||
Dim tFechaCaducidad As String = If(FechaCaducidad > MinFecha, String.Format("AND FechaCaducidad = '{0}' ", FechaCaducidad), "")
|
||||
For Each gvr As GridViewRow In GvDatos.Rows
|
||||
Dim Existencia As Decimal = 0
|
||||
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)
|
||||
|
||||
Dim ExistenciaEspecificada As Decimal = 0
|
||||
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))
|
||||
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
|
||||
'si hay existencia en almacen costeado, lo tengo que sacar
|
||||
Existencia = ObjInventario.DtResultados.FiltroPrimeroValor("ExistenciaFinal", String.Format("CveAlmacen = {0}", DdlAlmacenOrigen.SelectedValue)).ToDecimal
|
||||
End If
|
||||
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 -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero()
|
||||
|
||||
'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)
|
||||
Existencia -= CantidadenGrid
|
||||
'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
|
||||
ErrorExistencia = True
|
||||
|
||||
If Existencia < 0 Then
|
||||
ErrorExistencia = True
|
||||
dr("EstatusExistencia") = "-1"
|
||||
dr("Cantidad") = Existencia
|
||||
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
|
||||
'gvr.FCTextBox("TxtCantidad2").Text = (Existencia + gvr.FCTextBox("TxtCantidad2").Text.ToEntero).ToString
|
||||
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))
|
||||
End If
|
||||
Next
|
||||
|
||||
If ErrorExistencia Then
|
||||
Alert(TextoExistencia.ToString, TipoMensaje.MsgError)
|
||||
@@ -1809,6 +1770,11 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
e.Row.FCTextBox("TxtCaducidad").Visible = True
|
||||
End If
|
||||
|
||||
e.Row.FCTextBox("TxtSerie").ReadOnly = True
|
||||
|
||||
'e.Row.FCTextBox("TxtSerie").Enabled = False
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'FUNCIONALIDAD PISTOLA DE CODIGOS
|
||||
@@ -1819,7 +1785,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnCancelarTraspaso_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Reference in New Issue
Block a user