VERSION 5.00
Object = "{0F987290-56EE-11D0-9C43-00A0C90F29FC}#1.0#0"; "ActBar.ocx"
Object = "{B02F3647-766B-11CE-AF28-C3A2FBE76A13}#2.5#0"; "ss32x25.ocx"
Object = "{CDF3B183-D408-11CE-AE2C-0080C786E37D}#2.1#0"; "Edt32x20.ocx"
Begin VB.Form FCO2080 
   Caption         =   "Mto Tabla ALA - ISS"
   ClientHeight    =   5745
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10035
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "TablasISS.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   5745
   ScaleWidth      =   10035
   Begin EditLib.fpLongInteger txtMes 
      Height          =   285
      Left            =   3105
      TabIndex        =   2
      Top             =   120
      Width           =   735
      _Version        =   131073
      _ExtentX        =   1296
      _ExtentY        =   503
      _StockProps     =   68
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      ThreeDInsideStyle=   1
      ThreeDInsideHighlightColor=   -2147483633
      ThreeDInsideShadowColor=   -2147483642
      ThreeDInsideWidth=   1
      ThreeDOutsideStyle=   1
      ThreeDOutsideHighlightColor=   16777215
      ThreeDOutsideShadowColor=   -2147483632
      ThreeDOutsideWidth=   1
      ThreeDFrameWidth=   0
      BorderStyle     =   0
      BorderColor     =   -2147483642
      BorderWidth     =   1
      ButtonDisable   =   0   'False
      ButtonHide      =   0   'False
      ButtonIncrement =   1
      ButtonMin       =   1
      ButtonMax       =   100
      ButtonStyle     =   1
      ButtonWidth     =   0
      ButtonWrap      =   -1  'True
      ButtonDefaultAction=   -1  'True
      ThreeDText      =   0
      ThreeDTextHighlightColor=   -2147483633
      ThreeDTextShadowColor=   -2147483632
      ThreeDTextOffset=   1
      AlignTextH      =   2
      AlignTextV      =   1
      AllowNull       =   0   'False
      NoSpecialKeys   =   3
      AutoAdvance     =   0   'False
      AutoBeep        =   0   'False
      CaretInsert     =   0
      CaretOverWrite  =   3
      UserEntry       =   0
      HideSelection   =   -1  'True
      InvalidColor    =   -2147483637
      InvalidOption   =   0
      MarginLeft      =   3
      MarginTop       =   3
      MarginRight     =   3
      MarginBottom    =   3
      NullColor       =   -2147483637
      OnFocusAlignH   =   0
      OnFocusAlignV   =   0
      OnFocusNoSelect =   0   'False
      OnFocusPosition =   0
      ControlType     =   0
      Text            =   "0"
      MaxValue        =   "12"
      MinValue        =   "1"
      NegFormat       =   1
      NegToggle       =   0   'False
      Separator       =   ""
      UseSeparator    =   0   'False
      IncInt          =   1
      BorderGrayAreaColor=   -2147483637
      ThreeDOnFocusInvert=   0   'False
      ThreeDFrameColor=   -2147483633
      Appearance      =   0
      BorderDropShadow=   0
      BorderDropShadowColor=   -2147483632
      BorderDropShadowWidth=   3
      MouseIcon       =   "TablasISS.frx":030A
   End
   Begin EditLib.fpLongInteger txtAnio 
      Height          =   285
      Left            =   1305
      TabIndex        =   1
      Top             =   120
      Width           =   735
      _Version        =   131073
      _ExtentX        =   1296
      _ExtentY        =   503
      _StockProps     =   68
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      ThreeDInsideStyle=   1
      ThreeDInsideHighlightColor=   -2147483633
      ThreeDInsideShadowColor=   -2147483642
      ThreeDInsideWidth=   1
      ThreeDOutsideStyle=   1
      ThreeDOutsideHighlightColor=   16777215
      ThreeDOutsideShadowColor=   -2147483632
      ThreeDOutsideWidth=   1
      ThreeDFrameWidth=   0
      BorderStyle     =   0
      BorderColor     =   -2147483642
      BorderWidth     =   1
      ButtonDisable   =   0   'False
      ButtonHide      =   0   'False
      ButtonIncrement =   1
      ButtonMin       =   1
      ButtonMax       =   100
      ButtonStyle     =   1
      ButtonWidth     =   0
      ButtonWrap      =   -1  'True
      ButtonDefaultAction=   -1  'True
      ThreeDText      =   0
      ThreeDTextHighlightColor=   -2147483633
      ThreeDTextShadowColor=   -2147483632
      ThreeDTextOffset=   1
      AlignTextH      =   2
      AlignTextV      =   1
      AllowNull       =   0   'False
      NoSpecialKeys   =   3
      AutoAdvance     =   0   'False
      AutoBeep        =   0   'False
      CaretInsert     =   0
      CaretOverWrite  =   3
      UserEntry       =   0
      HideSelection   =   -1  'True
      InvalidColor    =   -2147483637
      InvalidOption   =   0
      MarginLeft      =   3
      MarginTop       =   3
      MarginRight     =   3
      MarginBottom    =   3
      NullColor       =   -2147483637
      OnFocusAlignH   =   0
      OnFocusAlignV   =   0
      OnFocusNoSelect =   0   'False
      OnFocusPosition =   0
      ControlType     =   0
      Text            =   "0"
      MaxValue        =   "2078"
      MinValue        =   "2002"
      NegFormat       =   1
      NegToggle       =   0   'False
      Separator       =   ""
      UseSeparator    =   0   'False
      IncInt          =   1
      BorderGrayAreaColor=   -2147483637
      ThreeDOnFocusInvert=   0   'False
      ThreeDFrameColor=   -2147483633
      Appearance      =   0
      BorderDropShadow=   0
      BorderDropShadowColor=   -2147483632
      BorderDropShadowWidth=   3
      MouseIcon       =   "TablasISS.frx":0326
   End
   Begin FPSpread.vaSpread sprMtto 
      Bindings        =   "TablasISS.frx":0342
      Height          =   3615
      Left            =   120
      TabIndex        =   9
      Top             =   1320
      Width           =   9615
      _Version        =   131077
      _ExtentX        =   16960
      _ExtentY        =   6376
      _StockProps     =   64
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MaxCols         =   1
      MaxRows         =   1
      SpreadDesigner  =   "TablasISS.frx":0358
   End
   Begin VB.TextBox txtSUC 
      Height          =   285
      Left            =   6960
      MaxLength       =   10
      TabIndex        =   5
      Top             =   120
      Width           =   615
   End
   Begin VB.Frame frmNov 
      Caption         =   "Novedades"
      Height          =   735
      Left            =   5040
      TabIndex        =   10
      Top             =   480
      Width           =   4095
      Begin VB.Label lblConvenciones 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "A: Pension"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   6.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   0
         Left            =   120
         TabIndex        =   11
         Top             =   240
         Width           =   675
      End
      Begin VB.Label lblConvenciones 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "B: Salud"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   6.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   1
         Left            =   120
         TabIndex        =   14
         Top             =   480
         Width           =   525
      End
      Begin VB.Label lblConvenciones 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "C: Riesgos Profesionales"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   6.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   4
         Left            =   960
         TabIndex        =   12
         Top             =   240
         Width           =   1605
      End
      Begin VB.Label lblConvenciones 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "D: Día anterior al inicio de la novedad"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   6.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   5
         Left            =   960
         TabIndex        =   15
         Top             =   480
         Width           =   2370
      End
      Begin VB.Label lblConvenciones 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "E: Duración novedad"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   6.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   8
         Left            =   2640
         TabIndex        =   13
         Top             =   240
         Width           =   1320
      End
   End
   Begin VB.TextBox txtBusqID 
      Height          =   285
      Left            =   1380
      TabIndex        =   7
      Top             =   960
      Width           =   975
   End
   Begin VB.TextBox txtBusqTrab 
      Height          =   285
      Left            =   105
      TabIndex        =   6
      Top             =   960
      Width           =   990
   End
   Begin VB.TextBox txtBusqNom 
      Height          =   285
      Left            =   2370
      TabIndex        =   8
      Top             =   960
      Width           =   2460
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "&Año"
      Height          =   210
      Index           =   2
      Left            =   840
      TabIndex        =   0
      Top             =   180
      Width           =   300
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "&Mes"
      Height          =   210
      Index           =   3
      Left            =   2640
      TabIndex        =   3
      Top             =   180
      Width           =   300
   End
   Begin ActiveBarLibraryCtl.ActiveBar abToolbar 
      Left            =   9420
      Top             =   60
      _ExtentX        =   847
      _ExtentY        =   847
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Bands           =   "TablasISS.frx":04B1
   End
   Begin VB.Image imgListaSuc 
      Height          =   375
      Index           =   0
      Left            =   7680
      Top             =   120
      Width           =   405
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "&Sucursal"
      Height          =   210
      Index           =   0
      Left            =   6240
      TabIndex        =   4
      Top             =   120
      Width           =   645
   End
   Begin VB.Image imgListaSuc 
      Height          =   375
      Index           =   1
      Left            =   7680
      Top             =   120
      Width           =   405
   End
End
Attribute VB_Name = "FCO2080"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private MBitacora As New ADAMBitacora.Bitacora
Private WithEvents clsSpread As NSpread
Attribute clsSpread.VB_VarHelpID = -1
Private MAdo As ODBC.ODBCDirecto
Private Micx As Integer 'Conexión
Private MiX As Integer 'Ancho de la forma
Private MiY As Integer 'Alta de la forma
Private MsTabla As String

Private MiNumDecimales As Integer        ' Número de decimales

Private MbRenovar As Boolean
Private MsSql As String
Private MSOrder As String
Private MsCondID As String
Private MsCondNO As String
Private MsCondTR As String
Private MsCodAgrSUC As String
Private MbFocoForm As Boolean

Private MbOrdenAsc As Boolean
Private MsAntOrden As String


Private Sub abToolbar_Click(ByVal Tool As ActiveBarLibraryCtl.Tool)
    Select Case LCase(Tool.Name)
        Case "tlordena": OrdenarDatos
        Case "tlrenueva": RenuevaDatos
        Case "tlguarda": GuardaCambios
        Case "tlbaja": EliminarTabla
        Case "tlsalida": Unload Me
    End Select
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyF3: Unload Me
        Case vbKeyF4: If LTrim(ActiveControl.Name) = "txtsuc" Then imgListaSuc_Click 0
        Case vbKeyF5: RenuevaDatos
        Case vbKeyF7: EliminarTabla
        Case vbKeyF11: GuardaCambios
        Case vbKeyF12: abToolbar.Bands(1).TrackPopup -1, -1
    End Select
End Sub

Private Sub Form_Load()
    GbAError = False
    Me.Tag = GiVenMax%
    Gven(Val(Me.Tag)).icx = Gicx%
    Micx = Gven(Val(Me.Tag)).icx
    Set MAdo = Gtc(Micx).Ado
    Me.Icon = LoadPicture(sIconoForma)
    
    'Checa nivel de seguridad
    Gven(Val(Me.Tag)).iNivSeguridad = iObtenNivSeguridad(GsOper, GsUid, Micx)
    If Gven(Val(Me.Tag)).iNivSeguridad = 0 Then
        Screen.MousePointer = vbDefault
        Me.Top = -10000
        GbAError = True
        Exit Sub
    End If
    
    Set clsSpread = New NSpread
    GAdam.ObtieneColores
    
    If Not MDIChild Then
        WindowState = 0
        Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
        Screen.MousePointer = vbDefault
    End If
    
    'Tamaño de la forma
    If Me.WindowState = 0 Then
        MiX = 10155
        MiY = 6150
        Me.Width = MiX
        Me.Height = MiY
    End If

    imgListaSuc(0).Picture = LoadPicture(App.Path & "\images\F4a2.ico")
    imgListaSuc(1).Picture = LoadPicture(App.Path & "\images\F4a1.ico")
    Caption = GsDsn & " / " & GsCveCia & " - Mantenimiento tabla reporte ALA - ISS"
    AsignaIconos abToolbar, 3, LBAJA, LORDENA, LRENUEVA, LGUARDA, LSALIDA
    ToolInicioGrupo abToolbar, 3, True, 1, 4
    
    txtAnio = IIf(Month(Date) = 12, Year(Date) - 1, Year(Date))
    txtMes = IIf(Month(Date) = 1, 12, Month(Date) - 1)
    
    MSOrder = ""
    MsCondID = ""
    MsCondNO = ""
    MsCondTR = ""
    MbFocoForm = True
    
    'Decimales según panel de control
    MiNumDecimales = iNumeroDecimalesImporte
    
    CreaBitacora
    RenuevaDatos
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Not MbFocoForm Then imgListaSuc(0).ZOrder
    MbFocoForm = True
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 2 Then abToolbar.Bands(1).TrackPopup -1, -1
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If iDeseaGuardarCambios = 2 Then Cancel = True
    Set MAdo = Nothing
    Set MBitacora = Nothing
    Set clsSpread = Nothing
    Gtc(Micx).ihijas = Gtc(Micx).ihijas - 1
    Set FCO2080 = Nothing
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If GbExterno Then End
End Sub

Private Sub imgListaSuc_Click(Index As Integer)
    Screen.MousePointer = vbHourglass
    MsCodAgrSUC = sRecuperarParamALA(MAdo, 23)
    GsParamIN(0) = "SELECT dato, descripcion FROM datos_agr_trab WHERE agrupacion ='" & MsCodAgrSUC & "'"
    GsParamIN(1) = "dato"
    GsParamIN(2) = "descripcion"
    GsParamIN(3) = "Codigo"
    GsParamIN(4) = "Nombre"
    GsParamIN(5) = "Sucursal"
    GsParamIN(6) = ""
    frmLista.Show 1
    txtSUC = GsParamOUT(0)
End Sub

Private Sub imgListaSuc_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    imgListaSuc(1).ZOrder
    MbFocoForm = False
End Sub

Private Sub sprMtto_Change(ByVal Col As Long, ByVal Row As Long)
    MBitacora.mCambia
End Sub

Private Sub sprMtto_DataFill(ByVal Col As Long, ByVal Row As Long, ByVal DataType As Integer, ByVal fGetData As Integer, Cancel As Integer)
    Dim Aux As Variant
    Select Case Col
        Case 4
            sprMtto.GetDataFillData Aux, 1
            sprMtto.SetText Col, Row, Replace(Aux, "/", " ")
            Cancel = True
    End Select
End Sub

Private Sub sprMtto_EditMode(ByVal Col As Long, ByVal Row As Long, ByVal Mode As Integer, ByVal ChangeMade As Boolean)
    MBitacora.mCambia
End Sub

Private Sub ConfiguraSpread()
    sprMtto.VisibleCols = 14
    With sprMtto
        .Visible = False
        .Action = 28
        GAdam.ConfiguracionSpread sprMtto
        .Row = 0:
        .Col = 1: .Text = "Trab."
        .Col = 2: .Text = "Id"
        .Col = 3: .Text = "Nro"
        .Col = 4: .Text = "Nombre"
        .Col = 5: .Text = "A"
        .Col = 6: .Text = "B"
        .Col = 7: .Text = "C"
        .Col = 8: .Text = "D"
        .Col = 9: .Text = "E"
        .Col = 10: .Text = "Dias"
        .Col = 11: .Text = "IBC"
        .Col = 12: .Text = "Ap Pe"
        .Col = 13: .Text = "FSP"
        .Col = 14: .Text = "Ap Sa"
        .Col = 1: .Row = -1: .Lock = True
        .Col = 3: .Row = -1: .Lock = True
        .Col = 4: .Row = -1: .Lock = True
        .Visible = True
        .Col = 4
        .DataFillEvent = True
        ConfiguraSpreadJCL sprMtto
    End With
    EstablecerAncho
End Sub

Private Sub CreaBitacora()
   MBitacora.mCreaBitacora sprMtto, MAdo.lhEnv, MAdo.lhDbc, MAdo.lhstmt, MAdo
   MBitacora.p_ConfirmaBaja = True
   MBitacora.mDefineLlave 1
   MBitacora.mTablaSPInfo 2, "sp_fco_cambio_vw_iss", "'" & GsCveCia & "'", "'" & MsTabla & "'", 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
   MBitacora.mColNoNulls 1
End Sub

Private Sub GuardaCambios()
    If sprMtto.MaxRows = 0 Then Exit Sub
    Screen.MousePointer = vbHourglass
    MbRenovar = MBitacora.mActualizaBD
    MBitacora.mVaciaBuffer
    Screen.MousePointer = vbDefault
End Sub

Private Function iDeseaGuardarCambios() As Integer
    ' Descripción : Devuelve el valor de la opción seleccionada en la clsMsgBox
    ' Uso : iDeseaGuardarCambios
    ' Regresa : Un Entero , dependiendo de la respuesta en clsMsgBox
    If MBitacora.pTransActual > 0 Then
       iDeseaGuardarCambios = clsMsgbox.Mensaje("¿Desea guardar los cambios?", mSiNoCancelar, mConfirma, GsTitMsg)
       Select Case iDeseaGuardarCambios
          Case 6
             GuardaCambios
             If MbRenovar = 0 Then iDeseaGuardarCambios = 2
          Case 7
             MBitacora.mVaciaBuffer 'Vacía el Buffer de la Bitácora
       End Select
    Else
        iDeseaGuardarCambios = 1
    End If
End Function

Private Sub OrdenarDatos()
    Screen.MousePointer = vbHourglass
    If MsAntOrden = CStr(sprMtto.ActiveCol) Then
        MbOrdenAsc = Not (MbOrdenAsc)
    Else
        MbOrdenAsc = True
    End If
    MSOrder = " Order By " & CStr(sprMtto.ActiveCol) & IIf(MbOrdenAsc, "", "DESC")
    MsAntOrden = CStr(sprMtto.ActiveCol)
    RenuevaDatos
    Screen.MousePointer = vbDefault
End Sub

Private Sub RenuevaDatos()
Dim sSELECT As String
Dim sFROM As String
Dim sWHERE As String

    ConfiguraSpread
    RecuperarTabla
                            
    sSELECT = _
    " SELECT COD_TRAB, C10A, C10B, REPLACE(C10C,'/', ' '), LTRIM(RTRIM(C11A)) A, LTRIM(RTRIM(C11B)) B, LTRIM(RTRIM(C11C)) C," & _
    " C11D, C11E, C12A, C13A, C14A, C14B, C14C"
    
    sFROM = " FROM " & MsTabla
    
    sWHERE = " WHERE  CIA=" & "'" & GsCveCia & "'" & _
    " AND C13A + C14A + C14B + C14C > 0" & _
    IIf(Trim(txtSUC) = "", "", "   AND  ltrim(rtrim(COD_SUC))='" & Trim(txtSUC) & "'")
    
    If MsTabla = "FCO_VW_ISS" Then sWHERE = " WHERE 1=2"

    MsSql = sSELECT & sFROM & sWHERE
      
    MAdo.Sql = MsSql & MsCondID & MsCondNO & MsCondTR & MSOrder
      
    If Not MAdo.SendSQL Then  'capturamos aqui el error.  Quizas el usuario no tenga permisos
      MsTabla = "FCO_VW_ISS"
      sFROM = " FROM " & MsTabla
      sWHERE = " WHERE 1 = 2 "
      
      MsSql = sSELECT & sFROM & sWHERE
      
      MAdo.Sql = MsSql & MsCondID & MsCondNO & MsCondTR & MSOrder
      If Not MAdo.SendSQL Then Exit Sub
    End If

    clsSpread.LlenaSpread 0, sprMtto, MAdo, MAdo.lhDbc, MAdo.lhstmt
    
    EstablecerAncho
    EstablecerPropiedades
    On Error Resume Next
    sprMtto.SetFocus

    CreaBitacora

End Sub

Private Sub sprMtto_KeyPress(KeyAscii As Integer)
    If sprMtto.ActiveCol > 4 And sprMtto.ActiveCol < 8 Then
        KeyAscii = iValidarDato(KeyAscii, "LVTRI ", True, True)
    End If
End Sub

Private Sub sprMtto_LeaveCell(ByVal Col As Long, ByVal Row As Long, ByVal NewCol As Long, ByVal NewRow As Long, Cancel As Boolean)
    If Col > 4 Then
        With sprMtto
            .Col = Col
            .Row = Row
            .Text = Trim(.Text)
            .Col = NewCol
            .Row = NewRow
        End With
        MBitacora.mCambia
    End If
End Sub

Private Sub txtAnio_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        CambioAnioMes
        Me.txtMes.SetFocus
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If

End Sub

Private Sub txtBusqID_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case vbKeyReturn
            MsCondID = " AND C10B Like '%" & txtBusqID & "%'"
            RenuevaDatos
        Case 10
            MsCondID = " AND LTrim(RTrim(C11B)) Like '" & txtBusqID & "%'"
            RenuevaDatos
    End Select
End Sub

Private Sub txtBusqNom_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case vbKeyReturn
            MsCondNO = " AND C10C Like '%" & txtBusqNom & "%'"
            RenuevaDatos
        Case 10
            MsCondNO = " AND LTrim(RTrim(C10C)) Like '" & txtBusqNom & "%'"
            RenuevaDatos
    End Select
End Sub

Private Sub txtBusqTrab_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case vbKeyReturn
            MsCondTR = " AND COD_TRAB Like '%" & txtBusqTrab & "%'"
            RenuevaDatos
        Case 10
            MsCondTR = " AND LTrim(RTrim(COD_TRAB)) Like '" & txtBusqTrab & "%'"
            RenuevaDatos
    End Select
End Sub

Private Sub txtMes_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        CambioAnioMes
        Me.txtSUC.SetFocus
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If
End Sub

Private Sub txtSUC_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then SendEnter
End Sub

Private Sub EstablecerAncho()
    With sprMtto
        .ColWidth(1) = 8
        .ColWidth(2) = 2
        .ColWidth(3) = 8
        .ColWidth(4) = 21
        .ColWidth(5) = 2
        .ColWidth(6) = 2
        .ColWidth(7) = 2
        .ColWidth(8) = 2
        .ColWidth(9) = 2
        .ColWidth(10) = 4
        .ColWidth(11) = 10
        .ColWidth(12) = 10
        .ColWidth(13) = 10
        .ColWidth(14) = 10
    End With
End Sub

Private Sub RecuperarTabla()
    MsTabla = "FCO_VW_ISS"
    
    If Mid$(UCase(GsDsn), 1, 3) = "ORA" Then
        MAdo.Sql = "Select object_name from All_Objects" & _
        " Where object_type='TABLE' and object_name = 'FCO_VW_ISS_" & Trim(GsCveCia) & "_" & txtAnio.Text & "_" & txtMes.Text & "'"
    Else
        MAdo.Sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES" & _
        " WHERE TABLE_TYPE = 'BASE TABLE'" & _
        " AND TABLE_NAME = 'FCO_VW_ISS_" & Trim(GsCveCia) & "_" & txtAnio.Text & "_" & txtMes.Text & "'"
    End If
    MAdo.SendSQL
    If Not MAdo.EOF Then
        MsTabla = MAdo.GetField(1)
    End If
End Sub

Private Sub EliminarTabla()
    If Val(txtAnio) = 0 Or Val(txtMes) = 0 Then
        Screen.MousePointer = vbDefault
        clsMsgbox.Mensaje "Debe digitar un año y mes válidos", mAceptar, mAdvierte, GsTitMsg
        Exit Sub
    End If
    
    If clsMsgbox.Mensaje("¿Esta realmente seguro de eliminar definitivamente esta tabla?", mSiNoCancelar, mConfirma, GsTitMsg) = vbYes Then
        Screen.MousePointer = vbHourglass
        MAdo.Sql = "sp_fco_baja_tablas '" & MsTabla & "'"
        If MAdo.ExecSQL = -1 Then GoTo NoPude
        Screen.MousePointer = vbDefault
    End If
    
    RenuevaDatos
    sprMtto.VirtualMaxRows = 0
    Exit Sub
NoPude:
    Screen.MousePointer = vbDefault
    If Err > 0 Then
        clsMsgbox.Mensaje Err.Description, mAceptar, mAdvierte, GsTitMsg
    End If
End Sub

Private Sub EstablecerPropiedades()
    Dim i As Byte
    With sprMtto
        For i = 5 To 7
            .Col = i: .Row = -1: .TypeEditLen = 1: .TypeEditCharCase = 2
        Next i
        .Col = 3: .Row = -1: .CellType = 3
        For i = 11 To 14
          .Col = i: .Row = -1:  .CellType = 2: .TypeFloatSeparator = True:
                  .TypeFloatDecimalPlaces = MiNumDecimales: .TypeFloatMax = "99999999999999999": .TypeFloatMin = "0.00"
        Next i
    
    End With
End Sub

Private Sub CambioAnioMes()
  Screen.MousePointer = vbHourglass
  MSOrder = ""
  txtBusqID = "": MsCondID = ""
  txtBusqNom = "": MsCondNO = ""
  txtBusqTrab = "": MsCondTR = ""
  RenuevaDatos
  Screen.MousePointer = vbDefault
End Sub

