-- permitir entregar con lote/caducidad en surtido directo

This commit is contained in:
2024-11-14 12:27:58 -07:00
parent 6710b55c6c
commit df494a2896
2 changed files with 77 additions and 20 deletions

View File

@@ -1987,18 +1987,23 @@
<asp:Literal ID="LtlPS" runat="server" Text='<%# Eval("CodigoPS") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serie">
<asp:TemplateField HeaderText="Serie" visible="false">
<ItemTemplate>
<asp:Literal ID="LtlSerie" Text='<%# Eval("Serie") %>' Visible="false" runat="server" />
<asp:TextBox ID="TxtSerie" AutoPostBack="false" Text='<%# Eval("Serie") %>' Visible="false" runat="server" />
<asp:Button Text="" ID="BtnSerie" Style="display: none;" OnClick="BtnSerie_Click" runat="server" />
<asp:HiddenField runat="server" Value='<%# Eval("Serie") %>' ID="HdnSerie" />
<%--<asp:HiddenField runat="server" ID="HdnSerieLote" Value='<%# Eval("SerieLote")%>' />--%>
<asp:HiddenField runat="server" Value='<%# Eval("Serie") %>' ID="HdnSerie" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Lote" HeaderText="Lote" />
<asp:BoundField DataField="Lote" HeaderText="Lote" Visible="False" />
<asp:BoundField DataField="FechaCaducidad" HeaderText="F. Caducidad" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Lote/Caducidad" ItemStyle-HorizontalAlign="Left" Visible="false" ItemStyle-Width="270px">
<ItemTemplate>
<asp:DropDownList ID="DdlCaducidadProducto" CssClass="select2me" Width="100%" runat="server" Visible="false" CausesValidation="true" >
<asp:ListItem Selected="True" Text="-" Value="|"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>

View File

@@ -6716,6 +6716,9 @@ Partial Class Ventas
ddlAlmacen.Items.Clear()
DTAlmacen = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}")
If UsuarioActual.CveEmpresa = 199 Then
DTAlmacen.Merge(GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto <> {DdlSubProyectoDatos.SelectedValue.ToEntero()}"))
End If
ddlAlmacen.DataSource = DTAlmacen
ddlAlmacen.Items.Insert(0, New ListItem("Seleccione ", "-1"))
@@ -9526,18 +9529,18 @@ Partial Class Ventas
e.Row.FCLiteral("LtlSerie").Visible = True
End If
If e.Row.DBCampo("CveTipoInvPS").ToEntero() = 5 And CveVenta <= 0 Then
e.Row.FCTextBox("TxtSerie").Visible = True
e.Row.FCTextBox("TxtSerie").Attributes.Remove("onkeypress")
e.Row.FCTextBox("TxtSerie").Attributes.Add("onkeypress", String.Format("SeriePS(event,{0},this,{1});", e.Row.FCButton("BtnSerie").ClientID, e.Row.FCHiddenField("HdnSerie").ClientID))
e.Row.FCTextBox("TxtSerie").Attributes.Remove("onblur")
e.Row.FCTextBox("TxtSerie").Attributes.Add("onblur", String.Format("SeriePSBlur({0},this,{1});", e.Row.FCButton("BtnSerie").ClientID, e.Row.FCHiddenField("HdnSerie").ClientID))
'e.Row.FCTextBox("TxtSerie").Attributes.Add("onkeyup", String.Format("LimpiaAF(1, '{0}'); EnterAFEdit(event,this,{1},{2});", e.Row.FCHiddenField("HdnCveConcepto").Value, e.Row.FCHiddenField("HdnCveAF").ClientID, e.Row.FCHiddenField("HdnCodAF").ClientID))
'e.Row.FCTextBox("LblCodigo").Attributes.Add("onkeyup", String.Format("LimpiaAF(1, '{0}'); EnterAFEdit(event,this,{1},{2});", e.Row.FCHiddenField("HdnCveConcepto").Value, e.Row.FCHiddenField("HdnCveAF").ClientID, e.Row.FCHiddenField("HdnCodAF").ClientID))
'e.Row.FCTextBox("LblCodigo").Attributes.Add("onblur", String.Format("LimpiaAF(1, '{0}'); AFBlurEdit(this,{1},{2});", e.Row.FCHiddenField("HdnCveConcepto").Value, e.Row.FCHiddenField("HdnCveAF").ClientID, e.Row.FCHiddenField("HdnCodAF").ClientID))
If CveVenta <= 0 Then
If e.Row.DBCampo("AplicaSerie").ToEntero() = 1 Then
GvInv.Columns(4).Visible = True
e.Row.FCTextBox("TxtSerie").Visible = True
e.Row.FCTextBox("TxtSerie").Attributes.Remove("onkeypress")
e.Row.FCTextBox("TxtSerie").Attributes.Add("onkeypress", String.Format("SeriePS(event,{0},this,{1});", e.Row.FCButton("BtnSerie").ClientID, e.Row.FCHiddenField("HdnSerie").ClientID))
e.Row.FCTextBox("TxtSerie").Attributes.Remove("onblur")
e.Row.FCTextBox("TxtSerie").Attributes.Add("onblur", String.Format("SeriePSBlur({0},this,{1});", e.Row.FCButton("BtnSerie").ClientID, e.Row.FCHiddenField("HdnSerie").ClientID))
End If
If e.Row.DBCampo("AplicaLote").ToEntero() = 1 Then
CargarCaducidadProducto(e.Row.DBCampo("CvePS").ToEntero, e.Row.FCDropDownList("DdlCaducidadProducto"), "", Nothing)
End If
End If
If e.Row.DBCampo("CvePS") = "" Then
@@ -9590,6 +9593,37 @@ Partial Class Ventas
End If
End Sub
Private Sub CargarCaducidadProducto(CvePS As Integer, ByRef DdlLoteFechaCaducidad As DropDownList, ValorAsignado As String, DtDatosDevolucion As DataTable)
DdlLoteFechaCaducidad.Items.Clear()
DdlLoteFechaCaducidad.Items.Add(New ListItem("-", "|"))
Dim almacenes As String = ddlAlmacen.SelectedValue
If almacenes = "" Then
almacenes = "-1"
End If
GvInv.Columns(7).Visible = True
If DtDatosDevolucion IsNot Nothing Then
DdlLoteFechaCaducidad.Visible = True
For Each dr As DataRow In DtDatosDevolucion.FiltraParametros($"CvePS = {CvePS}", DistinctColumns:={"Lote", "FechaCaducidad"}).Rows
DdlLoteFechaCaducidad.Items.Add(New ListItem($"Lote: {dr("Lote").ToString} - Cad: {dr("FechaCaducidad").ToString.ToDate.ToString("dd/MM/yyyy")}", $"{dr("Lote").ToString}|{dr("FechaCaducidad").ToString.ToDate.ToString("dd/MM/yyyy")}"))
Next
Else
Dim ObjInventarios As New ClsInventarios
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, almacenes) Then
DdlLoteFechaCaducidad.Visible = True
For Each dr As DataRow In ObjInventarios.DtResultados.FiltraParametros("", DistinctColumns:={"Lote", "FechaCaducidad"}).Rows
DdlLoteFechaCaducidad.Items.Add(New ListItem($"Lote: {dr("Lote").ToString} - Cad: {dr("FechaCaducidad").ToString.ToDate.ToString("dd/MM/yyyy")}", $"{dr("Lote").ToString}|{dr("FechaCaducidad").ToString.ToDate.ToString("dd/MM/yyyy")}"))
Next
End If
ObjInventarios.Dispose()
End If
If Not String.IsNullOrEmpty(ValorAsignado) Then
DdlLoteFechaCaducidad.SelectedValueExist(ValorAsignado)
End If
End Sub
Protected Sub GVINV_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvInv.RowEditing
GvInv.EditIndex = e.NewEditIndex
CargaGVInv(DtInv.FiltraParametros("CveTipoPS=2"))
@@ -10132,6 +10166,8 @@ Partial Class Ventas
Dim CveProducto As Integer
Dim Existencia As Double
Dim CveAlmacen As Integer = ddlAlmacen.SelectedValue.ToEntero()
Dim tCveSubProyecto As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero()
If UsuarioActual.CveEmpresa = 199 Then tCveSubProyecto = -1
For Each dr As DataRow In TmpDT.FiltraParametros("CveTipoPS = 2").Rows
If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then
@@ -10141,7 +10177,7 @@ Partial Class Ventas
Cantidad = TmpDT.SUM("Cantidad", $"CvePS = {CveProducto} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") 'VALIDA CONTRA LA SUMA DEL MISMO PS
If UsuarioActual.Empresa.UsaInventarios AndAlso RemisionesLista.Count < 1 AndAlso dr("EntregaDirecta").ToString().ToEntero() < 1 Then
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
Existencia = ObjInventarios.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
Existencia = ObjInventarios.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=tCveSubProyecto,
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
If Existencia < Cantidad Then
@@ -16606,8 +16642,16 @@ Partial Class Ventas
End If
Dim CveSeccionAlmacen As Integer = -3
'If AplicaSeccion Then CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacen, CveProducto).FiltroPrimeroValor("CveSeccionAlmacen", "").ToEntero
Dim Lote As String = "-1"
Dim FCaducidad As Date = MinFecha
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Dr("Serie").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
If GvInv.Rows(i).FCDropDownList("DdlCaducidadProducto") IsNot Nothing AndAlso GvInv.Rows(i).FCDropDownList("DdlCaducidadProducto").Visible Then
Dim ArrayCaducidad As String() = GvInv.Rows(i).FCDropDownList("DdlCaducidadProducto").SelectedValue.Split("|"c)
Lote = ArrayCaducidad(0)
FCaducidad = ArrayCaducidad(1).ToDate
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Dr("Serie").ToString(), Lote:=Lote, FechaCaducidad:=FCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />")
Exit For
@@ -20341,6 +20385,9 @@ Partial Class Ventas
Row("CodigoPS") = DrPS("PSCodigo").ToString()
Row("CveTipoPS") = DrPS("CveTipoPS")
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
Row("AplicaSerie") = DrPS("AplicaSerie")
Row("AplicaLote") = DrPS("AplicaLote")
Row("AplicaCaducidad") = DrPS("AplicaCaducidad")
Row("CveTamaño") = DrPS("CveTamaño")
Row("CodigoObjetoImpuesto") = DrPS("CodigoObjetoImpuesto")
@@ -20599,6 +20646,9 @@ Partial Class Ventas
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
TmpDT.Columns.Add("CveTipoPS", GetType(Integer))
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
TmpDT.Columns.Add("AplicaSerie", GetType(Integer))
TmpDT.Columns.Add("AplicaLote", GetType(Integer))
TmpDT.Columns.Add("AplicaCaducidad", GetType(Integer))
TmpDT.Columns.Add("Serie", GetType(String))
TmpDT.Columns.Add("CuentaPredial", GetType(String))
TmpDT.Columns.Add("Obs", GetType(String))
@@ -24959,6 +25009,8 @@ Partial Class Ventas
ObjInventarios.Dispose()
UpINV.Update()
End Sub
Private Function ValidaSerieINV() As Boolean
Dim Retorno As Boolean = False
Dim Existencia As Decimal = 0
@@ -25305,7 +25357,7 @@ Partial Class Ventas
DtTemporal.Columns.Add(colNew)
End If
GvInv.Columns(4).Visible = DtTemporal.MAX("Serie", "Serie <> ''") <> "" Or CveVenta <= 0
GvInv.Columns(4).Visible = DtTemporal.MAX("Serie", "Serie <> ''") <> ""
GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad").ToDate > MinFecha