-- opción para seleccionar lote/caducidad en combo

This commit is contained in:
2025-05-26 19:14:11 -07:00
parent 30a6ed3f40
commit ddb56952e5
2 changed files with 68 additions and 44 deletions

View File

@@ -10,7 +10,7 @@
.psagregar > div.comboxes { .psagregar > div.comboxes {
display: inline-block; display: inline-block;
width: 450px; width: 550px;
} }
.psagregar > div.codigo input { .psagregar > div.codigo input {
@@ -398,8 +398,7 @@
<th style="width: 88px" runat="server" id="ThSerie" visible="false">Serie</th> <th style="width: 88px" runat="server" id="ThSerie" visible="false">Serie</th>
<th style="width: 88px" runat="server" id="ThLote" visible="false">Lote</th> <th style="width: 88px" runat="server" id="ThLote" visible="false">Lote</th>
<th style="width: 88px" runat="server" id="ThFechaCaducidad" visible="false">Fecha Caducidad</th> <th style="width: 88px" runat="server" id="ThFechaCaducidad" visible="false">Fecha Caducidad</th>
<th width="80px">Comandos</th>
<th width="160px">Comandos</th>
</tr> </tr>
</thea> </thea>
<tr> <tr>
@@ -422,7 +421,6 @@
<ContentTemplate> <ContentTemplate>
<div class="psagregar"> <div class="psagregar">
<div class="comboxes"> <div class="comboxes">
<ADS:Dropdownlost runat="server" ID="DdlProducto2" CssStyle="width: 100%;" IncluyeTodos="false" CssClassDdl="select2me" TabIndex="2" DataTextField="PSCodigo" DataValueField="CvePS" /> <ADS:Dropdownlost runat="server" ID="DdlProducto2" CssStyle="width: 100%;" IncluyeTodos="false" CssClassDdl="select2me" TabIndex="2" DataTextField="PSCodigo" DataValueField="CvePS" />
</div> </div>
</div> </div>
@@ -440,6 +438,8 @@
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem> <asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</td> </td>
<td runat="server" id="TdLoteCaducidad" visible="false">
</td>
<td runat="server" id="TdSerie" visible="false"> <td runat="server" id="TdSerie" visible="false">
<asp:Panel runat="server" DefaultButton="BtnSerieAddNew"> <asp:Panel runat="server" DefaultButton="BtnSerieAddNew">
<asp:TextBox ID="TxtnSerie" Visible="false" runat="server" Width="80px"></asp:TextBox> <asp:TextBox ID="TxtnSerie" Visible="false" runat="server" Width="80px"></asp:TextBox>
@@ -450,8 +450,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">
<table id="tbFechaCaducidad" runat="server">
<table>
<tr> <tr>
<td> <td>
<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>
@@ -463,9 +462,9 @@
</td> </td>
</tr> </tr>
</table> </table>
<asp:DropDownList ID="DdlLoteFechaCaducidad" Visible="false" CssClass="select2me" Width="100%" runat="server" CausesValidation="true" AutoPostBack="true" >
<asp:ListItem Selected="True" Text="-" Value="|"></asp:ListItem>
</asp:DropDownList>
</td> </td>
<td align="center"> <td align="center">
<asp:LinkButton ID="LbAgregar" runat="server" CssClass="Texto" ValidationGroup="GrpAgregar" TabIndex="3" Text="Agregar" /> <asp:LinkButton ID="LbAgregar" runat="server" CssClass="Texto" ValidationGroup="GrpAgregar" TabIndex="3" Text="Agregar" />
@@ -500,7 +499,7 @@
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" CommandName="Delete" CommandArgument='<%# Eval("No")%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea eliminar el concepto?" data-btn-ok-label="si"></asp:LinkButton> <asp:LinkButton ID="lnkRemove" runat="server" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" CommandName="Delete" CommandArgument='<%# Eval("No")%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea eliminar el concepto?" data-btn-ok-label="si"></asp:LinkButton>
</ItemTemplate> </ItemTemplate>
<ItemStyle Width="160px" HorizontalAlign="Center"></ItemStyle> <ItemStyle Width="80px" HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />

View File

@@ -158,7 +158,6 @@ Partial Class Inventarios_TraspasoAlmacen
ViewState("FolioBusqueda") = value ViewState("FolioBusqueda") = value
End Set End Set
End Property End Property
Private Property ArchivoBitacora As String Private Property ArchivoBitacora As String
Get Get
Return CType(ViewState("ArchivoBitacora"), String) Return CType(ViewState("ArchivoBitacora"), String)
@@ -167,6 +166,17 @@ Partial Class Inventarios_TraspasoAlmacen
ViewState("ArchivoBitacora") = value ViewState("ArchivoBitacora") = value
End Set End Set
End Property End Property
Private Property SeleccionLoteCaducidadCombo As Boolean
Get
If ViewState("SeleccionLoteCaducidadCombo") Is Nothing Then
ViewState("SeleccionLoteCaducidadCombo") = False
End If
Return CType(ViewState("SeleccionLoteCaducidadCombo"), Boolean)
End Get
Set(value As Boolean)
ViewState("SeleccionLoteCaducidadCombo") = 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
@@ -212,6 +222,8 @@ Partial Class Inventarios_TraspasoAlmacen
DivTransitorio2.Visible = True DivTransitorio2.Visible = True
End If End If
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then SeleccionLoteCaducidadCombo = True
'If UsuarioActual.CveEmpresa.Contiene(141, 152, 158, 159, 160, 161, 162, 163) Then 'If UsuarioActual.CveEmpresa.Contiene(141, 152, 158, 159, 160, 161, 162, 163) Then
' ChkEmitirTimbrado.Visible = False ' ChkEmitirTimbrado.Visible = False
' divEmitir.Visible = False ' divEmitir.Visible = False
@@ -605,7 +617,7 @@ Partial Class Inventarios_TraspasoAlmacen
End If End If
Dim DrPS As DataRow = Nothing Dim DrPS As DataRow = Nothing
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimero("") ' Estado = -1 DrPS = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimero("") ' Estado = -1
If DrPS IsNot Nothing Then If DrPS IsNot Nothing Then
@@ -618,9 +630,16 @@ Partial Class Inventarios_TraspasoAlmacen
End If End If
If DrPS("AplicaCaducidad").ToString = "True" Then If DrPS("AplicaCaducidad").ToString = "True" Then
If Not ChkSugiereFechaCaducidad.Checked AndAlso (TxtnFechaCaducidad.Text = "" OrElse TxtnLote.Text = "") Then If SeleccionLoteCaducidadCombo Then
Alert("Falta Especificar lote/Fecha del producto", TipoMensaje.MsgAdvertencia) If DdlLoteFechaCaducidad.SelectedValue = "|" Then
Exit Sub Alert("Falta Especificar lote/Fecha del producto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
If Not ChkSugiereFechaCaducidad.Checked AndAlso (TxtnFechaCaducidad.Text = "" OrElse TxtnLote.Text = "") Then
Alert("Falta Especificar lote/Fecha del producto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If End If
End If End If
@@ -647,14 +666,9 @@ Partial Class Inventarios_TraspasoAlmacen
If CantidadRestante <= 0 Then Exit For If CantidadRestante <= 0 Then Exit For
Next Next
End If End If
End If End If
ObjInventarios.Dispose() ObjInventarios.Dispose()
Else Else
'codigo temporal
Dim tLote As String Dim tLote As String
Dim tCaducidad As Date Dim tCaducidad As Date
@@ -662,17 +676,19 @@ Partial Class Inventarios_TraspasoAlmacen
tCaducidad = If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha) tCaducidad = If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha)
Dim tSerie As String = If(TxtnSerie.Visible, TxtnSerie.Text, "-1").Trim Dim tSerie As String = If(TxtnSerie.Visible, TxtnSerie.Text, "-1").Trim
If SeleccionLoteCaducidadCombo Then
Dim ArrayCaducidad As String() = DdlLoteFechaCaducidad.SelectedValue.Split("|"c)
tLote = ArrayCaducidad(0)
tCaducidad = ArrayCaducidad(1).ToDate
End If
Dim Valido As Boolean = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, DdlSeccionAlmacen.SelectedValue.ToEntero, tSerie, tLote, tCaducidad) Dim Valido As Boolean = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, DdlSeccionAlmacen.SelectedValue.ToEntero, tSerie, tLote, tCaducidad)
If Valido Then 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) 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 End If
End If End If
End If End If
End Sub End Sub
Private Function ValidaExistencia(Cantidad As Decimal, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, Serie As String, Lote As String, FechaCaducidad As Date) As Boolean Private Function ValidaExistencia(Cantidad As Decimal, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, Serie As String, Lote As String, FechaCaducidad As Date) As Boolean
@@ -737,7 +753,6 @@ Partial Class Inventarios_TraspasoAlmacen
End If End If
Dim CveClasificacion As Integer Dim CveClasificacion As Integer
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If ChkEmitirTimbrado.Checked AndAlso ChkEmitirCartaPorte.Checked Then If ChkEmitirTimbrado.Checked AndAlso ChkEmitirCartaPorte.Checked Then
@@ -1369,36 +1384,46 @@ Partial Class Inventarios_TraspasoAlmacen
TxtnFechaCaducidad.Visible = False TxtnFechaCaducidad.Visible = False
If DdlProducto2.SelectedValue.ToEntero > 0 Then If DdlProducto2.SelectedValue.ToEntero > 0 Then
Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("", "PS") Dim drP As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("", "PS")
If drP IsNot Nothing Then If drP IsNot Nothing Then
ThSeccionAlmacen.Visible = CBool(drP("AplicaSeccion")) ThSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
TdSeccionAlmacen.Visible = CBool(drP("AplicaSeccion")) TdSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
DdlSeccionAlmacen.Visible = CBool(drP("AplicaSeccion")) DdlSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
'GvDatos.Columns(5).Visible = CBool(drP("AplicaSeccion"))
Dim AplicaSerie As Boolean = CBool(drP("AplicaSerie")) Dim AplicaSerie As Boolean = CBool(drP("AplicaSerie"))
ThSerie.Visible = AplicaSerie ThSerie.Visible = AplicaSerie
TdSerie.Visible = AplicaSerie TdSerie.Visible = AplicaSerie
TxtnSerie.Visible = AplicaSerie TxtnSerie.Visible = AplicaSerie
'GvDatos.Columns(6).Visible = CBool(drP("AplicaSerie"))
TxtnLote.Visible = CBool(drP("AplicaLote"))
ThLote.Visible = CBool(drP("AplicaLote"))
TdLote.Visible = CBool(drP("AplicaLote"))
'GvDatos.Columns(7).Visible = CBool(drP("AplicaLote"))
TxtnFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
ThFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then ThFechaCaducidad.InnerText = UsuarioActual.Empresa.Funcionalidad(147)
'ThFechaCaducidad.InnerText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad")
TdFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
'GvDatos.Columns(8).Visible = CBool(drP("AplicaCaducidad"))
If SeleccionLoteCaducidadCombo AndAlso (CBool(drP("AplicaLote")) OrElse CBool(drP("AplicaCaducidad"))) Then
TxtnLote.Visible = False
ThLote.Visible = CBool(drP("AplicaLote"))
TdLote.Visible = CBool(drP("AplicaLote"))
TxtnFechaCaducidad.Visible = False
ThFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
TdFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
tbFechaCaducidad.Visible = False
DdlLoteFechaCaducidad.Visible = True
Dim ObjInventarios As New ClsInventarios
If ObjInventarios.GetExistenciasCaducidad(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue) Then
For Each dr As DataRow In ObjInventarios.DtResultados.FiltraParametros("", DistinctColumns:={"Lote", "FechaCaducidad"}).Rows
Dim Cad As String = ""
If dr("FechaCaducidad").ToString <> "" Then Cad = $"- Cad: {dr("FechaCaducidad").ToString.ToDate.ToString("dd/MM/yyyy")}"
DdlLoteFechaCaducidad.Items.Add(New ListItem($"Lote: {dr("Lote").ToString} {Cad}", $"{dr("Lote").ToString}|{dr("FechaCaducidad").ToString.ToDate.ToString("dd/MM/yyyy")}"))
Next
End If
ObjInventarios.Dispose()
Else
TxtnLote.Visible = CBool(drP("AplicaLote"))
ThLote.Visible = CBool(drP("AplicaLote"))
TdLote.Visible = CBool(drP("AplicaLote"))
TxtnFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
ThFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then ThFechaCaducidad.InnerText = UsuarioActual.Empresa.Funcionalidad(147)
TdFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
End If
End If End If
End If End If
DdlUnidad.Items.Clear() DdlUnidad.Items.Clear()