ajustes en aplicar lote/caducidad
This commit is contained in:
@@ -443,6 +443,7 @@
|
|||||||
<asp:TextBox ID="TxtnLote" CssClass="form-control input-sm" runat="server" Width="80px" Visible="false"></asp:TextBox>
|
<asp:TextBox ID="TxtnLote" CssClass="form-control input-sm" runat="server" Width="80px" Visible="false"></asp:TextBox>
|
||||||
</td>
|
</td>
|
||||||
<td runat="server" id="TdFechaCaducidad" visible="false">
|
<td runat="server" id="TdFechaCaducidad" visible="false">
|
||||||
|
<asp:CheckBox ID="ChkSugiereFechaCaducidad" runat="server" Text="Auto Sugiere" ToolTip="Auto Sugiere Fecha de caducidad" AutoPostBack="true" OnCheckedChanged="ChkSugiereFechaCaducidad_CheckedChanged" />
|
||||||
<asp:TextBox ID="TxtnFechaCaducidad" CssClass="form-control input-sm" runat="server" Width="80px" Visible="false"></asp:TextBox>
|
<asp:TextBox ID="TxtnFechaCaducidad" CssClass="form-control input-sm" runat="server" Width="80px" Visible="false"></asp:TextBox>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
@@ -456,7 +457,7 @@
|
|||||||
<asp:GridView ID="GvDatos" DataKeyNames="No,PS,CvePS,CveUM,Serie,Cantidad" runat="server" ShowHeader="false" AutoGenerateColumns="False" EmptyDataText="" ToolTip="Listado de Movimientos" CssClass="Widthall table table-striped table-hover" GridLines="None">
|
<asp:GridView ID="GvDatos" DataKeyNames="No,PS,CvePS,CveUM,Serie,Cantidad" runat="server" ShowHeader="false" AutoGenerateColumns="False" EmptyDataText="" ToolTip="Listado de Movimientos" CssClass="Widthall table table-striped table-hover" GridLines="None">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField HeaderText="#" DataField="No" ItemStyle-Width="23px" />
|
<asp:BoundField HeaderText="#" DataField="No" ItemStyle-Width="23px" />
|
||||||
<asp:TemplateField ItemStyle-Width="93px">
|
<asp:TemplateField ItemStyle-Width="93px" ItemStyle-HorizontalAlign ="Right">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal runat="server" Text='<%# Eval("Cantidad") %>' ID="ltlCantidad"></asp:Literal>
|
<asp:Literal runat="server" Text='<%# Eval("Cantidad") %>' ID="ltlCantidad"></asp:Literal>
|
||||||
<asp:TextBox runat="server" ID="TxtCantidad2" Text='<%# Eval("Cantidad", "{0:###,###,###,##0.##}") %>' Width="50px" Visible="false"></asp:TextBox>
|
<asp:TextBox runat="server" ID="TxtCantidad2" Text='<%# Eval("Cantidad", "{0:###,###,###,##0.##}") %>' Width="50px" Visible="false"></asp:TextBox>
|
||||||
|
|||||||
@@ -526,19 +526,73 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
|
|
||||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimero("") ' Estado = -1
|
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimero("") ' Estado = -1
|
||||||
|
|
||||||
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
If DrPS IsNot Nothing Then
|
||||||
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
|
||||||
If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then
|
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
||||||
Alert(String.Format("El producto se vende solo en cantidades de {0:#,###.####}", DrPS("VentaMinima")))
|
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
||||||
Exit Sub
|
If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then
|
||||||
|
Alert(String.Format("El producto se vende solo en cantidades de {0:#,###.####}", DrPS("VentaMinima")))
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, DdlSeccionAlmacen.SelectedValue.ToEntero, If(TxtnSerie.Visible, TxtnSerie.Text, "-1"), If(TxtnLote.Visible, TxtnLote.Text, "-1"), If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha))
|
'codigo provisional.
|
||||||
|
Dim CveSubP As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenOrigen.selectedvalue.toentero).FiltroPrimeroValor("CveSubProyecto", "").ToEntero
|
||||||
|
|
||||||
|
|
||||||
|
If DrPS("AplicaCaducidad").ToString = "True" AndAlso ChkSugiereFechaCaducidad.checked And CveSubP.Contiene(10276) Then
|
||||||
|
|
||||||
|
Dim ObjInventarios As New ClsInventarios
|
||||||
|
If ObjInventarios.GetExistenciasCaducidad(CveProducto, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.selectedvalue) Then
|
||||||
|
Dim dtt As DataTable = ObjInventarios.DtResultados
|
||||||
|
|
||||||
|
If Cantidad > dtt.SUMD("Cantidad") Then
|
||||||
|
Alert("No se cuenta con la cantidad requerida")
|
||||||
|
Else
|
||||||
|
'recorro las existencias para tomar la cantidad
|
||||||
|
Dim i As Decimal = 0
|
||||||
|
Dim CantidadRestante As Decimal = Cantidad
|
||||||
|
For Each drr As DataRow In dtt.Rows
|
||||||
|
If drr("Cantidad").ToString.ToDecimal < CantidadRestante Then
|
||||||
|
i = drr("Cantidad").ToString.ToDecimal
|
||||||
|
Else
|
||||||
|
i = CantidadRestante
|
||||||
|
End If
|
||||||
|
AgregarPS(i, CveProducto, DdlUnidad.SelectedValue.ToEntero, TxtnObservaciones.Text, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Lote:=drr("Lote").ToString, FechaCaducidad:=drr("FechaCaducidad").ToString.ToDate, CveSeccionAlmacenDestino:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Limpia:=FuncionalidadSinSerie)
|
||||||
|
CantidadRestante -= i
|
||||||
|
If CantidadRestante <= 0 Then Exit For
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjInventarios.Dispose()
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
|
'codigo temporal
|
||||||
|
Dim tLote As String
|
||||||
|
Dim tCaducidad As Date
|
||||||
|
|
||||||
|
tLote = If(TxtnLote.Visible, TxtnLote.Text, "-1")
|
||||||
|
tCaducidad = If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha)
|
||||||
|
|
||||||
|
If CveSubP <> 10276 Then
|
||||||
|
tLote = "-1"
|
||||||
|
tCaducidad = MinFecha
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, DdlSeccionAlmacen.SelectedValue.ToEntero, If(TxtnSerie.Visible, TxtnSerie.Text, "-1"), tLote, tCaducidad)
|
||||||
|
|
||||||
|
If Valido Then
|
||||||
|
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, TxtnObservaciones.Text, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(TxtnSerie.Visible, TxtnSerie.Text, ""), Lote:=If(tLote = "-1", "", tLote), FechaCaducidad:=tCaducidad, CveSeccionAlmacenDestino:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Limpia:=FuncionalidadSinSerie)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
If Valido Then
|
|
||||||
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, TxtnObservaciones.Text, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(TxtnSerie.Visible, TxtnSerie.Text, ""), Lote:=If(TxtnLote.Visible, TxtnLote.Text, ""), FechaCaducidad:=If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha), CveSeccionAlmacenDestino:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Limpia:=FuncionalidadSinSerie)
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
@@ -550,26 +604,39 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
|
|
||||||
Dim Inv As New ClsInventarios
|
Dim Inv As New ClsInventarios
|
||||||
Dim Existencia As Decimal = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), PendientePorSurtir:=1)
|
Dim Existencia As Decimal = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), PendientePorSurtir:=1)
|
||||||
'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 Serie <> "" OrElse Lote <> "" Then
|
|
||||||
ExistenciaEspecificada = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, 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)
|
|
||||||
Else
|
|
||||||
ExistenciaEspecificada = Existencia
|
|
||||||
End If
|
|
||||||
Inv.Dispose()
|
|
||||||
|
|
||||||
If Existencia - Cantidad - CantidadEnGrid < 0 OrElse ExistenciaEspecificada - Cantidad - CantidadEnGrid < 0 Then
|
If Existencia > 0 Then
|
||||||
If Existencia < 0 OrElse ExistenciaEspecificada < 0 Then
|
'la primera vez valida, que la existencia global, cumpla, considerando lo pendiente por surtir
|
||||||
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
|
'las segunda consulta, que tenga existencia, ya con los parametros especificos
|
||||||
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
|
If (FechaCaducidad > MinFecha OrElse Serie <> "" OrElse Lote <> "") Then
|
||||||
|
ExistenciaEspecificada = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, 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)
|
||||||
|
Dim StrB As New stringbuilder
|
||||||
|
StrB.appendformat("CvePS = {0} AND CveUM = {1} ", CvePS, CveUnidadMedida)
|
||||||
|
If Serie <> "" Then StrB.appendformat(" AND Serie = '{0}' ", Serie)
|
||||||
|
If Lote <> "" Then StrB.appendformat(" AND Lote = '{0}' ", Lote)
|
||||||
|
If FechaCaducidad.ToDate > MinFecha Then StrB.appendformat(" AND FechaCaducidad = '{0}' ", FechaCaducidad.ToShortDateString)
|
||||||
|
Dim CantidadEspecificaEnGrid As Decimal = DtMovimientos.SUMD("Cantidad", StrB.tostring)
|
||||||
|
|
||||||
|
If ExistenciaEspecificada - Cantidad - CantidadEspecificaEnGrid < 0 Then
|
||||||
|
Alert(String.Format("Solo hay en existencia: {0:#,###.##}", ExistenciaEspecificada), TipoMensaje.MsgAdvertencia)
|
||||||
|
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
|
||||||
|
Retorno = False
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Alert(String.Format("Solo hay en existencia: {0}", Existencia), TipoMensaje.MsgAdvertencia)
|
ExistenciaEspecificada = Existencia
|
||||||
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
|
If Existencia - Cantidad - CantidadEnGrid < 0 Then
|
||||||
|
Alert(String.Format("Solo hay en existencia: {0:#,###.##}", ExistenciaEspecificada), TipoMensaje.MsgAdvertencia)
|
||||||
|
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
|
||||||
|
Retorno = False
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
Retorno = False
|
Else
|
||||||
|
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
|
||||||
|
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Inv.Dispose()
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Observaciones As String = "", Optional CveSeccionAlmacen As Integer = -1, Optional SeccionAlmacen As String = "", Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True, Optional CveSeccionAlmacenDestino As Integer = -1)
|
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Observaciones As String = "", Optional CveSeccionAlmacen As Integer = -1, Optional SeccionAlmacen As String = "", Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True, Optional CveSeccionAlmacenDestino As Integer = -1)
|
||||||
@@ -1482,6 +1549,13 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
' CargaGvDatos()
|
' CargaGvDatos()
|
||||||
'End Sub
|
'End Sub
|
||||||
|
|
||||||
|
Protected Sub ChkSugiereFechaCaducidad_CheckedChanged(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
TxtnFechaCaducidad.visible = Not ChkSugiereFechaCaducidad.checked
|
||||||
|
TxtnLote.visible = Not ChkSugiereFechaCaducidad.checked
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user