- 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> <Columns>
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" /> <asp:BoundField HeaderText="Producto" DataField="CodigoPS" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="5%" /> <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:BoundField HeaderText="Existencia" DataField="Existencia" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" />
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>
@@ -54,7 +54,7 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Nueva Seccion" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField HeaderText="Nueva Seccion" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <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> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>

View File

@@ -170,7 +170,13 @@
<br /> <br />
Producto Producto
</th> </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>
<th width="160px">Comandos</th> <th width="160px">Comandos</th>
</tr> </tr>
@@ -203,17 +209,26 @@
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</td> </td>
<td runat="server" id="TdSerieLote" visible="false"> <td runat="server" id="TdSerie" visible="false">
<asp:Panel runat="server" DefaultButton="BtnSerieAddNew"> <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:Button Text="" ID="BtnSerieAddNew" OnClick="BtnSerieAddNew_Click" Style="display: none" runat="server" />
</asp:Panel> </asp:Panel>
</td> </td>
<td runat="server" id="TdSeccionAlmacen" visible="false"> <td runat="server" id="TdLote" visible="false">
<asp:Panel runat="server" DefaultButton="BtnSeccionAddNew"> <asp:Panel runat="server" DefaultButton="BtnAddLote">
<asp:Button Text="" ID="BtnAddLote" Style="display: none" runat="server" />
<asp:DropDownlist runat="server" DataTextField="Seccion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me" />
</asp:Panel> </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>
<td align="center"> <td align="center">
<asp:LinkButton ID="LbAgregar" runat="server" CssClass="Texto" ValidationGroup="GrpAgregar" Text="Agregar" /> <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="Unidad" DataField="UnidadMedida" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-Width="500px" /> <asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-Width="500px" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="90px" /> <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"> <asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate> <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> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
@@ -292,9 +310,11 @@
</div> </div>
<div class="col-md-1" style="max-width: 70px">Cliente</div> <div class="col-md-1" style="max-width: 70px">Cliente</div>
<div class="col-md-2"> <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> <ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClienteDesapartado" OnSelectedIndexChanged="DdlClienteDesapartado_SelectedIndexChanged" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;">
<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> </ADS:Dropdownlost>
<ajax:ValidatorCalloutExtender ID="VCEFClienteDesapartado" runat="server" HighlightCssClass="vco" TargetControlID="RFVFClienteDesapartado" Width="350px"></ajax:ValidatorCalloutExtender>
<%--<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>
<div class="col-md-1" style="max-width: 70px">Vendedor:</div> <div class="col-md-1" style="max-width: 70px">Vendedor:</div>
<div class="col-md-2"> <div class="col-md-2">
@@ -357,7 +377,7 @@
<div class="row"> <div class="row">
<label class="col-md-2">Almacén Destino:</label> <label class="col-md-2">Almacén Destino:</label>
<div class="col-md-3"> <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> <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> <ajax:ValidatorCalloutExtender ID="VCEAlmacenOrigenDesapartado" runat="server" HighlightCssClass="vco" TargetControlID="RFVAlmacenOrigenDesapartado" Width="350px"></ajax:ValidatorCalloutExtender>
</div> </div>
@@ -381,7 +401,7 @@
<asp:UpdatePanel runat="server" ID="UpDatosDesapartado" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpDatosDesapartado" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div style="max-height: 300px; overflow-y: auto;"> <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> <Columns>
<asp:BoundField HeaderText="#" DataField="No" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" /> <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" /> <asp:BoundField HeaderText="Disponible" DataField="Cantidad" DataFormatString="{0:#,###.##}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />
@@ -393,10 +413,14 @@
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-Width="15%" /> <asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-Width="35%" /> <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"> <asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate> <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> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>

View File

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

View File

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

View File

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

View File

@@ -777,7 +777,7 @@
<asp:BoundField HeaderText="Sección Almacen" DataField="Seccion" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField HeaderText="Sección Almacen" DataField="Seccion" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Lote" DataField="Lote" 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> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>

View File

@@ -831,7 +831,7 @@ Partial Class Inventarios_EntregaAlmacen
If CBool(e.Row.DBCampo("AplicaSeccion")) Then If CBool(e.Row.DBCampo("AplicaSeccion")) Then
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True
If DdlAlmacen.SelectedValue.ToEntero > 0 Then 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").DataBind()
e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
End If 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 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 Try
For Each dr As DataRow In DtDatosDetalleLote.Rows For Each dr As DataRow In DtDatosDetalleLote.Rows
If dr("Lote").ToString = keySerieLote Then If dr("Lote").ToString = keyLote Then
dr.Delete() dr.Delete()
End If End If
Next Next
@@ -2069,7 +2069,7 @@ Partial Class Inventarios_EntregaAlmacen
Else Else
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows 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 ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada") TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada")
Exit For Exit For

View File

@@ -479,7 +479,7 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Dividir" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center" Visible="false"> <asp:TemplateField HeaderText="Dividir" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center" Visible="false">
<ItemTemplate> <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="." /> <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;" /> <asp:Button runat="server" ID="BtnDividir" Text="Dividir" OnClick="Dividir" Style="display: none;" />
</ItemTemplate> </ItemTemplate>
@@ -721,23 +721,12 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="80px">Serie/Lote:</td> <td width="80px">Serie:</td>
<td> <td>
<asp:TextBox runat="server" ID="TxtSerie" Width="300px" ClientIDMode="Static" /> <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> <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> <ajax:ValidatorCalloutExtender ID="VCESerie" runat="server" HighlightCssClass="vco" TargetControlID="RFVSerie" Width="300px"></ajax:ValidatorCalloutExtender>
</td> </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>
<tr> <tr>
<td colspan="4" align="right"> <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"> <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> <Columns>
<asp:BoundField HeaderText="Serie-Folio" DataField="Serie" ItemStyle-Width="40%" /> <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"> <asp:TemplateField HeaderText="Eliminar" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <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> <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 DivRemision.Visible = True
End If End If
TxtFechaCaducidad.Text = Now.ToShortDateString
TxtFechaPendientes.Text = Now.ToShortDateString TxtFechaPendientes.Text = Now.ToShortDateString
TipoCambio = -1 TipoCambio = -1
CreaDtDetalle() CreaDtDetalle()
@@ -1268,6 +1267,7 @@ Partial Class Inventarios_RecepcionAlmacen
e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind()
e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
End If End If
e.Row.FCTextBox("TxtDividir").Visible = True
Else Else
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False
@@ -1277,6 +1277,7 @@ Partial Class Inventarios_RecepcionAlmacen
e.Row.FCTextBox("TxtCaducidad").Visible = True e.Row.FCTextBox("TxtCaducidad").Visible = True
e.Row.FCLinkButton("LnkCaducidad").Visible = True e.Row.FCLinkButton("LnkCaducidad").Visible = True
e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString
e.Row.FCTextBox("TxtDividir").Visible = True
Else Else
e.Row.FCTextBox("TxtCaducidad").Visible = False e.Row.FCTextBox("TxtCaducidad").Visible = False
e.Row.FCLinkButton("LnkCaducidad").Visible = False e.Row.FCLinkButton("LnkCaducidad").Visible = False
@@ -1446,7 +1447,6 @@ Partial Class Inventarios_RecepcionAlmacen
LbProducto.Text = Argumentos(3) LbProducto.Text = Argumentos(3)
LbCantidad.Text = Argumentos(4).FormatoNumero LbCantidad.Text = Argumentos(4).FormatoNumero
TxtFechaCaducidad.Text = Now.ToShortDateString()
CvePSSerie = Argumentos(0).ToEntero CvePSSerie = Argumentos(0).ToEntero
CveUMSerie = Argumentos(1).ToEntero CveUMSerie = Argumentos(1).ToEntero
@@ -1638,7 +1638,6 @@ Partial Class Inventarios_RecepcionAlmacen
If Tipo = 1 Then If Tipo = 1 Then
TxtSerie.Text = "" TxtSerie.Text = ""
TxtFechaCaducidad.Text = Now.ToShortDateString
End If End If
CargaSerie(Tipo, True) CargaSerie(Tipo, True)
@@ -1752,10 +1751,10 @@ Partial Class Inventarios_RecepcionAlmacen
End Sub End Sub
Protected Sub BtnAddPSLote_Click(sender As Object, e As EventArgs) 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 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 If Lote.Trim = "" Then
Alert("El campo Lote es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) 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 'VERIFICA EXISTENCIAS
If TipoMovimiento > 1 Then 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 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')") RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
End If End If
If TipoMovimiento = 2 Then If TipoMovimiento = 2 Then
If Not DtExistencias.SUM("Existencia", $"Lote = '{Lote}' FechaCaducidad = '{FechaCaducidad}'") = 0 Then If Not DtExistencias.SUM("Existencia", $"Lote = '{Lote}' ") = 0 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')") RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
End If End If
End If End If
@@ -1804,8 +1803,8 @@ Partial Class Inventarios_RecepcionAlmacen
Row("CveUM") = CveUMSerie Row("CveUM") = CveUMSerie
Row("PU") = PUSerie Row("PU") = PUSerie
Row("Lote") = Lote Row("Lote") = Lote
Row("FechaCaducidad") = FechaCaducidad 'Row("FechaCaducidad") = FechaCaducidad
Row("FechaCaducidad") = If(IsDate(TxtFechaCaducidadLote.Text), TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString) 'Row("FechaCaducidad") = If(IsDate(TxtFechaCaducidadLote.Text), TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString)
'Row("FechaCaducidad") = If(AplicaCaducidad, TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString) 'Row("FechaCaducidad") = If(AplicaCaducidad, TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString)
DtDatosLoteDetalle.Rows.Add(Row) DtDatosLoteDetalle.Rows.Add(Row)
@@ -1813,8 +1812,6 @@ Partial Class Inventarios_RecepcionAlmacen
If Tipo = 1 Then If Tipo = 1 Then
TxtLote.Text = "" TxtLote.Text = ""
TxtBatch.Text = ""
TxtFechaCaducidad.Text = Now.ToShortDateString
End If End If
CargaLote(1, True) CargaLote(1, True)
@@ -2817,10 +2814,16 @@ Partial Class Inventarios_RecepcionAlmacen
End If End If
End If End If
Else
ErrorMovInv = True
MensajeError = "Error al obtener movimientos"
End If End If
'PREPOLIZA - NC '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 Dim DtCostos As DataTable = Nothing
DtCostos = ObjInventario.DtResultados DtCostos = ObjInventario.DtResultados
@@ -2932,6 +2935,11 @@ Partial Class Inventarios_RecepcionAlmacen
End If End If
End If End If
Else
ErrorMovInv = True
MensajeError = "Error al obtener movimientos"
End If
End If End If
'AGREGA SALDOS A OC SURTIDAS '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 ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content> </asp:Content>
@@ -110,7 +110,7 @@
</asp:TemplateField> </asp:TemplateField>
<%--<asp:BoundField HeaderText="Producto" DataField="GPO" ItemStyle-Width="60%" />--%> <%--<asp:BoundField HeaderText="Producto" DataField="GPO" ItemStyle-Width="60%" />--%>
<%-- <asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-Width="10%" /> <%-- <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="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" /> <asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Right" />
</Columns> </Columns>

View File

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

View File

@@ -91,7 +91,7 @@
<asp:Label ID="lblCountRegistros" runat="server" Font-Bold="true"></asp:Label> <asp:Label ID="lblCountRegistros" runat="server" Font-Bold="true"></asp:Label>
</div> </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> <Columns>
<asp:TemplateField HeaderText="Producto" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="Producto" ItemStyle-HorizontalAlign="Left">
@@ -117,7 +117,7 @@
Text='<%# Eval("Folio").ToString %>' /> Text='<%# Eval("Folio").ToString %>' />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="SerieLote" HeaderText="Serie" /> <asp:BoundField DataField="Serie" HeaderText="Serie" />
<asp:BoundField DataField="Observaciones" HeaderText="Observaciones" /> <asp:BoundField DataField="Observaciones" HeaderText="Observaciones" />

View File

@@ -459,10 +459,10 @@
<asp:BoundField HeaderText="Observaciones" DataField="Observaciones" ItemStyle-Width="100px" /> <asp:BoundField HeaderText="Observaciones" DataField="Observaciones" ItemStyle-Width="100px" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="90px" /> <asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="90px" />
<asp:BoundField HeaderText="Lote" DataField="Lote" 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"> <asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate> <ItemTemplate>
s <asp:Literal runat="server" Text='<%# Eval("SeccionAlmacen") %>' ID="ltlSec"></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
@@ -661,9 +661,13 @@
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-Width="10%" /> <asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-Width="40%" /> <asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-Width="40%" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="15%" /> <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"> <asp:TemplateField HeaderText="Sección Almacén" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">
<ItemTemplate> <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> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </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)) 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 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 If End If
End Sub 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 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 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() Inv.Dispose()
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(Serie <> "-1", $" AND Serie = '{Serie}'", "")}") < 0 Then If Existencia - Cantidad - CantidadEnGrid < 0 ORELSE ExistenciaEspecificada - Cantidad - CantidadEnGrid < 0 Then
If Existencia < 0 Then If Existencia < 0 OrElse ExistenciaEspecificada < 0 Then
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia) Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
Else Else
@@ -535,7 +545,7 @@ Partial Class Inventarios_TraspasoAlmacen
Return Retorno Return Retorno
End Function End Function
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Observaciones As String = "", Optional CveSeccionAlmacen As Integer = -1, Optional SeccionAlmacen As String = "", Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True) 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 If Cantidad <= 0 Then
Alert("La cantidad debe ser mayor a cero (0). Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) 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')") RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
@@ -558,10 +568,13 @@ Partial Class Inventarios_TraspasoAlmacen
registro.Item("Observaciones") = Observaciones registro.Item("Observaciones") = Observaciones
registro.Item("Serie") = Serie registro.Item("Serie") = Serie
registro.Item("Lote") = Lote registro.Item("Lote") = Lote
registro.Item("FechaCaducidad") = FechaCaducidad If FechaCaducidad > MinFecha Then registro.Item("FechaCaducidad") = FechaCaducidad
registro.Item("CveClasificacion") = CveClasificacion registro.Item("CveClasificacion") = CveClasificacion
registro.Item("CveAF") = -1 registro.Item("CveAF") = -1
registro.Item("EstatusExistencia") = "1" registro.Item("EstatusExistencia") = "1"
registro.Item("CveSeccionAlmacen") = CveSeccionAlmacen
registro.Item("SeccionAlmacen") = SeccionAlmacen
registro.Item("CveSeccionAlmacenDestino") = CveSeccionAlmacenDestino
registro.Item("TotalImporte") = 0 registro.Item("TotalImporte") = 0
registro.Item("PU") = 0 registro.Item("PU") = 0
@@ -678,15 +691,33 @@ Partial Class Inventarios_TraspasoAlmacen
'VALIDA LA EXISTENCIA DEL ALMACEN DE ORIGEN 'VALIDA LA EXISTENCIA DEL ALMACEN DE ORIGEN
Dim ErrorExistencia = False Dim ErrorExistencia = False
Dim Serie, Lote As String
Dim CveSeccionAlmacen As Integer
Dim FechaCaducidad As Date
Dim TextoExistencia As StringBuilder = New StringBuilder Dim TextoExistencia As StringBuilder = New StringBuilder
Dim Existencia As Double 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 If Not CargadoDeMov Then
For Each dr As DataRow In DtMovimientos.Rows 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) CveSeccionAlmacen = If(dr("CveSeccionAlmacen").ToString = "", -1, dr("CveSeccionAlmacen").ToString.ToEntero)
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}'", "")}") 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)) '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 If Existencia < 0 Then
ErrorExistencia = True ErrorExistencia = True
@@ -701,7 +732,12 @@ Partial Class Inventarios_TraspasoAlmacen
Next Next
Else Else
For Each gvr As GridViewRow In GvDatos.Rows 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 Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero
If Existencia < 0 Then If Existencia < 0 Then
ErrorExistencia = True ErrorExistencia = True
@@ -764,7 +800,7 @@ Partial Class Inventarios_TraspasoAlmacen
Else Else
Dim Cont As Integer = 0 Dim Cont As Integer = 0
For Each Dr As DataRow In DtMovimientos.Rows 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 ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida" TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For Exit For
@@ -819,7 +855,7 @@ Partial Class Inventarios_TraspasoAlmacen
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim Cont As Integer = 0 Dim Cont As Integer = 0
For Each Dr As DataRow In ObjInventario.DtResultados.Rows 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 ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada" TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For Exit For
@@ -1119,35 +1155,33 @@ Partial Class Inventarios_TraspasoAlmacen
TxtnLote.Visible = False TxtnLote.Visible = False
TxtnFechaCaducidad.Visible = False TxtnFechaCaducidad.Visible = False
EscondeColumnasGVM(DtMovimientos)
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 = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("", "PS")
If drP IsNot Nothing Then If drP IsNot Nothing Then
If CBool(drP("AplicaSeccion")) Then
ThSeccionAlmacen.Visible = True ThSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
TdSeccionAlmacen.Visible = True TdSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
DdlSeccionAlmacen.Visible = True DdlSeccionAlmacen.Visible = CBool(drP("AplicaSeccion"))
GvDatos.Columns(5).Visible = True 'GvDatos.Columns(5).Visible = CBool(drP("AplicaSeccion"))
End If
If CBool(drP("AplicaSerie")) Then
ThSerie.Visible = True ThSerie.Visible = CBool(drP("AplicaSerie"))
TdSerie.Visible = True TdSerie.Visible = CBool(drP("AplicaSerie"))
TxtnSerie.Visible = True TxtnSerie.Visible = CBool(drP("AplicaSerie"))
GvDatos.Columns(6).Visible = True 'GvDatos.Columns(6).Visible = CBool(drP("AplicaSerie"))
End If
If CBool(drP("AplicaLote")) Then
TxtnLote.Visible = True TxtnLote.Visible = CBool(drP("AplicaLote"))
ThLote.Visible = True ThLote.Visible = CBool(drP("AplicaLote"))
TdLote.Visible = True TdLote.Visible = CBool(drP("AplicaLote"))
GvDatos.Columns(7).Visible = True 'GvDatos.Columns(7).Visible = CBool(drP("AplicaLote"))
End If
If CBool(drP("AplicaCaducidad")) Then
TxtnFechaCaducidad.Visible = True TxtnFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
ThFechaCaducidad.Visible = True ThFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
TdFechaCaducidad.Visible = True TdFechaCaducidad.Visible = CBool(drP("AplicaCaducidad"))
GvDatos.Columns(8).Visible = True 'GvDatos.Columns(8).Visible = CBool(drP("AplicaCaducidad"))
End If
End If End If
End If End If
@@ -1193,38 +1227,48 @@ Partial Class Inventarios_TraspasoAlmacen
End Sub End Sub
Private Sub EscondeColumnasGVM(DtTemp As DataTable) Private Sub EscondeColumnasGVM(DtTemp As DataTable)
TxtnSerie.Visible = False
ThSerie.Visible = False
TdSerie.Visible = False
GvDatos.Columns(5).Visible = False
TxtnLote.Visible = False GvDatos.Columns(5).Visible = DtTemp.MAX("Serie").ToString <> ""
ThLote.Visible = False GvDatos.Columns(6).Visible = DtTemp.MAX("Lote").ToString <> ""
TdLote.Visible = False GvDatos.Columns(7).Visible = DtTemp.MAX("FechaCaducidad").ToString.ToDate > MinFecha
GvDatos.Columns(6).Visible = False GvDatos.Columns(8).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString.ToEntero > 0
TxtnFechaCaducidad.Visible = False ''TxtnSerie.Visible = False
ThFechaCaducidad.Visible = False ''ThSerie.Visible = False
TdFechaCaducidad.Visible = False ''TdSerie.Visible = False
GvDatos.Columns(7).Visible = False 'GvDatos.Columns(5).Visible = False
If DtTemp.MAX("Serie").ToString <> "" Then 'TxtnLote.Visible = False
TxtnSerie.Visible = True 'ThLote.Visible = False
ThSerie.Visible = True 'TdLote.Visible = False
TdSerie.Visible = True 'GvDatos.Columns(6).Visible = False
GvDatos.Columns(5).Visible = True
End If 'TxtnFechaCaducidad.Visible = False
If DtTemp.MAX("Lote").ToString <> "" Then 'ThFechaCaducidad.Visible = False
TxtnLote.Visible = True 'TdFechaCaducidad.Visible = False
ThLote.Visible = True 'GvDatos.Columns(7).Visible = False
TdLote.Visible = True
GvDatos.Columns(6).Visible = True
'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 End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
@@ -1399,6 +1443,11 @@ Partial Class Inventarios_TraspasoAlmacen
If Dtt IsNot Nothing Then If Dtt IsNot Nothing Then
GvDatosRecepcion.DataSource = Dtt GvDatosRecepcion.DataSource = Dtt
GvDatosRecepcion.DataBind() 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() 'Dt.Dispose()
End If End If
@@ -1447,6 +1496,12 @@ Partial Class Inventarios_TraspasoAlmacen
Else Else
e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", String.Format("ValidaCantidad(this,{0});", e.Row.DBCampo("Cantidad"))) 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 End If
'FUNCIONALIDAD PISTOLA DE CODIGOS 'FUNCIONALIDAD PISTOLA DE CODIGOS
@@ -1695,7 +1750,7 @@ Partial Class Inventarios_TraspasoAlmacen
Exit For Exit For
End If 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 ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida" TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For Exit For