diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index 35dfa7999..f5f94aaee 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -34,22 +34,19 @@ Public Class CalendarEvent Public Property NomprePersonal As String Public Property NombreAcercamiento As String Public Property CvePersonal As Integer + Public Property CvePersonal2 As Integer Public Property CveCliente As Integer Public Property CveProveedor As Integer Public Property CveOS As Integer Public Property CveOSDetalle As Integer Public Property CveUsuarioAtendio As Integer - Public Property CveSubProyectoUsuarioAtendio As Integer - Public Property CveCompra As Integer Public Property SerieFolioCompra As String - Public Property CveVenta As Integer Public Property SerieFolioVenta As String Public Property CveActivoFijo As Integer Public Property AFCodigo As String - Public Property CveMovimiento As Integer Public Property MovimientoFolio As String Public Property CveIE As Integer @@ -57,7 +54,7 @@ Public Class CalendarEvent Public Property Pesos As Double Public Property Dolares As Double Public Property Anticipo As Double - - + Public Property CantidadPasajeros As String + Public Property NumeroContrato As String End Class diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index e4535dd69..142209d07 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -91,6 +91,7 @@ Public Class ClsAF Public Property CveTipoServicio As Integer Public Property CveOrdenTrabajo As Integer Public Property FolioOT As Integer + Public Property CveHorometroDiario As Integer #End Region @@ -3478,97 +3479,97 @@ Public Class ClsAF #Region "TIPO SERVICIO" - Public Function GetTiposServicios(CveTipoServicio As Integer, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + 'Public Function GetTiposServicios(CveTipoServicio As Integer, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_TiposServicioGet") + ' DataAdapter("PA_AF_TiposServicioGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function - Public Function AddTiposServicios(Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - CveTipoServicio = -1 - DataAdapter("PA_AF_TiposServicioAdd") + 'Public Function AddTiposServicios(Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' CveTipoServicio = -1 + ' DataAdapter("PA_AF_TiposServicioAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre - .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveTipoServicio", SqlDbType.Int).Direction = ParameterDirection.Output + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + ' .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveTipoServicio", SqlDbType.Int).Direction = ParameterDirection.Output - End With + ' End With - Try - SqlAdapter.Fill(Data) + ' Try + ' SqlAdapter.Fill(Data) - CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero + ' CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al agregar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function - Public Function UpdateTiposServicios(CveTipoServicio As Integer, Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + 'Public Function UpdateTiposServicios(CveTipoServicio As Integer, Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_TiposServicioUpdate") + ' DataAdapter("PA_AF_TiposServicioUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre - .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + ' .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al actualizar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function - Public Function DeleteTiposServicios(CveTipoServicio As Integer) As Boolean - Dim Retorno As Boolean = False + 'Public Function DeleteTiposServicios(CveTipoServicio As Integer) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_TiposServicioDelete") + ' DataAdapter("PA_AF_TiposServicioDelete") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al eliminar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function Public Function GetTiposServiciosActividades(CveTipoServicioActividad As Integer, CveTipoServicio As Integer, CveActividad As Integer) As Boolean @@ -3766,7 +3767,7 @@ Public Class ClsAF Return Retorno End Function - Public Function GetActividades(CveActividad As Integer, CvePuesto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Public Function GetActividades(CveActividad As Integer, CvePuesto As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional Op As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_ActividadesGet") @@ -4089,87 +4090,87 @@ Public Class ClsAF Return Retorno End Function - Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + 'Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_CheckListGet") + ' DataAdapter("PA_AF_CheckListGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function - Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean - Dim Retorno As Boolean = False + 'Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_CheckListAdd") + ' DataAdapter("PA_AF_CheckListAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function - Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean - Dim Retorno As Boolean = False + 'Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_CheckListUpdate") + ' DataAdapter("PA_AF_CheckListUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList - .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio - .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function - Public Function DeleteCheckList(CveCheckList As Integer) As Boolean - Dim Retorno As Boolean = False + 'Public Function DeleteCheckList(CveCheckList As Integer) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_CheckListDelete") + ' DataAdapter("PA_AF_CheckListDelete") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function @@ -4371,138 +4372,138 @@ Public Class ClsAF End Function - Public Function GetOrdenesTrabajoMateriales(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + 'Public Function GetOrdenesTrabajoMateriales(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_OrdenesTrabajoMaterialesGet") + ' DataAdapter("PA_AF_OrdenesTrabajoMaterialesGet") - With SqlAdapter.SelectCommand.Parameters + ' With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' End With - Try - SqlAdapter.Fill(Data) + ' Try + ' SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los materiales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener los materiales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno + ' Return Retorno - End Function + 'End Function - Public Function GetOrdenesTrabajoActividades(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + 'Public Function GetOrdenesTrabajoActividades(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_OrdenesTrabajoActividadesGet") + ' DataAdapter("PA_AF_OrdenesTrabajoActividadesGet") - With SqlAdapter.SelectCommand.Parameters + ' With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' End With - Try - SqlAdapter.Fill(Data) + ' Try + ' SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno + ' Return Retorno - End Function + 'End Function - Public Function UpdateOrdenesTrabajoActividades(CveOrdenTrabajoActividad As Integer, Valor As String, Terminado As Integer, Observaciones As String, CveEmpresa As Integer) As Boolean + 'Public Function UpdateOrdenesTrabajoActividades(CveOrdenTrabajoActividad As Integer, Valor As String, Terminado As Integer, Observaciones As String, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_OrdenesTrabajoActividadesUpdate") + ' DataAdapter("PA_AF_OrdenesTrabajoActividadesUpdate") - With SqlAdapter.SelectCommand.Parameters + ' With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajoActividad", SqlDbType.Int).Value = CveOrdenTrabajoActividad - .Add("@Valor", SqlDbType.VarChar).Value = Valor - .Add("@Terminado", SqlDbType.Int).Value = Terminado - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveOrdenTrabajoActividad", SqlDbType.Int).Value = CveOrdenTrabajoActividad + ' .Add("@Valor", SqlDbType.VarChar).Value = Valor + ' .Add("@Terminado", SqlDbType.Int).Value = Terminado + ' .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' End With - Try - SqlAdapter.Fill(Data) + ' Try + ' SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al actualizar las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno + ' Return Retorno - End Function + 'End Function - Public Function GetOrdenesTrabajoCheckList(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + 'Public Function GetOrdenesTrabajoCheckList(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_OrdenesTrabajoCheckListGet") + ' DataAdapter("PA_AF_OrdenesTrabajoCheckListGet") - With SqlAdapter.SelectCommand.Parameters + ' With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' End With - Try - SqlAdapter.Fill(Data) + ' Try + ' SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno + ' Return Retorno - End Function + 'End Function - Public Function UpdateOrdenesTrabajoCheckList(CveOrdenTrabajoCheckList As Integer, Valor As String, Terminado As Integer, Observaciones As String, Estatus As Integer, CveEmpresa As Integer) As Boolean + 'Public Function UpdateOrdenesTrabajoCheckList(CveOrdenTrabajoCheckList As Integer, Valor As String, Terminado As Integer, Observaciones As String, Estatus As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + ' Dim Retorno As Boolean = False - DataAdapter("PA_AF_OrdenesTrabajoCheckListUpdate") + ' DataAdapter("PA_AF_OrdenesTrabajoCheckListUpdate") - With SqlAdapter.SelectCommand.Parameters + ' With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenTrabajoCheckList", SqlDbType.Int).Value = CveOrdenTrabajoCheckList - .Add("@Valor", SqlDbType.VarChar).Value = Valor - .Add("@Terminado", SqlDbType.Int).Value = Terminado - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveOrdenTrabajoCheckList", SqlDbType.Int).Value = CveOrdenTrabajoCheckList + ' .Add("@Valor", SqlDbType.VarChar).Value = Valor + ' .Add("@Terminado", SqlDbType.Int).Value = Terminado + ' .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + ' .Add("@Estatus", SqlDbType.Int).Value = Estatus + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With + ' End With - Try - SqlAdapter.Fill(Data) + ' Try + ' SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al actualizar el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try - Return Retorno + ' Return Retorno - End Function + 'End Function #End Region @@ -4842,6 +4843,1822 @@ Public Class ClsAF +#Region "MQ" + + + Public Function GetActividades(CveActividad As Integer, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddActividades(Actividad As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Actividad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActividades(CveActividad As Integer, Actividad As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Nombre", SqlDbType.VarChar).Value = Actividad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteActividades(CveActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + + + Public Function GetTiposOT(CveOrdenTrabajoTipo As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposOT(OrdenTrabajoTipo As String, CveUsuario As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@OrdenTrabajoTipo", SqlDbType.VarChar).Value = OrdenTrabajoTipo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposOT(CveOrdenTrabajoTipo As Integer, OrdenTrabajoTipo As String, CveUsuario As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@OrdenTrabajoTipo", SqlDbType.VarChar).Value = OrdenTrabajoTipo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposOT(CveOrdenTrabajoTipo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetActividadesOT(CveActividadOT As Integer, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddActividadesOT(ActividadOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, CvePuesto As Integer, Horas As Decimal) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@ActividadOT", SqlDbType.NVarChar).Value = ActividadOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Horas", SqlDbType.Money).Value = Horas + '.Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActividadesOT(CveActividadOT As Integer, ActividadOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, CvePuesto As Integer, Horas As Decimal) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@ActividadOT", SqlDbType.VarChar).Value = ActividadOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Horas", SqlDbType.Money).Value = Horas + '.Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteActividadesOT(CveActividadOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + Public Function GetEstatusOT(CveEstatusOT As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Etapas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddEstatusOT(EstatusOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EstatusOT", SqlDbType.VarChar).Value = EstatusOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la Etapa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateEstatusOT(CveEstatusOT As Integer, EstatusOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@EstatusOT", SqlDbType.VarChar).Value = EstatusOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Etapa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeletEstatusOT(CveEstatusOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la etapa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + Public Function GetCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividadGrupo(CheckListActividadGrupo As String, CveEmpresa As Integer, Estatus As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividadGrupo", SqlDbType.VarChar).Value = CheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CheckListActividadGrupo As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividad(CheckListActividad As String, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividad(CveCheckListActividad As Integer, CheckListActividad As String, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividad(CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetHerramientasOT(CveHerramientaOT As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddHerramientasOT(HerramientaOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@HerramientaOT", SqlDbType.VarChar).Value = HerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateHerramientasOT(CveHerramientaOT As Integer, HerramientaOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHerramientaOT", SqlDbType.NVarChar).Value = CveHerramientaOT + .Add("@HerramientaOT", SqlDbType.VarChar).Value = HerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteHerramientasOT(CveHerramientaOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetSubContratacionOT(CveSubContratacion As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Sub Contrataciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddSubContratacionOT(SubContratacion As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@SubContratacion", SqlDbType.VarChar).Value = SubContratacion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateSubContratacionOT(CveSubContratacion As Integer, SubContratacion As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@SubContratacion", SqlDbType.VarChar).Value = SubContratacion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveSubContratacionOT(CveSubContratacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + 'Public Function GetTiposServicios(CveTipoServicio As Integer, CveOrdenTrabajoTipo As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_AF_TiposServicioGet") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + + 'Public Function AddTiposServicios(Nombre As String, CveOrdenTrabajoTipo As Integer, Duracion As Decimal, CveUsuario As Integer, CveEmpresa As Integer, CveModeloActivoFijo As Integer, HorasServicio As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' CveTipoServicio = -1 + ' DataAdapter("PA_AF_TiposServicioAdd") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + ' .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + ' .Add("@Duracion", SqlDbType.Money).Value = Duracion + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo + ' .Add("@HorasServicio", SqlDbType.Int).Value = HorasServicio + ' .Add("@CveTipoServicio", SqlDbType.Int).Direction = ParameterDirection.Output + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + + ' CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero + + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al agregar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + + 'Public Function UpdateTiposServicios(CveTipoServicio As Integer, Nombre As String, CveOrdenTrabajoTipo As Integer, Duracion As Decimal, CveUsuario As Integer, CveEmpresa As Integer, CveModeloActivoFijo As Integer, HorasServicio As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_AF_TiposServicioUpdate") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + ' .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + ' .Add("@Duracion", SqlDbType.Money).Value = Duracion + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@HorasServicio", SqlDbType.Int).Value = HorasServicio + ' .Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al actualizar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + + 'Public Function DeleteTiposServicios(CveTipoServicio As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_AF_TiposServicioDelete") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al eliminar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + + + Public Function GetTiposServicios(CveTipoServicio As Integer, CveOrdenTrabajoTipo As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposServicios(Nombre As String, CveOrdenTrabajoTipo As Integer, Duracion As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + CveTipoServicio = -1 + DataAdapter("PA_AF_TiposServicioAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@Duracion", SqlDbType.Money).Value = Duracion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveTipoServicio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + + CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposServicios(CveTipoServicio As Integer, Nombre As String, CveOrdenTrabajoTipo As Integer, Duracion As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@Duracion", SqlDbType.Money).Value = Duracion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposServicios(CveTipoServicio As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetTiposServiciosHerramientasOT(CveTipoServicio As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposServiciosHerramientasOT(CveTipoServicio As Integer, CveHerramientaOT As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposServiciosHerramientasOT(CveTipoServicioHerramientaOT As Integer, CveTipoServicio As Integer, CveHerramientaOT As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioHerramientaOT", SqlDbType.Int).Value = CveTipoServicioHerramientaOT + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposServiciosHerramientasOT(CveTipoServicioHerramientaOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioHerramientaOT", SqlDbType.Int).Value = CveTipoServicioHerramientaOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + Public Function GetTipoServicioSubContratacionOT(CveTipoServicio As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Sub Contrataciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTipoServicioSubContratacionOT(CveTipoServicio As Integer, CveSubContratacion As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.VarChar).Value = CveTipoServicio + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTipoServicioSubContratacionOT(CveTipoServicioSubContratacion As Integer, CveTipoServicio As Integer, CveSubContratacion As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioSubContratacion", SqlDbType.Int).Value = CveTipoServicioSubContratacion + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveTipoServicioSubContratacionOT(CveTipoServicioSubContratacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioSubContratacion", SqlDbType.Int).Value = CveTipoServicioSubContratacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckList(CveCheckList As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + + Public Function GetOperador(CveOperador As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los operadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddOperador(Operador As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Operador", SqlDbType.VarChar).Value = Operador + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el operador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateOperador(CveOperador As Integer, Operador As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@Operador", SqlDbType.VarChar).Value = Operador + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el operador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveOperador(CveOperador As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el operador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + '''Horometro diario + Public Function GetHorometroDiario(FechaI As Date, FechaF As Date, CveHorometroDiario As Integer, CveActivoFijo As Integer, CveOperador As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los operadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + Public Function AddHorometroDiario(CveActivoFijo As Integer, CveOperador As Integer, CveSubProyecto As Integer, Fecha As Date, Entrada As Decimal, Salida As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + CveHorometroDiario = -1 + + DataAdapter("PA_AF_HorometroDiarioAdd") + + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Entrada", SqlDbType.Money).Value = Entrada + .Add("@Salida", SqlDbType.Money).Value = Salida + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveHorometroDiario", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + CveHorometroDiario = SqlAdapter.SelectCommand.Parameters("@CveHorometroDiario").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Horometro Diario", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateHorometroDiario(CveHorometroDiario As Integer, CveActivoFijo As Integer, CveOperador As Integer, CveSubProyecto As Integer, Fecha As Date, Entrada As Decimal, Salida As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Entrada", SqlDbType.Money).Value = Entrada + .Add("@Salida", SqlDbType.Money).Value = Salida + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Horometro Diario", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveHorometroDiario(CveOperador As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Horometro Diario", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + '''Horometro diario detalle + Public Function GetHorometroDiarioDetalleDetalle(CveHorometroDiario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddHorometroDiarioDetalle(CveHorometroDiario As Integer, CveActividad As Integer, Horas As Decimal) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleAdd") + + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Horas", SqlDbType.Money).Value = Horas + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateHorometroDiarioDetalle(CveHorometroDiarioDetalle As Integer, CveHorometroDiario As Integer, CveActividad As Integer, Horas As Decimal) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleUpdate") + + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveHorometroDiarioDetalle", SqlDbType.Int).Value = CveHorometroDiarioDetalle + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Horas", SqlDbType.Money).Value = Horas + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveHorometroDiarioDetalle(CveHorometroDiarioDetalle As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHorometroDiarioDetalle", SqlDbType.Int).Value = CveHorometroDiarioDetalle + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + Public Function GetOrdenesTrabajo(CveOrdenTrabajo As Integer, CveTipoServicio As Integer, Folio As Integer, CveAF As Integer, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer, CveOperador As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + '.Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar las ordenes de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function AddOrdenesTrabajo(CveTipoServicio As Integer, CveAF As Integer, Servicio As String, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer, CveOperador As Integer, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + '.Add("@Servicio", SqlDbType.VarChar).Value = Servicio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output + + End With + + Try + SqlAdapter.Fill(Data) + + CveOrdenTrabajo = SqlAdapter.SelectCommand.Parameters("@CveOrdenTrabajo").Value.ToString.ToEntero + FolioOT = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function UpdateOrdenesTrabajo(CveOrdenTrabajo As Integer, CveTipoServicio As Integer, CveAF As Integer, Servicio As String, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer, CveOperador As Integer, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoUpdate") + + With SqlAdapter.SelectCommand.Parameters + + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Servicio", SqlDbType.VarChar).Value = Servicio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + + + + + + Public Function GetOrdenesTrabajoMateriales(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoMaterialesGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los materiales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetOrdenesTrabajoActividades(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoActividadesGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetOrdenesTrabajoCheckList(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoCheckListGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function GetOrdenesTrabajoHerramientas(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoHerramientasGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function GetOrdenesTrabajoSubContrataciones(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoSubContratacionesGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + + Public Function UpdateOrdenesTrabajoActividades(CveOrdenTrabajoActividad As Integer, Valor As String, Terminado As Integer, Observaciones As String, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajoActividad", SqlDbType.Int).Value = CveOrdenTrabajoActividad + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@Terminado", SqlDbType.Int).Value = Terminado + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + Public Function UpdateOrdenesTrabajoCheckList(CveOrdenTrabajoCheckList As Integer, Valor As String, Terminado As Integer, Observaciones As String, Estatus As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoCheckListUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajoCheckList", SqlDbType.Int).Value = CveOrdenTrabajoCheckList + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@Terminado", SqlDbType.Int).Value = Terminado + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetOrdenesTrabajoAF(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoAFGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los activos Fijos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + '******************************************************************************************************************************************** + +#End Region + #Region " IDisposable Support " ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 54fe23b28..bd5384c25 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -890,6 +890,32 @@ Public Class ClsClientes ' Return Retorno 'End Function + Public Function UpdateClienteFranquicia(CveCliente As Integer, CveEmpresaActual As Integer, CveEmpresaFranquicia As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_ClientesFranquiciaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveEmpresaActual", SqlDbType.Int).Value = CveEmpresaActual + .Add("@CveEmpresaFranquicia", SqlDbType.Int).Value = CveEmpresaFranquicia + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("El Cliente no se guardo debido a que actualmente se encuentra registrado", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al intentar Actualizar los datos del Cliente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al intentar Actualizar los datos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function UpdateClientePersonaFisica(CveCliente As Integer, ApellidoPaterno As String, ApellidoMaterno As String, Nombres As String) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index c56dffb17..bc3794d36 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -38,7 +38,6 @@ Public Class ClsContratos Public Property NumeroEstimacionNueva As Integer Public Property CveEstimacionNueva As Integer - Public Property CveChofer As Integer @@ -135,7 +134,6 @@ Public Class ClsContratos Public Property NumeroLicitacion As String Public Property Observaciones As String Public Property CveDireccionEnvio As Integer - Public Property CveProveedor As Integer Public Property RazonSocial As String Public Property CveCliente As Integer @@ -186,11 +184,16 @@ Public Class ClsContratos Public Property AplicaImpuestosLocales As Boolean Public Property CveEstimacionActual As Integer Public Property NumeroEstimacionActual As Integer - - - - - + 'Viajes + Public Property CveTipoAF As Integer + Public Property CveChofer As Integer + Public Property CveChofer2 As Integer + Public Property CveAF As Integer + Public Property CantidadPasajeros As Integer + Public Property CveRuta As Integer + Public Property CvePartida As Integer + Public Property CveDestino As Integer + Public Property CveMasivo As Integer #End Region #Region " C O N T R A T O S " @@ -227,8 +230,7 @@ Public Class ClsContratos End Try Return Retorno - End Function - + End Function Public Function GetContratos(CveContrato As Integer, CveEmpresa As Integer, Optional CveCliente As Integer = -1, Optional CveEstatus As Integer = -1, Optional TipoEstatus As Integer = -1, Optional TipoContrato As Integer = -1, Optional EstatusFianza As Integer = -1, Optional CveVendedor As Integer = -1) As Boolean @@ -299,30 +301,37 @@ Public Class ClsContratos Me.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero Me.ImporteTotal = Data.Rows(0)("ImporteTotal").ToString.ToDecimal Me.Lugar = Data.Rows(0)("Lugar").ToString - Me.LimiteDeGasto = Data.Rows(0)("LimiteDeGasto").ToString.ToDouble - CveChofer = Data.Rows(0)("CveChofer").ToString.ToEntero - + Me.LimiteDeGasto = Data.Rows(0)("LimiteDeGasto").ToString.ToDouble Observaciones = Data.Rows(0)("Observaciones").ToString CveDireccionEnvio = Data.Rows(0)("CveDireccionEnvio").ToString.ToEntero AplicaImpuestosLocales = CBool(Data.Rows(0)("AplicaImpuestosLocales")) + 'Viajes + Me.CveTipoAF = Data.Rows(0)("CveTipoAF").ToString.ToEntero + Me.CveChofer = Data.Rows(0)("CveChofer").ToString.ToEntero + Me.CveChofer2 = Data.Rows(0)("CveChofer2").ToString.ToEntero + Me.CveAF = Data.Rows(0)("CveAF").ToString.ToEntero + Me.CantidadPasajeros = Data.Rows(0)("CantidadPasajeros").ToString.ToEntero + Me.CveRuta = Data.Rows(0)("CveRuta").ToString.ToEntero + Me.CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero + Me.CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero + Me.CveMasivo = Data.Rows(0)("CveMasivo").ToString.ToEntero - End If + End If Retorno = True Catch ex As Exception OnError("Ocurrió un error al obtener el Catálogo de Contratos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - - Public Function AddContratos(NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime, - Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, - Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, - Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, - Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, - Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", - Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "", - Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional CveAF As Integer = -1, Optional CantidadPasajeros As Integer = -1) As Integer + End Function + Public Function AddContratos(NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime, + Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, + Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, + Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, + Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, + Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", + Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "", + Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CveRuta As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Con_ContratosAdd") @@ -378,11 +387,16 @@ Public Class ClsContratos .Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales - .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF - .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + 'Viajes + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + .Add("@CveChofer2", SqlDbType.Int).Value = CveChofer2 .Add("@CveAF", SqlDbType.Int).Value = CveAF .Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros - + .Add("@CveRuta", SqlDbType.Int).Value = CveRuta + .Add("@CvePartida", SqlDbType.Int).Value = CvePartida + .Add("@CveDestino", SqlDbType.Int).Value = CveDestino + .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo End With Try @@ -400,14 +414,13 @@ Public Class ClsContratos Return Retorno End Function - Public Function UpdateContratos(CveContrato As Integer, NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime, Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, - Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional EstatusContrato As Integer = -1, Optional CveAF As Integer = -1) As Boolean + Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CveRuta As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_ContratosUpdate") @@ -462,12 +475,17 @@ Public Class ClsContratos .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales - .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + 'Viajes + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF .Add("@CveChofer", SqlDbType.Int).Value = CveChofer - .Add("@EstatusContrato", SqlDbType.Int).Value = EstatusContrato + .Add("@CveChofer2", SqlDbType.Int).Value = CveChofer2 .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros + .Add("@CveRuta", SqlDbType.Int).Value = CveRuta + .Add("@CvePartida", SqlDbType.Int).Value = CvePartida + .Add("@CveDestino", SqlDbType.Int).Value = CveDestino + .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo End With - Try SqlAdapter.Fill(Data) Retorno = True diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 365eecdb7..c16b91bb9 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10376,6 +10376,25 @@ Public Class ClsPaginas PaginaDict.Add("/MF/CargaLayout.aspx".ToUpper(), 863) PaginaDict.Add("/MF/RepConsumoCombustible.aspx".ToUpper(), 864) #End Region +#Region "MQ" + PaginaDict.Add("/MQ/CatActividades.aspx".ToUpper, 1401) + PaginaDict.Add("/MQ/ContratosMaquinariaRentada.aspx".ToUpper, 1402) + PaginaDict.Add("/MQ/CatOrdenesTrabajoTipos.aspx".ToUpper, 1403) + PaginaDict.Add("/MQ/CatActividadesOT.aspx".ToUpper, 1404) + PaginaDict.Add("/MQ/CatCheckListActividadesGrupos.aspx".ToUpper, 1405) + PaginaDict.Add("/MQ/CatCheckListActividades.aspx".ToUpper, 1406) + PaginaDict.Add("/MQ/CatEstatusOT.aspx".ToUpper, 1407) + PaginaDict.Add("/MQ/CatHerramientasOT.aspx".ToUpper, 1408) + PaginaDict.Add("/MQ/SubContrataciones.aspx".ToUpper, 1409) + PaginaDict.Add("/MQ/CatTipoOrdenTrabajo.aspx".ToUpper, 1410) + PaginaDict.Add("/MQ/CatOperadores.aspx".ToUpper, 1411) + PaginaDict.Add("/MQ/OrdenTrabajo.aspx".ToUpper, 1412) + PaginaDict.Add("/MQ/CatOrdenTrabajo.aspx".ToUpper, 1413) + PaginaDict.Add("/MQ/HorometroDiario.aspx".ToUpper, 1414) + + PaginaDict.Add("/MQ/TipoOrdenTrabajo.aspx".ToUpper, -1) +#End Region + #Region "Nomina" PaginaDict.Add("/Nomina/Calculo.aspx".ToUpper(), -1) PaginaDict.Add("/Nomina/SobreRecibo.aspx".ToUpper(), -1) @@ -10812,7 +10831,7 @@ Public Class ClsPaginas #Region "Transportes" PaginaDict.Add("/Transportes/RepContratos.aspx".ToUpper(), 598) - PaginaDict.Add("/Transportes/RepContratosDetalles.aspx".ToUpper(), 598) + PaginaDict.Add("/Transportes/RepContratoDetalle.aspx".ToUpper(), 598) PaginaDict.Add("/Transportes/RepViajes.aspx".ToUpper(), 599) PaginaDict.Add("/Transportes/Boletos.aspx".ToUpper(), 600) PaginaDict.Add("/Transportes/RepBoletos.aspx".ToUpper(), 601) diff --git a/App_Code/ClsTransportes.vb b/App_Code/ClsTransportes.vb index 612d9f694..a5e09b0c2 100644 --- a/App_Code/ClsTransportes.vb +++ b/App_Code/ClsTransportes.vb @@ -134,113 +134,6 @@ Public Class ClsTransportes End Sub #End Region -#Region "Viajes" - Public Function AddViajes(CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime, CvePartida As Integer, CveDestino As Integer, Optional IsMasivo As Boolean = False, Optional CveMasivo As Integer = -1) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_Trans_ViajesAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveViaje", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@CveRuta", SqlDbType.Int).Value = CveRuta - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Fecha", SqlDbType.DateTime).Value = Fecha - .Add("@CvePartida", SqlDbType.Int).Value = CvePartida - .Add("@CveDestino", SqlDbType.Int).Value = CveDestino - .Add("@IsMasivo", SqlDbType.Bit).Value = IsMasivo - .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViaje").Value.ToString) - - Catch ex As Exception - OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function GetViajes(CveViaje As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Trans_ViajesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveViaje", SqlDbType.Int).Value = CveViaje - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - If CveViaje > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then - CveRuta = Data.Rows(0)("CveRuta").ToString.ToEntero - CveAF = Data.Rows(0)("CveAF").ToString.ToEntero - CvePersonal = Data.Rows(0)("CvePersonal").ToString.ToEntero - CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero - CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero - CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero - CveMasivo = Data.Rows(0)("CveMasivo").ToString.ToEntero - Fecha = Data.Rows(0)("Fecha").ToString.ToDate - Ruta = Data.Rows(0)("Ruta").ToString - Me.CveViaje = Data.Rows(0)("CveViaje").ToString.ToEntero - End If - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el catálogo de viajes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function RemoveViaje(Optional CveViaje As Integer = -1, Optional CveMasivo As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - - DataAdapter("PA_Trans_ViajesRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveViaje", SqlDbType.Int).Value = CveViaje - .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateViajes(CveViaje As Integer, CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime, CvePartida As Integer, CveDestino As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Trans_ViajesUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveViaje", SqlDbType.Int).Value = CveViaje - .Add("@CveRuta", SqlDbType.Int).Value = CveRuta - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@CvePartida", SqlDbType.Int).Value = CvePartida - .Add("@CveDestino", SqlDbType.Int).Value = CveDestino - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el Contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - #Region "Boletos" Public Function AddViajesPasajeros(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer, CveVendedor As Integer) As Integer Dim Retorno As Integer = -1 diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 6f7c546d5..dec991bdb 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -2052,7 +2052,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1) As Integer + Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1, Optional UpdateFranquicia As Boolean = False) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Vta_PrecioListaAdd") @@ -2064,6 +2064,7 @@ Public Class ClsVentas .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje .Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada .Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar + .Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia .Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -2084,7 +2085,7 @@ Public Class ClsVentas End Function Public Function UpdatePrecioLista(PrecioLista As String, Estatus As Boolean, CveUsuario As Integer, Porcentaje As Double, - Predeterminada As Boolean, CvePrecioLista As Integer) As Boolean + Predeterminada As Boolean, CvePrecioLista As Integer, Optional UpdateFranquicia As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PrecioListaUpdate") @@ -2096,6 +2097,7 @@ Public Class ClsVentas .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje .Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia End With Try diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index 84be4f7ec..0513bd853 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -449,7 +449,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState - If ObjContratos.GetContratos(-1, usuarioActual_.CveEmpresa, TipoContrato:=2) Then + If ObjContratos.GetContratos(-1, usuarioActual_.CveEmpresa, TipoContrato:=34) Then If ObjContratos.DtResultados.Rows.Count > 0 Then @@ -465,14 +465,15 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.NombreAcercamiento = dr("Ubicacion").ToString cevent.CveCliente = dr("CveCliente").ToString.ToEntero cevent.CvePersonal = dr("CveChofer").ToString.ToEntero + cevent.CvePersonal2 = dr("CveChofer2").ToString.ToEntero + cevent.CveEventoEstatus = dr("CveContratosEstatus").ToString.ToEntero cevent.Dolares = dr("Importe").ToString.ToDecimal cevent.Pesos = dr("ImporteMax").ToString.ToDecimal cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero cevent.backgroundColor = dr("BackgroundColor").ToString - - - + cevent.CantidadPasajeros = dr("CantidadPasajeros").ToString + cevent.NumeroContrato = dr("NumeroContrato").ToString If Not cevent.recurrenciatipo > 0 Then diff --git a/MQ/CatActividades.aspx b/MQ/CatActividades.aspx new file mode 100644 index 000000000..8512cf848 --- /dev/null +++ b/MQ/CatActividades.aspx @@ -0,0 +1,102 @@ +<%@ Page Title="AF - Catálogo de Actividades" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatActividades.aspx.cs" Inherits="AF_CatActividades" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Actividadedes + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MQ/CatActividades.aspx.cs b/MQ/CatActividades.aspx.cs new file mode 100644 index 000000000..058388ad3 --- /dev/null +++ b/MQ/CatActividades.aspx.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatActividades : ClsPaginas +{ + private int CveActividad + { + get + { + return ViewState["CveActividad"].ToString().ToEntero(); + } + + set + { + ViewState["CveActividad"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetActividades(-1, -1, UsuarioActual.CveEmpresa,-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadD_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Agregar"; + TxtNombre.Text = ""; + + LtlTituloModalActividad.Text = "Agregar Actividad"; + ChkEstatus.Checked = true; + CheckActiveSection.Visible = false; + + UpModalTiposD.Update(); + + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividad = GvRow.DataKey("CveActividad").ToEntero(); + TxtNombre.Text = GvRow.DataKey("Nombre"); + + ChkEstatus.Checked = GvRow.DataKey("Estatus").ToEntero() == 1 ? true : false; + CheckActiveSection.Visible = true; + + UpModalTiposD.Update(); + + LtlTituloModalActividad.Text = "Actualizar Actividad"; + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividad = GvRow.DataKey("CveActividad").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteActividades(CveActividad, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se eliminó la Actividad correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividad_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + + int Estatus = ChkEstatus.Checked ? 1 : 0; + + if (BtnAgregarActividad.Text == "Agregar") + { + if (ObjAF.AddActividades(TxtNombre.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,Estatus)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se agregó la Actividad correctamente"); + } + } + else + { + if (ObjAF.UpdateActividades(CveActividad,TxtNombre.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,Estatus)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se actualizó la Actividad correctamente"); + } + } + ObjAF.Dispose(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + } +} \ No newline at end of file diff --git a/MQ/CatActividadesOT.aspx b/MQ/CatActividadesOT.aspx new file mode 100644 index 000000000..73571bef7 --- /dev/null +++ b/MQ/CatActividadesOT.aspx @@ -0,0 +1,105 @@ +<%@ Page Title="AF - Catálogo de Actividades" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatActividadesOT.aspx.cs" Inherits="AF_CatActividadesOT" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Actividades Ordenes de Trabajo + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MQ/CatActividadesOT.aspx.cs b/MQ/CatActividadesOT.aspx.cs new file mode 100644 index 000000000..98152e4a3 --- /dev/null +++ b/MQ/CatActividadesOT.aspx.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatActividadesOT : ClsPaginas +{ + private int CveActividadOT + { + get + { + return ViewState["CveActividadOT"].ToString().ToEntero(); + } + + set + { + ViewState["CveActividadOT"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + + ClsRH objRH = new ClsRH(); + + if (objRH.GetPuestos(UsuarioActual.CveEmpresa)) + { + DdlPuesto.DataSource = objRH.DtResultados; + } + else { + DdlPuesto.DataSource = null; + } + + + DdlPuesto.DataBind(); + DdlPuesto.Items.Insert(0, new ListItem("Seleccione uno", "-1")); + + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetActividadesOT(-1, -1, UsuarioActual.CveEmpresa,-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadD_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Agregar"; + TxtNombre.Text = ""; + + LtlTituloModalActividad.Text = "Agregar Actividad"; + ChkEstatus.Checked = true; + CheckActiveSection.Visible = false; + + DdlPuesto.SelectedValueExist(-1); ; + TxtHoras.Text = "0"; + + + + UpModalTiposD.Update(); + + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividadOT = GvRow.DataKey("CveActividadOT").ToEntero(); + TxtNombre.Text = GvRow.DataKey("ActividadOT"); + + ChkEstatus.Checked = GvRow.DataKey("Estatus").ToEntero() == 1 ? true : false; + CheckActiveSection.Visible = true; + + DdlPuesto.SelectedValueExist(GvRow.DataKey("CvePuesto")); + TxtHoras.Text = GvRow.DataKey("Horas"); + + + UpModalTiposD.Update(); + + LtlTituloModalActividad.Text = "Actualizar Actividad"; + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividadOT = GvRow.DataKey("CveActividadOT").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteActividadesOT(CveActividadOT, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se eliminó la Actividad correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividad_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + + int Estatus = ChkEstatus.Checked ? 1 : 0; + + if (BtnAgregarActividad.Text == "Agregar") + { +// if (ObjAF.AddActividadesOT(TxtNombre.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,Estatus, DdlPuesto.SelectedValue.ToEntero(), TxtHoras.Text.ToDecimal())) + if (ObjAF.AddActividadesOT(TxtNombre.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Estatus, DdlPuesto.SelectedValue.ToEntero(), TxtHoras.Text.ToDecimal())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se agregó la Actividad correctamente"); + } + } + else + { + if (ObjAF.UpdateActividadesOT(CveActividadOT,TxtNombre.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,Estatus, DdlPuesto.SelectedValue.ToEntero(), TxtHoras.Text.ToDecimal())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se actualizó la Actividad correctamente"); + } + } + ObjAF.Dispose(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + } +} \ No newline at end of file diff --git a/MQ/CatCheckListActividades.aspx b/MQ/CatCheckListActividades.aspx new file mode 100644 index 000000000..02b47978a --- /dev/null +++ b/MQ/CatCheckListActividades.aspx @@ -0,0 +1,92 @@ +<%@ Page Title="AF - Catálogo de Actividades de CheckList" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListActividades.aspx.cs" Inherits="AF_CatCheckListActividades" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de CheckList Nivel 2 + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MQ/CatCheckListActividades.aspx.cs b/MQ/CatCheckListActividades.aspx.cs new file mode 100644 index 000000000..2310261d5 --- /dev/null +++ b/MQ/CatCheckListActividades.aspx.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatCheckListActividades : ClsPaginas +{ + private int CveCheckListActividad + { + get + { + return ViewState["CveCheckListActividad"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListActividad"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + DdlCheckListActividadGrupo.Items.Clear(); + + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListActividad(-1, -1,UsuarioActual.CveEmpresa,-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + if (ObjAF.GetCheckListActividadGrupo(-1, UsuarioActual.CveEmpresa,1)) + { + DdlCheckListActividadGrupo.DataSource = ObjAF.DtResultados; + DdlCheckListActividadGrupo.DataBind(); + DdlCheckListActividadGrupo.Items.Insert(0, new ListItem("Seleccione", "-1")); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarActividadCheckList.Text = "Agregar"; + TxtCheckListActividad.Text = ""; + DdlCheckListActividadGrupo.SelectedValueExist(-1); + LtlTituloModalActividad.Text = "Agregar CheckList Nivel 2"; + ChkEstatus.Checked = true; + CheckActiveSection.Visible = false; + + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarActividadCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero(); + TxtCheckListActividad.Text = GvRow.DataKey("CheckListActividad"); + DdlCheckListActividadGrupo.SelectedValueExist(GvRow.DataKey("CveCheckListActividadGrupo")); + LtlTituloModalActividad.Text = "Actualizar CheckList Nivel 2"; + ChkEstatus.Checked = GvRow.DataKey("Estatus").ToEntero() == 1 ? true : false; + CheckActiveSection.Visible = true; + + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListActividad(CveCheckListActividad, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + Alert("Se eliminó CheckList Nivel 2"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadCheckList_Click(object sender, EventArgs e) + { + + ClsAF ObjAF = new ClsAF(); + int Estatus = ChkEstatus.Checked ? 1 : 0; + + if (BtnAgregarActividadCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListActividad(TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa,Estatus,UsuarioActual.CveUsuario)) + { + Alert("Se agregó CheckList Nivel 2 correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListActividad(CveCheckListActividad, TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, Estatus, UsuarioActual.CveUsuario)) + { + Alert("Se actualizó CheckList Nivel 2 correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + } +} \ No newline at end of file diff --git a/MQ/CatCheckListActividadesGrupos.aspx b/MQ/CatCheckListActividadesGrupos.aspx new file mode 100644 index 000000000..da7ef4085 --- /dev/null +++ b/MQ/CatCheckListActividadesGrupos.aspx @@ -0,0 +1,84 @@ +<%@ Page Title="AF - Catálogo de Grupos de CheckLists" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListActividadesGrupos.aspx.cs" Inherits="AF_CatCheckListActividadesGrupos" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de CheckList Nivel 1 + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MQ/CatCheckListActividadesGrupos.aspx.cs b/MQ/CatCheckListActividadesGrupos.aspx.cs new file mode 100644 index 000000000..2162fe286 --- /dev/null +++ b/MQ/CatCheckListActividadesGrupos.aspx.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatCheckListActividadesGrupos : ClsPaginas +{ + private int CveCheckListActividadGrupo + { + get + { + return ViewState["CveCheckListActividadGrupo"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListActividadGrupo"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListActividadGrupo(-1, UsuarioActual.CveEmpresa,-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarGrupoCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarGrupoCheckList.Text = "Agregar"; + TxtGrupoCheckList.Text = ""; + LtlTituloModalGrupoCheckList.Text = "Agregar CheckList Nivel 1"; + ChkEstatus.Checked = true; + CheckActiveSection.Visible = false; + + + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarGrupoCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + + CveCheckListActividadGrupo = GvRow.DataKey("CveCheckListActividadGrupo").ToEntero(); + TxtGrupoCheckList.Text = GvRow.DataKey("CheckListActividadGrupo"); + ChkEstatus.Checked = GvRow.DataKey("Estatus").ToEntero() == 1 ? true : false; + CheckActiveSection.Visible = true; + + LtlTituloModalGrupoCheckList.Text = "Actualizar CheckList Nivel 1"; + + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividadGrupo = GvRow.DataKey("CveCheckListActividadGrupo").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListActividadGrupo(CveCheckListActividadGrupo, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + Alert("Se eliminó el CheckList Nivel 1"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarGrupoCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + int Estatus = ChkEstatus.Checked ? 1 : 0; + + + if (BtnAgregarGrupoCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListActividadGrupo(TxtGrupoCheckList.Text, UsuarioActual.CveEmpresa,Estatus,UsuarioActual.CveUsuario)) + { + Alert("Se agregó el CheckList Nivel 1 correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListActividadGrupo(CveCheckListActividadGrupo, TxtGrupoCheckList.Text, Estatus, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + Alert("Se actualizó el CheckList Nivel 1 correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + } +} \ No newline at end of file diff --git a/MQ/CatEstatusOT.aspx b/MQ/CatEstatusOT.aspx new file mode 100644 index 000000000..441261a1a --- /dev/null +++ b/MQ/CatEstatusOT.aspx @@ -0,0 +1,143 @@ +<%@ Page Title="Catálogo Operadores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatEstatusOT.aspx.vb" Inherits="AF_CatEstatusOT" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo Operadores + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    +
    +
    + + + + \ No newline at end of file diff --git a/MQ/CatEstatusOT.aspx.vb b/MQ/CatEstatusOT.aspx.vb new file mode 100644 index 000000000..b7a580f87 --- /dev/null +++ b/MQ/CatEstatusOT.aspx.vb @@ -0,0 +1,135 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class AF_CatEstatusOT + Inherits ClsPaginas + + Protected Property CveEstatusOT As Integer + Get + If ViewState("CveEstatusOT") Is Nothing Then + Return -1 + Else + Return ViewState("CveEstatusOT").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveEstatusOT") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaDatos() + End If + + End Sub + + + Private Sub CargaDatos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetEstatusOT(-1, UsuarioActual.CveEmpresa, -1) Then + GvDatos.DataSource = ObjAF.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvDatos.DataBind() + UpDatos.Update() + + End Sub + + + Protected Sub BtnAgregarOperador_Click(sender As Object, e As EventArgs) Handles LnkAgregarEstatusOT.Click + ResetModalEstatusOT() + RegistraScript(String.Format("$('#{0}').modal();", "DVModalEstatusOT")) + End Sub + + Private Sub ResetModalEstatusOT() + CveEstatusOT = -1 + TxtEstatusOT.Text = "" + ChkEstatus.Checked = True + LtlTituloModalOperdaor.Text = "Agregar Etapa" + CheckActiveSection.Visible = False + + UpModalEstatusOT.Update() + End Sub + + Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveEstatusOT = GvRow.DataKey("CveEstatusOT").ToEntero + TxtEstatusOT.Text = GvRow.DataKey("EstatusOT") + 'TxtFecha.Text = GvRow.DataKey("Fecha").ToDate.ToString("dd/MM/yyyy") + + ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString.ToEntero = 1, True, False) + LtlTituloModalOperdaor.Text = "Actualizar Etapa" + CheckActiveSection.Visible = True + + UpModalEstatusOT.Update() + + RegistraScript(String.Format("$('#{0}').modal();", "DVModalEstatusOT")) + + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnModalAgregarEstatusOT.Click + + Dim ObjAF As New ClsAF + Dim ErrorProceso As Boolean = False + + If CveEstatusOT = -1 Then + If Not ObjAF.AddEstatusOT(TxtEstatusOT.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkEstatus.Checked, 1, 0)) Then + ErrorProceso = True + End If + Else + + If Not ObjAF.UpdateEstatusOT(CveEstatusOT, TxtEstatusOT.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkEstatus.Checked, 1, 0)) Then + ErrorProceso = True + End If + + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + Alert($"Etapa { If(CveEstatusOT > 0, "Actualizada", "Agregada") } correctamente.") + RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalEstatusOT")) + CargaDatos() + End If + + + End Sub + + Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ErrorProceso As Boolean = False + Dim CveEstatusOTEliminar As Integer = GvRow.DataKey("CveEstatusOT").ToEntero + + Dim ObjAF As New ClsAF + + If ObjAF.DeletEstatusOT(CveEstatusOTEliminar, UsuarioActual.CveEmpresa) Then + Alert("Etapa eliminado correctamente") + Else + ErrorProceso = True + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + CargaDatos() + End If + + + End Sub +End Class diff --git a/MQ/CatHerramientasOT.aspx b/MQ/CatHerramientasOT.aspx new file mode 100644 index 000000000..335b8830e --- /dev/null +++ b/MQ/CatHerramientasOT.aspx @@ -0,0 +1,123 @@ +<%@ Page Title="Catálogo Operadores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatHerramientasOT.aspx.vb" Inherits="AF_CatHerramientasOT" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Herramientas para Orden de Trabajo + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    +
    +
    + + + + \ No newline at end of file diff --git a/MQ/CatHerramientasOT.aspx.vb b/MQ/CatHerramientasOT.aspx.vb new file mode 100644 index 000000000..ead33dbeb --- /dev/null +++ b/MQ/CatHerramientasOT.aspx.vb @@ -0,0 +1,135 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class AF_CatHerramientasOT + Inherits ClsPaginas + + Protected Property CveHerramientaOT As Integer + Get + If ViewState("CveHerramientaOT") Is Nothing Then + Return -1 + Else + Return ViewState("CveHerramientaOT").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveHerramientaOT") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaDatos() + End If + + End Sub + + + Private Sub CargaDatos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetHerramientasOT(-1, UsuarioActual.CveEmpresa, -1) Then + GvDatos.DataSource = ObjAF.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvDatos.DataBind() + UpDatos.Update() + + End Sub + + + Protected Sub BtnAgregarOperador_Click(sender As Object, e As EventArgs) Handles LnkAgregarHerramientas.Click + ResetModalOperador() + RegistraScript(String.Format("$('#{0}').modal();", "DVModalHerramientaOT")) + End Sub + + Private Sub ResetModalOperador() + CveHerramientaOT = -1 + TxtHerramientaOT.Text = "" + ChkEstatus.Checked = True + LtlTituloModalOperdaor.Text = "Agregar Herramienta" + CheckActiveSection.Visible = False + + UpModalHerramienta.Update() + End Sub + + Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveHerramientaOT = GvRow.DataKey("CveHerramientaOT").ToEntero + TxtHerramientaOT.Text = GvRow.DataKey("HerramientaOT") + 'TxtFecha.Text = GvRow.DataKey("Fecha").ToDate.ToString("dd/MM/yyyy") + + ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString.ToEntero = 1, True, False) + LtlTituloModalOperdaor.Text = "Actualizar Herramienta" + CheckActiveSection.Visible = True + + UpModalHerramienta.Update() + + RegistraScript(String.Format("$('#{0}').modal();", "DVModalHerramientaOT")) + + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnModalAgregarHerramientaOT.Click + + Dim ObjAF As New ClsAF + Dim ErrorProceso As Boolean = False + + If CveHerramientaOT = -1 Then + If Not ObjAF.AddHerramientasOT(TxtHerramientaOT.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkEstatus.Checked, 1, 0)) Then + ErrorProceso = True + End If + Else + + If Not ObjAF.UpdateHerramientasOT(CveHerramientaOT, TxtHerramientaOT.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkEstatus.Checked, 1, 0)) Then + ErrorProceso = True + End If + + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + Alert($"Herramienta { If(CveHerramientaOT > 0, "Actualizada", "Agregada") } correctamente.") + RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalHerramientaOT")) + CargaDatos() + End If + + + End Sub + + Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ErrorProceso As Boolean = False + Dim CveHerramientaOTEliminar As Integer = GvRow.DataKey("CveHerramientaOT").ToEntero + + Dim ObjAF As New ClsAF + + If ObjAF.DeleteHerramientasOT(CveHerramientaOTEliminar, UsuarioActual.CveEmpresa) Then + Alert("Herramienta eliminada correctamente") + Else + ErrorProceso = True + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + CargaDatos() + End If + + + End Sub +End Class diff --git a/MQ/CatOperadores.aspx b/MQ/CatOperadores.aspx new file mode 100644 index 000000000..ebcaa60a7 --- /dev/null +++ b/MQ/CatOperadores.aspx @@ -0,0 +1,143 @@ +<%@ Page Title="Catálogo Operadores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatOperadores.aspx.vb" Inherits="AF_CatOperadores" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo Operadores + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    +
    +
    + + + + \ No newline at end of file diff --git a/MQ/CatOperadores.aspx.vb b/MQ/CatOperadores.aspx.vb new file mode 100644 index 000000000..3a9c75d70 --- /dev/null +++ b/MQ/CatOperadores.aspx.vb @@ -0,0 +1,135 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class AF_CatOperadores + Inherits ClsPaginas + + Protected Property CveOperador As Integer + Get + If ViewState("CveOperador") Is Nothing Then + Return -1 + Else + Return ViewState("CveOperador").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveOperador") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaDatos() + End If + + End Sub + + + Private Sub CargaDatos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetOperador(-1, UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjAF.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvDatos.DataBind() + UpDatos.Update() + + End Sub + + + Protected Sub BtnAgregarOperador_Click(sender As Object, e As EventArgs) Handles LnkAgregarOperador.Click + ResetModalOperador() + RegistraScript(String.Format("$('#{0}').modal();", "DVModalOperador")) + End Sub + + Private Sub ResetModalOperador() + CveOperador = -1 + TxtOperador.Text = "" + ChkEstatus.Checked = True + LtlTituloModalOperdaor.Text = "Agregar operador" + CheckActiveSection.Visible = False + + UpModalOperador.Update() + End Sub + + Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveOperador = GvRow.DataKey("CveOperador").ToEntero + TxtOperador.Text = GvRow.DataKey("Operador") + 'TxtFecha.Text = GvRow.DataKey("Fecha").ToDate.ToString("dd/MM/yyyy") + + ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString.ToEntero = 1, True, False) + LtlTituloModalOperdaor.Text = "Actualizar operador" + CheckActiveSection.Visible = True + + UpModalOperador.Update() + + RegistraScript(String.Format("$('#{0}').modal();", "DVModalOperador")) + + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnModalAgregarOperador.Click + + Dim ObjAF As New ClsAF + Dim ErrorProceso As Boolean = False + + If CveOperador = -1 Then + If Not ObjAF.AddOperador(TxtOperador.Text, If(ChkEstatus.Checked, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + Else + + If Not ObjAF.UpdateOperador(CveOperador, TxtOperador.Text, If(ChkEstatus.Checked, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + Alert($"Operador { If(CveOperador > 0, "Actualizado", "Agregado") } correctamente.") + RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalOperador")) + CargaDatos() + End If + + + End Sub + + Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ErrorProceso As Boolean = False + Dim CveOperadorEliminar As Integer = GvRow.DataKey("CveOperador").ToEntero + + Dim ObjAF As New ClsAF + + If ObjAF.RemoveOperador(CveOperadorEliminar, UsuarioActual.CveEmpresa) Then + Alert("Operador eliminado correctamente") + Else + ErrorProceso = True + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + CargaDatos() + End If + + + End Sub +End Class diff --git a/MQ/CatOrdenTrabajo.aspx b/MQ/CatOrdenTrabajo.aspx new file mode 100644 index 000000000..06e2fe2f5 --- /dev/null +++ b/MQ/CatOrdenTrabajo.aspx @@ -0,0 +1,198 @@ +<%@ Page Title="Catálogo Operadores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatOrdenTrabajo.aspx.vb" Inherits="AF_CatOrdenTrabajo" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo Ordenes de Trabajo + + + + + + + + + + + + + +
    +
    +
    + + +
    +
    +
    + +
    Obra:
    +
    + + +
    + +
    Folio:
    +
    + + +
    + +
    + Fecha de: +
    +
    +
    + + + + +
    + + + + + + +
    +
    + Fecha a: +
    +
    +
    + + + + +
    + + + + + + +
    + + +
    + Etapa: +
    +
    + + +
    + + + + +
    +
    +
    + +
    +
    +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + <%-- + + + + --%> + + + + +
    + + + + + +
    +
    +
    + + + + \ No newline at end of file diff --git a/MQ/CatOrdenTrabajo.aspx.vb b/MQ/CatOrdenTrabajo.aspx.vb new file mode 100644 index 000000000..c3be6be9a --- /dev/null +++ b/MQ/CatOrdenTrabajo.aspx.vb @@ -0,0 +1,179 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class AF_CatOrdenTrabajo + Inherits ClsPaginas + + Protected Property CveOperador As Integer + Get + If ViewState("CveOperador") Is Nothing Then + Return -1 + Else + Return ViewState("CveOperador").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveOperador") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + + + + CargaCombos() + 'CargaDatos() + End If + + End Sub + + + Protected Sub CargaCombos() + + txtFechaF.Text = Now.ToString("dd/MM/yyyy") + txtFechaI.Text = Now.AddDays(-30).ToString("dd/MM/yyyy") + + + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + + DdlSubProyecto.Items.Insert(0, New ListItem("Todas", "-1")) + DdlSubProyecto.SelectedValueExist(-1) + + + + 'CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto) + + + + + Dim ObjAF As New ClsAF + + If ObjAF.GetEstatusOT(-1, UsuarioActual.CveEmpresa, 1) Then + DdlOrdenesTrabajoEstatus.DataSource = ObjAF.DtResultados + Else + DdlOrdenesTrabajoEstatus.DataSource = Nothing + End If + + + If ObjAF.GetTiposOT(-1, 1, UsuarioActual.CveEmpresa) Then + DdlTipoMantenimiento.DataSource = ObjAF.DtResultados + Else + DdlTipoMantenimiento.DataSource = Nothing + End If + + + If ObjAF.GetOperador(-1, UsuarioActual.CveEmpresa) Then + DdlOperador.DataSource = ObjAF.DtResultados + Else + DdlOperador.DataSource = Nothing + End If + + + If ObjAF.GetOrdenesTrabajoAF(-1, UsuarioActual.CveEmpresa) Then + DdlAF.DataSource = ObjAF.DtResultados + Else + DdlAF.DataSource = Nothing + End If + + + + + ObjAF.Dispose() + + ' DdlTipoServicio.DataBind() + DdlOrdenesTrabajoEstatus.DataBind() + DdlTipoMantenimiento.DataBind() + DdlOperador.DataBind() + DdlAF.DataBind() + + + + DdlOrdenesTrabajoEstatus.Items.Insert(0, New ListItem("Todos", "-1")) + DdlOrdenesTrabajoEstatus.SelectedValueExist(-1) + + DdlOperador.Items.Insert(0, New ListItem("Todos", "-1")) + DdlOperador.SelectedValueExist(-1) + + DdlTipoMantenimiento.Items.Insert(0, New ListItem("Todos", "-1")) + DdlTipoMantenimiento.SelectedValueExist(-1) + + DdlAF.Items.Insert(0, New ListItem("Todos", "-1")) + DdlAF.SelectedValueExist(-1) + + UPFiltros.Update() + + + + End Sub + + Private Sub CargaDatos() + + Dim ObjAF As New ClsAF + + + Dim Folio As Integer = If(TxtFolio.Text.ToEntero > 0, TxtFolio.Text.ToEntero, -1) + + If ObjAF.GetOrdenesTrabajo(-1, DdlTipoServicio.SelectedValue.ToEntero, Folio, DdlAF.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, Nothing, DdlOrdenesTrabajoEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlOperador.SelectedValue.ToEntero) Then + GvDatos.DataSource = ObjAF.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvDatos.DataBind() + UpDatos.Update() + + End Sub + + Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.Cells(7).Text = $"" + + End If + + End Sub + + + Protected Sub DdlTipoMantenimiento_SelectedIndexChanged(sender As Object, e As EventArgs) + + + + If DdlTipoMantenimiento.SelectedValue.ToEntero > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposServicios(-1, DdlTipoMantenimiento.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then + DdlTipoServicio.DataSource = ObjAF.DtResultados + Else + DdlTipoServicio.DataSource = Nothing + End If + + + ObjAF.Dispose() + + Else + DdlTipoServicio.DataSource = Nothing + End If + + DdlTipoServicio.DataBind() + DdlTipoServicio.Items.Insert(0, New ListItem("Todos", "-1")) + + UPFiltros.Update() + + End Sub + + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + + +End Class diff --git a/MQ/CatOrdenesTrabajoTipos.aspx b/MQ/CatOrdenesTrabajoTipos.aspx new file mode 100644 index 000000000..27d1772fb --- /dev/null +++ b/MQ/CatOrdenesTrabajoTipos.aspx @@ -0,0 +1,90 @@ +<%@ Page Title="AF - Catálogo de Actividades" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatOrdenesTrabajoTipos.aspx.cs" Inherits="AF_CatOrdenesTrabajoTipos" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo Tipos Ordenes de Trabajo + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MQ/CatOrdenesTrabajoTipos.aspx.cs b/MQ/CatOrdenesTrabajoTipos.aspx.cs new file mode 100644 index 000000000..3cdf02a09 --- /dev/null +++ b/MQ/CatOrdenesTrabajoTipos.aspx.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatOrdenesTrabajoTipos : ClsPaginas +{ + private int CveOrdenTrabajoTipo + { + get + { + return ViewState["CveOrdenTrabajoTipo"].ToString().ToEntero(); + } + + set + { + ViewState["CveOrdenTrabajoTipo"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + + + + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetTiposOT(-1, -1, UsuarioActual.CveEmpresa)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadD_Click(object sender, EventArgs e) + { + BtnAgregarTipo.Text = "Agregar"; + TxtOrdenTrabajoTipo.Text = ""; + + LtlTituloModalActividad.Text = "Agregar Tipo"; + ChkEstatus.Checked = true; + CheckActiveSection.Visible = false; + + + + + + UpModalTiposD.Update(); + + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTipo")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarTipo.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveOrdenTrabajoTipo = GvRow.DataKey("CveOrdenTrabajoTipo").ToEntero(); + TxtOrdenTrabajoTipo.Text = GvRow.DataKey("OrdenTrabajoTipo"); + + ChkEstatus.Checked = GvRow.DataKey("Estatus").ToEntero() == 1 ? true : false; + CheckActiveSection.Visible = true; + + + UpModalTiposD.Update(); + + LtlTituloModalActividad.Text = "Actualizar Tipo"; + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTipo")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveOrdenTrabajoTipo = GvRow.DataKey("CveOrdenTrabajoTipo").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteTiposOT(CveOrdenTrabajoTipo, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTipo")); + Alert("Se eliminó el tipo correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarTipo_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + + int Estatus = ChkEstatus.Checked ? 1 : 0; + + if (BtnAgregarTipo.Text == "Agregar") + { + if (ObjAF.AddTiposOT(TxtOrdenTrabajoTipo.Text, UsuarioActual.CveUsuario, Estatus, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTipo")); + Alert("Se agregó el tipo de orden"); + } + } + else + { + if (ObjAF.UpdateTiposOT(CveOrdenTrabajoTipo, TxtOrdenTrabajoTipo.Text, UsuarioActual.CveUsuario, Estatus, UsuarioActual.CveEmpresa )) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTipo")); + Alert("Se actualizó el tipo de orden"); + } + } + ObjAF.Dispose(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTipo")); + } +} \ No newline at end of file diff --git a/MQ/CatTipoOrdenTrabajo.aspx b/MQ/CatTipoOrdenTrabajo.aspx new file mode 100644 index 000000000..e4b4711d8 --- /dev/null +++ b/MQ/CatTipoOrdenTrabajo.aspx @@ -0,0 +1,80 @@ +<%@ Page Title="Catálogo Operadores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatTipoOrdenTrabajo.aspx.vb" Inherits="AF_CatTipoOrdenTrabajo" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo Tipos de Ordenes de Trabajo + + + + +
  • + + Agregar Tipo de Orden de trabajo +
  • + +
    +
    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + +
    + + + + + +
    +
    +
    + + + + \ No newline at end of file diff --git a/MQ/CatTipoOrdenTrabajo.aspx.vb b/MQ/CatTipoOrdenTrabajo.aspx.vb new file mode 100644 index 000000000..f26854a20 --- /dev/null +++ b/MQ/CatTipoOrdenTrabajo.aspx.vb @@ -0,0 +1,73 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class AF_CatTipoOrdenTrabajo + Inherits ClsPaginas + + Protected Property CveOperador As Integer + Get + If ViewState("CveOperador") Is Nothing Then + Return -1 + Else + Return ViewState("CveOperador").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveOperador") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaDatos() + End If + + End Sub + + + Private Sub CargaDatos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposServicios(-1, -1, -1, UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjAF.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvDatos.DataBind() + UpDatos.Update() + + End Sub + + + + + 'Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + + ' Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + ' Dim CveTipoServicio = GvRow.DataKey("CveTipoServicio").ToEntero + + ' Response.Redirect($"./TipoOrdenTrabajo.aspx?CveTipoServicio={CveTipoServicio}", True) + + + 'End Sub + + Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + + + e.Row.Cells(2).Text = $"" + + End If + + End Sub + +End Class diff --git a/MQ/ClsAF.vb b/MQ/ClsAF.vb new file mode 100644 index 000000000..43efb1c7c --- /dev/null +++ b/MQ/ClsAF.vb @@ -0,0 +1,4212 @@ +Option Strict On +Option Explicit On + +Imports System.Data +Imports System.Data.SqlClient +Imports Extensiones +Imports System +Imports System.Configuration + +Public Class ClsAF + Implements IDisposable + +#Region "Campos" + 'SQL + Private SqlConexion As SqlConnection + Private SqlAdapter As SqlDataAdapter + + Private SqlTransacc As SqlTransaction + Private Data As DataTable + + Private disposedValue As Boolean = False ' Para detectar llamadas redundantes +#End Region + +#Region "Propiedades" + Public ReadOnly Property DtResultados() As DataTable + Get + DtResultados = Data + End Get + End Property + + Public Property CveActivoFijo As Integer + Public Property Codigo As String + Public Property Descripcion As String + Public Property CveCompra As Integer + Public Property ValorCompra As Double + Public Property FechaCompra As Date + Public Property CuentaInicial As Integer + Public Property CveTipoActivoFijo As Integer + Public Property TipoActivoFijo As String + Public Property CveSubTipoActivoFijo As Integer + Public Property SubTipoActivoFijo As String + Public Property CveModeloActivoFijo As Integer + Public Property ModeloActivoFijo As String + Public Property CveMarcaActivoFijo As Integer + Public Property MarcaActivoFijo As String + Public Property CvePersonaResponsable As Integer + Public Property Responsable As String + Public Property NoSerie As String + Public Property Año As Integer + Public Property CveSubProyecto As Integer + Public Property SubProyecto As String + Public Property CveProyecto As Integer + Public Property Proyecto As String + Public Property Cuenta As Integer + Public Property CveEstadoActivoFijo As Integer + Public Property EstadoActivoFijo As String + Public Property IdCtaContDepreciacion As Integer + Public Property PorDepreciacion As Double + Public Property PorDeduccion As Double + Public Property FechaUltimaDepreciacion As DateTime + Public Property Observaciones As String + + Public Property EsRentada As Boolean + + Public Property FechaIng As Date + Public Property CveUsuario As Integer + Public Property Usuario As String + Public Property CveEmpresa As Integer + Public Property FolioVale As Integer + Public Property FolioResguardo As Integer + + + Public Property CveProveedorPersonal As Integer + Public Property ProveedorPersonal As String + Public Property RazonSocial As String + Public Property CveHorometroDiario As Integer + Public Property CveTipoServicio As Integer + + Public Property CveOrdenTrabajo As Integer + Public Property FolioOT As Integer + +#End Region + +#Region "C O N E X I O N E S" + Property CveConexion As Integer = 0 + Private Property DepurarConecciones As Boolean = False + + Private Sub ValidaDepurarConexiones(SqlTransactionVal As SqlTransaction) + + Dim Depurar As String = System.Configuration.ConfigurationManager.AppSettings("DepurarConexiones") + + If Depurar = "1" AndAlso SqlTransactionVal Is Nothing Then + DepurarConecciones = True + Else + DepurarConecciones = False + End If + + End Sub + + Private Sub ConexionAdd() + + If DepurarConecciones Then + + Dim Clase As String = Me.GetType().Name + DataAdapter("PA_Gral_ConexionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Clase + Try + .Add("@Url", SqlDbType.VarChar).Value = If(System.Web.HttpContext.Current.Handler Is Nothing, "", System.Web.HttpContext.Current.Request.Url.PathAndQuery) + Catch ex As Exception + .Add("@Url", SqlDbType.VarChar).Value = "" + End Try + .Add("@CveConexion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + CveConexion = SqlAdapter.SelectCommand.Parameters("@CveConexion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al agregar la conexion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + End If + End Sub + + Private Sub ConexionUpdate() + If DepurarConecciones Then + DataAdapter("PA_Gral_ConexionesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConexion", SqlDbType.Int).Value = CveConexion + End With + + Try + SqlAdapter.Fill(Data) + Catch ex As Exception + OnError("Ocurrió un error al actualizar el cierra de la conexion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + End If + End Sub + +#End Region + + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + ValidaDepurarConexiones(TransaccionCompartida) + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + End If + + SqlAdapter = New SqlDataAdapter("", SqlConexion) + ConexionAdd() + + End Sub + Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = StrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable + End Sub + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc + End Function + Public Sub RollBack() + SqlTransacc.Rollback() + End Sub + Public Sub Commit() + SqlTransacc.Commit() + End Sub + + +#Region "A C T I V O S- F I J O S" + + Public Function GetRepActivosFijos(CveActivoFijo As Integer, CveEmpresa As Integer, Codigo As String, Descripcion As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, NoSerie As String, Año As Integer, CvePersonaResponsable As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CaracteristicaValor As String, Optional BuscaGrupoEmpresa As Integer = -1, Optional Agrupador As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_AFGetRep") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CvePersonaResponsable", SqlDbType.Int).Value = CvePersonaResponsable + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@CaracteristicaValor", SqlDbType.VarChar).Value = CaracteristicaValor + .Add("@BuscaGrupoEmpresa", SqlDbType.Int).Value = BuscaGrupoEmpresa + .Add("@Gpo", SqlDbType.Int).Value = Agrupador + + End With + Try + SqlAdapter.Fill(Data) + + If CveActivoFijo > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then + Me.CveActivoFijo = Data.Rows(0)("CveActivoFijo").ToString.ToEntero + + Me.Codigo = Data.Rows(0)("Codigo").ToString + Me.Descripcion = Data.Rows(0)("Descripcion").ToString + Me.CuentaInicial = Data.Rows(0)("Conta_CuentaInicial").ToString.ToEntero + Me.CveTipoActivoFijo = Data.Rows(0)("CveTipoActivoFijo").ToString.ToEntero + Me.TipoActivoFijo = Data.Rows(0)("TipoActivoFijo").ToString + Me.CveSubTipoActivoFijo = Data.Rows(0)("CveSubTipoActivoFijo").ToString.ToEntero + Me.SubTipoActivoFijo = Data.Rows(0)("SubTipoActivoFijo").ToString + Me.CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero + Me.ValorCompra = Data.Rows(0)("ValorCompra").ToString.ToDouble + Me.FechaCompra = Data.Rows(0)("FechaCompra").ToString.ToDate + Me.CvePersonaResponsable = Data.Rows(0)("CvePersonaResponsable").ToString.ToEntero + Me.Responsable = Data.Rows(0)("Responsable").ToString + Me.NoSerie = Data.Rows(0)("NoSerie").ToString + Me.Año = Data.Rows(0)("Año").ToString.ToEntero + Me.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero + Me.SubProyecto = Data.Rows(0)("SubProyecto").ToString + Me.CveProyecto = Data.Rows(0)("CveProyecto").ToString.ToEntero + Me.Proyecto = Data.Rows(0)("Proyecto").ToString + Me.Cuenta = Data.Rows(0)("Cuenta").ToString.ToEntero + Me.CveEstadoActivoFijo = Data.Rows(0)("CveEstadoActivoFijo").ToString.ToEntero + Me.EstadoActivoFijo = Data.Rows(0)("EstadoActivoFijo").ToString + Me.IdCtaContDepreciacion = Data.Rows(0)("IdCtaContDepreciacion").ToString.ToEntero + Me.PorDepreciacion = Data.Rows(0)("PorDepreciacion").ToString.ToDouble + Me.PorDeduccion = Data.Rows(0)("PorDeduccion").ToString.ToDouble + Me.Observaciones = Data.Rows(0)("Observaciones").ToString + Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate + Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero + Me.Usuario = Data.Rows(0)("Usuario").ToString + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetActivosFijosProyectos(CveEmpresa As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosUsuarioGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetActivosFijos(CveActivoFijo As Integer, CveEmpresa As Integer, Codigo As String, Descripcion As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, NoSerie As String, Año As Integer, CvePersonaResponsable As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveEstadoActivoFijo As Integer, CaracteristicaValor As String, Optional BuscaGrupoEmpresa As Integer = -1, Optional Traslados As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CvePersonaResponsable", SqlDbType.Int).Value = CvePersonaResponsable + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@CaracteristicaValor", SqlDbType.VarChar).Value = CaracteristicaValor + .Add("@BuscaGrupoEmpresa", SqlDbType.Int).Value = BuscaGrupoEmpresa + .Add("@Traslados", SqlDbType.Int).Value = Traslados + + End With + Try + SqlAdapter.Fill(Data) + + If CveActivoFijo > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then + Me.CveActivoFijo = Data.Rows(0)("CveActivoFijo").ToString.ToEntero + + Me.Codigo = Data.Rows(0)("Codigo").ToString + Me.Descripcion = Data.Rows(0)("Descripcion").ToString + Me.CuentaInicial = Data.Rows(0)("Conta_CuentaInicial").ToString.ToEntero + Me.CveTipoActivoFijo = Data.Rows(0)("CveTipoActivoFijo").ToString.ToEntero + Me.TipoActivoFijo = Data.Rows(0)("TipoActivoFijo").ToString + Me.CveSubTipoActivoFijo = Data.Rows(0)("CveSubTipoActivoFijo").ToString.ToEntero + Me.SubTipoActivoFijo = Data.Rows(0)("SubTipoActivoFijo").ToString + Me.CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero + Me.ValorCompra = Data.Rows(0)("ValorCompra").ToString.ToDouble + Me.FechaCompra = Data.Rows(0)("FechaCompra").ToString.ToDate + Me.CvePersonaResponsable = Data.Rows(0)("CvePersonaResponsable").ToString.ToEntero + Me.Responsable = Data.Rows(0)("Responsable").ToString + Me.NoSerie = Data.Rows(0)("NoSerie").ToString + Me.Año = Data.Rows(0)("Año").ToString.ToEntero + Me.CveSubProyecto = Data.Rows(0)("CveSubProyecto").ToString.ToEntero + Me.SubProyecto = Data.Rows(0)("SubProyecto").ToString + Me.CveProyecto = Data.Rows(0)("CveProyecto").ToString.ToEntero + Me.Proyecto = Data.Rows(0)("Proyecto").ToString + Me.Cuenta = Data.Rows(0)("Cuenta").ToString.ToEntero + Me.CveEstadoActivoFijo = Data.Rows(0)("CveEstadoActivoFijo").ToString.ToEntero + Me.EstadoActivoFijo = Data.Rows(0)("EstadoActivoFijo").ToString + Me.IdCtaContDepreciacion = Data.Rows(0)("IdCtaContDepreciacion").ToString.ToEntero + Me.PorDepreciacion = Data.Rows(0)("PorDepreciacion").ToString.ToDouble + Me.PorDeduccion = Data.Rows(0)("PorDeduccion").ToString.ToDouble + Me.Observaciones = Data.Rows(0)("Observaciones").ToString + Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate + Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero + Me.Usuario = Data.Rows(0)("Usuario").ToString + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + Me.EsRentada = CBool(Data.Rows(0)("EsRentada")) + Me.CveProveedorPersonal = Data.Rows(0)("CveProveedorPersonal").ToString.ToEntero + Me.ProveedorPersonal = Data.Rows(0)("ProveedorPersonal").ToString + Me.RazonSocial = Data.Rows(0)("RazonSocial").ToString + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddActivosFijos(Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, + CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, Cuenta As Integer, + CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, PorDeduccion As Double, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra + .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = Cuenta + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion + .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion + .Add("@PorDeduccion", SqlDbType.Float).Value = PorDeduccion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + + End Try + + Return Retorno + End Function + Public Function AddActivosFijos2(Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, + CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, Cuenta As Integer, + CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, PorDeduccion As Double, Observaciones As String, EsRentada As Boolean, CveUsuario As Integer, CveEmpresa As Integer, + Optional CvePS As Integer = -1, Optional CveSATPS As Integer = -1, Optional CveSATUnidadMedida As Integer = -1, Optional PesoKg As Decimal = -1, Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional Dimensiones As String = "-1") As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_AF_ActivosFijosAdd2") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra + .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = Cuenta + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion + .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion + .Add("@PorDeduccion", SqlDbType.Float).Value = PorDeduccion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@EsRentada", SqlDbType.Bit).Value = EsRentada + .Add("@CveActivoFijo", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue + .Add("@CvePS", SqlDbType.Int).Value = CvePS + + .Add("@CveSATPS", SqlDbType.Int).Value = CveSATPS + .Add("@CveSATUnidadMedida", SqlDbType.Int).Value = CveSATUnidadMedida + .Add("@PesoKg", SqlDbType.SmallMoney).Value = PesoKg + .Add("@CveMaterialPeligroso", SqlDbType.Int).Value = CveMaterialPeligroso + .Add("@CveEmbalaje", SqlDbType.Int).Value = CveEmbalaje + .Add("@Dimensiones", SqlDbType.VarChar).Value = Dimensiones + End With + + Try + SqlAdapter.Fill(Data) + CveActivoFijo = SqlAdapter.SelectCommand.Parameters("@CveActivoFijo").Value.ToString.ToEntero + 'Dim RetValue As Integer = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString.ToEntero + Retorno = CveActivoFijo + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + If Ex1.Message.Contains("UN_ActivoFijo") Then + Alert("El Codigo ya se encuentra registrado", TipoMensaje.MsgAdvertencia) + Else + Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + End If + + Else + Me.OnError("Ocurrió un error al Guardar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + + End Try + + Return Retorno + End Function + Public Function UpdateActivosFijos(CveActivoFijo As Integer, Codigo As String, Descripcion As String, ValorCompra As Double, FechaCompra As Date, CveSubTipoActivoFijo As Integer, + CvePersonalResponsable As Integer, NoSerie As String, Año As Integer, CveSubProyecto As Integer, IdCtaContActivoFijo As Integer, + CveEstadoActivoFijo As Integer, IdCtaContDepreciacion As Integer, PorDepreciacion As Double, PorDeduccion As Double, Observaciones As String, EsRentada As Boolean, + CveUsuarioModifico As Integer, CveEmpresa As Integer, Optional CvePS As Integer = -1, + Optional CveSATPS As Integer = -1, Optional CveSATUnidadMedida As Integer = -1, Optional PesoKg As Decimal = -1, Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional Dimensiones As String = "-1") As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@ValorCompra", SqlDbType.Money).Value = ValorCompra + .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + '.Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo + '.Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo + .Add("@CvePersonalResponsable", SqlDbType.Int).Value = CvePersonalResponsable + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + .Add("@Año", SqlDbType.Int).Value = Año + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@IdCtaContActivoFijo", SqlDbType.Int).Value = IdCtaContActivoFijo + .Add("@IdCtaContDepreciacion", SqlDbType.Int).Value = IdCtaContDepreciacion + .Add("@PorDepreciacion", SqlDbType.Float).Value = PorDepreciacion + .Add("@PorDeduccion", SqlDbType.Float).Value = PorDeduccion + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@EsRentada", SqlDbType.Bit).Value = EsRentada + + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveSATPS", SqlDbType.Int).Value = CveSATPS + .Add("@CveSATUnidadMedida", SqlDbType.Int).Value = CveSATUnidadMedida + .Add("@PesoKg", SqlDbType.SmallMoney).Value = PesoKg + .Add("@CveMaterialPeligroso", SqlDbType.Int).Value = CveMaterialPeligroso + .Add("@CveEmbalaje", SqlDbType.Int).Value = CveEmbalaje + .Add("@Dimensiones", SqlDbType.VarChar).Value = Dimensiones + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + ElseIf Ex1.Message.Contains("No se puede actualizar el responsable/estado/proyecto porque está en resguardo el Activo Fijo.") Then + Alert("No se puede actualizar el responsable/estado/proyecto porque está en resguardo el Activo Fijo.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveActivosFijos(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosCompra(CveActivoFijo As Integer, CveCompraDetalle As Integer, TipoAF As Integer, ValorCompra As Double, FechaCompra As Date, CveUsuario As Integer, Optional NoSerie As String = "-1") As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosCompraUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle + .Add("@TipoAF", SqlDbType.Int).Value = TipoAF + .Add("@ValorCompra", SqlDbType.Float).Value = ValorCompra + .Add("@FechaCompra", SqlDbType.Date).Value = FechaCompra + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@NoSerie", SqlDbType.VarChar).Value = NoSerie + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Activo Fijo con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosCuentaAC(CveActivoFijo As Integer, IdCuentaContable As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosCtaContableUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@IdCuentaContable", SqlDbType.Int).Value = IdCuentaContable + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + +#End Region + +#Region "A C T I V O S - F I J O S- B I T A C O R A S" + Public Function GetActivosFijosBitacora(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosBitacoraGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Bitacora.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddActivosFijosBitacora(CveActivoFijo As Integer, Observacion As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosBitacoraAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar la Bitacora del Activo Fijo ", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S - F I J O S - C A R A C T E R I S T I C A S" + Public Function GetActivosFijosCaracteristicas(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosCaracteristicasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region "A C T I V O S- F I J O S - H I S T O R I A L" + Public Function GetActivosFijosHistorial(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosHistorialGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Historial.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddActivosFijosHistorial(CveActivoFijo As Integer, CveConceptoHistorialActivoFijo As Integer, Actual As String, Anterior As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosHistorialAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo + .Add("@Actual", SqlDbType.VarChar).Value = Actual + .Add("@Anterior", SqlDbType.VarChar).Value = Anterior + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Historial del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S- F I J O S - I M A G E N E S" + Public Function GetActivosFijosImagenes(CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosImagenesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Imagenes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddActivosFijosImagenes(CveActivoFijo As Integer, URL As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosImagenesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Imagen en Fijo Imagenes con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Imagen en Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Imagen en Activo Fijo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RemoveActivosFijosImagenes(CveImagenActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivosFijosImagenesRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveImagenActivoFijo", SqlDbType.Int).Value = CveImagenActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Imagen del Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Imagen del Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Imagen del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S - F I J O S - R E S G U A R D O S" + Public Function GetActivosFijosResguardos(CveActivoFijo As Integer, CveActivoFijoResguardo As Integer, CveResponsable As Integer, CveResguardo As Integer, Optional CveEmpresa As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional Folio As Integer = -1, Optional CveResguardo2 As Integer = -1, Optional Tipo As Integer = -1, Optional CveProveedorPersonal As Integer = -1, Optional CveProveedor As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo + .Add("@CveResponsable", SqlDbType.Int).Value = CveResponsable + .Add("@CveResguardo", SqlDbType.Int).Value = CveResguardo + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveResguardo2", SqlDbType.Int).Value = CveResguardo2 + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Tipo", SqlDbType.Int).Value = Tipo + .Add("@CveProveedorPersonal", SqlDbType.Int).Value = CveProveedorPersonal + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Activos Fijos - Resguardos.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function ActivoFijoResguardoAdd(FechaInicio As Date, CvePersonal As Integer, CveUsuario As Integer, CveSubProyecto As Integer, CveActivoFijo As Integer, TipoDocto As String, Tipo As Integer, CveEmpresa As Integer, Optional Observaciones As String = " ", Optional CveResguardo As Integer = -1, Optional CveSubProyectoOrigen As Integer = -1, Optional CveProveedorPersonal As Integer = -1) As Boolean + 'Dim CveResguardo As Integer = -1 + Dim Retorno = False + DataAdapter("PA_AF_ActivosFijosResguardosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyectoOrigen + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@Tipo", SqlDbType.Int).Value = Tipo + .Add("@CveResguardo", SqlDbType.Int).Value = CveResguardo + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedorPersonal", SqlDbType.Int).Value = CveProveedorPersonal + .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + Try + SqlAdapter.Fill(Data) + FolioResguardo = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString().ToEntero() + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar el resguardo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function ActivoFijoResguardoGpo() As Integer + Dim CveResguardo As Integer = -1 + DataAdapter("PA_AF_ActivosFijosResguardosGpo") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveResguardo", SqlDbType.Int).Direction = ParameterDirection.Output + End With + Try + SqlAdapter.Fill(Data) + CveResguardo = SqlAdapter.SelectCommand.Parameters("@CveResguardo").Value.ToString().ToEntero() + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo del resguardo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return CveResguardo + End Function + Public Function ActivoFijoResguardoGpo2() As Integer + Dim CveResguardo As Integer = -1 + DataAdapter("PA_AF_ActivosFijosResguardosGpo2") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveResguardo", SqlDbType.Int).Direction = ParameterDirection.Output + End With + Try + SqlAdapter.Fill(Data) + CveResguardo = SqlAdapter.SelectCommand.Parameters("@CveResguardo").Value.ToString().ToEntero() + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo del resguardo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return CveResguardo + End Function + + Public Function UpdateActivosFijosResguardos(FechaFin As String, Observaciones As String, URL As String, CveActivoFijoResguardo As Integer, CveActivoFijo As Integer, Optional URL2 As String = "-1", Optional CveResguardo2 As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional CveUsuarioLibero As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaFin", SqlDbType.VarChar).Value = FechaFin + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@URL2", SqlDbType.VarChar).Value = URL2 + .Add("@CveResguardo2", SqlDbType.Int).Value = CveResguardo2 + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveUsuarioLibero", SqlDbType.Int).Value = CveUsuarioLibero + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateEstatusResguardo(EstatusResguardo As Integer, CveEmpresa As Integer, CveActivoFijo As Integer, Optional CveSubProyecto As Integer = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_UpdateEstatusResguardo") + 'ESTATUS RESGUARDO: 1- Disponible, 2- En Traslado, 3- Asignado + With SqlAdapter.SelectCommand.Parameters + .Add("@EstatusResguardo", SqlDbType.Int).Value = EstatusResguardo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosResguardosURL(URL As String, URL2 As String, CveActivoFijoResguardo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosUrlUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@URL2", SqlDbType.VarChar).Value = URL2 + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveActivoFijoResguardo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateActivosFijosResguardosURLGpo(URL As String, URL2 As String, CveResguardo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosResguardosGpoUrl") + + With SqlAdapter.SelectCommand.Parameters + .Add("@URL", SqlDbType.VarChar).Value = URL + .Add("@URL2", SqlDbType.VarChar).Value = URL2 + .Add("@CveActivoFijoResguardo", SqlDbType.Int).Value = CveResguardo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + +#End Region + +#Region "A C T I V O S - F I J O S - COMPRAS " + Public Function GetActivosFijosCompras(CveActivoFijo As Integer, Optional CveClasificacion As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivosFijosCompras") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As Exception + OnError("Ocurrió un error al obtener las Compras del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function +#End Region + +#Region " ************************************************ C A R A C T E R I S T I C A S ************************************************ " + +#Region "ClasificacionesCaracteristicas" + + Public Function GetCaracteristicasClasificaciones(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasClasificacionesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Data.TableName = "CaracteristicasClasificaciones" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Clasificaciones de Características.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddClasificacionesCaracteristicas(CaracteristicaClasificacion As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasClasificacionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaClasificacion", SqlDbType.VarChar).Value = CaracteristicaClasificacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateClasificacionesCaracteristicas(CaracteristicaClasificacion As String, Estatus As Boolean, CveCaracteristicaClasificacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasClasificacionesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaClasificacion", SqlDbType.VarChar).Value = CaracteristicaClasificacion + '.Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + '.Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Clasificacion de Caracteristica con el mismo nombre: " & CaracteristicaClasificacion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Clasificacion de Caracteristica", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveClasificacionesCaracteristicas(CveCaracteristicaClasificacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasClasificacionesRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Clasificacion de Caracteristica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Clasificacion de Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Clasificacion de Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + +#Region "Características" + Public Function GetCaracteristicas(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasGet") + + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + Try + SqlAdapter.Fill(Data) + Data.TableName = "Caracteristicas" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Características.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + + Return Retorno + End Function + Public Function AddCaracteristica(Caracteristica As String, CveCaracteristicaClasificacion As Integer, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, TipoCampo As Integer, Longitud As Integer, Requerido As Integer, Orden As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@TipoCampo", SqlDbType.TinyInt).Value = TipoCampo + .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + .Add("@Longitud", SqlDbType.Int).Value = Longitud + .Add("@Requerido", SqlDbType.Int).Value = Requerido + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Característica con el mismo nombre: " & Caracteristica & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Característica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCaracteristica(CveCaracteristicaClasificacion As Integer, Caracteristica As String, CveTipoActivoFijo As Integer, CveSubTipoActivoFijo As Integer, TipoCampo As Integer, Longitud As Integer, Requerida As Boolean, Orden As Integer, Estatus As Boolean, CveEmpresa As Integer, CveCaracteristica As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristica", SqlDbType.VarChar).Value = CveCaracteristica + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@CveCaracteristicaClasificacion", SqlDbType.Int).Value = CveCaracteristicaClasificacion + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@TipoCampo", SqlDbType.TinyInt).Value = TipoCampo + .Add("@Longitud", SqlDbType.Int).Value = Longitud + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@Requerida", SqlDbType.Bit).Value = Requerida + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Caracteristica con el mismo nombre: " & Caracteristica & ".", TipoMensaje.MsgAdvertencia) + ElseIf Ex1.Message.Contains("Número: 547;") Then + Alert("La Característica tiene Opciones que están siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Característica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveCaracteristica(CveCaracteristica As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Característica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Característica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Característica de Tipo de Cuenta y/o Equipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + +#Region "CaracteristicasOpciones" + + Public Function GetCaracteristicasOpciones(CveCaracteristica As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasOpcionesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Data.TableName = "CaracteristicasOpciones" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Opciones para las Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetCaracteristicasOpcionesSubTipo(CveCaracteristica As Integer, CveSubTipoActivoFijo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasOpcionesSubTipoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Data.TableName = "CaracteristicasOpciones" + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Opciones para las Caracteristicas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCaracteristicasOpciones(CaracteristicaOpcion As String, CveCaracteristica As Integer, Orden As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasOpcionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaOpcion", SqlDbType.VarChar).Value = CaracteristicaOpcion + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Opcion para la Caracteristica con el mismo nombre: " & CaracteristicaOpcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCaracteristicasOpciones(CveCaracteristica As Integer, CaracteristicaOpcion As String, Orden As Integer, Estatus As Boolean, CveCaracteristicaOpcion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasOpcionesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CaracteristicaOpcion", SqlDbType.VarChar).Value = CaracteristicaOpcion + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveCaracteristicaOpcion", SqlDbType.Int).Value = CveCaracteristicaOpcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe una Opcion para la Caracteristica con el mismo nombre: " & CaracteristicaOpcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveCaracteristicasOpciones(CveCaracteristicaOpcion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasOpcionesRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCaracteristicaOpcion", SqlDbType.Int).Value = CveCaracteristicaOpcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Opcion para la Caracteristica no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Opcion para la Caracteristica.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Opcion para la Caracteristica.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + +#Region "A C T I V O S V A L O R E S" + Public Function GetActivosFijosValores(CveActivoFijo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ActivoFijoValoresGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Valores de Activos Fijos .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al Guardar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + + End Try + + Return Retorno + End Function + + Public Function AddUpdActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresAddUpd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al Guardar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + + End Try + + Return Retorno + End Function + + Public Function UpdateActivosFijosValores(CveActivoFijo As Integer, CveCaracteristica As Integer, CveOpcion As Integer, Valor As String, CveUsuario As Integer, CveValor As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveOpcion", SqlDbType.Int).Value = CveOpcion + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveValor", SqlDbType.Int).Value = CveValor + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al guardar los cambios en el Valor del Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Valor del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveActivosFijosValores(CveActivoFijo As Integer, CveValor As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActivoFijoValoresRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + SqlAdapter.SelectCommand.Parameters.Add("@CveValor", SqlDbType.Int).Value = CveValor + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Valor de Activo Fijo no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Valor de Activo Fijo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Valor de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region +#End Region + +#Region "Subtipos Activos Fijos" + + Public Function GetSubTiposActivosFijos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_SubTiposActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Subtipos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddSubTiposActivosFijos(CveTipoActivoFijo As Integer, SubTipoActivoFijo As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@SubTipoActivoFijo", SqlDbType.VarChar).Value = SubTipoActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Subtipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateSubTiposActivosFijos(CveSubTipoActivoFijo As Integer, CveTipoActivoFijo As Integer, SubTipoActivoFijo As String, Estado As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@SubTipoActivoFijo", SqlDbType.VarChar).Value = SubTipoActivoFijo + .Add("@Estado", SqlDbType.Bit).Value = Estado + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Subtipo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveSubTiposActivosFijos(CveSubTiposActivosFijos As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTiposActivosFijos + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Subtipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "Tipos Activos Fijos" + + Public Function GetTiposActivosFijos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_TiposActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Tipos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddTiposActivosFijos(TipoActivoFijo As String, CuentaInicial As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoActivoFijo", SqlDbType.VarChar).Value = TipoActivoFijo + .Add("@CuentaInicial", SqlDbType.VarChar).Value = CuentaInicial + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Tipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposActivosFijos(CveTipoActivoFijo As Integer, TipoActivoFijo As String, CuentaInicial As Integer, Estado As Boolean) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTipoActivoFijo + .Add("@TipoActivoFijo", SqlDbType.VarChar).Value = TipoActivoFijo + .Add("@CuentaInicial", SqlDbType.VarChar).Value = CuentaInicial + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Tipo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveTiposActivosFijos(CveTiposActivosFijos As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveTipoActivoFijo", SqlDbType.Int).Value = CveTiposActivosFijos + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el tipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "A C T I V O S - S U B T I P O S " + + Public Function GetSubTiposCaracteristicas(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_SubTiposCaracteristicasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de caracteristicas de Subtipos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddSubTipoCaracteristica(CveSubTipoActivoFijo As Integer, CveCaracteristica As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposCaracteristicasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Subtipo de Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveSubTipoCaracteristica(CveSubTipoActivosFijos As Integer, CveCaracteristica As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubTiposCaracteristicasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivosFijos + .Add("@CveCaracteristica", SqlDbType.Int).Value = CveCaracteristica + End With + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Subtipo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ESTATUS DE ACTIVOS FIJOS" + Public Function GetEstatusActivoFijo() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_EstatusActivoFijoGet") + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddEstatusActivoFIjo(EstadoActivoFijo As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusActivoFijoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EstadoActivoFijo", SqlDbType.Int).Value = EstadoActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Departamento", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateEstatusActivoFijo(CveEstadoActivoFIjo As Integer, EstadoActivoFijo As Integer, Estado As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_EstatusActivoFijoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EstadoActivoFijo", SqlDbType.Int).Value = EstadoActivoFijo + .Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFIjo + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al guardar los cambios en el Estado del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function RemoveEstatusActivoFijo(CveEstadoActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusActivoFijoRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveEstadoActivoFijo", SqlDbType.Int).Value = CveEstadoActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Departamento no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Departamento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Departamento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFModelosActivosFijos" + Public Function GetModelosActivosFijos() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ModelosActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Modelos de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddModelosActivosFijos(ModeloActivoFijo As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ModelosActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@ModeloActivoFijo", SqlDbType.VarChar).Value = ModeloActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Modelo del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateModelosActivosFijos(CveModeloActivoFijo As Integer, ModeloActivoFijo As String, Estado As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ModelosActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModeloActivoFijo + .Add("@ModeloActivoFijo", SqlDbType.VarChar).Value = ModeloActivoFijo + .Add("@Estado", SqlDbType.Bit).Value = Estado + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Modelo del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveModelosActivosFijos(CveModelosActivosFijos As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ModelosActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveModeloActivoFijo", SqlDbType.Int).Value = CveModelosActivosFijos + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Modelo del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFMarcasActivosFijos" + Public Function GetMarcasActivosFijos() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_MarcasActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + '.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Marcas de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddMarcasActivosFijos(MarcaActivoFijo As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MarcasActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@MarcaActivoFijo", SqlDbType.VarChar).Value = MarcaActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar la Marca del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateMarcasActivosFijos(CveMarcaActivoFijo As Integer, MarcaActivoFijo As String, Estado As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MarcasActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo + .Add("@MarcaActivoFijo", SqlDbType.VarChar).Value = MarcaActivoFijo + .Add("@Estado", SqlDbType.Bit).Value = Estado + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Marca del Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveMarcasActivosFijos(CveMarcaActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_MarcasActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveMarcaActivoFijo", SqlDbType.Int).Value = CveMarcaActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar la Marca del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFConceptosHistorial" + + Public Function GetConceptosHistorial() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ConceptosHistorialGet") + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo Historial de Conceptos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddConceptosHistorial(ConceptoHistorialActivoFijo As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ConceptosHistorialAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@ConceptoHistorialActivoFijo", SqlDbType.VarChar).Value = ConceptoHistorialActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar el Concepto del Historial", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateDepartamento(CveConceptoHistorialActivoFijo As Integer, ConceptoHistorialActivoFijo As String, Estado As Boolean) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_RH_DepartamentoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo + .Add("@ConceptoHistorialActivoFijo", SqlDbType.VarChar).Value = ConceptoHistorialActivoFijo + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al guardar los cambios en el Concepto del Historial.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveConceptosHistorialRemove(CveConceptoHistorialActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ConceptosHistorialRemove") + SqlAdapter.SelectCommand.Parameters.Add("@CveConceptoHistorialActivoFijo", SqlDbType.Int).Value = CveConceptoHistorialActivoFijo + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar el Concepto del Historial.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ClsAFCaracteristicasActivosFijos" + + Public Function GetCaracteristicasActivosFijos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_CaracteristicasActivosFijos") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Características de Activos Fijos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCaracteristicasActivosFijos(CveActivoFijo As Integer, Caracteristica As String, EsRequerido As Boolean, EsUnico As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActivoFijo", SqlDbType.VarChar).Value = CveActivoFijo + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@EsRequerido", SqlDbType.Bit).Value = EsUnico + .Add("@EsUnico", SqlDbType.Bit).Value = EsRequerido + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al Guardar la Característica del Activo Fijo", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCaracteristicasActivosFijos(CveTipoActivoFijo As Integer, Caracteristica As String, EsRequerido As Boolean, EsUnico As Boolean, CveEmpresa As Integer, CveCaracteristicaActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasActivosFijosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoActivoFijo", SqlDbType.VarChar).Value = CveTipoActivoFijo + .Add("@Caracteristica", SqlDbType.VarChar).Value = Caracteristica + .Add("@EsRequerido", SqlDbType.Bit).Value = EsUnico + .Add("@EsUnico", SqlDbType.Bit).Value = EsRequerido + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCaracteristicaActivoFijo", SqlDbType.VarChar).Value = CveCaracteristicaActivoFijo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + OnError("Ocurrió un error al guardar los cambios en la Característica del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveCaracteristicasActivosFijos(CveCaracteristicaActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CaracteristicasActivosFijosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCaracteristicaActivoFijo", SqlDbType.Int).Value = CveCaracteristicaActivoFijo + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex As SqlException + Me.OnError("Ocurrió un error al eliminar la Característica del Activo Fijo.", Ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + + Public Function GetRepMaquinaria() As Boolean + Dim Retorno As Boolean = False + Dim StrSQL As New StringBuilder + + StrSQL.Append("SELECT + TipoActivoFijo, AF.CveSubTipoActivoFijo, + ISNULL(SubTipoActivoFijo, CONCAT('Total ', TipoActivoFijo)) AS SubTipoActivoFijo, + COUNT(*) AS Total, + SUM(CASE WHEN EstadoActivoFijo = 'Activo' THEN 1 ELSE 0 END) AS Disponible, + SUM(CASE WHEN EstadoActivoFijo = 'Activo' THEN 1 ELSE 0 END) / cast(COUNT(*) as money) AS Porcentaje ") + + StrSQL.Append("FROM ((AF_ActivosFijos AF + INNER JOIN AF_EstatusActivoFijo EAF ON AF.CveEstadoActivoFijo=EAF.CveEstadoActivoFijo) + INNER JOIN AF_SubTiposActivosFijos SAF ON AF.CveSubTipoActivoFijo=SAF.CveSubTipoActivoFijo) + INNER JOIN AF_TiposActivosFijos TAF ON SAF.CveTipoActivoFijo=TAF.CveTipoActivoFijo ") + + StrSQL.Append("WHERE NOT (EAF.EstadoActivoFijo='Baja' OR EAF.EstadoActivoFijo='Vendido') AND TAF.TipoActivoFijo='Maquinaria Pesada' AND AF.EsRentada=0 + GROUP BY GROUPING SETS ((TipoActivoFijo),(TipoActivoFijo, SubTipoActivoFijo, AF.CveSubTipoActivoFijo)) ") + + StrSQL.Append("ORDER BY CASE WHEN SubTipoActivoFijo IS NULL THEN 0 ELSE 1 END, TAF.TipoActivoFijo, SAF.SubTipoActivoFijo") + + DataAdapter(StrSQL.ToString, CommandType.Text) + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Maquinaria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetRepMaquinariaDetalle(CveSubTipoActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + Dim StrSQL As New StringBuilder() + + StrSQL.Append(" SELECT SAF.SubTipoActivoFijo, AF.Codigo, AF.Descripcion, AF.NoSerie, AF.Año, ISNULL (SP.SubProyecto, 'Sin Asignar') AS SubProyecto, ") + StrSQL.Append(" ISNULL (P.NombreCompleto, 'Sin Resguardo') AS Resguardo ") + StrSQL.Append(" FROM AF_ActivosFijos AF") + StrSQL.Append(" INNER JOIN AF_SubTiposActivosFijos SAF ON AF.CveSubTipoActivoFijo = SAF.CveSubTipoActivoFijo ") + StrSQL.Append(" LEFT JOIN SubProyectos SP ON AF.CveSubProyecto = SP.CveSubProyecto ") + StrSQL.Append(" LEFT JOIN RH_Personal P ON AF.CvePersonaResponsable = P.CvePersonal ") + StrSQL.Append(" WHERE AF.CveSubTipoActivoFijo = @CveSubTipoActivoFijo ") + + DataAdapter(StrSQL.ToString, CommandType.Text) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubTipoActivoFijo", SqlDbType.Int).Value = CveSubTipoActivoFijo + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Maquinaria Detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#Region "ValesCombustible" + Public Function AddValesCombustible(FolioUsuario As Integer, CveCompra As Integer, CveProveedor As Integer, CveAF As Integer, CvePersonal As Integer, Fecha As Date, NombreRecibe As String, CveSubProyecto As Integer, Observaciones As String, Odometro As Integer, CveCombustible As Integer, Litros As Double, TipoVale As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional Recibo As Integer = -1, Optional Importe As Integer = -1) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_AF_ValesCombustibleAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FolioUsuario", SqlDbType.Int).Value = FolioUsuario + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@NombreRecibe", SqlDbType.VarChar).Value = NombreRecibe + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Odometro", SqlDbType.Int).Value = Odometro + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + .Add("@Litros", SqlDbType.Float).Value = Litros + .Add("@Recibo", SqlDbType.Float).Value = Recibo + .Add("@Importe", SqlDbType.Float).Value = Importe + .Add("@TipoVale", SqlDbType.Int).Value = TipoVale + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveVale", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + FolioVale = SqlAdapter.SelectCommand.Parameters("@vFolio").Value.ToString.ToEntero + Retorno = SqlAdapter.SelectCommand.Parameters("@CveVale").Value.ToString.ToEntero + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Vale de Combustible con el mismo nombre: " & Descripcion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Vale de Combustible.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + + End Try + + Return Retorno + + End Function + + Public Function GetValesCombustible(CveCompra As Integer, CveValeCombustible As Integer, Folio As Integer, CveProveedor As Integer, CveAF As Integer, CveSubProyecto As Integer, Odometro As Integer, CveCombustible As Integer, Litros As Double, CvePersonal As Integer, CveUsuario As Integer, CveEmpresa As Integer, Recibo As Integer, Importe As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_AF_ValesCombustibleGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveValeCombustible", SqlDbType.Int).Value = CveValeCombustible + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Odometro", SqlDbType.Int).Value = Odometro + .Add("@CveCombustible", SqlDbType.Int).Value = CveCombustible + .Add("@Litros", SqlDbType.Float).Value = Litros + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Recibo", SqlDbType.Int).Value = Recibo + .Add("@Importe", SqlDbType.Int).Value = Importe + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Vales Combustible.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateValeCombustible(CveVale As Integer, CveCompra As Integer, CveProveedor As Integer, NombreRecibe As String, Litros As Double, Recibo As Integer, Importe As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ValesCombustibleUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVale", SqlDbType.Int).Value = CveVale + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@NombreRecibe", SqlDbType.VarChar).Value = NombreRecibe + .Add("@Litros", SqlDbType.Float).Value = Litros + .Add("@Recibo", SqlDbType.Int).Value = Recibo + .Add("@Importe", SqlDbType.Int).Value = Importe + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al actualizar la cuenta contable en el Activo Fijo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + + +#Region "M A Q U U I N A R I A" + + Public Function GetActividades(CveActividad As Integer, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddActividades(Actividad As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Actividad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActividades(CveActividad As Integer, Actividad As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Nombre", SqlDbType.VarChar).Value = Actividad + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteActividades(CveActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + Public Function GetCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividadGrupo(CheckListActividadGrupo As String, CveEmpresa As Integer, Estatus As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividadGrupo", SqlDbType.VarChar).Value = CheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CheckListActividadGrupo As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividad(CheckListActividad As String, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividad(CveCheckListActividad As Integer, CheckListActividad As String, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer, Estatus As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividad(CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + + + + + 'TipoServicio + + 'Public Function GetTiposServicios(CveTipoServicio As Integer, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_AF_TiposServicioGet") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + ' .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + + + + + + + + + '''Operador + ''' + Public Function GetOperador(CveOperador As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los operadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddOperador(Operador As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Operador", SqlDbType.VarChar).Value = Operador + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el operador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateOperador(CveOperador As Integer, Operador As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@Operador", SqlDbType.VarChar).Value = Operador + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el operador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveOperador(CveOperador As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el operador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + '''Horometro diario + Public Function GetHorometroDiario(FechaI As Date, FechaF As Date, CveHorometroDiario As Integer, CveActivoFijo As Integer, CveOperador As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los operadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddHorometroDiario(CveActivoFijo As Integer, CveOperador As Integer, CveSubProyecto As Integer, Fecha As Date, Entrada As Decimal, Salida As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + CveHorometroDiario = -1 + + DataAdapter("PA_AF_HorometroDiarioAdd") + + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Entrada", SqlDbType.Money).Value = Entrada + .Add("@Salida", SqlDbType.Money).Value = Salida + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveHorometroDiario", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + CveHorometroDiario = SqlAdapter.SelectCommand.Parameters("@CveHorometroDiario").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Horometro Diario", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateHorometroDiario(CveHorometroDiario As Integer, CveActivoFijo As Integer, CveOperador As Integer, CveSubProyecto As Integer, Fecha As Date, Entrada As Decimal, Salida As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Entrada", SqlDbType.Money).Value = Entrada + .Add("@Salida", SqlDbType.Money).Value = Salida + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Horometro Diario", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveHorometroDiario(CveOperador As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OperadoresRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Horometro Diario", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + '''Horometro diario detalle + Public Function GetHorometroDiarioDetalleDetalle(CveHorometroDiario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddHorometroDiarioDetalle(CveHorometroDiario As Integer, CveActividad As Integer, Horas As Decimal) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleAdd") + + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Horas", SqlDbType.Money).Value = Horas + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateHorometroDiarioDetalle(CveHorometroDiarioDetalle As Integer, CveHorometroDiario As Integer, CveActividad As Integer, Horas As Decimal) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleUpdate") + + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveHorometroDiarioDetalle", SqlDbType.Int).Value = CveHorometroDiarioDetalle + .Add("@CveHorometroDiario", SqlDbType.Int).Value = CveHorometroDiario + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Horas", SqlDbType.Money).Value = Horas + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveHorometroDiarioDetalle(CveHorometroDiarioDetalle As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HorometroDiarioDetalleRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHorometroDiarioDetalle", SqlDbType.Int).Value = CveHorometroDiarioDetalle + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Horometro Diario detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + 'Actividades OT + + Public Function GetActividadesOT(CveActividadOT As Integer, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddActividadesOT(ActividadOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, CvePuesto As Integer, Horas As Decimal) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@ActividadOT", SqlDbType.NVarChar).Value = ActividadOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Horas", SqlDbType.Money).Value = Horas + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActividadesOT(CveActividadOT As Integer, ActividadOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, CvePuesto As Integer, Horas As Decimal) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@ActividadOT", SqlDbType.VarChar).Value = ActividadOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Horas", SqlDbType.Money).Value = Horas + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteActividadesOT(CveActividadOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesOTDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + 'Tipo OT + + Public Function GetTiposOT(CveOrdenTrabajoTipo As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposOT(OrdenTrabajoTipo As String, CveUsuario As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@OrdenTrabajoTipo", SqlDbType.VarChar).Value = OrdenTrabajoTipo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposOT(CveOrdenTrabajoTipo As Integer, OrdenTrabajoTipo As String, CveUsuario As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@OrdenTrabajoTipo", SqlDbType.VarChar).Value = OrdenTrabajoTipo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposOT(CveOrdenTrabajoTipo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposOTDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + 'Herramientas OT + + Public Function GetHerramientasOT(CveHerramientaOT As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddHerramientasOT(HerramientaOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@HerramientaOT", SqlDbType.VarChar).Value = HerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateHerramientasOT(CveHerramientaOT As Integer, HerramientaOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHerramientaOT", SqlDbType.NVarChar).Value = CveHerramientaOT + .Add("@HerramientaOT", SqlDbType.VarChar).Value = HerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteHerramientasOT(CveHerramientaOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_HerramientasOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + 'Estatus OT + + Public Function GetEstatusOT(CveEstatusOT As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Etapas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddEstatusOT(EstatusOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EstatusOT", SqlDbType.VarChar).Value = EstatusOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la Etapa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateEstatusOT(CveEstatusOT As Integer, EstatusOT As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@EstatusOT", SqlDbType.VarChar).Value = EstatusOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Etapa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeletEstatusOT(CveEstatusOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_EstatusOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la etapa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + 'Sub Contrataciones + + Public Function GetSubContratacionOT(CveSubContratacion As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Sub Contrataciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddSubContratacionOT(SubContratacion As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@SubContratacion", SqlDbType.VarChar).Value = SubContratacion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateSubContratacionOT(CveSubContratacion As Integer, SubContratacion As String, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@SubContratacion", SqlDbType.VarChar).Value = SubContratacion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveSubContratacionOT(CveSubContratacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_SubContratacionOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + + +#End Region + + + + +#Region "Tipo Orden de trabajo" 'PLATILLAS PARA ORDENES DE TRABAJO + + + 'Tipo Orden de trabajo + + Public Function GetTiposServicios(CveTipoServicio As Integer, CveOrdenTrabajoTipo As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposServicios(Nombre As String, CveOrdenTrabajoTipo As Integer, Duracion As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + CveTipoServicio = -1 + DataAdapter("PA_AF_TiposServicioAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@Duracion", SqlDbType.Money).Value = Duracion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveTipoServicio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + + CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposServicios(CveTipoServicio As Integer, Nombre As String, CveOrdenTrabajoTipo As Integer, Duracion As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CveOrdenTrabajoTipo", SqlDbType.Int).Value = CveOrdenTrabajoTipo + .Add("@Duracion", SqlDbType.Money).Value = Duracion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposServicios(CveTipoServicio As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServicioDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el tipo de orden.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + 'MATERIALES + Public Function GetTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los materiales de los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposServiciosMaterial(CveTipoServicio As Integer, Cantidad As Decimal, CveUM As Integer, CvePS As Integer, + Tipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@CveUM", SqlDbType.Int).Value = CveUM + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer, Cantidad As Decimal, CveUM As Integer, CvePS As Integer, + Tipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@CveUM", SqlDbType.Int).Value = CveUM + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosMaterialDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + ' A C T I V I D A D E S + Public Function GetTiposServiciosActividades(CveTipoServicioActividad As Integer, CveTipoServicio As Integer, CveActividadOT As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposServiciosActividades(CveActividadOT As Integer, CveTipoServicio As Integer, Duracion As Decimal, Observaciones As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion + .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposServiciosActividades(CveTipoServicioActividad As Integer, CveActividadOT As Integer, Duracion As Decimal, Observaciones As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad + .Add("@CveActividadOT", SqlDbType.Int).Value = CveActividadOT + .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion + .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposServiciosActividades(CveTipoServicioActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TiposServiciosActividadesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + '''CheckList + ''' + + Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckList(CveCheckList As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + 'herramienta + + Public Function GetTiposServiciosHerramientasOT(CveTipoServicio As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTiposServiciosHerramientasOT(CveTipoServicio As Integer, CveHerramientaOT As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTiposServiciosHerramientasOT(CveTipoServicioHerramientaOT As Integer, CveTipoServicio As Integer, CveHerramientaOT As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioHerramientaOT", SqlDbType.Int).Value = CveTipoServicioHerramientaOT + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveHerramientaOT", SqlDbType.Int).Value = CveHerramientaOT + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteTiposServiciosHerramientasOT(CveTipoServicioHerramientaOT As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioHerramientasOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioHerramientaOT", SqlDbType.Int).Value = CveTipoServicioHerramientaOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la herramienta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + 'Sub Contrataciones + + Public Function GetTipoServicioSubContratacionOT(CveTipoServicio As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Sub Contrataciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddTipoServicioSubContratacionOT(CveTipoServicio As Integer, CveSubContratacion As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.VarChar).Value = CveTipoServicio + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTipoServicioSubContratacionOT(CveTipoServicioSubContratacion As Integer, CveTipoServicio As Integer, CveSubContratacion As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioSubContratacion", SqlDbType.Int).Value = CveTipoServicioSubContratacion + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveSubContratacion", SqlDbType.Int).Value = CveSubContratacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveTipoServicioSubContratacionOT(CveTipoServicioSubContratacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_TipoServicioSubContratacionOTRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicioSubContratacion", SqlDbType.Int).Value = CveTipoServicioSubContratacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la Sub Contratacion", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + +#End Region + + +#Region "ORDEN DE TRABAJO" + + Public Function GetOrdenesTrabajo(CveOrdenTrabajo As Integer, CveTipoServicio As Integer, Folio As Integer, CveAF As Integer, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer, CveOperador As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + '.Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar las ordenes de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function AddOrdenesTrabajo(CveTipoServicio As Integer, CveAF As Integer, Servicio As String, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer, CveOperador As Integer, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + '.Add("@Servicio", SqlDbType.VarChar).Value = Servicio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output + + End With + + Try + SqlAdapter.Fill(Data) + + CveOrdenTrabajo = SqlAdapter.SelectCommand.Parameters("@CveOrdenTrabajo").Value.ToString.ToEntero + FolioOT = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function UpdateOrdenesTrabajo(CveOrdenTrabajo As Integer, CveTipoServicio As Integer, CveAF As Integer, Servicio As String, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer, CveOperador As Integer, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoUpdate") + + With SqlAdapter.SelectCommand.Parameters + + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Servicio", SqlDbType.VarChar).Value = Servicio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveOperador", SqlDbType.Int).Value = CveOperador + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + + + + + + Public Function GetOrdenesTrabajoMateriales(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoMaterialesGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los materiales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetOrdenesTrabajoActividades(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoActividadesGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetOrdenesTrabajoCheckList(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoCheckListGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function GetOrdenesTrabajoHerramientas(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoHerramientasGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function GetOrdenesTrabajoSubContrataciones(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoSubContratacionesGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + + Public Function UpdateOrdenesTrabajoActividades(CveOrdenTrabajoActividad As Integer, Valor As String, Terminado As Integer, Observaciones As String, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajoActividad", SqlDbType.Int).Value = CveOrdenTrabajoActividad + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@Terminado", SqlDbType.Int).Value = Terminado + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + + Public Function UpdateOrdenesTrabajoCheckList(CveOrdenTrabajoCheckList As Integer, Valor As String, Terminado As Integer, Observaciones As String, Estatus As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoCheckListUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajoCheckList", SqlDbType.Int).Value = CveOrdenTrabajoCheckList + .Add("@Valor", SqlDbType.VarChar).Value = Valor + .Add("@Terminado", SqlDbType.Int).Value = Terminado + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el check list", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function GetOrdenesTrabajoAF(CveOrdenTrabajo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoAFGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Value = CveOrdenTrabajo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los activos Fijos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + +#End Region + + + + + + + + +#Region " IDisposable Support " + ' IDisposable + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not disposedValue Then + If disposing Then + ConexionUpdate() + ' TODO: Liberar otro estado (objetos administrados). + + If Not Data Is Nothing Then Data.Dispose() + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If Not SqlConexion Is Nothing Then SqlConexion.Dispose() + + End If + + ' TODO: Liberar su propio estado (objetos no administrados). + ' TODO: Establecer campos grandes como Null. + End If + disposedValue = True + End Sub + + ' Visual Basic agregó este código para implementar correctamente el modelo descartable. + Public Sub Dispose() Implements IDisposable.Dispose + ' No cambie este código. Coloque el código de limpieza en Dispose (ByVal que se dispone como Boolean). + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region +End Class diff --git a/MQ/ContratosMaquinariaRentada.aspx b/MQ/ContratosMaquinariaRentada.aspx new file mode 100644 index 000000000..d6d68661c --- /dev/null +++ b/MQ/ContratosMaquinariaRentada.aspx @@ -0,0 +1,320 @@ +<%@ Page Title="Contrato Maquinaria Rentada" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="ContratosMaquinariaRentada.aspx.vb" Inherits="AF_ContratosMaquinariaRentada" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Contrato Maquinaria Rentada + + + +<%-- + +
  • + +
  • + +
    +
    --%> + +
    + + + + + + + + + + +
    + +
    +
    +
    +
    + +
    +
    Datos Generales
    +
    +
    + + + + + + +
    + + + + + +
    + + +
    + + + + + + +
    + + +
    + + + + + +
    + + + <%--
    + + + + +
    --%> + + + + + +
    + +
    + +
    + + +
    + + + + + + + + + + +
    +
    + +
    + + + + + + + +
    + +
    + + + + + + +
    + + + +
    +
    +
    + + + + <%--
    +
    +
    +
    + +
    +
    Horómetro
    +
    +
    + +
    + +
    + + + + + + + + +
    + +
    + + + + + + +
    + +
    + +
    +
    +
    --%> +
    + +
    +
    + + + + + + +
    +
    +
    +
    +
    + +
    +
    Trabajos realizados
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    +
    + + + + + + + + + + + +
    +
    + + +
    + + + + + + + + + + + +
    + + + + + <%-- --%> + + +
    + + + + \ No newline at end of file diff --git a/MQ/ContratosMaquinariaRentada.aspx.vb b/MQ/ContratosMaquinariaRentada.aspx.vb new file mode 100644 index 000000000..af46bc28a --- /dev/null +++ b/MQ/ContratosMaquinariaRentada.aspx.vb @@ -0,0 +1,364 @@ +Option Strict On + +Imports System.Data +Imports System.Globalization +Imports System.Linq +Imports Extensiones + +Partial Class AF_ContratosMaquinariaRentada + Inherits ClsPaginas + + Protected Property CveHorometroDiario As Integer + Get + If ViewState("CveHorometroDiario") Is Nothing Then + Return -1 + Else + Return ViewState("CveHorometroDiario").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveHorometroDiario") = value + End Set + End Property + + Protected Property CveHorometroDiarioDetalle As Integer + Get + If ViewState("CveHorometroDiarioDetalle") Is Nothing Then + Return -1 + Else + Return ViewState("CveHorometroDiarioDetalle").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveHorometroDiarioDetalle") = value + End Set + End Property + + + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + + CargCombos() + + + If Request("CveHorometroDiario") IsNot Nothing AndAlso Request("CveHorometroDiario").ToString.ToEntero > 0 Then + CveHorometroDiario = Request("CveHorometroDiario").ToString.ToEntero + + ' LnkAgregarHorometroDiarioDetalle.Visible = True + DVDetalles.Visible = True + + CargaDatos() + CargaDetalles() + + End If + + + End If + + End Sub + + Private Sub CargCombos() + + + DdlSubProyecto.Items.Clear() + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + Dim ObjAF As New ClsAF() + + 'If ObjAF.GetOperador(-1, UsuarioActual.CveEmpresa) Then + ' DdlOperador.DataSource = ObjAF.DtResultados.FiltraParametros("Estatus = 1") + 'Else + ' DdlOperador.DataSource = Nothing + 'End If + 'ObjAF.Dispose() + + 'DdlOperador.DataBind() + 'DdlOperador.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpDatosGenerales.Update() + + + + 'ObjAF = New ClsAF() + + 'If ObjAF.GetActividades(-1, -1, UsuarioActual.CveEmpresa, 1) Then + ' DdlActividad.DataSource = ObjAF.DtResultados + 'Else + ' DdlActividad.DataSource = Nothing + 'End If + + + + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa) + + + ObjAF.Dispose() + + 'DdlActividad.DataBind() + 'DdlActividad.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + DdlAF.DataBind() + DdlAF.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + + End Sub + + Private Sub CargaDatos() + + + 'If CveHorometroDiario > 0 Then + + ' Dim ObjAF As New ClsAF + + ' If ObjAF.GetHorometroDiario(MinFecha, MaxFecha, CveHorometroDiario, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + + ' DdlAF.SelectedValueExist(ObjAF.DtResultados.Rows(0)("CveActivoFijo").ToString.ToEntero) + ' 'DdlOperador.SelectedValueExist(ObjAF.DtResultados.Rows(0)("CveOperador").ToString.ToEntero) + ' DdlSubProyecto.SelectedValueExist(ObjAF.DtResultados.Rows(0)("CveSubProyecto").ToString.ToEntero) + + ' TxtFecha.Text = ObjAF.DtResultados.Rows(0)("Fecha").ToString.ToDate.ToString("dd/MM/yyyy") + + ' TxtEntrada.Text = ObjAF.DtResultados.Rows(0)("Entrada").ToString + ' TxtSalida.Text = ObjAF.DtResultados.Rows(0)("Salida").ToString + + ' End If + + ' ObjAF.Dispose() + ' UpDatosGenerales.Update() + + 'End If + + End Sub + + Private Sub CargaDetalles() + + 'Dim ObjAF As New ClsAF + + 'If ObjAF.GetHorometroDiarioDetalleDetalle(CveHorometroDiario, UsuarioActual.CveEmpresa) Then + ' GvDatos.DataSource = ObjAF.DtResultados + 'Else + ' GvDatos.DataSource = Nothing + 'End If + + 'ObjAF.Dispose() + 'GvDatos.DataBind() + + 'UpDatosDetalle.Update() + + End Sub + + + 'Protected Sub LnkAgregarHorometroDiarioDetalle_Click(sender As Object, e As EventArgs) Handles LnkAgregarHorometroDiarioDetalle.Click + + + ' CveHorometroDiarioDetalle = -1 + ' 'LtlTituloModalDetalle.Text = "Agregar Detalle" + ' ResetModalActividades() + ' RegistraScript($"$('#DVModalHorometroDetalle').modal('show');") + + 'End Sub + + Private Sub ResetModalActividades() + + 'DdlActividad.SelectedValueExist(-1) + ' TxtHoras.Text = "" + 'UpModalHorometroDetalle.Update() + + End Sub + + Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + + 'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + '' LtlTituloModalDetalle.Text = "Actualizar Detalle" + + 'CveHorometroDiarioDetalle = GvRow.DataKey("CveHorometroDiarioDetalle").ToEntero + 'DdlActividad.SelectedValueExist(GvRow.DataKey("CveActividad").ToString) + 'TxtHoras.Text = GvRow.DataKey("Horas").ToEntero.ToString + + 'UpModalHorometroDetalle.Update() + + 'RegistraScript($"$('#DVModalHorometroDetalle').modal('show');") + + End Sub + + 'Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnModalAgregarHorometroDetalle.Click + + + ' Dim ObjAF As New ClsAF + ' Dim ErrorProceso As Boolean = False + + ' If CveHorometroDiarioDetalle > 0 Then + + ' If ObjAF.UpdateHorometroDiarioDetalle(CveHorometroDiarioDetalle, CveHorometroDiario, DdlActividad.SelectedValue.ToEntero, TxtHoras.Text.ToDecimal) Then + ' Alert("Detalle agregado correctamente.") + ' RegistraScript($"$('#DVModalHorometroDetalle').modal('hide');") + ' ErrorProceso = False + ' Else + ' ErrorProceso = True + ' End If + + ' Else + ' If ObjAF.AddHorometroDiarioDetalle(CveHorometroDiario, DdlActividad.SelectedValue.ToEntero, TxtHoras.Text.ToDecimal) Then + ' Alert("Detalle actualizado correctamente.") + ' RegistraScript($"$('#DVModalHorometroDetalle').modal('hide');") + ' ErrorProceso = False + ' Else + ' ErrorProceso = True + ' End If + ' End If + + + + ' ObjAF.Dispose() + + ' If Not ErrorProceso Then + ' CargaDetalles() + ' End If + + + 'End Sub + + Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs) + + 'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + 'Dim ErrorProceso As Boolean = False + + 'Dim ObjAF As New ClsAF + 'Dim CveHorometroDiarioDetalleEliminar As Integer = GvRow.DataKey("CveHorometroDiarioDetalle").ToEntero + + 'If ObjAF.RemoveHorometroDiarioDetalle(CveHorometroDiarioDetalleEliminar) Then + ' Alert("Detalle eliminado correctamente.") + ' ErrorProceso = False + 'Else + ' ErrorProceso = True + 'End If + + 'ObjAF.Dispose() + + 'If Not ErrorProceso Then + ' CargaDetalles() + 'End If + + End Sub + + Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + + + + + 'If TxtEntrada.Text.ToDecimal > TxtSalida.Text.ToDecimal Then + ' Alert("La salida no puede ser inferior a la entrada", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + + 'Dim ErrorProceso As Boolean = False + 'Dim ObjAF As New ClsAF + + 'ObjAF.IniciaTransacSQL() + + + 'Dim Anio As Integer = TxtFecha.Text.ToDate.Year + 'Dim Semana As Integer = GetIso8601WeekOfYear(TxtFecha.Text.ToDate) + 'Dim DiaSemana As Integer = GetDayOfWeek(TxtFecha.Text.ToDate.DayOfWeek) + + + 'If CveHorometroDiario > 0 Then + + ' If ObjAF.UpdateHorometroDiario(CveHorometroDiario, DdlAF.SelectedValue.ToEntero, DdlOperador.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, TxtFecha.Text.ToDate, TxtEntrada.Text.ToDecimal, TxtSalida.Text.ToDecimal, + ' UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Anio, Semana, DiaSemana) Then + ' Alert("Actualizado correctamente.") + ' Else + ' ErrorProceso = True + ' End If + + 'Else + + ' If ObjAF.AddHorometroDiario(DdlAF.SelectedValue.ToEntero, DdlOperador.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, TxtFecha.Text.ToDate, TxtEntrada.Text.ToDecimal, TxtSalida.Text.ToDecimal, UsuarioActual.CveUsuario, + ' UsuarioActual.CveEmpresa, Anio, Semana, DiaSemana) Then + + ' CveHorometroDiario = ObjAF.CveHorometroDiario + + ' If CveHorometroDiario > 0 Then + + ' ErrorProceso = False + ' Alert("Regsitro guardado correctamente.", TipoMensaje.MsgInformacion, $"location.href=""HorometroDiario.aspx?CveHorometroDiario={CveHorometroDiario}""") + + ' Else + ' ErrorProceso = True + ' End If + ' Else + ' ErrorProceso = True + ' End If + + 'End If + + + + + + 'If ErrorProceso Then + ' ObjAF.RollBack() + 'Else + ' ObjAF.Commit() + 'End If + + 'ObjAF.Dispose() + + End Sub + + + + + + + Private Function GetIso8601WeekOfYear(time As Date) As Integer + + + ' Seriously cheat. If its Monday, Tuesday Or Wednesday, then it'll + ' be the same week# as whatever Thursday, Friday Or Saturday are, + ' And we always get those right + Dim day As DayOfWeek = CultureInfo.InvariantCulture.Calendar.GetDayOfWeek(time) + + If (day >= DayOfWeek.Monday And day <= DayOfWeek.Wednesday) Then + time = time.AddDays(3) + End If + + + + ' Return the week of our adjusted day + Return CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(time, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday) + + End Function + + Private Function GetDayOfWeek(Dia As DayOfWeek) As Integer + + Select Case Dia + Case DayOfWeek.Monday + Return 1 + Case DayOfWeek.Tuesday + Return 2 + Case DayOfWeek.Wednesday + Return 3 + Case DayOfWeek.Thursday + Return 4 + Case DayOfWeek.Friday + Return 5 + Case DayOfWeek.Saturday + Return 6 + Case DayOfWeek.Sunday + Return 7 + Case Else + Return 1 + End Select + + End Function + + + + + +End Class diff --git a/MQ/HorometroDiario.aspx b/MQ/HorometroDiario.aspx new file mode 100644 index 000000000..ec28674bc --- /dev/null +++ b/MQ/HorometroDiario.aspx @@ -0,0 +1,284 @@ +<%@ Page Title="Horometro Diario" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="HorometroDiario.aspx.vb" Inherits="AF_HorometroDiario" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Registro Horómetro Diario + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + +
    + +
    +
    +
    +
    + +
    +
    Datos Generales
    +
    +
    + +
    + + + + + +
    + + + + +
    + + + + + +
    + + + +
    + + + + +
    + + + + + +
    + +
    + +
    + + +
    + + + + + + + + + + +
    +
    + +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    Horómetro
    +
    +
    + +
    + +
    + + + + + + + + +
    + +
    + + + + + + +
    + +
    + +
    +
    +
    +
    + +
    +
    + + + + + + +
    +
    +
    +
    +
    + +
    +
    Trabajos realizados
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    +
    + + + + + + + + + + + +
    +
    + + +
    + + + + + + + + + + + +
    + + + + + + + +
    + + + + \ No newline at end of file diff --git a/MQ/HorometroDiario.aspx.vb b/MQ/HorometroDiario.aspx.vb new file mode 100644 index 000000000..d4c1749d1 --- /dev/null +++ b/MQ/HorometroDiario.aspx.vb @@ -0,0 +1,309 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class AF_HorometroDiario + Inherits ClsPaginas + + Protected Property CveHorometroDiario As Integer + Get + If ViewState("CveHorometroDiario") Is Nothing Then + Return -1 + Else + Return ViewState("CveHorometroDiario").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveHorometroDiario") = value + End Set + End Property + + Protected Property CveHorometroDiarioDetalle As Integer + Get + If ViewState("CveHorometroDiarioDetalle") Is Nothing Then + Return -1 + Else + Return ViewState("CveHorometroDiarioDetalle").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveHorometroDiarioDetalle") = value + End Set + End Property + + + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + + CargCombos() + + + If Request("CveHorometroDiario") IsNot Nothing AndAlso Request("CveHorometroDiario").ToString.ToEntero > 0 Then + CveHorometroDiario = Request("CveHorometroDiario").ToString.ToEntero + + LnkAgregarHorometroDiarioDetalle.Visible = True + DVDetalles.Visible = True + + CargaDatos() + CargaDetalles() + + End If + + + End If + + End Sub + + Private Sub CargCombos() + + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa) + DdlAF.DataBind() + + + DdlSubProyecto.Items.Clear() + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + Dim ObjAF As New ClsAF() + + If ObjAF.GetOperador(-1, UsuarioActual.CveEmpresa) Then + DdlOperador.DataSource = ObjAF.DtResultados.FiltraParametros("Estatus = 1") + Else + DdlOperador.DataSource = Nothing + End If + ObjAF.Dispose() + + DdlOperador.DataBind() + DdlOperador.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpDatosGenerales.Update() + + + + ObjAF = New ClsAF() + + If ObjAF.GetActividades(-1, -1, UsuarioActual.CveEmpresa, 1) Then + DdlActividad.DataSource = ObjAF.DtResultados + Else + DdlActividad.DataSource = Nothing + End If + ObjAF.Dispose() + + DdlActividad.DataBind() + DdlActividad.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + + End Sub + + Private Sub CargaDatos() + + + If CveHorometroDiario > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.GetHorometroDiario(MinFecha, MaxFecha, CveHorometroDiario, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + + DdlAF.SelectedValueExist(ObjAF.DtResultados.Rows(0)("CveActivoFijo").ToString.ToEntero) + DdlOperador.SelectedValueExist(ObjAF.DtResultados.Rows(0)("CveOperador").ToString.ToEntero) + DdlSubProyecto.SelectedValueExist(ObjAF.DtResultados.Rows(0)("CveSubProyecto").ToString.ToEntero) + + TxtFecha.Text = ObjAF.DtResultados.Rows(0)("Fecha").ToString.ToDate.ToString("dd/MM/yyyy") + + TxtEntrada.Text = ObjAF.DtResultados.Rows(0)("Entrada").ToString + TxtSalida.Text = ObjAF.DtResultados.Rows(0)("Salida").ToString + + End If + + ObjAF.Dispose() + UpDatosGenerales.Update() + + End If + + End Sub + + Private Sub CargaDetalles() + + Dim ObjAF As New ClsAF + + If ObjAF.GetHorometroDiarioDetalleDetalle(CveHorometroDiario, UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjAF.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjAF.Dispose() + GvDatos.DataBind() + + UpDatosDetalle.Update() + + End Sub + + + Protected Sub LnkAgregarHorometroDiarioDetalle_Click(sender As Object, e As EventArgs) Handles LnkAgregarHorometroDiarioDetalle.Click + + + CveHorometroDiarioDetalle = -1 + LtlTituloModalDetalle.Text = "Agregar Detalle" + ResetModalActividades() + RegistraScript($"$('#DVModalHorometroDetalle').modal('show');") + + End Sub + + Private Sub ResetModalActividades() + + DdlActividad.SelectedValueExist(-1) + TxtHoras.Text = "" + UpModalHorometroDetalle.Update() + + End Sub + + Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + LtlTituloModalDetalle.Text = "Actualizar Detalle" + + CveHorometroDiarioDetalle = GvRow.DataKey("CveHorometroDiarioDetalle").ToEntero + DdlActividad.SelectedValueExist(GvRow.DataKey("CveActividad").ToString) + TxtHoras.Text = GvRow.DataKey("Horas").ToEntero.ToString + + UpModalHorometroDetalle.Update() + + RegistraScript($"$('#DVModalHorometroDetalle').modal('show');") + + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnModalAgregarHorometroDetalle.Click + + + Dim ObjAF As New ClsAF + Dim ErrorProceso As Boolean = False + + If CveHorometroDiarioDetalle > 0 Then + + If ObjAF.UpdateHorometroDiarioDetalle(CveHorometroDiarioDetalle, CveHorometroDiario, DdlActividad.SelectedValue.ToEntero, TxtHoras.Text.ToDecimal) Then + Alert("Detalle agregado correctamente.") + RegistraScript($"$('#DVModalHorometroDetalle').modal('hide');") + ErrorProceso = False + Else + ErrorProceso = True + End If + + Else + If ObjAF.AddHorometroDiarioDetalle(CveHorometroDiario, DdlActividad.SelectedValue.ToEntero, TxtHoras.Text.ToDecimal) Then + Alert("Detalle actualizado correctamente.") + RegistraScript($"$('#DVModalHorometroDetalle').modal('hide');") + ErrorProceso = False + Else + ErrorProceso = True + End If + End If + + + + ObjAF.Dispose() + + If Not ErrorProceso Then + CargaDetalles() + End If + + + End Sub + + Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ErrorProceso As Boolean = False + + Dim ObjAF As New ClsAF + Dim CveHorometroDiarioDetalleEliminar As Integer = GvRow.DataKey("CveHorometroDiarioDetalle").ToEntero + + If ObjAF.RemoveHorometroDiarioDetalle(CveHorometroDiarioDetalleEliminar) Then + Alert("Detalle eliminado correctamente.") + ErrorProceso = False + Else + ErrorProceso = True + End If + + ObjAF.Dispose() + + If Not ErrorProceso Then + CargaDetalles() + End If + + End Sub + + Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + + Dim ErrorProceso As Boolean = False + Dim ObjAF As New ClsAF + + ObjAF.IniciaTransacSQL() + + If CveHorometroDiario > 0 Then + + If ObjAF.UpdateHorometroDiario(CveHorometroDiario, DdlAF.SelectedValue.ToEntero, DdlOperador.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, TxtFecha.Text.ToDate, TxtEntrada.Text.ToDecimal, TxtSalida.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + Alert("Actualizado correctamente.") + Else + ErrorProceso = True + End If + + Else + + If ObjAF.AddHorometroDiario(DdlAF.SelectedValue.ToEntero, DdlOperador.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, TxtFecha.Text.ToDate, TxtEntrada.Text.ToDecimal, TxtSalida.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + + CveHorometroDiario = ObjAF.CveHorometroDiario + + If CveHorometroDiario > 0 Then + + ErrorProceso = False + Alert("Regsitro guardado correctamente.", TipoMensaje.MsgInformacion, $"location.href=""HorometroDiario.aspx?CveHorometroDiario={CveHorometroDiario}""") + + Else + ErrorProceso = True + End If + Else + ErrorProceso = True + End If + + End If + + + + + + If ErrorProceso Then + ObjAF.RollBack() + Else + ObjAF.Commit() + End If + + ObjAF.Dispose() + + End Sub + + Private Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubProyecto.SelectedIndexChanged + + DdlAF.Items.Clear() + + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue}") + DdlAF.DataBind() + Else + DdlAF.DataSource = Nothing + DdlAF.DataBind() + End If + + DdlAF.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpDatosGenerales.Update() + + End Sub + + +End Class diff --git a/MQ/OrdenTrabajo.aspx b/MQ/OrdenTrabajo.aspx new file mode 100644 index 000000000..a14d0618e --- /dev/null +++ b/MQ/OrdenTrabajo.aspx @@ -0,0 +1,621 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OrdenTrabajo.aspx.vb" Inherits="AF_OrdenTrabajo" EnableEventValidation = "false" %> + + + + + + + + + + Ordenes de Trabajo + + + + + + + + + +
    + +
    +
    +
    +
    + + + +
    +
    +
    + <%--
    +
    +
    + + +
    + +
    + + + + +
    + + +
    + + + + +
    + + +
    + + + +
    + +
    + + Seleccione Uno + + + + +
    + + + + + <%--
    + + + + +
    + --%> + + +
    + + +
    + +
    + +
    +
    +
    +
    + + + +
    +
    +
    + <%--
    +
    +
    + + +
    + +
    + +
    + +
    + + + + +
    + +
    + <%--
    +
    + + + +
    +
    --%> + +
    + + +
    + + Baja + Media + Alta + + +
    + + +
    +
    +
    + + +
    + + + + +
    + + + + + + + +
    + +
    +
    +
    + +
    + + + + +
    + + + <%----%> + + <%----%> + +
    + +
    +
    + +
    + +
    + + + + + +
    +
    + + + + + +
    + + +
    +
    +
    +
    + + +
    +
    + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + Faltante + + + + + +
    +
    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + +
    +
    +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Condiciones Operativas
    SiNoND
    +
    + + + + + + + + + + + + + +
    + + + + + + + + +
    +
    + +
    +
    + + + + +
    +
    +
    +
    + + + + + + + + +
    +
    + + + + + + + + + + + + + <%-- + + + + + + + --%> + + + + + + +
    +
    + + +
    +
    +
    +
    + + + + + + + + +
    +
    + + + + + + + + + + + + + <%-- + + + + + + + --%> + + + + + + +
    +
    + + +
    +
    +
    +
    + +
    + + + + + + +
    +
    +
    + + + + + + + + +
    +
    + + +
    + + + + + + diff --git a/MQ/OrdenTrabajo.aspx.vb b/MQ/OrdenTrabajo.aspx.vb new file mode 100644 index 000000000..cd0fe08df --- /dev/null +++ b/MQ/OrdenTrabajo.aspx.vb @@ -0,0 +1,579 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports System.IO +Imports Extensiones +Imports GemBox.Spreadsheet +Imports Microsoft.Reporting.WebForms + +Partial Class AF_OrdenTrabajo + Inherits ClsPaginas + +#Region " PROPIEDADES" + + Property CveOrdenTrabajo As Integer + Get + If ViewState("CveOrdenTrabajo") Is Nothing Then + Return -1 + Else + Return ViewState("CveOrdenTrabajo").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveOrdenTrabajo") = value + End Set + End Property + + Property CveOrdenCompra As Integer + Get + If ViewState("CveOrdenCompra") Is Nothing Then + Return -1 + Else + Return ViewState("CveOrdenCompra").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveOrdenCompra") = value + End Set + End Property + + + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + + CargaCombos() + + If Request("CveOrdenTrabajo") IsNot Nothing Then + CveOrdenTrabajo = Request("CveOrdenTrabajo").ToEntero + + If CveOrdenTrabajo > 0 Then + + DVFechaFin.Visible = True + DVFolioAsignado.Visible = True + DVEstatus.Visible = True + + Tab.Visible = True + CargaDatos() + + End If + + End If + + + End If + End Sub + + +#Region " CARGA PARAMETROS " + +#End Region + +#Region " CARGA COMBOS " + + Protected Sub CargaCombos() + + + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + + DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + DdlSubProyecto.SelectedValueExist(-1) + + LblSubProyecto.Text = "Obra" + + 'CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto) + + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa, -1) + DdlAF.DataBind() + + DdlAF.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + Dim ObjAF As New ClsAF + + If ObjAF.GetEstatusOT(-1, UsuarioActual.CveEmpresa, 1) Then + DdlOrdenesTrabajoEstatus.DataSource = ObjAF.DtResultados + Else + DdlOrdenesTrabajoEstatus.DataSource = Nothing + End If + + + If ObjAF.GetTiposOT(-1, 1, UsuarioActual.CveEmpresa) Then + DdlTipoMantenimiento.DataSource = ObjAF.DtResultados + Else + DdlTipoMantenimiento.DataSource = Nothing + End If + + + If ObjAF.GetOperador(-1, UsuarioActual.CveEmpresa) Then + DdlOperador.DataSource = ObjAF.DtResultados + Else + DdlOperador.DataSource = Nothing + End If + + ObjAF.Dispose() + + ' DdlTipoServicio.DataBind() + DdlOrdenesTrabajoEstatus.DataBind() + DdlTipoMantenimiento.DataBind() + DdlOperador.DataBind() + + + + DdlOrdenesTrabajoEstatus.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + DdlOrdenesTrabajoEstatus.SelectedValueExist(-1) + + DdlOperador.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + DdlOperador.SelectedValueExist(-1) + + + DdlTipoMantenimiento.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + DdlTipoMantenimiento.SelectedValueExist(-1) + + + + + UpGeneral.Update() + + + + End Sub + + + Protected Sub DdlTipoMantenimiento_SelectedIndexChanged(sender As Object, e As EventArgs) + + + + If DdlTipoMantenimiento.SelectedValue.ToEntero > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposServicios(-1, DdlTipoMantenimiento.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then + DdlTipoServicio.DataSource = ObjAF.DtResultados + Else + DdlTipoServicio.DataSource = Nothing + End If + + + ObjAF.Dispose() + + Else + DdlTipoServicio.DataSource = Nothing + End If + + DdlTipoServicio.DataBind() + DdlTipoServicio.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) + + UpGeneral.Update() + + End Sub + + +#End Region + + + +#Region " GV DATOS " + + Private Sub CargaDatos() + + + + Dim ObjAF As New ClsAF + + If ObjAF.GetOrdenesTrabajo(CveOrdenTrabajo, -1, -1, -1, -1, -1, MinFecha, MaxFecha, Nothing, -1, UsuarioActual.CveEmpresa, -1) Then + + If ObjAF.DtResultados IsNot Nothing AndAlso ObjAF.DtResultados.Rows.Count > 0 Then + + LblFolio.Text = ObjAF.DtResultados(0)("Folio").ToString + + + DdlSubProyecto.SelectedValueExist(ObjAF.DtResultados(0)("CveSubProyecto").ToString) + DdlAF.SelectedValueExist(ObjAF.DtResultados(0)("CveAF").ToString) + 'DdlTipoServicio.SelectedValueExist(ObjAF.DtResultados(0)("CveTipoServicio").ToString) + + DdlPrioridad.SelectedValueExist(ObjAF.DtResultados(0)("Prioridad").ToString) + txtFechaI.Text = ObjAF.DtResultados(0)("FechaInicio").ToString.ToDate.ToString("dd/MM/yyyy") + DdlOperador.SelectedValueExist(ObjAF.DtResultados(0)("CveOperador").ToString) + + If ObjAF.DtResultados(0)("FechaFin").ToString.Length > 0 Then + txtFechaF.Text = ObjAF.DtResultados(0)("FechaFin").ToString.ToDate.ToString("dd/MM/yyyy") + End If + + DdlOrdenesTrabajoEstatus.SelectedValueExist(ObjAF.DtResultados(0)("CveEstatusOT").ToString) + + DdlTipoMantenimiento.SelectedValueExist(ObjAF.DtResultados(0)("CveOrdenTrabajoTipo").ToString) + DdlTipoMantenimiento_SelectedIndexChanged(Nothing, Nothing) + + DdlTipoServicio.SelectedValueExist(ObjAF.DtResultados(0)("CveTipoServicio").ToString) + + Else + Alert("No se encontro la orden de trabajo", TipoMensaje.MsgAdvertencia) + End If + End If + + ObjAF.Dispose() + + + CargaMaterial() + CargaActividades() + CargaCheckList() + CargaHerramientas() + CargaSubContrataciones() + + + End Sub + + + +#End Region + + Protected Sub LnkEliminarMetricaValor_Click(sender As Object, e As EventArgs) + + End Sub + + + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + + If CveOrdenTrabajo <= 0 Then + + + Dim ObjAF As New ClsAF + ObjAF.IniciaTransacSQL() + Dim ErrorProceso As Boolean = False + + If Not ObjAF.AddOrdenesTrabajo(DdlTipoServicio.SelectedValue.ToEntero, DdlAF.SelectedValue.ToEntero, "", DdlSubProyecto.SelectedValue.ToEntero, DdlPrioridad.SelectedValue.ToEntero, txtFechaI.Text.ToDate, MaxFecha, MaxFecha, DdlOrdenesTrabajoEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlOperador.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then + ErrorProceso = True + + + End If + + If Not ErrorProceso Then + ObjAF.Commit() + Alert($"Orden de trabajo guardada corectamente Folio {ObjAF.FolioOT}", TipoMensaje.MsgInformacion, $" document.location.href=""OrdenTrabajo.aspx?CveOrdenTrabajo={CveOrdenTrabajo}"";") + Else + ObjAF.RollBack() + End If + + + + ObjAF.Dispose() + + + Else + + If DdlOrdenesTrabajoEstatus.SelectedValue.ToEntero = 3 Then + If txtFechaF.Text.Length = 0 Then + Alert("La fecha fin es requerida.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + + + + + Dim ObjAF As New ClsAF + ObjAF.IniciaTransacSQL() + Dim ErrorProceso As Boolean = False + + + Dim FechaFinal As Date = MaxFecha + Dim FechaFinReal As Date = MaxFecha + + + If txtFechaF.Text.ToDate > MinFecha Then + FechaFinal = txtFechaF.Text.ToDate + End If + + If Not ObjAF.UpdateOrdenesTrabajo(CveOrdenTrabajo, DdlTipoServicio.SelectedValue.ToEntero, DdlAF.SelectedValue.ToEntero, "", DdlSubProyecto.SelectedValue.ToEntero, DdlPrioridad.SelectedValue.ToEntero, txtFechaI.Text.ToDate, FechaFinal, MaxFecha, DdlOrdenesTrabajoEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlOperador.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then + ErrorProceso = True + End If + + If Not ErrorProceso Then + For Each GvRow As GridViewRow In GvActividades.Rows + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim TxtObservaciones As TextBox = GvRow.FCTextBox("TxtObservaciones") + Dim CveOrdenTrabajoActividad As Integer = GvRow.DataKey("CveOrdenTrabajoActividad").ToEntero + + If Not ObjAF.UpdateOrdenesTrabajoActividades(CveOrdenTrabajoActividad, "-1", If(Chk.Checked, 1, 0), TxtObservaciones.Text, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + Exit For + End If + + Next + End If + + + If Not ErrorProceso Then + For Each GvRow As GridViewRow In GvCheckList.Rows + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim TxtObservaciones As TextBox = GvRow.FCTextBox("TxtObservaciones") + Dim CveOrdenTrabajoCheckList As Integer = GvRow.DataKey("CveOrdenTrabajoCheckList").ToEntero + Dim RBL As RadioButtonList = GvRow.FCRadioButtonList("RDLSINOND") + Dim Estatus As Integer = 0 + + If RBL.SelectedValue.ToEntero > 0 Then + Estatus = RBL.SelectedValue.ToEntero + End If + + If CveOrdenTrabajoCheckList > 0 Then + + If Not ObjAF.UpdateOrdenesTrabajoCheckList(CveOrdenTrabajoCheckList, "-1", If(Chk.Checked, 1, 0), TxtObservaciones.Text, Estatus, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + Exit For + End If + + End If + Next + End If + + + If Not ErrorProceso Then + ObjAF.Commit() + Alert($"Orden de trabajo actualizada correctamente.", TipoMensaje.MsgInformacion, $" document.location.href=""OrdenTrabajo.aspx?CveOrdenTrabajo={CveOrdenTrabajo}"";") + Else + ObjAF.RollBack() + End If + + End If + + + + End Sub + + + + + +#Region "FOLIOS" + + + Private Function CargaFolios() As Boolean + + Dim Respuesta As Boolean = False + + If DdlSubProyecto.SelectedValue.ToEntero() <= 0 Then + Alert("No se tienen asignadas sucursales", TipoMensaje.MsgError) + Return False + Exit Function + End If + + Dim ObjFolios As New ClsGralFolios() + + If ObjFolios.GetFolios("OT", UsuarioActual.CveEmpresa) Then + + Dim DT As DataTable = ObjFolios.DtResultados '.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyecto.SelectedValue)) + + If DT.Rows.Count > 0 Then + Respuesta = True + Else + + Alert("No tiene registrados Folios para " & DdlSubProyecto.SelectedItem.Text & " ", TipoMensaje.MsgAdvertencia) + End If + + DT.Dispose() + + End If + + ObjFolios.Dispose() + + + Return Respuesta + End Function + +#End Region + + + Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) + + If CargaFolios() Then + BtnGuardar.Enabled = True + Else + BtnGuardar.Enabled = False + End If + + UpGuardar.Update() + + + End Sub + + + Private Sub CargaMaterial() + + Dim ObjAF As New ClsAF + Dim MaterialFaltante As Decimal = 0 + + If ObjAF.GetOrdenesTrabajoMateriales(CveOrdenTrabajo, UsuarioActual.CveEmpresa) Then + GvMaterial.DataSource = ObjAF.DtResultados + MaterialFaltante = ObjAF.DtResultados.SUMD("Faltante") + Else + GvMaterial.DataSource = Nothing + End If + + ObjAF.Dispose() + + + + + If MaterialFaltante > 0 AndAlso CveOrdenCompra <= 0 Then + + GvMaterial.Columns(4).Visible = True + End If + + GvMaterial.DataBind() + + UpGvMaterial.Update() + + End Sub + + Private Sub CargaActividades() + + Dim ObjAF As New ClsAF + + + If ObjAF.GetOrdenesTrabajoActividades(CveOrdenTrabajo, UsuarioActual.CveEmpresa) Then + GvActividades.DataSource = ObjAF.DtResultados + Else + GvActividades.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvActividades.DataBind() + UpGvActividades.Update() + + + End Sub + + Private Sub CargaCheckList() + + Dim ObjAF As New ClsAF + + + If ObjAF.GetOrdenesTrabajoCheckList(CveOrdenTrabajo, UsuarioActual.CveEmpresa) Then + + + GvCheckList.DataSource = ObjAF.DtResultados + Else + GvCheckList.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvCheckList.DataBind() + UpGvCheckList.Update() + + End Sub + + + Private Sub CargaHerramientas() + + Dim ObjAF As New ClsAF + + + If ObjAF.GetOrdenesTrabajoHerramientas(CveOrdenTrabajo, UsuarioActual.CveEmpresa) Then + GvHerramientas.DataSource = ObjAF.DtResultados + Else + GvHerramientas.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvHerramientas.DataBind() + UpGvHerramientas.Update() + + End Sub + + + Private Sub CargaSubContrataciones() + + Dim ObjAF As New ClsAF + + + If ObjAF.GetOrdenesTrabajoSubContrataciones(CveOrdenTrabajo, UsuarioActual.CveEmpresa) Then + GvSubContrataciones.DataSource = ObjAF.DtResultados + Else + GvSubContrataciones.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvSubContrataciones.DataBind() + UpGvSubContrataciones.Update() + + End Sub + + Protected Sub GvMaterial_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + If GvMaterial.Columns(4).Visible Then + + If e.Row.DataKey("Faltante").ToDecimal > 0 Then + Dim HLOC As HyperLink = e.Row.FCHyperLink("HLOC") + HLOC.Visible = True + HLOC.NavigateUrl = $"../OC/OC.aspx?CveOrdenTrabajo={CveOrdenTrabajo}" + End If + + + End If + + End If + + End Sub + Protected Sub GvActividades_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + Dim Chk As CheckBox = e.Row.FCCheckBox("Chk") + + If Boolean.Parse(e.Row.DataKey("Terminado")) Then + Chk.Checked = True + Else + Chk.Checked = False + End If + End If + + + End Sub + Protected Sub GvCheckList_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim Chk As CheckBox = e.Row.FCCheckBox("Chk") + Dim RDLSINOND As RadioButtonList = e.Row.FCRadioButtonList("RDLSINOND") + Dim TxtObservaciones As TextBox = e.Row.FCTextBox("TxtObservaciones") + + If e.Row.DataKey("CveOrdenTrabajoCheckList").ToEntero = 0 Then + + e.Row.FCLiteral("LtlNROW").Text = e.Row.DataKey("CheckListActividadGrupo").ToString + e.Row.Attributes.Add("style", "background-color:#DDD") + + Chk.Visible = False + RDLSINOND.Visible = False + TxtObservaciones.Visible = False + Else + Dim Estatus As String = e.Row.DataKey("Estatus") + + RDLSINOND.SelectedValuesIfExist(Estatus) + + If Boolean.Parse(e.Row.DataKey("Terminado")) Then + Chk.Checked = True + Else + Chk.Checked = False + End If + + End If + + + End If + + End Sub + + + +End Class diff --git a/MQ/SubContrataciones.aspx b/MQ/SubContrataciones.aspx new file mode 100644 index 000000000..e0c823b9d --- /dev/null +++ b/MQ/SubContrataciones.aspx @@ -0,0 +1,126 @@ +<%@ Page Title="Catálogo Operadores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="SubContrataciones.aspx.vb" Inherits="AF_SubContrataciones" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Sub Contrataciones + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    +
    +
    + + + + \ No newline at end of file diff --git a/MQ/SubContrataciones.aspx.vb b/MQ/SubContrataciones.aspx.vb new file mode 100644 index 000000000..b92cbcc06 --- /dev/null +++ b/MQ/SubContrataciones.aspx.vb @@ -0,0 +1,135 @@ +Option Strict On + +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class AF_SubContrataciones + Inherits ClsPaginas + + Protected Property CveSubContratacion As Integer + Get + If ViewState("CveSubContratacion") Is Nothing Then + Return -1 + Else + Return ViewState("CveSubContratacion").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveSubContratacion") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaDatos() + End If + + End Sub + + + Private Sub CargaDatos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetSubContratacionOT(-1, UsuarioActual.CveEmpresa, -1) Then + GvDatos.DataSource = ObjAF.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjAF.Dispose() + + GvDatos.DataBind() + UpDatos.Update() + + End Sub + + + Protected Sub LnkAgregarSubContratacion_Click(sender As Object, e As EventArgs) Handles LnkAgregarSubContratacion.Click + ResetModalSubContrataciones() + RegistraScript(String.Format("$('#{0}').modal();", "DVModalSubContratacion")) + End Sub + + Private Sub ResetModalSubContrataciones() + CveSubContratacion = -1 + TxtSubContratacion.Text = "" + ChkEstatus.Checked = True + LtlTituloModalOperdaor.Text = "Agregar operador" + CheckActiveSection.Visible = False + + UpModalOperador.Update() + End Sub + + Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveSubContratacion = GvRow.DataKey("CveSubContratacion").ToEntero + TxtSubContratacion.Text = GvRow.DataKey("SubContratacion") + 'TxtFecha.Text = GvRow.DataKey("Fecha").ToDate.ToString("dd/MM/yyyy") + + ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString.ToEntero = 1, True, False) + LtlTituloModalOperdaor.Text = "Actualizar Sub Contratación" + CheckActiveSection.Visible = True + + UpModalOperador.Update() + + RegistraScript(String.Format("$('#{0}').modal();", "DVModalSubContratacion")) + + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnModalAgregarOperador.Click + + Dim ObjAF As New ClsAF + Dim ErrorProceso As Boolean = False + + If CveSubContratacion = -1 Then + If Not ObjAF.AddSubContratacionOT(TxtSubContratacion.Text, If(ChkEstatus.Checked, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + Else + + If Not ObjAF.UpdateSubContratacionOT(CveSubContratacion, TxtSubContratacion.Text, If(ChkEstatus.Checked, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + Alert($"Sub Contratación { If(CveSubContratacion > 0, "Actualizada", "Agregada") } correctamente.") + RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalSubContratacion")) + CargaDatos() + End If + + + End Sub + + Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ErrorProceso As Boolean = False + Dim CveSubContratacionEliminar As Integer = GvRow.DataKey("CveSubContratacion").ToEntero + + Dim ObjAF As New ClsAF + + If ObjAF.RemoveSubContratacionOT(CveSubContratacionEliminar, UsuarioActual.CveEmpresa) Then + Alert("Sub Contratación eliminada correctamente") + Else + ErrorProceso = True + End If + + ObjAF.Dispose() + + + If Not ErrorProceso Then + CargaDatos() + End If + + + End Sub +End Class diff --git a/MQ/TipoOrdenTrabajo.aspx b/MQ/TipoOrdenTrabajo.aspx new file mode 100644 index 000000000..ea38f5ba5 --- /dev/null +++ b/MQ/TipoOrdenTrabajo.aspx @@ -0,0 +1,581 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="TipoOrdenTrabajo.aspx.vb" Inherits="MQ_TipoOrdenTrabajo" EnableEventValidation = "false" %> + + + + + + + + + + Tipo de Ordenes de Trabajo + + + + + +
  • + +
  • +
  • + +
  • +
  • + +
  • + +
  • + +
  • +
    +
    + + +
    + + + + + + + +
    +
    +
    +
    +
    + + + Tipo de Ordenes de Trabajo +
    +
    +
    + +
    +
    +
    + + +
    + +
    + + + + +
    + + +
    + + + + +
    + +
    + + + + + +
    + + +
    + + +
    + +
    +
    + + + +
    +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    + + +
    +
    +
    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + +
    + + + + + + diff --git a/MQ/TipoOrdenTrabajo.aspx.vb b/MQ/TipoOrdenTrabajo.aspx.vb new file mode 100644 index 000000000..e734ff8f2 --- /dev/null +++ b/MQ/TipoOrdenTrabajo.aspx.vb @@ -0,0 +1,1264 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports System.IO +Imports Extensiones +Imports GemBox.Spreadsheet +Imports Microsoft.Reporting.WebForms + +Partial Class MQ_TipoOrdenTrabajo + Inherits ClsPaginas + +#Region " PROPIEDADES" + + Property CveTipoServicio As Integer + Get + If ViewState("CveTipoServicio") Is Nothing Then + Return -1 + Else + Return ViewState("CveTipoServicio").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveTipoServicio") = value + End Set + End Property + + Property DTMateriales As DataTable + Get + If ViewState("DTMateriales") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTMateriales"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTMateriales") = value + End Set + End Property + + + Property DTActividades As DataTable + Get + If ViewState("DTActividades") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTActividades"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTActividades") = value + End Set + End Property + + Property DTHerramientas As DataTable + Get + If ViewState("DTHerramientas") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTHerramientas"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTHerramientas") = value + End Set + End Property + + Property DTACheckList As DataTable + Get + If ViewState("DTACheckList") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTACheckList"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTACheckList") = value + End Set + End Property + + + Property DTSubContratacion As DataTable + Get + If ViewState("DTSubContratacion") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTSubContratacion"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTSubContratacion") = value + End Set + End Property + + + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + + + If Request("CveTipoServicio") IsNot Nothing Then + CveTipoServicio = Request("CveTipoServicio").ToEntero + End If + + CargaCombos() + + + If CveTipoServicio = -1 Then + + CrearTablas() + CargaActividades() + CargaCheckList() + CargaHerramientas() + CargaSubContataciones() + + Else + CargaDatos() + End If + + + End If + End Sub + + + + + + +#Region " CARGA COMBOS " + + Protected Sub CargaCombos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposOT(-1, 1, UsuarioActual.CveEmpresa) Then + DdlTipoMantenimiento.DataSource = ObjAF.DtResultados + Else + DdlTipoMantenimiento.DataSource = Nothing + End If + + + + If ObjAF.GetActividadesOT(-1, -1, UsuarioActual.CveEmpresa, 1) Then + DdlModalActiviades.DataSource = ObjAF.DtResultados + Else + DdlModalActiviades.DataSource = Nothing + End If + + + If ObjAF.GetHerramientasOT(-1, UsuarioActual.CveEmpresa, 1) Then + DdlModalHerramienta.DataSource = ObjAF.DtResultados + Else + DdlModalHerramienta.DataSource = Nothing + End If + + If ObjAF.GetSubContratacionOT(-1, UsuarioActual.CveEmpresa, 1) Then + DdlModalSubContratacion.DataSource = ObjAF.DtResultados + Else + DdlModalSubContratacion.DataSource = Nothing + End If + + + + + + ObjAF.Dispose() + + DdlTipoMantenimiento.DataBind() + DdlTipoMantenimiento.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + DdlModalActiviades.DataBind() + DdlModalActiviades.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + + DdlModalHerramienta.DataBind() + DdlModalHerramienta.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + DdlModalSubContratacion.DataBind() + DdlModalSubContratacion.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + + + 'DdlmodalPuesto.DataSource = GlobalDTPuestos().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") + + 'DdlmodalPuesto.DataBind() + 'DdlmodalPuesto.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpFiltro.Update() + + DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + + + End Sub + + + + + +#End Region + +#Region "CREAR TABLAS" + + Private Sub CrearTablas() + 'CveTipoServicioMaterial CveTipoServicio Cantidad CveUM CvePS Tipo + + Dim DtTempMaterial As New DataTable + Dim DtTempActividades As New DataTable + Dim DtTempHerramientas As New DataTable + Dim DtTempSubContrataciones As New DataTable + + DtTempMaterial.Columns.Add("CveTipoServicioMaterial", GetType(Integer)) + DtTempMaterial.Columns.Add("CveTipoServicio", GetType(Integer)) + DtTempMaterial.Columns.Add("Cantidad", GetType(Decimal)) + DtTempMaterial.Columns.Add("CveUM", GetType(Integer)) + DtTempMaterial.Columns.Add("CvePS", GetType(Integer)) + DtTempMaterial.Columns.Add("Tipo", GetType(Integer)) + DtTempMaterial.Columns.Add("PS", GetType(String)) + DtTempMaterial.Columns.Add("Abreviatura", GetType(String)) + DtTempMaterial.AcceptChanges() + + DTMateriales = DtTempMaterial + + + 'CveTipoServicioActividad CveActividad Duracion Observaciones + + DtTempActividades.Columns.Add("CveTipoServicioActividad", GetType(Integer)) + DtTempActividades.Columns.Add("CveActividadOT", GetType(Integer)) + DtTempActividades.Columns.Add("ActividadOT", GetType(String)) + DtTempActividades.Columns.Add("CvePuesto", GetType(Integer)) + DtTempActividades.Columns.Add("Puesto", GetType(String)) + DtTempActividades.Columns.Add("Horas", GetType(Decimal)) + DtTempActividades.Columns.Add("Observaciones", GetType(String)) + DtTempActividades.AcceptChanges() + + DTActividades = DtTempActividades + + DtTempHerramientas.Columns.Add("CveTipoServicioHerramientaOT", GetType(Integer)) + DtTempHerramientas.Columns.Add("CveTipoServicio", GetType(Integer)) + DtTempHerramientas.Columns.Add("CveHerramientaOT", GetType(Integer)) + DtTempHerramientas.Columns.Add("HerramientaOT", GetType(String)) + DtTempHerramientas.Columns.Add("CveUsuario", GetType(Integer)) + + DTHerramientas = DtTempHerramientas + + + + DtTempSubContrataciones.Columns.Add("CveTipoServicioSubContratacion", GetType(Integer)) + DtTempSubContrataciones.Columns.Add("CveTipoServicio", GetType(Integer)) + DtTempSubContrataciones.Columns.Add("CveSubContratacion", GetType(Integer)) + DtTempSubContrataciones.Columns.Add("SubContratacion", GetType(String)) + DtTempSubContrataciones.Columns.Add("CveUsuario", GetType(Integer)) + + DTSubContratacion = DtTempSubContrataciones + + + End Sub + +#End Region + + + + +#Region " GV DATOS " + + Private Sub CargaDatos() + + Dim ErrorProceso As Boolean = False + + Dim ObjAf As New ClsAF + + If ObjAf.GetTiposServicios(CveTipoServicio, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + + + If ObjAf.DtResultados.Rows.Count > 0 Then + TxtTipoServicio.Text = ObjAf.DtResultados(0)("Nombre").ToString + DdlTipoMantenimiento.SelectedValueExist(ObjAf.DtResultados(0)("CveOrdenTrabajoTipo").ToString) + TxtDuracion.Text = ObjAf.DtResultados(0)("Duracion").ToString.ToDecimal.ToString("###.00") + End If + + + Else + ErrorProceso = True + End If + + ObjAf.Dispose() + + CargaMateriales() + CargaActividades() + CargaCheckList() + CargaHerramientas() + CargaSubContataciones() + + End Sub + + Private Sub CargaMateriales() + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposServiciosMaterial(-1, CveTipoServicio, UsuarioActual.CveEmpresa) Then + + DTMateriales = ObjAF.DtResultados + GvMaterial.DataSource = DTMateriales + + Else + GvMaterial = Nothing + End If + + ObjAF.Dispose() + + GvMaterial.DataBind() + Else + GvMaterial.DataSource = DTMateriales + GvMaterial.DataBind() + End If + + UpGvMaterial.Update() + + End Sub + + Private Sub CargaActividades() + + Dim ObjAF As New ClsAF + + If CveTipoServicio > 0 Then + + If ObjAF.GetTiposServiciosActividades(-1, CveTipoServicio, -1) Then + GvActividades.DataSource = ObjAF.DtResultados + Else + GvActividades.DataSource = Nothing + End If + + Else + + 'If ObjAF.GetActividadesOT(-1, -1, UsuarioActual.CveEmpresa, 1) Then + ' GvActividades.DataSource = ObjAF.DtResultados + 'Else + ' GvActividades.DataSource = Nothing + 'End If + GvActividades.DataSource = DTActividades + End If + + + ObjAF.Dispose() + + GvActividades.DataBind() + UpGvActividades.Update() + + End Sub + + Private Sub CargaCheckList() + + Dim ObjAF As New ClsAF + + ' If CveTipoServicio > 0 Then + + If ObjAF.GetCheckList(-1, CveTipoServicio, -1, UsuarioActual.CveEmpresa) Then + GvCheckList.DataSource = ObjAF.DtResultados + Else + GvCheckList.DataSource = Nothing + End If + + + + + ObjAF.Dispose() + + GvCheckList.DataBind() + UpGvCheckList.Update() + End Sub + + Private Sub CargaHerramientas() + + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + If ObjAF.GetTiposServiciosHerramientasOT(CveTipoServicio, 1, UsuarioActual.CveEmpresa) Then + GvHerraminetas.DataSource = ObjAF.DtResultados + Else + GvHerraminetas.DataSource = Nothing + End If + ObjAF.Dispose() + + + Else + GvHerraminetas.DataSource = DTHerramientas + End If + + GvHerraminetas.DataBind() + UpGvHerramientas.Update() + End Sub + + + + Private Sub CargaSubContataciones() + + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + If ObjAF.GetTipoServicioSubContratacionOT(CveTipoServicio, 1, UsuarioActual.CveEmpresa) Then + GvSubContratacion.DataSource = ObjAF.DtResultados + Else + GvSubContratacion.DataSource = Nothing + End If + ObjAF.Dispose() + + + Else + GvSubContratacion.DataSource = DTSubContratacion + End If + + GvSubContratacion.DataBind() + UpGvSubContratacion.Update() + + End Sub + + Protected Sub GvActividades_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim CveTipoServicioActividad As Integer = e.Row.DataKey("CveTipoServicioActividad").ToEntero + Dim TxtHoras As TextBox = e.Row.FCTextBox("TxtHoras") + Dim Chk As CheckBox = e.Row.FCCheckBox("Chk") + + 'If CveTipoServicioActividad > 0 Then + + Chk.Checked = True + TxtHoras.Text = e.Row.DataKey("Horas") + + + + 'End If + + + + End If + + End Sub + + Protected Sub GvCheckList_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + Dim Chk As CheckBox = e.Row.FCCheckBox("Chk") + + + If e.Row.DataKey("CveCheckListActividad").ToEntero = 0 Then + + e.Row.FCLiteral("LtlNROW").Text = e.Row.DataKey("CheckListActividadGrupo").ToString + e.Row.Attributes.Add("style", "background-color:#DDD") + + Chk.Visible = False + + + End If + + + If e.Row.DataKey("CveTipoServicio").ToEntero > 0 Then + Chk.Checked = True + End If + + + End If + + End Sub + + + Private Sub GvHerraminetas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvHerraminetas.RowDataBound + + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim CveTipoServicioHerramientaOT As Integer = e.Row.DataKey("CveTipoServicioHerramientaOT").ToEntero + Dim Chk As CheckBox = e.Row.FCCheckBox("Chk") + + If CveTipoServicioHerramientaOT > 0 Then + + Chk.Checked = True + + End If + + + + End If + + + End Sub + +#End Region + + + + +#Region "DESCARGA EXCEL" + + 'Public Sub ExportToExcelG(Gv1 As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional filtros As String = "") + + + + ' For Each GvRow As GridViewRow In Gv1.Rows + + ' Dim IDX_LIMPIAR As Integer = 1 + + ' For IDX_LIMPIAR = 1 To 15 + ' GvRow.Cells(IDX_LIMPIAR).Text = GvRow.FCTextBox($"TxtMetrica{IDX_LIMPIAR}").Text + ' Next + + ' If GvRow.FCDropDownList("DDLPersonal").SelectedValue.ToEntero > 0 Then + ' GvRow.Cells(16).Text = GvRow.FCDropDownList("DDLPersonal").SelectedItem.Text + ' Else + ' GvRow.Cells(16).Text = "" + ' End If + + ' Next + + + + ' Dim sw1 As New StringWriter() + ' Dim htw1 As New HtmlTextWriter(sw1) + ' Gv1.RenderControl(htw1) + + ' Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault + ' Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString())) + + ' htmlStream1.Position = 0 + ' Dim sr1 As New StreamReader(htmlStream1) + ' Dim myStr1 = sr1.ReadToEnd() + + ' sr1.Dispose() + ' htmlStream1.Dispose() + ' sw1.Dispose() + + ' Dim HtmlCompleto As String = myStr1 + + + ' HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "") + + ' Dim asd As String = "" + + + ' Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) + + ' GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet()) + + ' Dim excel As GemBox.Spreadsheet.ExcelFile + + ' excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) + + ' If Usuario IsNot Nothing Then + ' Dim TotalRowHeader As Integer = 8 + ' Dim TotalRowFooter As Integer = 2 + + ' Dim worksheet = excel.Worksheets(0) + ' worksheet.Rows.InsertEmpty(0, TotalRowHeader) + ' Dim celdasConTexto = worksheet.GetUsedCellRange(True) + ' celdasConTexto.Style.Font.Name = "Calibri Light" + + ' Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + ' RangoNombreEmpresa.Merged = True + ' RangoNombreEmpresa.Value = Usuario.Empresa.Empresa + ' RangoNombreEmpresa.Style.Font.Size = 18 * 20 + ' RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + ' RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + ' Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) + ' RangoFiltros.Merged = True + ' RangoFiltros.Value = filtros + ' RangoFiltros.Style.Font.Size = 15 * 20 + ' RangoFiltros.Style.Font.Name = "Calibri Light" + ' RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left + ' RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + ' Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + ' RangoTitulo.Merged = True + ' RangoTitulo.Value = Titulo + ' RangoTitulo.Style.Font.Size = 20 * 20 + ' RangoTitulo.Style.Font.Name = "Calibri Light" + ' RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + ' For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + ' worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 + ' worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + ' worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + ' worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + + + + + ' If i > 0 Then + ' Try + ' worksheet.Columns(i).AutoFit(1) + ' Catch ex As Exception + ' End Try + ' End If + + ' Next + + ' Dim IndexEndTable As Integer = Gv1.Rows.Count + 4 + TotalRowHeader + TotalRowFooter + + ' worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" + ' worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre + + ' worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" + ' worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy") + + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + ' If Imagen.Exists Then + ' Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + ' Using sr As New StreamReader(Ruta) + ' Dim ms As New MemoryStream() + ' sr.BaseStream.CopyTo(ms) + ' worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + ' End Using + ' End If + + ' End If + + + + + ' Dim memoryStream As New MemoryStream() + ' excel.Save(memoryStream, SaveOptions.XlsxDefault) + ' ReporteBytes = memoryStream.ToArray() + ' memoryStream.Dispose() + + 'End Sub + + + 'Protected Sub LnkDescargaReporte_Click(sender As Object, e As EventArgs) + + + ' Response.ContentType = "application/force-download" + ' Response.AppendHeader("Content-Disposition", $"attachment;filename=RegistroRevision{Now.ToString("yyyyMMddmmss")}.xlsx") + ' Response.BinaryWrite(ReporteBytes) + ' Response.End() + + 'End Sub + + + 'Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + 'End Sub + +#End Region + + + + Protected Sub LnkAgregarMaterial_Click(sender As Object, e As EventArgs) + + RegistraScript("$('#ModalMateriales').modal('show');") + ResetModalMaterial() + End Sub + + + + Protected Sub LnkAgregarActividad_Click(sender As Object, e As EventArgs) + RegistraScript("$('#ModalActividades').modal('show');") + ResetModalActividad() + End Sub + + Protected Sub LnkAgregarHorramienta_Click(sender As Object, e As EventArgs) + RegistraScript("$('#ModalHerramientas').modal('show');") + ResetModalHerramienta() + End Sub + + + Protected Sub LnkAgregarSubContratacion_Click(sender As Object, e As EventArgs) + RegistraScript("$('#ModalSubContratacion').modal('show');") + ResetModalHerramienta() + End Sub + + + Private Sub ResetModalMaterial() + DdlPS.txtValue.Value = "" + DdlPS.txtText.Value = "" + TxtCantidad.Text = "" + UpModalMaterialesBody.Update() + End Sub + + + Private Sub ResetModalActividad() + + DdlModalActiviades.SelectedValueExist(-1) + 'DdlmodalPuesto.SelectedValueExist(-1) + TxtmodalHoras.Text = "" + chkModalContinuarActividades.Checked = False + UpModalActividades.Update() + End Sub + + Private Sub ResetModalHerramienta() + DdlModalHerramienta.SelectedValueExist(-1) + ChkModalContinuarHerramientas.Checked = False + UpModalHerramientas.Update() + End Sub + + + + Private Sub ResetModalSubContrataciones() + DdlModalSubContratacion.SelectedValueExist(-1) + ChkModalContinuarSubcatratacion.Checked = False + UpModalSubContratacion.Update() + End Sub + + Protected Sub BtnGuardarMaterial_Click(sender As Object, e As EventArgs) + + If DdlPS.txtValue.Value.ToString.ToEntero <= 0 Then + Alert("Debe seleccionar un producto o servicio", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim CveUnidadMedida As Integer = -1 + Dim CvePS As Integer = DdlPS.txtValue.Value.ToEntero + Dim Tipo As Integer = -1 + Dim UMAbreviatura As String = "" + + Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0) 'GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + CveUnidadMedida = drPS("CveUM").ToString.ToEntero + Tipo = drPS("CveTipoPS").ToString.ToEntero + UMAbreviatura = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Abreviatura", $"CveUnidadMedida = {CveUnidadMedida}") + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.AddTiposServiciosMaterial(CveTipoServicio, TxtCantidad.Text.ToDecimal, CveUnidadMedida, CvePS, Tipo) Then + Alert("Material agregado correctamente") + End If + + ObjAF.Dispose() + + Else + + Dim nRow As DataRow = DTMateriales.NewRow + + nRow("CveTipoServicioMaterial") = -1 + nRow("CveTipoServicio") = -1 + nRow("Cantidad") = TxtCantidad.Text.ToEntero + nRow("CveUM") = CveUnidadMedida + nRow("CvePS") = DdlPS.txtValue.Value.ToEntero + nRow("Tipo") = Tipo + nRow("Abreviatura") = UMAbreviatura + nRow("PS") = DdlPS.txtText.Value + + DTMateriales.Rows.Add(nRow) + Alert("Material agregado correctamente") + + End If + + CargaMateriales() + + ResetModalMaterial() + + + If Not ChkContinuarMaterial.Checked Then + RegistraScript("$('#ModalMateriales').modal('hide');") + End If + + End Sub + + + + Protected Sub BtnmodalActividad_Click(sender As Object, e As EventArgs) + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + If ObjAF.AddTiposServiciosActividades(DdlModalActiviades.SelectedValue.ToEntero, CveTipoServicio, TxtmodalHoras.Text.ToDecimal, "") Then + Alert("Actividad agregada correctamente") + End If + ObjAF.Dispose() + + Else + + Dim nRow As DataRow = DTActividades.NewRow + + nRow("CveTipoServicioActividad") = -1 + nRow("CveActividadOT") = DdlModalActiviades.SelectedValue.ToEntero + nRow("ActividadOT") = DdlModalActiviades.SelectedItem.Text + + + Dim ObjAF As New ClsAF + If ObjAF.GetActividadesOT(DdlModalActiviades.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, -1) Then + nRow("CvePuesto") = ObjAF.DtResultados(0)("CvePuesto").ToString.ToEntero + nRow("Puesto") = ObjAF.DtResultados(0)("Puesto").ToString + End If + + ObjAF.Dispose() + + + + nRow("Horas") = TxtmodalHoras.Text.ToDecimal + nRow("Observaciones") = "" + + DTActividades.Rows.Add(nRow) + Alert("Actividad agregada correctamente") + + End If + + + CargaActividades() + + If Not chkModalContinuarActividades.Checked Then + RegistraScript("$('#ModalActividades').modal('hide');") + End If + + End Sub + Protected Sub BtnModalHerramienta_Click(sender As Object, e As EventArgs) + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + If ObjAF.AddTiposServiciosHerramientasOT(CveTipoServicio, DdlModalHerramienta.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then + Alert("Herramienta agregada correctamente") + End If + ObjAF.Dispose() + + Else + + Dim nRow As DataRow = DTHerramientas.NewRow + + nRow("CveTipoServicioHerramientaOT") = -1 + nRow("CveHerramientaOT") = DdlModalHerramienta.SelectedValue.ToEntero + nRow("HerramientaOT") = DdlModalHerramienta.SelectedItem.Text + + DTHerramientas.Rows.Add(nRow) + Alert("Herramienta agregada correctamente") + + + End If + + + CargaHerramientas() + + If Not ChkModalContinuarHerramientas.Checked Then + RegistraScript("$('#ModalHerramientas').modal('hide');") + End If + + End Sub + + + Protected Sub BtnModalSubContratacion_Click(sender As Object, e As EventArgs) + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + If ObjAF.AddTipoServicioSubContratacionOT(CveTipoServicio, DdlModalSubContratacion.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then + Alert("Sub Contratación agregada correctamente") + End If + ObjAF.Dispose() + + Else + + Dim nRow As DataRow = DTSubContratacion.NewRow + + nRow("CveTipoServicioSubContratacion") = -1 + nRow("CveSubContratacion") = DdlModalSubContratacion.SelectedValue.ToEntero + nRow("SubContratacion") = DdlModalSubContratacion.SelectedItem.Text + + DTSubContratacion.Rows.Add(nRow) + Alert("Sub Contratación agregada correctamente") + + + End If + + + CargaSubContataciones() + + If Not ChkModalContinuarSubcatratacion.Checked Then + RegistraScript("$('#ModalSubContratacion').modal('hide');") + End If + + End Sub + + + Protected Sub LnkEliminarMaterial_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + If CveTipoServicio > 0 Then + + + Dim CveTipoServicioMaterial As Integer = GvRow.DataKey("CveTipoServicioMaterial").ToEntero + + Dim ObjAF As New ClsAF + If ObjAF.DeleteTiposServiciosMaterial(CveTipoServicioMaterial, UsuarioActual.CveEmpresa) Then + Alert("Material eliminado correctamente") + End If + ObjAF.Dispose() + Else + + + Dim dr As DataRow = DTMateriales.Rows(GvRow.RowIndex) + dr.Delete() + DTMateriales.AcceptChanges() + Alert("Material eliminado correctamente") + End If + + CargaMateriales() + + End Sub + + + Protected Sub LnkEliminarActividad_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + + If CveTipoServicio > 0 Then + + Dim CveTipoServicioActividad As Integer = GvRow.DataKey("CveTipoServicioActividad").ToEntero + + Dim ObjAF As New ClsAF + + If ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa) Then + Alert("Actividad eliminada correctamente") + End If + + ObjAF.Dispose() + + Else + + Dim dr As DataRow = DTActividades.Rows(GvRow.RowIndex) + dr.Delete() + DTActividades.AcceptChanges() + Alert("Actividad eliminada correctamente") + + End If + + CargaActividades() + + End Sub + + Protected Sub LnkEliminarHerramienta_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + + If CveTipoServicio > 0 Then + + Dim CveTipoServicioHerramientaOT As Integer = GvRow.DataKey("CveTipoServicioHerramientaOT").ToEntero + + Dim ObjAF As New ClsAF + + If ObjAF.DeleteTiposServiciosHerramientasOT(CveTipoServicioHerramientaOT, UsuarioActual.CveEmpresa) Then + Alert("Herramienta eliminada correctamente") + End If + + ObjAF.Dispose() + + Else + Dim dr As DataRow = DTHerramientas.Rows(GvRow.RowIndex) + dr.Delete() + DTHerramientas.AcceptChanges() + Alert("Herramienta eliminada correctamente") + + End If + + + CargaHerramientas() + + End Sub + + + Protected Sub LnkEliminarSubContratacion_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + + If CveTipoServicio > 0 Then + + Dim CveTipoServicioSubContratacionEliminar As Integer = GvRow.DataKey("CveTipoServicioSubContratacion").ToEntero + + Dim ObjAF As New ClsAF + + If ObjAF.RemoveTipoServicioSubContratacionOT(CveTipoServicioSubContratacionEliminar, UsuarioActual.CveEmpresa) Then + Alert("Sub Contratación eliminada correctamente") + End If + + ObjAF.Dispose() + + Else + Dim dr As DataRow = DTSubContratacion.Rows(GvRow.RowIndex) + dr.Delete() + DTSubContratacion.AcceptChanges() + Alert("Sub Contratación eliminada correctamente") + + End If + + CargaSubContataciones() + + End Sub + + + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + + Dim ObjAF As New ClsAF + Dim ErrorProceso As Boolean = False + Dim SBError As New StringBuilder + + ObjAF.IniciaTransacSQL() + + 'validacion? + + If CveTipoServicio = -1 Then + + If ObjAF.AddTiposServicios(TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, TxtDuracion.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + + + CveTipoServicio = ObjAF.CveTipoServicio + + For Each GvRow As GridViewRow In GvMaterial.Rows + + If Not ObjAF.AddTiposServiciosMaterial(CveTipoServicio, GvRow.DataKey("Cantidad").ToDecimal, GvRow.DataKey("CveUM").ToEntero, GvRow.DataKey("CvePS").ToEntero, GvRow.DataKey("Tipo").ToEntero) Then + ErrorProceso = True + Exit For + End If + + Next + + For Each GvRow As GridViewRow In GvActividades.Rows + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal + + ' If Chk.Checked Then + If Not ObjAF.AddTiposServiciosActividades(GvRow.DataKey("CveActividadOT").ToEntero, CveTipoServicio, Horas, "") Then + ErrorProceso = True + Exit For + End If + ' End If + Next + + + For Each GvRow As GridViewRow In GvCheckList.Rows + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim CveCheckListActividad As Integer = GvRow.DataKey("CveCheckListActividad").ToEntero + + If Chk.Checked Then + If Not ObjAF.AddCheckList(CveTipoServicio, CveCheckListActividad) Then + ErrorProceso = True + Exit For + End If + End If + + + Next + + + For Each GvRow As GridViewRow In GvHerraminetas.Rows + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim CveHerramientaOT As Integer = GvRow.DataKey("CveHerramientaOT").ToEntero + + ' If Chk.Checked Then + If Not ObjAF.AddTiposServiciosHerramientasOT(CveTipoServicio, CveHerramientaOT, UsuarioActual.CveUsuario) Then + ErrorProceso = True + Exit For + End If + 'End If + + Next + + + For Each GvRow As GridViewRow In GvSubContratacion.Rows + + Dim CveSubContratacion As Integer = GvRow.DataKey("CveSubContratacion").ToEntero + + ' If Chk.Checked Then + If Not ObjAF.AddTipoServicioSubContratacionOT(CveTipoServicio, CveSubContratacion, UsuarioActual.CveUsuario) Then + ErrorProceso = True + Exit For + End If + 'End If + + Next + + + End If + + Else + + If Not ObjAF.UpdateTiposServicios(CveTipoServicio, TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, TxtDuracion.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + + + If Not ErrorProceso Then + + 'For Each GvRow As GridViewRow In GvActividades.Rows + + + ' Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + ' Dim CveTipoServicioActividad As Integer = GvRow.DataKey("CveTipoServicioActividad").ToEntero + ' Dim CveActividadOT As Integer = GvRow.DataKey("CveActividadOT").ToEntero + + ' Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal + + ' If Chk.Checked Then + + ' If CveTipoServicioActividad > 0 Then + ' If Not ObjAF.UpdateTiposServiciosActividades(CveTipoServicioActividad, CveActividadOT, Horas, "") Then + ' ErrorProceso = True + ' Exit For + ' End If + ' Else + ' If Not ObjAF.AddTiposServiciosActividades(CveActividadOT, CveTipoServicio, Horas, "") Then + ' ErrorProceso = True + ' Exit For + ' End If + ' End If + + ' Else + + ' If CveTipoServicioActividad > 0 Then + ' If Not ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa) Then + ' ErrorProceso = True + ' Exit For + ' End If + ' End If + + ' End If + 'Next + + If Not ErrorProceso Then + + For Each GvRow As GridViewRow In GvCheckList.Rows + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + + If Chk.Visible Then + + Dim CveTipoServicioTmp As Integer = GvRow.DataKey("CveTipoServicio").ToEntero + Dim CveCheckList As Integer = GvRow.DataKey("CveCheckList").ToEntero + Dim CveCheckListActividad As Integer = GvRow.DataKey("CveCheckListActividad").ToEntero + + If CveTipoServicioTmp > 0 Then + If Not Chk.Checked Then + If Not ObjAF.DeleteCheckList(CveCheckList) Then + ErrorProceso = True + Exit For + End If + End If + Else + + If Chk.Checked Then + If Not ObjAF.AddCheckList(CveTipoServicio, CveCheckListActividad) Then + ErrorProceso = True + Exit For + End If + End If + End If + End If + Next + + End If + + 'If Not ErrorProceso Then + ' For Each GvRow As GridViewRow In GvHerraminetas.Rows + + ' Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + + ' Dim CveTipoServicioHerramientaOT As Integer = GvRow.DataKey("CveTipoServicioHerramientaOT").ToEntero + ' Dim CveHerramientaOT As Integer = GvRow.DataKey("CveHerramientaOT").ToEntero + + ' If CveTipoServicioHerramientaOT > 0 Then + ' If Not Chk.Checked Then + ' If Not ObjAF.DeleteTiposServiciosHerramientasOT(CveTipoServicioHerramientaOT, UsuarioActual.CveEmpresa) Then + ' ErrorProceso = True + ' Exit For + ' End If + ' End If + ' Else + + ' If Chk.Checked Then + ' If Not ObjAF.AddTiposServiciosHerramientasOT(CveTipoServicio, CveHerramientaOT, UsuarioActual.CveUsuario) Then + ' ErrorProceso = True + ' Exit For + ' End If + ' End If + + ' End If + + + ' Next + 'End If + + End If + + End If + + + + + If ErrorProceso Then + ObjAF.RollBack() + Else + ObjAF.Commit() + Alert("Tipo servicio guardado correctamente.", TipoMensaje.MsgInformacion) + End If + + + ObjAF.Dispose() + + CargaDatos() + + End Sub + + + Protected Sub Chk_CheckedChanged(sender As Object, e As EventArgs) + + 'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, CheckBox).BindingContainer, GridViewRow) + 'Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + + 'Dim CveTipoServicioActividad As Integer = GvRow.DataKey("CveTipoServicioActividad").ToEntero + 'Dim CveActividad As Integer = GvRow.DataKey("CveActividad").ToEntero + + 'Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal + + 'Dim ObjAF As New ClsAF + + + 'If Chk.Checked Then + + ' If CveTipoServicioActividad > 0 Then + ' If ObjAF.UpdateTiposServiciosActividades(CveTipoServicioActividad, CveActividad, Horas, "") Then + + ' End If + ' Else + ' If ObjAF.AddTiposServiciosActividades(CveActividad, CveTipoServicio, Horas, "") Then + + ' End If + ' End If + + 'Else + + + ' If CveTipoServicioActividad > 0 Then + + ' If ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa) Then + + ' End If + + ' End If + + 'End If + + + 'ObjAF.Dispose() + + + End Sub + + + + + + + +End Class diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx new file mode 100644 index 000000000..c88825dd2 --- /dev/null +++ b/Transportes/RepContratoDetalle.aspx @@ -0,0 +1,24 @@ +<%@ Page Language="VB" AutoEventWireup="true" Title="Transportes V&A - Detalles del Contrato" + MasterPageFile="~/Site.master" + CodeFile="RepContratoDetalle.aspx.vb" + Inherits="RepContratoDetalle" %> + + + Detalles del Contratos + + + + + + + + + + + + + + + + diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb new file mode 100644 index 000000000..57204ff36 --- /dev/null +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -0,0 +1,9 @@ +Option Explicit On +Option Strict On + +Partial Class RepContratoDetalle + Inherits ClsPaginas + +End Class + + diff --git a/Transportes/RepContratos - Copy.aspx b/Transportes/RepContratos - Copy.aspx deleted file mode 100644 index b89700e5b..000000000 --- a/Transportes/RepContratos - Copy.aspx +++ /dev/null @@ -1,361 +0,0 @@ -<%@ Page Language="VB" AutoEventWireup="true" Title="Transportes V&A - Contratos" - MasterPageFile="~/Site.master" - CodeFile="RepContratos - Copy.aspx.vb" - Inherits="ListadoContratos" %> - - - Listado de Contratos - - - - - - - - - -
  • - Agregar Contrato -
  • -
  • - Generar Excel -
  • -
    - - - -
    -
    - - - - -
    -
    - - - - -
    - -
    - - - - -
    - -
    - - -
    - -
    - -
    - - -
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - Fecha
    - Salida -
    - - - -
    - - - - - - - - - - - - - - - - - - - - - - Fecha
    - Regreso -
    - - - -
    - - - - - - - -
    -
    -
    -
    - - - -
    - - diff --git a/Transportes/RepContratos - Copy.aspx.vb b/Transportes/RepContratos - Copy.aspx.vb deleted file mode 100644 index 57ecfc736..000000000 --- a/Transportes/RepContratos - Copy.aspx.vb +++ /dev/null @@ -1,159 +0,0 @@ -Option Explicit On -Option Strict On -Imports System.Data.SqlClient -Imports Extensiones -Imports Extensiones.ModExtensiones - -Partial Class ListadoContratos - Inherits ClsPaginas - - Private Property CveContrato As Integer - Get - Return ViewState("CveContrato").ToString().ToEntero - End Get - Set(value As Integer) - ViewState("CveContrato") = value - End Set - End Property - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - txtFechaI.Text = DateTime.Now.AddMonths(-1).ToString("MM/dd/yyyy").Replace(" ", "T") - txtFechaF.Text = DateTime.Now.AddDays(7).ToString("MM/dd/yyyy").Replace(" ", "T") - - If Not IsPostBack Then - ViewState("CveContrato") = 0 - InicializaCombos() - CargaDatos() - End If - End Sub - Private Sub InicializaCombos() - 'Lista Tipo AF - DdlTipoAF.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa) - DdlTipoAF.DataBind() - DdlTipoAF.Items.Insert(0, New ListItem("-", "")) - 'Lista Chofer' - DdlChofer.DataSource = GlobalDTRHPersonal(185) - DdlChofer.DataBind() - DdlChofer.Items.Insert(0, New ListItem("-", "")) - UpModal.Update() - End Sub - Private Sub CargaDatos() - Dim ObjContratos As New ClsContratos - If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then - GvContratos.DataSource = ObjContratos.DtResultados - GvContratos.DataBind() - End If - If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then - DdlEstatusConsulta.DataSource = ObjContratos.DtResultados - DdlEstatusConsulta.DataBind() - DdlEstatusConsulta.Items.Insert(0, New ListItem("-", "")) - - End If - UpTitulos.Update() - - End Sub - Protected Sub MostrarModal(Optional Descripcion As String = "", Optional FechaSalida As String = "", Optional FechaRegreso As String = "", Optional Observaciones As String = "", Optional Ubicacion As String = "", Optional Transporte As String = "", Optional CveCliente As Integer = 0, Optional Dolares As String = "", Optional Pesos As String = "", Optional Anticipo As String = "", Optional Boton As String = "Guardar", Optional Chofer As String = "") - - 'DdlClientes.SelectedText = Cliente - TxtDescripcion.Text = Descripcion - TxtUbicacion.Text = Ubicacion - TxtFechaSalida.Text = FechaSalida - TxtFechaRegreso.Text = FechaRegreso - TxtObservaciones.Text = Observaciones - TxtUbicacion.Text = Ubicacion - DdlTipoAF.SelectedValue = Transporte - DdlClientes.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, -1, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial") - DdlClientes.SelectedValue = CveCliente.ToString - DdlChofer.SelectedValue = Chofer - TxtObservaciones.Text = Observaciones - TxtDolares.Text = Math.Round(Dolares.ToDecimal, 2).ToString - TxtPesos.Text = Math.Round(Pesos.ToDecimal, 2).ToString - TxtAnticipo.Text = Math.Round(Anticipo.ToDecimal * 100, 2).ToString - BtnGuardar.Text = Boton - myModalLabel.InnerHtml = $"{Boton} Contrato" - UpModal.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar")) - End Sub - Private Sub LBAgregarContrato_Click(sender As Object, e As EventArgs) Handles LBAgregarContrato.Click - MostrarModal() - End Sub - Protected Sub AddContrato(sender As Object, e As EventArgs) - - If DdlClientes.SelectedValue = "" Then - Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ObjContratos As New ClsContratos - ObjContratos.IniciaTransacSQL() - - - 'Agregar contrato - If BtnGuardar.Text = "Guardar" Then - If ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero) > 0 Then - ObjContratos.Commit() - Alert("Agregado Correctamente.") - End If - End If - - 'Actualizar contrato - If BtnGuardar.Text = "Editar" Then - If ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero) Then - - ObjContratos.Commit() - Alert("Actualizado Correctamente.") - End If - End If - - TxtDescripcion.Text = "" - TxtFechaSalida.Text = "" - TxtFechaRegreso.Text = "" - TxtObservaciones.Text = "" - TxtUbicacion.Text = "" - DdlClientes.SelectedText = "" - DdlTipoAF.SelectedValue = "" - DdlChofer.SelectedValue = "" - TxtDolares.Text = "" - TxtPesos.Text = "" - TxtAnticipo.Text = "" - BtnGuardar.Text = "Guardar" - - ObjContratos.Dispose() - CargaDatos() - - End Sub - - Protected Sub LBExcel_Click(sender As Object, e As EventArgs) Handles LBExcel.Click - GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString) - End Sub - - Protected Sub Consultar(sender As Object, e As EventArgs) - Dim fechaInicial As String = txtFechaI.Text - Dim fechaFinal As String = txtFechaF.Text - - Dim cliente As String = If(DdlClientesConsulta.SelectedValue = "", "", $"C.CveCliente = {DdlClientesConsulta.SelectedValue} AND") - Dim estatus As String = "" - Dim nombreEstatus As String = "" - Dim innerEstatus As String = "" - If (DdlEstatusConsulta.SelectedValue <> "") Then - estatus = $"C.CveContratosEstatus = {DdlEstatusConsulta.SelectedValue} AND" - nombreEstatus = ", CE.ContratoEstatus As ContratoEstatus1" - innerEstatus = "INNER JOIN Con_ContratosEstatus CE with(nolock) ON CE.CveContratoEstatus = C.CveContratosEstatus -" - End If - Dim intervalo As String = If(DdlEstatusConsulta.SelectedValue = "" And DdlClientesConsulta.SelectedValue = "", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'") - - - Dim query As String = $"SELECT *, ISNULL(Cli.NombreComercial,'') AS NombreComercial {nombreEstatus} FROM Con_Contratos C LEFT JOIN Clientes Cli with(nolock) ON Cli.CveCliente = C.CveCliente {innerEstatus} WHERE {cliente} {estatus} {intervalo}" - - Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString) - Using command As New SqlCommand(query, connection) - connection.Open() - Dim reader As SqlDataReader = command.ExecuteReader() - GvContratos.DataSource = reader - GvContratos.DataBind() - End Using - End Using - - UpTitulos.Update() - End Sub -End Class diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 9f4d4df89..bea5d7eca 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -14,85 +14,131 @@ } .consulta { - padding: 1rem 2rem; background-color: #95A5A6; - display: flex; - justify-content: space-around; - align-items: center; + padding: 1rem 1rem; margin-bottom: 1rem; } + .consulta_linea { + display: flex; + justify-content: space-between; + align-items: center; + margin-block: .5rem; + gap: 1rem; + } + .consulta_campo { display: flex; gap: 1rem; align-items: center; - width: 100%; } .consulta_campo label { color: white; } + + .expandir { + width: 2.5rem; + font-size: 2.5rem; + font-weight: 900; + color: white; + } - -
  • Agregar Contrato
  • - Generar Excel + Generar PDF +
  • +
  • + Generar Excel
  • -
    - - - -
    <%-- Filtros --%>
    -
    - +
    +
    + + +
    - +
    + + +
    -
    +
    + + +
    -
    - - - - -
    - -
    - - -
    - -
    - -
    - - +
    + +
    + + +
    +
    +
    + +
    - + +
    + +
    + + +
    +
    + +
    + +
    + + +
    +
    + +
    + +
    + + +
    +
    +
    <%-- Listado de Contratos --%> @@ -101,9 +147,9 @@ CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None" data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax,CveChofer, Observaciones, CveContratosEstatus, CveAF"> - + - + @@ -170,7 +216,11 @@