- Serie, Lote Caducidad, SeccionAlmacen

This commit is contained in:
rrene
2020-05-18 13:30:42 -07:00
parent 5166b17d17
commit 21de74f1cc
14 changed files with 459 additions and 346 deletions

View File

@@ -45,7 +45,7 @@
<Columns>
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Sección Actual" DataField="AlmacenSeccion" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Sección Actual" DataField="SeccionAlmacen" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Existencia" DataField="Existencia" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" />
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
@@ -54,7 +54,7 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Nueva Seccion" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:DropDownList ID="DDlS" runat="server" Width="150px" DataValueField="CveAlmacenSeccion" DataTextField="AlmacenSeccion" class="select2me"></asp:DropDownList>
<asp:DropDownList ID="DDlS" runat="server" Width="150px" DataValueField="CveSeccionAlmacen" DataTextField="SeccionAlmacen" class="select2me"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>

View File

@@ -170,7 +170,13 @@
<br />
Producto
</th>
<th style="width: 90px" runat="server" id="ThSerieLote" visible="false">Serie - Lote
<th style="width: 90px" runat="server" id="ThSerie" visible="false">Serie
</th>
<th style="width: 90px" runat="server" id="ThLote" visible="false">Lote
</th>
<th style="width: 90px" runat="server" id="ThCaducidad" visible="false">F.Caducidad
</th>
<th style="width: 90px" runat="server" id="ThSeccion" visible="false">Sección
</th>
<th width="160px">Comandos</th>
</tr>
@@ -203,17 +209,26 @@
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td runat="server" id="TdSerieLote" visible="false">
<td runat="server" id="TdSerie" visible="false">
<asp:Panel runat="server" DefaultButton="BtnSerieAddNew">
<asp:TextBox ID="TxtnSerieLote" Visible="false" runat="server" Width="80px"></asp:TextBox>
<asp:TextBox ID="TxtnSerie" Visible="false" runat="server" Width="80px"></asp:TextBox>
<asp:Button Text="" ID="BtnSerieAddNew" OnClick="BtnSerieAddNew_Click" Style="display: none" runat="server" />
</asp:Panel>
</td>
<td runat="server" id="TdSeccionAlmacen" visible="false">
<asp:Panel runat="server" DefaultButton="BtnSeccionAddNew">
<asp:DropDownlist runat="server" DataTextField="Seccion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me" />
<td runat="server" id="TdLote" visible="false">
<asp:Panel runat="server" DefaultButton="BtnAddLote">
<asp:Button Text="" ID="BtnAddLote" Style="display: none" runat="server" />
</asp:Panel>
</td>
<td runat="server" id="TdCaducidad" visible="false">
<asp:Panel runat="server" DefaultButton="BtnAddCaducidad">
<asp:Button Text="" ID="BtnFechaCaducidad" Style="display: none" runat="server" />
</asp:Panel>
</td>
<td runat="server" id="TdSeccionAlmacen" visible="false">
<asp:DropDownlist ID="DdlSeccionAlmacen" runat="server" DataTextField="Seccion" DataValueField="CveSeccionAlmacen" CssClass="form-control input-sm select2me" />
</td>
<td align="center">
<asp:LinkButton ID="LbAgregar" runat="server" CssClass="Texto" ValidationGroup="GrpAgregar" Text="Agregar" />
@@ -235,9 +250,12 @@
<asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-Width="500px" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="F.Caducidad" DataField="FechaCaducidad" ItemStyle-Width="90px" />
<asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate>
ssss
<asp:DropDownList ID="DdlSeccionAlmacen" DataTextField="Seccion" Visible="false" AppendDataBoundItems="true" DataValueField="CveSeccion" Class="form-control input-sm select2me" Style="width: 95% !important" runat="server" CausesValidation="true">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
@@ -292,9 +310,11 @@
</div>
<div class="col-md-1" style="max-width: 70px">Cliente</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlClienteDesapartado" OnSelectedIndexChanged="DdlClienteDesapartado_SelectedIndexChanged" AutoPostBack="true" Width="150px" AppendDataBoundItems="true" runat="server" DataTextField="Nombre" DataValueField="CveCliente" CssClass="form-control input-sm select2me"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVFClienteDesapartado" runat="server" ControlToValidate="DdlClienteDesapartado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cliente''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpCargarApartados"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFClienteDesapartado" runat="server" HighlightCssClass="vco" TargetControlID="RFVFClienteDesapartado" Width="350px"></ajax:ValidatorCalloutExtender>
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClienteDesapartado" OnSelectedIndexChanged="DdlClienteDesapartado_SelectedIndexChanged" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;">
</ADS:Dropdownlost>
<%--<asp:RequiredFieldValidator ID="RFVFClienteDesapartado" runat="server" ControlToValidate="DdlClienteDesapartado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cliente''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpCargarApartados"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFClienteDesapartado" runat="server" HighlightCssClass="vco" TargetControlID="RFVFClienteDesapartado" Width="350px"></ajax:ValidatorCalloutExtender>--%>
</div>
<div class="col-md-1" style="max-width: 70px">Vendedor:</div>
<div class="col-md-2">
@@ -357,7 +377,7 @@
<div class="row">
<label class="col-md-2">Almacén Destino:</label>
<div class="col-md-3">
<asp:DropDownList ID="DdlAlmacenDestinoDesapartado" Width="150px" AppendDataBoundItems="true" runat="server" DataTextField="Almacen" DataValueField="CveAlmacen" CssClass="form-control input-sm select2me"></asp:DropDownList>
<asp:DropDownList ID="DdlAlmacenDestinoDesapartado" Width="150px" AppendDataBoundItems="true" runat="server" DataTextField="Almacen" DataValueField="CveAlmacen" CssClass="form-control input-sm select2me" AutoPostBack="true"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVAlmacenOrigenDesapartado" runat="server" ControlToValidate="DdlAlmacenDestinoDesapartado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Almacen Destino''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardarDesapartado"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEAlmacenOrigenDesapartado" runat="server" HighlightCssClass="vco" TargetControlID="RFVAlmacenOrigenDesapartado" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
@@ -381,7 +401,7 @@
<asp:UpdatePanel runat="server" ID="UpDatosDesapartado" UpdateMode="Conditional">
<ContentTemplate>
<div style="max-height: 300px; overflow-y: auto;">
<asp:GridView ID="GvDatosDesapartado" DataKeyNames="CvePS,CveUM,CveMovimientoDetalle,CveSeccionAlmacen,Serie,PU,Cantidad" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró mercancía apartada" ToolTip="Listado de Movimientos" CssClass="Widthall table table-striped table-hover" GridLines="None">
<asp:GridView ID="GvDatosDesapartado" DataKeyNames="CvePS,CveUM,CveMovimientoDetalle,CveSeccionAlmacen,Serie,Lote,FechaCaducidad,PU,Cantidad,AplicaSeccion" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró mercancía apartada" ToolTip="Listado de Movimientos" CssClass="Widthall table table-striped table-hover" GridLines="None">
<Columns>
<asp:BoundField HeaderText="#" DataField="No" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Disponible" DataField="Cantidad" DataFormatString="{0:#,###.##}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />
@@ -393,10 +413,14 @@
</asp:TemplateField>
<asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-Width="35%" />
<asp:BoundField HeaderText="Serie" DataField="SerieLote" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="F.Caducidad" DataField="FechaCaducidad" DataFormatString="{0:d}" ItemStyle-Width="10%" />
<asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate>
ssss
<asp:DropDownList ID="DdlSeccionAlmacen" DataTextField="Seccion" AppendDataBoundItems="true" DataValueField="CveSeccion" Class="form-control input-sm select2me" Style="width: 95% !important" runat="server" CausesValidation="true">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>

View File

@@ -32,20 +32,20 @@ Partial Class Inventarios_Apartados
ViewState("CargadoDeMov") = value
End Set
End Property
Private Property CvePSSerieLote As Integer
Private Property CvePSSerie As Integer
Get
Return CType(ViewState("CvePSSerieLote"), Integer)
Return CType(ViewState("CvePSSerie"), Integer)
End Get
Set(value As Integer)
ViewState("CvePSSerieLote") = value
ViewState("CvePSSerie") = value
End Set
End Property
Private Property CveUMSerieLote As Integer
Private Property CveUMSerie As Integer
Get
Return CType(ViewState("CveUMSerieLote"), Integer)
Return CType(ViewState("CveUMSerie"), Integer)
End Get
Set(value As Integer)
ViewState("CveUMSerieLote") = value
ViewState("CveUMSerie") = value
End Set
End Property
Private Property CveCliente As Integer
@@ -64,14 +64,7 @@ Partial Class Inventarios_Apartados
ViewState("CveVendedor") = value
End Set
End Property
Private Property DtSeccionAlmacen As DataTable
Get
Return CType(ViewState("DtSeccionAlmacen"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtSeccionAlmacen") = value
End Set
End Property
Private Property IndexSeccionAlmacen As Integer
Get
Return CType(ViewState("IndexSeccionAlmacen"), Integer)
@@ -147,7 +140,7 @@ Partial Class Inventarios_Apartados
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem(" Seleccione ", "-1"))
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione ", "-1"))
DdlSubProyectoDesapartado.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
DdlSubProyectoDesapartado.DataBind()
@@ -168,11 +161,16 @@ Partial Class Inventarios_Apartados
Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
If EsWS Then
DdlClientes.setEsWebService(True)
DdlClienteDesapartado.setEsWebService(True)
Else
DdlClientes.setEsWebService(False)
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClientes.DataBind()
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
DdlClienteDesapartado.setEsWebService(False)
DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClienteDesapartado.DataBind()
DdlClienteDesapartado.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End If
@@ -180,9 +178,9 @@ Partial Class Inventarios_Apartados
'DdlCliente.DataBind()
'DdlCliente.Items.Insert(0, New ListItem(" Seleccione ", "-1"))
DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClienteDesapartado.DataBind()
DdlClienteDesapartado.Items.Insert(0, New ListItem(" Todos ", "-1"))
'DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
'DdlClienteDesapartado.DataBind()
'DdlClienteDesapartado.Items.Insert(0, New ListItem(" Todos ", "-1"))
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedor.DataBind()
@@ -230,7 +228,11 @@ Partial Class Inventarios_Apartados
dt.Columns.Add("CvePS", Type.GetType("System.Int32"))
dt.Columns.Add("CveAF", Type.GetType("System.Int32"))
dt.Columns.Add("PS")
dt.Columns.Add("SerieLote")
dt.Columns.Add("CveSeccionAlmacen", Type.GetType("System.Int32"))
dt.Columns.Add("SeccionAlmacen")
dt.Columns.Add("Serie")
dt.Columns.Add("Lote")
dt.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime"))
dt.Columns.Add("CveClasificacion", Type.GetType("System.Int32"))
dt.Columns.Add("EstatusExistencia")
@@ -262,16 +264,39 @@ Partial Class Inventarios_Apartados
ElProductoChange()
End Sub
Private Sub ElProductoChange()
TxtnSerieLote.Visible = False
TxtnSerie.Visible = False
If DdlProducto2.SelectedValue.ToEntero > 0 Then
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltraParametros("Inv_CveMetodoInventario = 5 OR AplicaSerie = 1 ", "PSCodigo").Rows.Count > 0 Then
ThSerieLote.Visible = True
TdSerieLote.Visible = True
TxtnSerieLote.Visible = True
Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("")
If drP IsNot Nothing Then
If CBool(drP("AplicaSerie")) Then
ThSerie.Visible = True
TdSerie.Visible = True
TxtnSerie.Visible = True
GvDatos.Columns(4).Visible = True
End If
If CBool(drP("AplicaLote")) Then
ThLote.Visible = True
TdLote.Visible = True
GvDatos.Columns(5).Visible = True
End If
If CBool(drP("AplicaCaducidad")) Then
ThCaducidad.Visible = True
TdCaducidad.Visible = True
GvDatos.Columns(6).Visible = True
End If
If CBool(drP("AplicaSeccion")) Then
ThSeccion.Visible = True
TdSeccionAlmacen.Visible = True
DdlSeccionAlmacen.DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlProducto2.SelectedValue.ToEntero)
DdlSeccionAlmacen.DataBind()
GvDatos.Columns(7).Visible = True
End If
End If
End If
DdlUnidad.Items.Clear()
DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa)
@@ -380,8 +405,8 @@ Partial Class Inventarios_Apartados
If DrPS("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then
TdSeriePS.Visible = True
TxtSeriePS.Focus()
CvePSSerieLote = DrPS("CvePS").ToString.ToEntero
CveUMSerieLote = DrPS("CveUnidadMedida").ToString.ToEntero
CvePSSerie = DrPS("CvePS").ToString.ToEntero
CveUMSerie = DrPS("CveUnidadMedida").ToString.ToEntero
Exit Sub
End If
@@ -397,10 +422,10 @@ Partial Class Inventarios_Apartados
txtCantidad.Text = "1"
Dim Valido = ValidaExistencia(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim)
Dim Valido = ValidaExistencia(1, CvePSSerie, CveUMSerie, TxtSeriePS.Text.Trim)
If Valido Then
AgregarPS(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim)
AgregarPS(1, CvePSSerie, CveUMSerie, Serie:=TxtSeriePS.Text.Trim)
Else
TxtSeriePS.Text = ""
TxtSeriePS.Focus()
@@ -426,10 +451,10 @@ Partial Class Inventarios_Apartados
Dim FuncionalidadSinSerie = True
If CveProducto > 0 Then
If TxtnSerieLote.Visible Then
If TxtnSerie.Visible Then
Cantidad = 1
If TxtnSerieLote.Text = "" Then
Alert("Serie-Lote es necesario", TipoMensaje.MsgAdvertencia)
If TxtnSerie.Text = "" Then
Alert("Serie es necesario", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
Exit Sub
End If
@@ -438,19 +463,20 @@ Partial Class Inventarios_Apartados
End If
End If
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1"))
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, Serie:=If(TxtnSerie.Visible, TxtnSerie.Text, "-1"))
If Valido Then
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1"), FuncionalidadSinSerie)
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(TxtnSerie.Text <> "", TxtnSerie.Text, ""), Limpia:=FuncionalidadSinSerie)
End If
End If
End Sub
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Boolean
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Serie As String = "-1",
Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha, Optional CveSeccionAlmacen As Integer = -1) As Boolean
Dim Retorno = True
Dim Inv As New ClsInventarios
Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Serie:=Serie)
Dim Existencia As Double = 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)
Inv.Dispose()
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(Serie <> "-1", $" AND Serie = '{Serie}'", "")}") < 0 Then
@@ -466,7 +492,8 @@ Partial Class Inventarios_Apartados
Return Retorno
End Function
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional SerieLote As String = "-1", Optional Limpia As Boolean = True)
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer,
Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True, Optional SeccionAlmacen As String = "")
If Cantidad <= 0 Then
Alert("La cantidad debe ser mayor a cero (0). Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
@@ -485,10 +512,14 @@ Partial Class Inventarios_Apartados
registro.Item("UnidadMedida") = DrUM("UnidadMedida")
registro.Item("CvePS") = CvePS
registro.Item("PS") = DrPS("PSCodigo")
registro.Item("SerieLote") = SerieLote
registro.Item("Serie") = Serie
registro.Item("Lote") = Lote
registro.Item("FechaCaducidad") = FechaCaducidad
registro.Item("CveClasificacion") = CveClasificacion
registro.Item("CveAF") = -1
registro.Item("EstatusExistencia") = "1"
registro.Item("CveSeccionAlmacen") = CveSeccionAlmacen
registro.Item("SeccionAlmacen") = If(CveSeccionAlmacen > 0, SeccionAlmacen, "")
DtMovimientos.Rows.Add(registro)
RegistraScript("playsonidito('beep-07.wav')")
@@ -498,16 +529,16 @@ Partial Class Inventarios_Apartados
LimpiaAgregar()
Else
txtCantidad.Text = (txtCantidad.Text.ToDouble - 1.0).ToString
TxtnSerieLote.Text = ""
TxtnSerieLote.Focus()
TxtnSerie.Text = ""
TxtnSerie.Focus()
End If
End Sub
Private Sub LimpiaAgregar()
DdlClasificacion.SelectedValue = "-1"
DdlClasificacion_SelectedIndexChanged(DdlClasificacion, EventArgs.Empty)
txtCantidad.Text = ""
TxtnSerieLote.Text = ""
TxtnSerieLote.Visible = False
TxtnSerie.Text = ""
TxtnSerie.Visible = False
txtCantidad.Focus()
If TxtCodigoPS.Visible Then
TxtCodigoPS.Focus()
@@ -517,12 +548,18 @@ Partial Class Inventarios_Apartados
#Region " GV DATOS "
Private Sub CargaGvDatos(Optional EscondeSerie As Boolean = True)
If EscondeSerie Then
TxtnSerieLote.Visible = False
ThSerieLote.Visible = False
TdSerieLote.Visible = False
GvDatos.Columns(4).Visible = False
End If
'If EscondeSerie Then
' TxtnSerie.Visible = False
' ThSerie.Visible = False
' TdSerie.Visible = False
' GvDatos.Columns(4).Visible = False
'End If
GvDatos.Columns(4).Visible = DtMovimientos.MAX("Serie").ToString <> ""
GvDatos.Columns(5).Visible = DtMovimientos.MAX("Lote").ToString <> ""
GvDatos.Columns(6).Visible = DtMovimientos.MAX("FechaCaducidad").ToString.ToDate > MinFecha
GvDatos.Columns(7).Visible = DtMovimientos.MAX("CveSeccionAlmacen").ToString.ToEntero > 0
GvDatos.DataSource = DtMovimientos
GvDatos.DataBind()
@@ -541,20 +578,20 @@ Partial Class Inventarios_Apartados
e.Row.FCTextBox("TxtCantidad2").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad")))
End If
If If(e.Row.DBCampo("Serie").ToString = "", "-1", e.Row.DBCampo("Serie").ToString) <> "-1" Then
TxtnSerieLote.Visible = True
ThSerieLote.Visible = True
TdSerieLote.Visible = True
GvDatos.Columns(4).Visible = True
e.Row.Cells(4).Text = e.Row.DBCampo("Serie").ToString
Else
e.Row.Cells(4).Text = ""
End If
'If If(e.Row.DBCampo("Serie").ToString = "", "-1", e.Row.DBCampo("Serie").ToString) <> "-1" Then
' TxtnSerie.Visible = True
' ThSerie.Visible = True
' TdSerie.Visible = True
' GvDatos.Columns(4).Visible = True
' e.Row.Cells(4).Text = e.Row.DBCampo("Serie").ToString
'Else
' e.Row.Cells(4).Text = ""
'End If
If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then
e.Row.FCLinkButton("lnkRemove").Visible = False
e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen"
End If
'If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then
' e.Row.FCLinkButton("lnkRemove").Visible = False
' e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen"
'End If
End If
End Sub
@@ -593,12 +630,12 @@ Partial Class Inventarios_Apartados
Next
Dim TotalCantidad As Double = DtMovimientos.SUMD("Cantidad")
If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 1").SUMD("CantidadSeccionAlmacen") Then
Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
' If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 1").SUMD("CantidadSeccionAlmacen") Then
' Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
'End If
Dim ObjInventario As New ClsInventarios
@@ -610,8 +647,8 @@ Partial Class Inventarios_Apartados
If Not CargadoDeMov Then
For Each dr As DataRow In DtMovimientos.Rows
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"), Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString))
Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND SerieLote = '{dr("SerieLote").ToString}'", "")}")
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:=dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString))
Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND Serie = '{dr("Serie").ToString}'", "")}")
'DtMovimientos.SUM("Cantidad", String.Format("CvePS = {0}", dr("CvePS").ToString.ToEntero))
If Existencia < 0 Then
@@ -623,7 +660,7 @@ Partial Class Inventarios_Apartados
Next
Else
For Each gvr As GridViewRow In GvDatos.Rows
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"), Serie:=If(gvr.DataKey("Serie").ToString = "", "-1", gvr.DataKey("Serie").ToString))
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:=gvr.DataKey("CveSeccionAlmacen").ToString.ToEntero, Serie:=If(gvr.DataKey("Serie").ToString = "", "-1", gvr.DataKey("Serie").ToString))
Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero
If Existencia < 0 Then
ErrorExistencia = True
@@ -666,7 +703,7 @@ Partial Class Inventarios_Apartados
ErrorMovInv = True
Else
For Each Dr As DataRow In DtMovimientos.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
@@ -689,8 +726,12 @@ Partial Class Inventarios_Apartados
ErrorMovInv = True
Else
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim CveSec As Integer = 0
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
CveSec = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestino.SelectedValue.ToEntero, Dr("CvePS").ToString.ToEntero).FiltroPrimeroValor("CveSeccionAlmacen", "").ToEntero
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSec, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
@@ -771,6 +812,13 @@ Partial Class Inventarios_Apartados
Protected Sub GvDatosDesapartado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosDesapartado.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCTextBox("TxtCantidad").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad")))
If CBool(e.Row.DBCampo("AplicaSeccion")) AndAlso DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero > 0 Then
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True
e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero)
e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind()
e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
End If
End Sub
Protected Sub BtnVerificarExistenciasDesarmado_Click(sender As Object, e As EventArgs)
@@ -789,11 +837,15 @@ Partial Class Inventarios_Apartados
Dim DtTemp = GetExistenciasDT()
If DtTemp IsNot Nothing Then
GvDatosDesapartado.Columns(5).Visible = DtTemp.MAX("Serie").ToString <> ""
GvDatosDesapartado.Columns(6).Visible = DtTemp.MAX("Lote").ToString <> ""
GvDatosDesapartado.Columns(7).Visible = DtTemp.MAX("FechaCaducidad").ToString.ToDate > MinFecha
GvDatosDesapartado.Columns(8).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString.ToEntero > 0
GvDatosDesapartado.DataSource = DtTemp
GvDatosDesapartado.DataBind()
UpDatosDesapartado.Update()
DtSeccionAlmacen.Rows.Clear()
End If
End Sub
@@ -856,12 +908,12 @@ Partial Class Inventarios_Apartados
End If
Next
If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 2").SUMD("CantidadSeccionAlmacen") Then
Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
' If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 2").SUMD("CantidadSeccionAlmacen") Then
' Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
'End If
'VALIDA SI HUBO CAMBIOS EN LA EXISTENCIA
Dim CantidadGV = GvDatosDesapartado.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("Cantidad").ToDouble)
@@ -889,6 +941,7 @@ Partial Class Inventarios_Apartados
Observaciones:=TxtObservacionesDesapartado.Text.Trim, Recibio:="", CveAlmacenDestino:=DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero,
CveCliente:=CveCliente, CveVendedor:=CveVendedor)
FolioSalida = ObjInventario.Folio
Dim Diccionario As New HybridDictionary
Dim Cont As Integer = 0
If CveMovimientoSalida <= 0 Then
ErrorMovInv = True
@@ -896,10 +949,12 @@ Partial Class Inventarios_Apartados
Else
For Each Gvr As GridViewRow In GvDatosDesapartado.Rows
If Gvr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, -1, Gvr.DataKey("Serie").ToString, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, CveSeccionAlmacen:=Gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Gvr.DataKey("Serie").ToString, Lote:=Gvr.DataKey("Lote").ToString, FechaCaducidad:=Gvr.DataKey("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
Else
Diccionario.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue)
End If
End If
Cont += 1
@@ -917,8 +972,11 @@ Partial Class Inventarios_Apartados
ErrorMovInv = True
Else
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim i As Integer = 0
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
Dim CveSeccionAlmacen As Integer = Diccionario(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
@@ -955,6 +1013,12 @@ Partial Class Inventarios_Apartados
ObjInventario.Dispose()
End Sub
Private Sub DdlAlmacenDestinoDesapartado_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacenDestinoDesapartado.SelectedIndexChanged
CargaExistencias()
End Sub
#End Region
#End Region

View File

@@ -62,6 +62,8 @@ Partial Class Inventarios_CatSeccionesAlmacenes
Alert("La Seccion se guardó correctamente.", TipoMensaje.MsgInformacion)
ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
ObjSeccion.GetSeccionesAlmacenes(UsuarioActual.CveEmpresa, -1)
GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados
If ViewState("Orden").ToString() <> String.Empty Then
@@ -107,6 +109,7 @@ Partial Class Inventarios_CatSeccionesAlmacenes
SeccionTxt.Text = ""
DdlAlmacen.SelectedIndex = 0
Alert("La Seccion se actualizo correctamente.", TipoMensaje.MsgInformacion)
ObjSeccion.GetSeccionesAlmacenes(UsuarioActual.CveEmpresa, -1)
ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados
End If

View File

@@ -2148,8 +2148,9 @@ Partial Class Inventarios_EntradasSalidas
EscondeColumnasGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' "))
If DdlProducto2.SelectedValue.ToEntero > 0 Then
Dim MetodoInventario As Integer = GlobalDTPS(UsuarioActual.CveEmpresa, DdlProducto2.SelectedValue.ToEntero).FiltroPrimeroValor("Inv_CveMetodoInventario", "").ToEntero ' ("Inv_CveMetodoInventario = 6", "PS")
If MetodoInventario = 5 Then
Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("")
If dr IsNot Nothing Then
If CBool(dr("AplicaSerie")) Then
'LblSerieLote.Visible = True
TxtnSerie.Visible = True
@@ -2157,20 +2158,19 @@ Partial Class Inventarios_EntradasSalidas
'TrSerieLote.Visible = True
'TrSerieLote2.Visible = True
GvM.Columns(9).Visible = True
End If
If MetodoInventario = 6 Then
If CBool(dr("AplicaLote")) Then
TxtnLote.Visible = True
divLote.Visible = True
'TrLote.Visible = True
'TrLote2.Visible = True
GvM.Columns(10).Visible = True
'TrBatch2.Visible = True
GvM.Columns(11).Visible = True
End If
End If
End If
DdlUnidad.Items.Clear()
DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa)
DdlUnidad.DataBind()
@@ -2230,43 +2230,10 @@ Partial Class Inventarios_EntradasSalidas
End If
If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 0 Then
If DtTemp.MAX("Serie").ToString <> "" Then
'LblSerie.Visible = True
TxtnSerie.Visible = True
'TrSerieLote.Visible = True
'TrSerieLote2.Visible = True
GvM.Columns(9).Visible = True
End If
If DtTemp.MAX("Lote").ToString <> "" Then
TxtnLote.Visible = True
'TrLote.Visible = True
'TrLote2.Visible = True
GvM.Columns(10).Visible = True
'TxtnBatch.Visible = True
'TrBatch.Visible = True
'TrBatch2.Visible = True
'GvM.Columns(11).Visible = True
End If
If DtTemp.MAX("FechaCaducidad").ToString <> "" Then
GvM.Columns(11).Visible = True
'TxtnBatch.Visible = True
'TrBatch.Visible = True
'TrBatch2.Visible = True
'GvM.Columns(11).Visible = True
End If
If DtTemp.MAX("CveSeccionAlmacen").ToString <> "" Then
'TxtnBatch.Visible = True
'TrBatch.Visible = True
'TrBatch2.Visible = True
GvM.Columns(12).Visible = True
End If
GvM.Columns(9).Visible = DtTemp.MAX("Serie").ToString <> ""
GvM.Columns(10).Visible = DtTemp.MAX("Lote").ToString <> ""
GvM.Columns(11).Visible = DtTemp.MAX("FechaCaducidad").ToString <> ""
GvM.Columns(12).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString <> ""
End If

View File

@@ -777,7 +777,7 @@
<asp:BoundField HeaderText="Sección Almacen" DataField="Seccion" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Caducidad" DataField="Caducidad" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Caducidad" DataField="FechaCaducidad" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
</Columns>
</asp:GridView>
</div>

View File

@@ -831,7 +831,7 @@ Partial Class Inventarios_EntregaAlmacen
If CBool(e.Row.DBCampo("AplicaSeccion")) Then
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True
If DdlAlmacen.SelectedValue.ToEntero > 0 Then
e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero)
e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero)
e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind()
e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
@@ -1315,10 +1315,10 @@ Partial Class Inventarios_EntregaAlmacen
Protected Sub GvLote_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvLote.RowDeleting
Dim keySerieLote As String = e.Keys("Lote").ToString
Dim keyLote As String = e.Keys("Lote").ToString
Try
For Each dr As DataRow In DtDatosDetalleLote.Rows
If dr("Lote").ToString = keySerieLote Then
If dr("Lote").ToString = keyLote Then
dr.Delete()
End If
Next
@@ -2069,7 +2069,7 @@ Partial Class Inventarios_EntregaAlmacen
Else
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then
ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada")
Exit For

View File

@@ -479,7 +479,7 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Dividir" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center" Visible="false">
<ItemTemplate>
<asp:TextBox runat="server" ID="TxtDividir" Width="30px"></asp:TextBox>
<asp:TextBox runat="server" ID="TxtDividir" Width="30px" Visible="false"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros2" runat="server" TargetControlID="TxtDividir" FilterType="Custom, Numbers" ValidChars="." />
<asp:Button runat="server" ID="BtnDividir" Text="Dividir" OnClick="Dividir" Style="display: none;" />
</ItemTemplate>
@@ -721,23 +721,12 @@
</td>
</tr>
<tr>
<td width="80px">Serie/Lote:</td>
<td width="80px">Serie:</td>
<td>
<asp:TextBox runat="server" ID="TxtSerie" Width="300px" ClientIDMode="Static" />
<asp:RequiredFieldValidator ID="RFVSerie" runat="server" ControlToValidate="TxtSerie" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Serie''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAgregaSerie"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCESerie" runat="server" HighlightCssClass="vco" TargetControlID="RFVSerie" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
<td runat="server" id="TdCaducidad1" width="80px">Fecha Caducidad:</td>
<td runat="server" id="TdCaducidad2">
<asp:TextBox ID="TxtFechaCaducidad" runat="server" CausesValidation="true" MaxLength="10" Width="80px" ClientIDMode="Static"></asp:TextBox>
&nbsp;<asp:ImageButton runat="server" ID="ImgFechaCaducidad" ImageUrl="/Imagenes/calendar.png" ImageAlign="AbsMiddle" Width="16px" Height="16px" AlternateText="Click para ver el Calendario" />
<ajax:MaskedEditExtender ID="MEEFechaCaducidad" runat="server" TargetControlID="TxtFechaCaducidad" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaCaducidad" TargetControlID="TxtFechaCaducidad" PopupButtonID="ImgFechaCaducidad" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaCaducidad" runat="server" ControlToValidate="TxtFechaCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''FechaCaducidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAgregaSerie"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaCaducidad" runat="server" ControlToValidate="TxtFechaCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''FechaCaducidad''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpAgregaSerie"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFechaCaducidad1" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaCaducidad" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCOFechaCaducidad2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaCaducidad" Width="350px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td colspan="4" align="right">
@@ -749,7 +738,6 @@
<asp:GridView ID="GvSerie" runat="server" EmptyDataText="Aun no hay registros." DataKeyNames="Serie" AutoGenerateColumns="False" ShowHeader="true" ShowHeaderWhenEmpty="True" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD" data-height="100" data-freezerows="1" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Serie-Folio" DataField="Serie" ItemStyle-Width="40%" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" ItemStyle-Width="40%" />
<asp:TemplateField HeaderText="Eliminar" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" CommandName="Delete" OnClientClick="return confirm('¿Desea borrar el registro?')"></asp:LinkButton>

View File

@@ -436,7 +436,6 @@ Partial Class Inventarios_RecepcionAlmacen
DivRemision.Visible = True
End If
TxtFechaCaducidad.Text = Now.ToShortDateString
TxtFechaPendientes.Text = Now.ToShortDateString
TipoCambio = -1
CreaDtDetalle()
@@ -1268,6 +1267,7 @@ Partial Class Inventarios_RecepcionAlmacen
e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind()
e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
e.Row.FCTextBox("TxtDividir").Visible = True
Else
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False
@@ -1277,6 +1277,7 @@ Partial Class Inventarios_RecepcionAlmacen
e.Row.FCTextBox("TxtCaducidad").Visible = True
e.Row.FCLinkButton("LnkCaducidad").Visible = True
e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString
e.Row.FCTextBox("TxtDividir").Visible = True
Else
e.Row.FCTextBox("TxtCaducidad").Visible = False
e.Row.FCLinkButton("LnkCaducidad").Visible = False
@@ -1446,7 +1447,6 @@ Partial Class Inventarios_RecepcionAlmacen
LbProducto.Text = Argumentos(3)
LbCantidad.Text = Argumentos(4).FormatoNumero
TxtFechaCaducidad.Text = Now.ToShortDateString()
CvePSSerie = Argumentos(0).ToEntero
CveUMSerie = Argumentos(1).ToEntero
@@ -1638,7 +1638,6 @@ Partial Class Inventarios_RecepcionAlmacen
If Tipo = 1 Then
TxtSerie.Text = ""
TxtFechaCaducidad.Text = Now.ToShortDateString
End If
CargaSerie(Tipo, True)
@@ -1752,10 +1751,10 @@ Partial Class Inventarios_RecepcionAlmacen
End Sub
Protected Sub BtnAddPSLote_Click(sender As Object, e As EventArgs)
AgregaLote(TxtLote.Text.Trim, TxtFechaCaducidad.Text.ToDate, 1)
AgregaLote(TxtLote.Text.Trim, 1)
End Sub
Private Sub AgregaLote(Lote As String, FechaCaducidad As Date, Tipo As Integer)
Private Sub AgregaLote(Lote As String, Tipo As Integer)
If Lote.Trim = "" Then
Alert("El campo Lote es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
@@ -1783,15 +1782,15 @@ Partial Class Inventarios_RecepcionAlmacen
'VERIFICA EXISTENCIAS
If TipoMovimiento > 1 Then
Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Lote, FechaCaducidad:=FechaCaducidad)
Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Lote)
If Existencia < CantidadLote Then
Alert($"<br/> El numero de Lote <b>""{Lote}""</b> y FechaCaducidad = '{FechaCaducidad}' proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia)
Alert($"<br/> El numero de Lote <b>""{Lote}""</b> proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
End If
If TipoMovimiento = 2 Then
If Not DtExistencias.SUM("Existencia", $"Lote = '{Lote}' FechaCaducidad = '{FechaCaducidad}'") = 0 Then
Alert($"<br/> El numero de Lote <b>""{Lote}""</b> y FechaCaducidad '{FechaCaducidad}' proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia)
If Not DtExistencias.SUM("Existencia", $"Lote = '{Lote}' ") = 0 Then
Alert($"<br/> El numero de Lote <b>""{Lote}""</b> proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
End If
End If
@@ -1804,8 +1803,8 @@ Partial Class Inventarios_RecepcionAlmacen
Row("CveUM") = CveUMSerie
Row("PU") = PUSerie
Row("Lote") = Lote
Row("FechaCaducidad") = FechaCaducidad
Row("FechaCaducidad") = If(IsDate(TxtFechaCaducidadLote.Text), TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString)
'Row("FechaCaducidad") = FechaCaducidad
'Row("FechaCaducidad") = If(IsDate(TxtFechaCaducidadLote.Text), TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString)
'Row("FechaCaducidad") = If(AplicaCaducidad, TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString)
DtDatosLoteDetalle.Rows.Add(Row)
@@ -1813,8 +1812,6 @@ Partial Class Inventarios_RecepcionAlmacen
If Tipo = 1 Then
TxtLote.Text = ""
TxtBatch.Text = ""
TxtFechaCaducidad.Text = Now.ToShortDateString
End If
CargaLote(1, True)
@@ -2817,10 +2814,16 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
Else
ErrorMovInv = True
MensajeError = "Error al obtener movimientos"
End If
'PREPOLIZA - NC
If TipoMovimiento = 3 AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
If TipoMovimiento = 3 Then
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
Dim DtCostos As DataTable = Nothing
DtCostos = ObjInventario.DtResultados
@@ -2932,6 +2935,11 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
Else
ErrorMovInv = True
MensajeError = "Error al obtener movimientos"
End If
End If
'AGREGA SALDOS A OC SURTIDAS

View File

@@ -1,4 +1,4 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepApartados2.aspx.vb" Inherits="Inventarios_RepApartados" %>
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepApartados2.aspx.vb" Inherits="Inventarios_RepApartados2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
@@ -110,7 +110,7 @@
</asp:TemplateField>
<%--<asp:BoundField HeaderText="Producto" DataField="GPO" ItemStyle-Width="60%" />--%>
<%-- <asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="SerieLote" DataField="SerieLote" ItemStyle-Width="15%" />--%>
%>
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Right" />
</Columns>

View File

@@ -5,7 +5,7 @@ Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Inventarios_RepApartados
Partial Class Inventarios_RepApartados2
Inherits ClsPaginas

View File

@@ -91,7 +91,7 @@
<asp:Label ID="lblCountRegistros" runat="server" Font-Bold="true"></asp:Label>
</div>
<asp:GridView ID="GvDatos" runat="server" DataKeyNames="CvePersonal,NombreCompleto,Cantidad,UnidadMedida,Folio,PS,CveAlmacen,Almacen,SerieLote,Observaciones,CveMovimiento" AutoGenerateColumns="False" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-freezerows="1" GridLines="None" EmptyDataText="No se encontraron Ordenes de Compra">
<asp:GridView ID="GvDatos" runat="server" DataKeyNames="CvePersonal,NombreCompleto,Cantidad,UnidadMedida,Folio,PS,CveAlmacen,Almacen,Serie,Observaciones,CveMovimiento" AutoGenerateColumns="False" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-freezerows="1" GridLines="None" EmptyDataText="No se encontraron Ordenes de Compra">
<Columns>
<asp:TemplateField HeaderText="Producto" ItemStyle-HorizontalAlign="Left">
@@ -117,7 +117,7 @@
Text='<%# Eval("Folio").ToString %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="SerieLote" HeaderText="Serie" />
<asp:BoundField DataField="Serie" HeaderText="Serie" />
<asp:BoundField DataField="Observaciones" HeaderText="Observaciones" />

View File

@@ -459,10 +459,10 @@
<asp:BoundField HeaderText="Observaciones" DataField="Observaciones" ItemStyle-Width="100px" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" DataFormatString="{0:d}" ItemStyle-Width="90px" />
<asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate>
s
<asp:Literal runat="server" Text='<%# Eval("SeccionAlmacen") %>' ID="ltlSec"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
@@ -661,9 +661,13 @@
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-Width="40%" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Caducidad" DataField="FechaCaducidad" DataFormatString="{0:d}" ItemStyle-Width="15%" />
<asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate>
sss
<asp:DropDownList ID="DdlSeccionAlmacen" DataTextField="Seccion" Visible="false" AppendDataBoundItems="true" DataValueField="CveSeccion" Class="form-control input-sm select2me" Style="width: 95% !important" runat="server" CausesValidation="true">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>

View File

@@ -510,20 +510,30 @@ Partial Class Inventarios_TraspasoAlmacen
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))
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), 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(TxtnLote.Visible, TxtnLote.Text, ""), FechaCaducidad:=If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha), CveSeccionAlmacenDestino:=DdlSeccionAlmacenDestino.SelectedValue.ToEntero, Limpia:=FuncionalidadSinSerie)
End If
End If
End Sub
Private Function ValidaExistencia(Cantidad As Double, 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 Double, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, Serie As String, Lote As String, FechaCaducidad As Date) As Boolean
Dim Retorno = True
Dim ExistenciaEspecificada As Decimal
Dim CantidadEnGrid As Decimal = DtMovimientos.SUMD("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(Serie <> "-1", $" AND Serie = '{Serie}'", "")}")
Dim Inv As New ClsInventarios
Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Serie:=Serie, Lote:=Lote, FechaCaducidad:=Fechacaducidad, 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 - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(Serie <> "-1", $" AND Serie = '{Serie}'", "")}") < 0 Then
If Existencia < 0 Then
If Existencia - Cantidad - CantidadEnGrid < 0 ORELSE ExistenciaEspecificada - Cantidad - CantidadEnGrid < 0 Then
If Existencia < 0 OrElse ExistenciaEspecificada < 0 Then
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
Else
@@ -535,7 +545,7 @@ Partial Class Inventarios_TraspasoAlmacen
Return Retorno
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)
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)
If Cantidad <= 0 Then
Alert("La cantidad debe ser mayor a cero (0). Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
@@ -558,10 +568,13 @@ Partial Class Inventarios_TraspasoAlmacen
registro.Item("Observaciones") = Observaciones
registro.Item("Serie") = Serie
registro.Item("Lote") = Lote
registro.Item("FechaCaducidad") = FechaCaducidad
If FechaCaducidad > MinFecha Then registro.Item("FechaCaducidad") = FechaCaducidad
registro.Item("CveClasificacion") = CveClasificacion
registro.Item("CveAF") = -1
registro.Item("EstatusExistencia") = "1"
registro.Item("CveSeccionAlmacen") = CveSeccionAlmacen
registro.Item("SeccionAlmacen") = SeccionAlmacen
registro.Item("CveSeccionAlmacenDestino") = CveSeccionAlmacenDestino
registro.Item("TotalImporte") = 0
registro.Item("PU") = 0
@@ -678,15 +691,33 @@ Partial Class Inventarios_TraspasoAlmacen
'VALIDA LA EXISTENCIA DEL ALMACEN DE ORIGEN
Dim ErrorExistencia = False
Dim Serie, Lote As String
Dim CveSeccionAlmacen As Integer
Dim FechaCaducidad As Date
Dim TextoExistencia As StringBuilder = New StringBuilder
Dim Existencia As Double
TextoExistencia.Append("Los siguiente productos se ajustaron por falta de exitencia:<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
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"), Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString), PendientePorSurtir:=1)
Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND Serie = '{dr("Serie").ToString}'", "")}")
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 ExistenciaEspecificada As Decimal = 0
CantidadenGrid = DtMovimientos.SUMD("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND Serie = '{dr("Serie").ToString}'", "")}")
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 <> "") Then
ExistenciaEspecificada = 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 = ExistenciaEspecificada - CantidadenGrid
End If
If Existencia < 0 Then
ErrorExistencia = True
@@ -701,7 +732,12 @@ Partial Class Inventarios_TraspasoAlmacen
Next
Else
For Each gvr As GridViewRow In GvDatos.Rows
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"), Serie:=If(gvr.DataKey("Serie").ToString = "", "-1", gvr.DataKey("Serie").ToString), PendientePorSurtir:=1)
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)
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
@@ -764,7 +800,7 @@ Partial Class Inventarios_TraspasoAlmacen
Else
Dim Cont As Integer = 0
For Each Dr As DataRow In DtMovimientos.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
@@ -819,7 +855,7 @@ Partial Class Inventarios_TraspasoAlmacen
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim Cont As Integer = 0
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacenDestino").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:=Dr("Observaciones").ToString) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
@@ -1119,35 +1155,33 @@ Partial Class Inventarios_TraspasoAlmacen
TxtnLote.Visible = False
TxtnFechaCaducidad.Visible = False
EscondeColumnasGVM(DtMovimientos)
If DdlProducto2.SelectedValue.ToEntero > 0 Then
Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("", "PS")
If drP IsNot Nothing Then
If CBool(drP("AplicaSeccion")) Then
ThSeccionAlmacen.Visible = True
TdSeccionAlmacen.Visible = True
DdlSeccionAlmacen.Visible = True
GvDatos.Columns(5).Visible = True
End If
If CBool(drP("AplicaSerie")) Then
ThSerie.Visible = True
TdSerie.Visible = True
TxtnSerie.Visible = True
GvDatos.Columns(6).Visible = True
End If
If CBool(drP("AplicaLote")) Then
TxtnLote.Visible = True
ThLote.Visible = True
TdLote.Visible = True
GvDatos.Columns(7).Visible = True
End If
If CBool(drP("AplicaCaducidad")) Then
TxtnFechaCaducidad.Visible = True
ThFechaCaducidad.Visible = True
TdFechaCaducidad.Visible = True
GvDatos.Columns(8).Visible = True
End If
ThSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
TdSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
DdlSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
'GvDatos.Columns(5).Visible = CBool(drP("AplicaSeccion"))
ThSerie.Visible = CBool(drP("AplicaSerie"))
TdSerie.Visible = CBool(drP("AplicaSerie"))
TxtnSerie.Visible = CBool(drP("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"))
TdFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
'GvDatos.Columns(8).Visible = CBool(drP("AplicaCaducidad"))
End If
End If
@@ -1193,44 +1227,54 @@ Partial Class Inventarios_TraspasoAlmacen
End Sub
Private Sub EscondeColumnasGVM(DtTemp As DataTable)
TxtnSerie.Visible = False
ThSerie.Visible = False
TdSerie.Visible = False
GvDatos.Columns(5).Visible = False
TxtnLote.Visible = False
ThLote.Visible = False
TdLote.Visible = False
GvDatos.Columns(6).Visible = False
GvDatos.Columns(5).Visible = DtTemp.MAX("Serie").ToString <> ""
GvDatos.Columns(6).Visible = DtTemp.MAX("Lote").ToString <> ""
GvDatos.Columns(7).Visible = DtTemp.MAX("FechaCaducidad").ToString.ToDate > MinFecha
GvDatos.Columns(8).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString.ToEntero > 0
TxtnFechaCaducidad.Visible = False
ThFechaCaducidad.Visible = False
TdFechaCaducidad.Visible = False
GvDatos.Columns(7).Visible = False
''TxtnSerie.Visible = False
''ThSerie.Visible = False
''TdSerie.Visible = False
'GvDatos.Columns(5).Visible = False
If DtTemp.MAX("Serie").ToString <> "" Then
TxtnSerie.Visible = True
ThSerie.Visible = True
TdSerie.Visible = True
GvDatos.Columns(5).Visible = True
End If
If DtTemp.MAX("Lote").ToString <> "" Then
TxtnLote.Visible = True
ThLote.Visible = True
TdLote.Visible = True
GvDatos.Columns(6).Visible = True
'TxtnLote.Visible = False
'ThLote.Visible = False
'TdLote.Visible = False
'GvDatos.Columns(6).Visible = False
'TxtnFechaCaducidad.Visible = False
'ThFechaCaducidad.Visible = False
'TdFechaCaducidad.Visible = False
'GvDatos.Columns(7).Visible = False
'If DtTemp.MAX("Serie").ToString <> "" Then
' TxtnSerie.Visible = True
' ThSerie.Visible = True
' TdSerie.Visible = True
' GvDatos.Columns(5).Visible = True
'End If
'If DtTemp.MAX("Lote").ToString <> "" Then
' TxtnLote.Visible = True
' ThLote.Visible = True
' TdLote.Visible = True
' GvDatos.Columns(6).Visible = True
'End If
'If DtTemp.MAX("FechaCaducidad").ToString.ToDate > MinFecha Then
' TxtnFechaCaducidad.Visible = True
' ThFechaCaducidad.Visible = True
' TdFechaCaducidad.Visible = True
' GvDatos.Columns(7).Visible = True
'End If
TxtnFechaCaducidad.Visible = True
ThFechaCaducidad.Visible = True
TdFechaCaducidad.Visible = True
GvDatos.Columns(7).Visible = True
End If
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("EstatusExistencia").ToEntero < 0 Then
If e.Row.DBCampo("EstatusExistencia").ToEntero <0 Then
e.Row.Cells(0).BackColor = Drawing.Color.Red
End If
@@ -1399,6 +1443,11 @@ Partial Class Inventarios_TraspasoAlmacen
If Dtt IsNot Nothing Then
GvDatosRecepcion.DataSource = Dtt
GvDatosRecepcion.DataBind()
GvDatosRecepcion.Columns(6).Visible = Dtt.MAX("Serie") <> ""
GvDatosRecepcion.Columns(7).Visible = Dtt.MAX("Lote") <> ""
GvDatosRecepcion.Columns(8).Visible = Dtt.MAX("FechaCaducidad") <> ""
GvDatosRecepcion.Columns(9).Visible = Dtt.MAX("Serie") <> ""
'Dt.Dispose()
End If
@@ -1447,6 +1496,12 @@ Partial Class Inventarios_TraspasoAlmacen
Else
e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", String.Format("ValidaCantidad(this,{0});", e.Row.DBCampo("Cantidad")))
If CBool(e.Row.DBCampo("AplicaSeccion")) AndAlso DdlAlmacenRecepcion.SelectedValue.ToEntero > 0 Then
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True
e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenRecepcion.SelectedValue.ToEntero)
e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind()
e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
End If
'FUNCIONALIDAD PISTOLA DE CODIGOS
@@ -1695,7 +1750,7 @@ Partial Class Inventarios_TraspasoAlmacen
Exit For
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("PU").ToString.ToDecimal, gvr.DataKey("CveAF").ToString.ToEntero, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("PU").ToString.ToDecimal, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For