-- cmbios de material utilizado

This commit is contained in:
2023-12-22 13:22:47 -07:00
parent a613feecbf
commit 21e90c5c65
2 changed files with 85 additions and 156 deletions

View File

@@ -14,7 +14,7 @@
<asp:LinkButton ID="ImgImprimir" runat="server"> <i class="fa fa-ad-pdf"></i> Imprimir Orden</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkAccionesDevolucion" runat="server" OnClick="LnkAccionesDevolucion_Click" Visible="false"> <i class="fa fa-plus"></i> Devolución Material</asp:LinkButton>
<asp:LinkButton ID="LnkAccionesMaterialUtilizado" runat="server" OnClick="LnkAccionesMaterialUtilizado_Click" Visible="false"> <i class="fa fa-plus"></i> Material Utilizado</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
@@ -1262,24 +1262,24 @@
<%--MODAL FINALIZAR ORDEN INICIO --%>
<div id="DVModalSolicitarDevolucion" class="modal ADS fade" role="dialog">
<div id="DivModalMaterialUtilizado" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpModalSolicitarDevolucion" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<asp:UpdatePanel ID="UpModalMaterialUtilizado" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" >Solicitar Devolución</h4>
<h4 class="modal-title" >Material Utilizado</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvSolicitarDevolucion" runat="server" AutoGenerateColumns="False" EmptyDataText="No se han capturado Historial"
<asp:GridView ID="GvMaterialUtilizado" runat="server" AutoGenerateColumns="False" EmptyDataText="No se han capturado Historial"
DataKeyNames="CveVentaDetalle,Cantidad,CveAlmacenActual,CvePS,CveUM,PU,CveMovimientoDetalle,Lote,Serie,FechaCaducidad,AplicaSerie,AplicaLote,AplicaCaducidad,CodigoPS"
CssClass="table table-striped table-advance table-hover Widthall" GridLines="None" OnRowDataBound="GvSolicitarDevolucion_RowDataBound">
CssClass="table table-striped table-advance table-hover Widthall" GridLines="None" OnRowDataBound="GvMaterialUtilizado_RowDataBound">
<Columns>
<asp:TemplateField>
<HeaderTemplate>Cant.</HeaderTemplate>
@@ -1288,7 +1288,7 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Dev</HeaderTemplate>
<HeaderTemplate>Utilizado</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtDev" runat="server" Width="50px" ></asp:TextBox>
<ajax:FilteredTextBoxExtender runat="server" FilterType="Custom" TargetControlID="TxtDev" ValidChars="123456789." />
@@ -1299,37 +1299,24 @@
<ItemTemplate>
<asp:Literal ID="LtlcodigoPS" runat="server" Text='<%# Eval("CodigoPS") %>' ></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Lote</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtLote" runat="server" Width="50px" Text='<%# Eval("Lote") %>' Visible="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Serie</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtSerie" runat="server" Width="50px" Text='<%# Eval("Serie") %>' Visible="false" ></asp:TextBox>
<asp:Label ID="TxtSerie" runat="server" Width="50px" Text='<%# Eval("Serie") %>' Visible="false" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Lote</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="TxtLote" runat="server" Width="50px" Text='<%# Eval("Lote") %>' Visible="false"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Fecha Cad.</HeaderTemplate>
<ItemTemplate>
<div runat="server" id="DVFechaCaducidad" visible="false">
<asp:TextBox ID="TxtFechaCaducidad" runat="server" Width="70px" Text='<%# Eval("FechaCaducidad") %>' ></asp:TextBox>
<ajax:MaskedEditExtender ID="METxtFechaCaducidad" runat="server" TargetControlID="TxtFechaCaducidad" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CCTxtFechaCaducidad" TargetControlID="TxtFechaCaducidad" PopupButtonID="TxtFechaCaducidad" PopupPosition="BottomLeft" ></ajax:CalendarExtender>
<asp:CompareValidator ID="CVTxtFechaCaducidad" runat="server" ControlToValidate="TxtFechaCaducidad" Display="None"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Caducidad''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)."
Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpDevolucion">
</asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCTxtFechaCaducidad" runat="server" HighlightCssClass="vco" TargetControlID="CVTxtFechaCaducidad" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:Label ID="TxtFechaCaducidad" runat="server" Width="70px" Text='<%# Eval("FechaCaducidad", "{0:d}") %>' ></asp:Label>
</div>
</ItemTemplate>
</asp:TemplateField>
@@ -1346,8 +1333,8 @@
</div>
<div class="modal-footer">
<asp:LinkButton ID="LnkModalSolicitarDevolucion" runat="server" CssClass="btn btn-primary" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" ValidationGroup="GrpDevolucion"
OnClick="LnkModalSolicitarDevolucion_Click" >Guardar</asp:LinkButton>
<asp:LinkButton ID="LnkModalMaterialUtilizado" runat="server" CssClass="btn btn-primary" data-toggle="confirmation" data-popout="true" data-original-title="El material definido es el correcto?" data-btn-ok-label="si" ValidationGroup="GrpDevolucion"
OnClick="LnkModalMaterialUtilizado_Click" >Guardar</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>

View File

@@ -704,7 +704,7 @@ Partial Class OS_OrdenesServicios
If CveVenta > 0 And TipoEstatus.Contiene(1, 2, 3) Then
LnkAccionesDevolucion.Visible = True
LnkAccionesMaterialUtilizado.Visible = True
End If
Else
Alert("La Orden de Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
@@ -1192,7 +1192,7 @@ Partial Class OS_OrdenesServicios
#Region "P E R M I S O S"
Private Sub PermisosSegunEstatus()
Dim TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor(String.Format("TipoEstatus", "CveEstatusOrdenServicio = {0}", "CveEstatusOrdenServicio ASC", DdlEstatusOS.SelectedValue.ToEntero))
Dim TipoEstatus As String = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor(String.Format("TipoEstatus", "CveEstatusOrdenServicio = {0}", "CveEstatusOrdenServicio ASC", DdlEstatusOS.SelectedValue.ToEntero))
Select Case TipoEstatus.ToEntero
Case 1
@@ -1258,7 +1258,7 @@ Partial Class OS_OrdenesServicios
Dim Errores As Boolean = False
Dim EstatusOrdenServicio As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 1").ToEntero
Dim DirectorioEmpresa = UsuarioActual.Empresa.Ruta
Dim DirectorioEmpresa As String = UsuarioActual.Empresa.Ruta
If Not CveOS > 0 Then
@@ -1354,8 +1354,7 @@ Partial Class OS_OrdenesServicios
MensajeAlert.AppendFormat(String.Format("<br/>La Orden de Servicio: <b>{0}</b> se generó correctamente.<br/><br/>", ObjOrdenServicio.Folio))
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=OS&CVEOS={0}", ObjOrdenServicio.CveOS)))
Dim Liga = $"document.location.href=""/OS/RepOrdenesServicios.aspx"";"
Dim Liga As String = $"document.location.href=""/OS/RepOrdenesServicios.aspx"";"
ObjOrdenServicio.Commit()
@@ -1603,7 +1602,7 @@ Partial Class OS_OrdenesServicios
Protected Sub imgEstatus_Click(sender As Object, e As EventArgs)
Dim Row As GridViewRow = DirectCast(DirectCast(sender, Control).NamingContainer, GridViewRow)
Dim Estatus = TmpDT(Row.RowIndex)("Estatus").ToString
Dim Estatus As String = TmpDT(Row.RowIndex)("Estatus").ToString
If Estatus = "False" Then
TmpDT.Rows(Row.RowIndex)("Estatus") = "True"
@@ -1616,7 +1615,7 @@ Partial Class OS_OrdenesServicios
End Sub
Private Sub BtnAddGvDetalle_Click(sender As Object, e As EventArgs) Handles BtnAddGvDetalle.Click
Dim ObjOS As New ClsOS
Dim TieneError = False
Dim TieneError As Boolean = False
If CveCliente > 0 Then
If DdlPSDetalle.SelectedValue.ToEntero > 0 Then
@@ -2972,7 +2971,7 @@ Partial Class OS_OrdenesServicios
End Sub
Private Sub BtnCambiarTecnico_Click(sender As Object, e As EventArgs) Handles BtnCambiarTecnico.Click
Dim ObjOS As New ClsOS
Dim TieneError = False
Dim TieneError As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(151).ToString = "1" Then
If Not ObjOS.UpdateTecnicoOS(DdlTecnico.SelectedValue.ToEntero, CveOS) Then
@@ -3041,76 +3040,45 @@ Partial Class OS_OrdenesServicios
End Sub
Protected Sub LnkAccionesMaterialUtilizado_Click(sender As Object, e As EventArgs)
Protected Sub LnkAccionesDevolucion_Click(sender As Object, e As EventArgs)
LnkModalSolicitarDevolucion.Visible = True
GvSolicitarDevolucion.DataSource = Nothing
LnkModalMaterialUtilizado.Visible = True
GvMaterialUtilizado.DataSource = Nothing
DTSolicitudDev = New DataTable
Dim ObjOS As New ClsOS
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, CveVenta, UsuarioActual.CveEmpresa) Then
DTSolicitudDev = ObjOS.DtResultados
GvSolicitarDevolucion.DataSource = DTSolicitudDev
GvMaterialUtilizado.DataSource = DTSolicitudDev
GvMaterialUtilizado.Columns(3).Visible = DTSolicitudDev.MIN("Serie") <> ""
GvMaterialUtilizado.Columns(4).Visible = DTSolicitudDev.MIN("Lote") <> ""
GvMaterialUtilizado.Columns(5).Visible = DTSolicitudDev.MIN("FechaCaducidad") <> ""
End If
ObjOS.Dispose()
GvSolicitarDevolucion.DataBind()
GvMaterialUtilizado.DataBind()
Dim EsDevolucionVenta As Boolean = (DTSolicitudDev.FiltroPrimeroValor("EsDevolucionVenta", "").ToEntero > 0)
RegistraScript("$('#DVModalSolicitarDevolucion').modal();")
RegistraScript("$('#DivModalMaterialUtilizado').modal();")
If EsDevolucionVenta Then
Alert("Ya existe una solicitud de devolución", TipoMensaje.MsgAdvertencia)
LnkModalSolicitarDevolucion.Visible = False
Alert("En la orden de servicio ya se determinó el material utilizado.", TipoMensaje.MsgAdvertencia)
LnkModalMaterialUtilizado.Visible = False
End If
UpModalSolicitarDevolucion.Update()
UpModalMaterialUtilizado.Update()
End Sub
Protected Sub GvSolicitarDevolucion_RowDataBound(sender As Object, e As GridViewRowEventArgs)
Protected Sub GvMaterialUtilizado_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCTextBox("TxtDev").Attributes.Add("onblur", String.Format("ValidarCantidad(this, {0})", e.Row.DataKey("Cantidad")))
'AplicaSerie, AplicaLote, AplicaCaducidad
If Boolean.Parse(e.Row.DataKey("AplicaSerie")) Then
e.Row.FCTextBox("TxtSerie").Visible = True
End If
If Boolean.Parse(e.Row.DataKey("AplicaLote")) Then
e.Row.FCTextBox("TxtLote").Visible = True
End If
If Boolean.Parse(e.Row.DataKey("AplicaCaducidad")) Then
e.Row.FCHtmlGenericControl("DVFechaCaducidad").Visible = True
'e.Row.FCTextBox("TxtFechaCaducidad").Visible = True
'e.Row.FCMaskedEditExtender("METxtFechaCaducidad").Visible = True
'e.Row.FCCalendarExtender("CCTxtFechaCaducidad").Visible = True
'e.Row.FCCompareValidator("CVTxtFechaCaducidad").Visible = True
'e.Row.FCValidatorCalloutExtender("VCTxtFechaCaducidad").Visible = True
End If
End If
End Sub
Protected Sub LnkModalSolicitarDevolucion_Click(sender As Object, e As EventArgs)
Protected Sub LnkModalMaterialUtilizado_Click(sender As Object, e As EventArgs)
Dim CveAlmacenActual As Integer = DTSolicitudDev.FiltroPrimeroValor("CveAlmacenActual").ToEntero
Dim CveMoneda As Integer = DTSolicitudDev.FiltroPrimeroValor("CveMoneda").ToEntero
@@ -3125,82 +3093,72 @@ Partial Class OS_OrdenesServicios
End If
Dim SbErroresDev As New StringBuilder
For Each GvRow As GridViewRow In GvSolicitarDevolucion.Rows
For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
If GvRow.DataKey("Cantidad").ToDecimal > 0 Then
Dim sbTemperror As New StringBuilder
Dim ErrorCountDev As Integer = 0
'sbTemperror.Append($"Producto: {GvRow.DataKey("CodigoPS") } requiere: ")
'If Boolean.Parse(GvRow.DataKey("AplicaSerie")) Then
' If GvRow.FCTextBox("TxtSerie").Text.Trim = String.Empty Then
' sbTemperror.Append($" Serie, ")
' ErrorCountDev = ErrorCountDev + 1
' End If
'End If
sbTemperror.Append($"Producto: {GvRow.DataKey("CodigoPS") } requiere: ")
If Boolean.Parse(GvRow.DataKey("AplicaSerie")) Then
If GvRow.FCTextBox("TxtSerie").Text.Trim = String.Empty Then
sbTemperror.Append($" Serie, ")
ErrorCountDev = ErrorCountDev + 1
End If
End If
If Boolean.Parse(GvRow.DataKey("AplicaLote")) Then
If GvRow.FCTextBox("TxtLote").Text = String.Empty Then
sbTemperror.Append($" Lote, ")
ErrorCountDev = ErrorCountDev + 1
End If
End If
If Boolean.Parse(GvRow.DataKey("AplicaCaducidad")) Then
If Not IsDate(GvRow.FCTextBox("TxtFechaCaducidad").Text) Then
sbTemperror.Append($" Fecha de caducidad")
ErrorCountDev = ErrorCountDev + 1
End If
End If
If ErrorCountDev > 0 Then
sbTemperror.Append($"<br/>")
SbErroresDev.AppendLine(sbTemperror.ToString)
End If
'If Boolean.Parse(GvRow.DataKey("AplicaLote")) Then
' If GvRow.FCTextBox("TxtLote").Text = String.Empty Then
' sbTemperror.Append($" Lote, ")
' ErrorCountDev = ErrorCountDev + 1
' End If
'End If
'If Boolean.Parse(GvRow.DataKey("AplicaCaducidad")) Then
' If Not IsDate(GvRow.FCTextBox("TxtFechaCaducidad").Text) Then
' sbTemperror.Append($" Fecha de caducidad")
' ErrorCountDev = ErrorCountDev + 1
' End If
'End If
'If ErrorCountDev > 0 Then
' sbTemperror.Append($"<br/>")
' SbErroresDev.AppendLine(sbTemperror.ToString)
'End If
End If
Next
If SbErroresDev.ToString.Length > 0 Then
Alert($"Se encontraron los siguientes errores: <br> {SbErroresDev.ToString}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim PropcesoOK As Boolean = True
Dim ProcesoOK As Boolean = True
Dim ObjV As New ClsVentas
ObjV.IniciaTransacSQL()
If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVenta) Then
PropcesoOK = False
ProcesoOK = False
End If
If PropcesoOK Then
For Each GvRow As GridViewRow In GvSolicitarDevolucion.Rows
If ProcesoOK Then
For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
Dim CantidadDev As Decimal = GvRow.FCTextBox("TxtDev").Text.ToDecimal
If CantidadDev > 0 Then
If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
PropcesoOK = False
ProcesoOK = False
Exit For
End If
End If
Next
End If
If PropcesoOK Then
If ProcesoOK Then
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
@@ -3209,34 +3167,30 @@ Partial Class OS_OrdenesServicios
If CveMovimiento > 0 Then
For Each GvRow As GridViewRow In GvSolicitarDevolucion.Rows
For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal
Dim CantidadDev As Decimal = GvRow.FCTextBox("TxtDev").Text.ToDecimal
Dim CantidadRegistro = Cantidad - CantidadDev
Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtDev").Text.ToDecimal
Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
Dim CveUM As Integer = GvRow.DataKey("CveUM").ToEntero
Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal
Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
Dim CveMovimientoDetalle As Integer = GvRow.DataKey("CveMovimientoDetalle").ToEntero
Dim Lote As String = GvRow.FCTextBox("TxtLote").Text.Trim
Dim Serie As String = GvRow.FCTextBox("TxtSerie").Text.Trim
Dim FechaCaducidad As DateTime = GvRow.FCTextBox("TxtFechaCaducidad").Text.ToDate
Dim Serie As String = GvRow.DataKey("Serie")
Dim Lote As String = GvRow.DataKey("Lote")
Dim FechaCaducidad As DateTime = GvRow.DataKey("FechaCaducidad").ToDate
If CantidadRegistro > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadRegistro, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
PropcesoOK = False
ProcesoOK = False
Exit For
End If
End If
Next
If PropcesoOK Then
If ProcesoOK Then
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, CveMoneda, ClsPaginas.NowADS(), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaPedido, CveSubProyectoPedido, -1, CveOS:=CveOS, CveMovimientoRelacionado:=CveMovimiento)
@@ -3257,48 +3211,36 @@ Partial Class OS_OrdenesServicios
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
PropcesoOK = False
ProcesoOK = False
Exit For
End If
Next
If PropcesoOK Then
If ProcesoOK Then
Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL)
Dim LigaVenta As String = String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimiento, Folio, "Material utilizado")
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaPedido, CveOS:=CveOS) Then
PropcesoOK = False
ProcesoOK = False
End If
End If
Else
PropcesoOK = False
ProcesoOK = False
End If
End If
Else
PropcesoOK = False
Else
ProcesoOK = False
End If
End If
If PropcesoOK Then
If ProcesoOK Then
'ObjV.RollBack()
ObjV.Commit()
Alert("La solicitud de Devolución de Almacén se guardó correctamente")
RegistraScript("$('#DVModalSolicitarDevolucion').modal('hide');")
Alert("El material utilizado se guardó correctamente")
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
Else
ObjV.RollBack()
End If
ObjV.Dispose()
End Sub