-- cmbios de material utilizado
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user