Cambios para aplicar lote y caducidad en la solicitud de traspaso
This commit is contained in:
@@ -4048,7 +4048,7 @@ Public Class ClsInventarios
|
||||
End Function
|
||||
|
||||
Public Function AddTrasladoSolicitudDetalle(CveTrasladoSolicitud As Integer, Cantidad As Integer, CveUM As Integer, CvePS As Integer, Precio As Double, Observaciones As String,
|
||||
CveContratoDetalle As Integer, Optional Serie As String = "-1") As Boolean
|
||||
CveContratoDetalle As Integer, Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
Dim CveTraspasoSolicitud As Integer = 0
|
||||
DataAdapter("PA_Inv_TraspasoSolicitudDetalleAdd")
|
||||
@@ -4062,6 +4062,9 @@ Public Class ClsInventarios
|
||||
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
|
||||
.Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle
|
||||
.Add("@Serie", SqlDbType.NVarChar).Value = Serie
|
||||
.Add("@Lote", SqlDbType.NVarChar).Value = Lote
|
||||
.Add("@FechaCaducidad", SqlDbType.Date).Value = FechaCaducidad
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
</div>
|
||||
<div class="portlet-body rowpadding">
|
||||
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePS, CodigoPS, CveUM, Cantidad, Precio, Observaciones, CveContratoDetalle,UnidadMedida,Serie" EmptyDataText="No se encontraron Productos registrados" ToolTip="Listado de Productos" CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD Widthall" GridLines="None">
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePS, CodigoPS, CveUM, Cantidad, Precio, Observaciones, CveContratoDetalle,UnidadMedida,Serie, Lote, FechaCaducidad" EmptyDataText="No se encontraron Productos registrados" ToolTip="Listado de Productos" CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD Widthall" GridLines="None">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Cantidad" HeaderStyle-HorizontalAlign="Left" DataFormatString="{0:N}" ItemStyle-HorizontalAlign="Center" DataField="Cantidad" ItemStyle-Width="5%" />
|
||||
<asp:BoundField HeaderText="U.M" HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:N}" ItemStyle-HorizontalAlign="Center" DataField="UnidadMedida" ItemStyle-Width="10%" />
|
||||
@@ -311,9 +311,21 @@
|
||||
<%--<asp:BoundField HeaderText="Direccion Envio" HeaderStyle-HorizontalAlign="Left" DataField="DireccionEnvio" ItemStyle-Width="20%" />--%>
|
||||
<asp:BoundField HeaderText="Observaciones" DataField="Observaciones" ItemStyle-Width="20%" />
|
||||
<asp:BoundField HeaderText="Precio" HeaderStyle-HorizontalAlign="Right" DataFormatString="{0:c}" ItemStyle-HorizontalAlign="Right" DataField="Precio" Visible="false" ItemStyle-Width="5%" />
|
||||
<asp:BoundField HeaderText="Serie" DataField="Serie" Visible="false" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center"/>
|
||||
<asp:BoundField HeaderText="Lote" DataField="Lote" Visible="false" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center"/>
|
||||
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" Visible="false" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}"/>
|
||||
<asp:TemplateField HeaderText="Serie" ItemStyle-HorizontalAlign="Center" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlSerie" runat="server" Text='<%# Eval("Serie")%>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Lote" ItemStyle-HorizontalAlign="Center" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlLote" runat="server" Text='<%# Eval("Lote")%>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Fecha Caducidad" ItemStyle-HorizontalAlign="Center" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlFechaCaducidad" runat="server" Text='<%# Eval("FechaCaducidad", "{0:d}")%>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Eliminar" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="imgD" runat="server" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="Si" />
|
||||
@@ -492,6 +504,9 @@
|
||||
<div class="col-md-4 form-group form-md-line-input input-iconright" id="divLote" runat="server" visible="false">
|
||||
<asp:TextBox ID="TxtLote" runat="server" CssClass="form-control"></asp:TextBox>
|
||||
<label for="<%= TxtLote.ClientID.ToString()%>">Lote:</label>
|
||||
<asp:RequiredFieldValidator ID="RFVLote" runat="server" ControlToValidate="TxtLote" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Lote''</b> es necesario, por favor ingréselo." ValidationGroup="AgregarPS"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCLote" runat="server" HighlightCssClass="vco" TargetControlID="RFVLote" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 form-group form-md-line-input input-iconright" id="divCaducidad" runat="server" visible="false">
|
||||
@@ -501,11 +516,11 @@
|
||||
|
||||
<div class="col-md-1 form-group form-md-line-input input-iconright" id="divCaducidad2" runat="server" visible="false">
|
||||
<asp:LinkButton ID="ImgFechaCad" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
<asp:RequiredFieldValidator ID="RFVFechaCad" runat="server" ControlToValidate="TxtCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="AddPSInvFisico"></asp:RequiredFieldValidator>
|
||||
<asp:RequiredFieldValidator ID="RFVFechaCad" runat="server" ControlToValidate="TxtCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="AgregarPS"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCFechaCad" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaCad" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaCad" runat="server" TargetControlID="TxtCaducidad" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CEFechaCad" TargetControlID="TxtCaducidad" PopupButtonID="ImgFechaCad" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:CompareValidator ID="CVFechaCad" runat="server" ControlToValidate="TxtCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="AddPSInvFisico"></asp:CompareValidator>
|
||||
<asp:CompareValidator ID="CVFechaCad" runat="server" ControlToValidate="TxtCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="AgregarPS"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEFechaCad" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaCad" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -50,6 +50,48 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property AplicaSerie As Boolean
|
||||
Get
|
||||
If ViewState("AplicaSerie") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return CType(ViewState("AplicaSerie"), Boolean)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("AplicaSerie") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property AplicaLote As Boolean
|
||||
Get
|
||||
If ViewState("AplicaLote") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return CType(ViewState("AplicaLote"), Boolean)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("AplicaLote") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property AplicaCaducidad As Boolean
|
||||
Get
|
||||
If ViewState("AplicaCaducidad") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return CType(ViewState("AplicaCaducidad"), Boolean)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("AplicaCaducidad") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
@@ -152,10 +194,27 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Dim ObjClientes As New ClsClientes
|
||||
|
||||
If ObjInventarios.AddTrasladoSolicitudGet(CveTraspasoSolicitud, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventarios.DtResultados.Rows.Count > 0 Then
|
||||
If ObjInventarios.DtResultados.Rows.Count > 0 Then
|
||||
For Each rowtp As DataRow In ObjInventarios.DtResultados.Rows
|
||||
If Not AplicaSerie Then
|
||||
AplicaSerie = rowtp("Serie").ToString <> ""
|
||||
End If
|
||||
If Not AplicaLote Then
|
||||
AplicaLote = rowtp("Lote").ToString <> ""
|
||||
End If
|
||||
If Not AplicaCaducidad Then
|
||||
AplicaCaducidad = rowtp("FechaCaducidad").ToString <> ""
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProductoServicio.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
|
||||
|
||||
GvDatos.Columns(4).Visible = False
|
||||
GvDatos.Columns(5).Visible = AplicaSerie
|
||||
GvDatos.Columns(6).Visible = AplicaLote
|
||||
GvDatos.Columns(7).Visible = AplicaCaducidad
|
||||
|
||||
GvDatos.Columns(4).Visible = False
|
||||
GvDatos.Columns(5).Visible = True
|
||||
DivFolio.Visible = True
|
||||
LbFolio.Text = ObjInventarios.DtResultados.Rows(0)("FolioTraspaso").ToString
|
||||
TxtObservaciones.Text = ObjInventarios.DtResultados.Rows(0)("ObservacionesTraspaso").ToString
|
||||
@@ -369,14 +428,14 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Row("CveUM") = DdlUM.SelectedValue.ToEntero
|
||||
Row("UnidadMedida") = DdlUM.SelectedItem.Text
|
||||
Row("Observaciones") = ""
|
||||
Row("Lote") = "-1"
|
||||
Row("Serie") = "-1"
|
||||
Row("FechaCaducidad") = MinFecha
|
||||
|
||||
If divLote.Visible Then
|
||||
Row("Lote") = TxtLote.Text
|
||||
GvDatos.Columns(6).Visible = True
|
||||
Lote = TxtLote.Text.ToString
|
||||
Else
|
||||
Row("Lote") = "-1"
|
||||
Lote = "-1"
|
||||
End If
|
||||
|
||||
|
||||
@@ -384,8 +443,9 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Row("FechaCaducidad") = TxtCaducidad.Text
|
||||
GvDatos.Columns(7).Visible = True
|
||||
FechaCaducidad = TxtCaducidad.Text.ToDate
|
||||
RFVFechaCad.Enabled = True
|
||||
|
||||
Else
|
||||
Row("FechaCaducidad") = MinFecha
|
||||
FechaCaducidad = MinFecha
|
||||
End If
|
||||
|
||||
@@ -393,8 +453,6 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
If Div4.Visible Then
|
||||
Row("Serie") = TxtSerie.Text
|
||||
GvDatos.Columns(5).Visible = True
|
||||
Else
|
||||
Row("Serie") = "-1"
|
||||
End If
|
||||
|
||||
|
||||
@@ -621,7 +679,7 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
|
||||
For Each row As GridViewRow In GvDatos.Rows
|
||||
CodigoPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=row.DataKey("CvePS").ToEntero).FiltroPrimeroValor("PSCodigo", "")
|
||||
Existencia = ObjInventarios.GetExistenciasPS(row.DataKey("CvePS").ToEntero, row.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"))
|
||||
Existencia = ObjInventarios.GetExistenciasPS(row.DataKey("CvePS").ToEntero, row.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Lote:=row.DataKey("Lote").ToString, FechaCaducidad:=row.DataKey("FechaCaducidad").ToString.ToDate)
|
||||
If Existencia - TempDT.SUM("Cantidad", $"CvePS = {row.DataKey("CvePS").ToEntero} AND CveUM = {row.DataKey("CveUM").ToEntero}") < 0 Then
|
||||
MensajeExistencia.AppendFormat("<br/> - <b>{0}.</b> Existencia: {1}", CodigoPS, Existencia)
|
||||
TieneErrorExistencia = True
|
||||
@@ -666,9 +724,11 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Dim Precio As Double = Row.DataKey("Precio").ToEntero
|
||||
Dim Observaciones As String = Row.DataKey("Observaciones")
|
||||
Dim CveContratoDetalle As Integer = Row.DataKey("CveContratoDetalle").ToEntero
|
||||
Dim Serie As String = Row.DataKey("Serie")
|
||||
Dim Serie As String = Row.DataKey("Serie")
|
||||
Dim Lote As String = Row.DataKey("Lote")
|
||||
Dim FechaCaducidad As Date = Row.DataKey("FechaCaducidad").ToDate
|
||||
|
||||
If Not ObjInventarios.AddTrasladoSolicitudDetalle(CveTraspasoSolicitud, Cantidad, CveUM, CvePS, Precio, Observaciones, CveContratoDetalle, Serie) Then
|
||||
If Not ObjInventarios.AddTrasladoSolicitudDetalle(CveTraspasoSolicitud, Cantidad, CveUM, CvePS, Precio, Observaciones, CveContratoDetalle, Serie, Lote, FechaCaducidad) Then
|
||||
TieneError = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -1019,15 +1079,17 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
DdlUM.SelectedValue = "-1"
|
||||
DdlUM.DataBind()
|
||||
DdlUM.SelectedValueExist(drPS("CveUnidadMedida").ToString)
|
||||
Dim AplicaSerie As Boolean = drPS("AplicaSerie").ToString = "True"
|
||||
Div4.Visible = AplicaSerie
|
||||
AplicaSerie = drPS("AplicaSerie").ToString = "True"
|
||||
Div4.Visible = AplicaSerie
|
||||
|
||||
AplicaLote = drPS("AplicaLote").ToString = "True"
|
||||
divLote.Visible = AplicaLote
|
||||
RFVLote.Enabled = AplicaLote
|
||||
|
||||
Dim AplicaLote As Boolean = drPS("AplicaLote").ToString = "True"
|
||||
divLote.Visible = AplicaLote
|
||||
|
||||
Dim AplicaCaducidad As Boolean = drPS("AplicaCaducidad").ToString = "True"
|
||||
AplicaCaducidad = drPS("AplicaCaducidad").ToString = "True"
|
||||
divCaducidad.Visible = AplicaCaducidad
|
||||
divCaducidad2.Visible = AplicaCaducidad
|
||||
divCaducidad2.Visible = AplicaCaducidad
|
||||
RFVFechaCad.Enabled = AplicaCaducidad
|
||||
|
||||
End If
|
||||
UpPS.Update()
|
||||
@@ -1180,5 +1242,23 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
GvDatos.Columns(5).Visible = Mostrar
|
||||
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.FCLiteral("LtlSerie").ToString = "-1" Then
|
||||
e.Row.FCLiteral("LtlSerie").Text = ""
|
||||
End If
|
||||
|
||||
If e.Row.FCLiteral("LtlLote").ToString = "-1" Then
|
||||
e.Row.FCLiteral("LtlLote").Text = ""
|
||||
End If
|
||||
|
||||
If e.Row.FCLiteral("LtlFechaCaducidad").ToString.ToDate = MinFecha Then
|
||||
e.Row.FCLiteral("LtlFechaCaducidad").Text = ""
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user