VERSION 5.00
Object = "{0F987290-56EE-11D0-9C43-00A0C90F29FC}#1.0#0"; "ActBar.ocx"
Object = "{AB3877A8-B7B2-11CF-9097-444553540000}#1.0#0"; "gtdate32.ocx"
Begin VB.Form FCO2000A 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Ausentismos"
   ClientHeight    =   7260
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6270
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "Alta o Cambio de Ausentismos.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7260
   ScaleWidth      =   6270
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame fraFrame 
      Height          =   735
      Index           =   1
      Left            =   240
      TabIndex        =   41
      Top             =   5880
      Visible         =   0   'False
      Width           =   5775
      Begin GTMaskDate.GTMaskDate GTdAccidente 
         Height          =   300
         HelpContextID   =   722
         Left            =   2280
         TabIndex        =   43
         Top             =   240
         Width           =   1320
         _Version        =   65537
         _ExtentX        =   2328
         _ExtentY        =   529
         _StockProps     =   77
         BackColor       =   -2147483643
         BeginProperty NullFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalDayCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty ToolTipFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Fecha del Accidente:"
         Height          =   210
         Index           =   13
         Left            =   360
         TabIndex        =   42
         Top             =   240
         Width           =   1530
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Fechas Reales del Ausentismo"
      ForeColor       =   &H00FF0000&
      Height          =   735
      Left            =   240
      TabIndex        =   16
      Top             =   3240
      Width           =   5775
      Begin VB.TextBox txtNroDoc 
         Height          =   315
         Left            =   4800
         TabIndex        =   22
         Top             =   240
         Width           =   855
      End
      Begin GTMaskDate.GTMaskDate GTdIniReal 
         Height          =   300
         HelpContextID   =   722
         Left            =   600
         TabIndex        =   18
         Top             =   240
         Width           =   1320
         _Version        =   65537
         _ExtentX        =   2328
         _ExtentY        =   529
         _StockProps     =   77
         BackColor       =   -2147483643
         BeginProperty NullFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalDayCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty ToolTipFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin GTMaskDate.GTMaskDate GTdFinReal 
         Height          =   300
         HelpContextID   =   722
         Left            =   2320
         TabIndex        =   20
         Top             =   240
         Width           =   1320
         _Version        =   65537
         _ExtentX        =   2328
         _ExtentY        =   529
         _StockProps     =   77
         BackColor       =   -2147483643
         BeginProperty NullFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         BeginProperty CalFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalDayCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty ToolTipFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Label lblLabels 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "N&ro. de incapacidad"
         Height          =   420
         Index           =   7
         Left            =   3720
         TabIndex        =   21
         Top             =   195
         Width           =   960
         WordWrap        =   -1  'True
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "&Fin"
         Height          =   210
         Index           =   12
         Left            =   2040
         TabIndex        =   19
         Top             =   240
         Width           =   210
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "&Inicio"
         Height          =   210
         Index           =   2
         Left            =   120
         TabIndex        =   17
         Top             =   240
         Width           =   360
      End
   End
   Begin VB.Frame fraFrame 
      Caption         =   "Tiempo"
      Height          =   855
      Index           =   3
      Left            =   240
      TabIndex        =   12
      Top             =   2280
      Width           =   5775
      Begin VB.TextBox txtDias 
         Height          =   285
         Left            =   1680
         MaxLength       =   8
         TabIndex        =   14
         Top             =   240
         Width           =   735
      End
      Begin VB.Frame fraFrame 
         Caption         =   "Tipo de Dias"
         Height          =   615
         Index           =   0
         Left            =   2760
         TabIndex        =   15
         Top             =   140
         Width           =   2655
         Begin VB.OptionButton optTipoDias 
            Caption         =   "Habiles"
            Height          =   255
            Index           =   1
            Left            =   1440
            TabIndex        =   39
            Top             =   240
            Width           =   1095
         End
         Begin VB.OptionButton optTipoDias 
            Caption         =   "Calendario"
            Height          =   255
            Index           =   0
            Left            =   120
            TabIndex        =   38
            Top             =   240
            Value           =   -1  'True
            Width           =   1095
         End
      End
      Begin VB.Label lblLabels 
         BackStyle       =   0  'Transparent
         Caption         =   "Nú&mero de Días"
         Height          =   255
         Index           =   5
         Left            =   120
         TabIndex        =   13
         Top             =   240
         Width           =   1440
      End
   End
   Begin VB.Frame fraFrame 
      Caption         =   "Observaciones"
      Height          =   1095
      Index           =   4
      Left            =   240
      TabIndex        =   28
      Top             =   4800
      Width           =   5790
      Begin VB.TextBox txtObservaciones 
         Height          =   735
         Left            =   120
         MultiLine       =   -1  'True
         TabIndex        =   29
         Top             =   240
         Width           =   5535
      End
   End
   Begin VB.TextBox txtProrroga 
      Height          =   285
      Left            =   4560
      TabIndex        =   9
      Top             =   1440
      Width           =   975
   End
   Begin VB.TextBox txtDiag 
      BackColor       =   &H8000000F&
      BorderStyle     =   0  'None
      Height          =   315
      Left            =   3000
      Locked          =   -1  'True
      TabIndex        =   37
      TabStop         =   0   'False
      Text            =   "Descripción del Diagnóstico"
      Top             =   1920
      Width           =   3015
   End
   Begin VB.ComboBox cboTipo 
      Height          =   330
      ItemData        =   "Alta o Cambio de Ausentismos.frx":030A
      Left            =   1425
      List            =   "Alta o Cambio de Ausentismos.frx":030C
      Style           =   2  'Dropdown List
      TabIndex        =   7
      Top             =   1440
      Width           =   2175
   End
   Begin VB.TextBox txtDiagnostico 
      Height          =   285
      Left            =   1425
      MaxLength       =   6
      TabIndex        =   11
      Top             =   1920
      Width           =   975
   End
   Begin VB.TextBox txtTrabajador 
      Height          =   285
      Left            =   1425
      MaxLength       =   10
      TabIndex        =   3
      Top             =   600
      Width           =   975
   End
   Begin VB.TextBox txtConcepto 
      Height          =   315
      Left            =   1425
      MaxLength       =   6
      TabIndex        =   5
      Top             =   960
      Width           =   975
   End
   Begin VB.Frame fraFrame 
      Caption         =   "Fechas de Amortización en Nómina"
      ForeColor       =   &H00800000&
      Height          =   705
      Index           =   2
      Left            =   240
      TabIndex        =   23
      Top             =   4080
      Width           =   5775
      Begin GTMaskDate.GTMaskDate GTdFin 
         Height          =   300
         HelpContextID   =   722
         Left            =   3240
         TabIndex        =   27
         Top             =   240
         Width           =   1320
         _Version        =   65537
         _ExtentX        =   2328
         _ExtentY        =   529
         _StockProps     =   77
         BackColor       =   -2147483643
         BeginProperty NullFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         BeginProperty CalFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalDayCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty ToolTipFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin GTMaskDate.GTMaskDate GTdInicio 
         Height          =   300
         HelpContextID   =   722
         Left            =   1080
         TabIndex        =   25
         Top             =   240
         Width           =   1320
         _Version        =   65537
         _ExtentX        =   2328
         _ExtentY        =   529
         _StockProps     =   77
         BackColor       =   -2147483643
         BeginProperty NullFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty CalDayCaptionFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty ToolTipFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "I&nicio"
         Height          =   210
         Index           =   4
         Left            =   480
         TabIndex        =   24
         Top             =   240
         Width           =   360
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Fin"
         Height          =   210
         Index           =   6
         Left            =   2880
         TabIndex        =   26
         Top             =   240
         Width           =   210
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Cálculo del IBC"
      Height          =   765
      Left            =   -480
      TabIndex        =   30
      Top             =   6240
      Visible         =   0   'False
      Width           =   5775
      Begin VB.ComboBox cboIBC 
         Height          =   330
         ItemData        =   "Alta o Cambio de Ausentismos.frx":030E
         Left            =   1020
         List            =   "Alta o Cambio de Ausentismos.frx":0310
         Style           =   2  'Dropdown List
         TabIndex        =   32
         Top             =   270
         Width           =   2175
      End
      Begin VB.TextBox txtIBC 
         ForeColor       =   &H00000000&
         Height          =   315
         Left            =   4155
         MaxLength       =   19
         TabIndex        =   34
         Top             =   270
         Width           =   1455
      End
      Begin VB.Label Label1 
         Caption         =   "ESTE FRAME NO SE VE, EL CLIENTE QUE LO NECESITA QUE AVISE..."
         ForeColor       =   &H000000FF&
         Height          =   375
         Left            =   120
         TabIndex        =   40
         Top             =   0
         Visible         =   0   'False
         Width           =   5415
      End
      Begin VB.Label lblLabels 
         BackStyle       =   0  'Transparent
         Caption         =   "Cálculo I&BC"
         Height          =   255
         Index           =   10
         Left            =   135
         TabIndex        =   31
         Top             =   270
         Width           =   1110
      End
      Begin VB.Label lblLabels 
         BackStyle       =   0  'Transparent
         Caption         =   "&Valor IBC"
         Height          =   255
         Index           =   9
         Left            =   3420
         TabIndex        =   33
         Top             =   300
         Width           =   705
      End
   End
   Begin VB.Label lblConc 
      BackStyle       =   0  'Transparent
      Caption         =   "Descripcion del concepto"
      Height          =   255
      Left            =   3000
      TabIndex        =   36
      Top             =   960
      Width           =   3135
   End
   Begin VB.Label lblProrroga 
      BackStyle       =   0  'Transparent
      Caption         =   "Pr&orroga"
      Height          =   255
      Left            =   3840
      TabIndex        =   8
      Top             =   1440
      Width           =   660
   End
   Begin VB.Image imgListaAus 
      Height          =   480
      Left            =   5640
      Picture         =   "Alta o Cambio de Ausentismos.frx":0312
      Top             =   1440
      Width           =   480
   End
   Begin ActiveBarLibraryCtl.ActiveBar abToolbar 
      Left            =   5520
      Top             =   6720
      _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           =   "Alta o Cambio de Ausentismos.frx":061C
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "Ti&po"
      Height          =   255
      Index           =   8
      Left            =   240
      TabIndex        =   6
      Top             =   1425
      Width           =   495
   End
   Begin VB.Image imgListaDx 
      Height          =   480
      Left            =   2520
      Picture         =   "Alta o Cambio de Ausentismos.frx":16EA
      Top             =   1920
      Width           =   480
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "&Diagnostico"
      Height          =   255
      Index           =   11
      Left            =   240
      TabIndex        =   10
      Top             =   1920
      Width           =   1095
   End
   Begin VB.Label lblIdAusentismo 
      Caption         =   "id"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1800
      TabIndex        =   1
      Top             =   120
      Width           =   1215
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "Id. del Ausentismo:"
      Height          =   255
      Index           =   3
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1575
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "&Trabajador"
      Height          =   255
      Index           =   0
      Left            =   240
      TabIndex        =   2
      Top             =   600
      Width           =   975
   End
   Begin VB.Image imgListaTra 
      Height          =   480
      Left            =   2520
      Picture         =   "Alta o Cambio de Ausentismos.frx":19F4
      Top             =   600
      Width           =   480
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "&Concepto"
      Height          =   255
      Index           =   1
      Left            =   240
      TabIndex        =   4
      Top             =   960
      Width           =   975
   End
   Begin VB.Image imgListaCon 
      Height          =   480
      Left            =   2520
      Picture         =   "Alta o Cambio de Ausentismos.frx":1CFE
      Top             =   960
      Width           =   480
   End
   Begin VB.Label lblTrab 
      BackStyle       =   0  'Transparent
      Caption         =   "Nombre del Trabajador"
      Height          =   255
      Left            =   3000
      TabIndex        =   35
      Top             =   600
      Width           =   3135
   End
End
Attribute VB_Name = "FCO2000A"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private MAdo As ODBC.ODBCDirecto
Private MiCx As Integer 'Conexión
Private MbHuboCambios As Boolean
Private MsAgrAus As String
Private MbTrValido As Boolean
Private MbCnValido As Boolean
Private MbDxValido As Boolean
Private MbBanderaTr As Boolean
Private MbBanderaCn As Boolean
Private MbBanderaDx As Boolean
Private MBCalcularFin As Boolean
Private MbListaAus As Boolean
Private GIdProc As Integer
Private MbDatosOk As Boolean
Private MsDia31 As String
Private MbValidaIni As Boolean
Private Enum UnidadTiempo
    Dias
    Horas
End Enum

Private Sub abToolbar_Click(ByVal Tool As ActiveBarLibraryCtl.Tool)
    Select Case LCase(Tool.Name)
        Case "tlguarda": GuardarDatos
        Case "tlinicial": Inicializa
        Case "tlsalida": Unload Me
    End Select
End Sub

Private Sub cboIBC_Click()
'este proceso solo se realiza si es un alta
If MbDatosOk Then
  If cboIBC.ListIndex > -1 Then
     ConsultarIBC
  End If
End If
End Sub

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

Private Sub cboTipo_Click()
    If Me.cboTipo.ListIndex = 4 Or (UCase(Me.cboTipo.Text) = "PRORROGA") Then
        Me.lblProrroga.Visible = True
        Me.txtProrroga.Visible = True
        Me.imgListaAus.Visible = True
        Me.txtProrroga = ""
    Else
        Me.lblProrroga.Visible = False
        Me.txtProrroga.Visible = False
        Me.imgListaAus.Visible = False
    End If

    If cboTipo.ListIndex = 3 Or (UCase(cboTipo.Text) = "ACCIDENTE DE TRABAJO") Then
        fraFrame(1).Visible = True
    Else
        fraFrame(1).Visible = False
    End If
End Sub

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

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyF3: Unload Me
        Case vbKeyF11: GuardarDatos
    End Select
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF4 Then
        If LCase(ActiveControl.Name) = "txtconcepto" Then imgListaCon_Click
        If LCase(ActiveControl.Name) = "txttrabajador" Then imgListaTra_Click
        If LCase(ActiveControl.Name) = "txtdiagnostico" Then imgListaDx_Click
    End If
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)
    
    WindowState = 0
    Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
    Screen.MousePointer = vbDefault
    
    'Tamaño de la forma
    If Me.WindowState = 0 Then
        Width = 6360
        Height = 7740
    End If
    
    AsignaIconos abToolbar, 3, LINICIAL, LGUARDA, LSALIDA
    ToolInicioGrupo abToolbar, 3, True, 1
    
    Me.lblProrroga.Visible = False
    Me.txtProrroga.Visible = False
    Me.imgListaAus.Visible = False
    RecuperarTipos
    RecuperarCalculoIBC
    RecuperarParametros
    
    MbValidaIni = False
    GAdam.ConfiguraFecha GTdInicio, True
    GAdam.ConfiguraFecha GTdFin, True
    GAdam.ConfiguraFecha GTdIniReal, True
    GAdam.ConfiguraFecha GTdFinReal, True
    GAdam.ConfiguraFecha GTdAccidente, True
            
    MbDatosOk = False
    'If FCO2000.Tag = "A" Then
    If GsLlave = "A" Then
        HallarSiguienteId
        lblTrab = ""
        lblConc = ""
        txtDiag = ""
        MbTrValido = False
        MbCnValido = False
        MbDxValido = False
        GTdInicio.Text = Date
        GTdIniReal.Text = GTdInicio.Text
        GTdAccidente.Text = GTdInicio.Text
        MbDatosOk = True
    Else
        RecuperarDatos
    End If
    
    MbHuboCambios = False
    imgListaTra.Height = 240
    GbRen = False
    MbValidaIni = True
    
    Screen.MousePointer = vbDefault
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    MbBanderaTr = False
    MbBanderaCn = False
    MbBanderaDx = False
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    BorrarIdRep
    Set MAdo = Nothing
    Gtc(MiCx).ihijas = Gtc(MiCx).ihijas - 1
    
    Set FCO2000A = Nothing
End Sub

Private Sub GTdAccidente_DropDown()
    If Trim(GTdAccidente.Text) = "/  /" Or Trim(GTdAccidente.Text) = "-  -" Then
        GAdam.ConfiguraGtDate GTdAccidente
    End If
End Sub

Private Sub GTdFin_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = vbKeyReturn Then txtObservaciones.SetFocus
End Sub

Private Sub GTdFinReal_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = vbKeyReturn Then txtNroDoc.SetFocus
End Sub

Private Sub GTdInicio_Change()
Dim iLong As Integer

    On Error Resume Next
    If MBCalcularFin Then
        iLong = Len(GTdInicio)
        If iLong <> 10 Then Exit Sub

        ValidarIni
        CalcularFin
        MbHuboCambios = True
    End If
End Sub

Private Sub GTdInicio_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = vbKeyReturn Then GTdFin.SetFocus
End Sub

Private Sub GTdInicio_Validate(Cancel As Boolean)
If Not bValidarFecha(GTdInicio) Then
   Cancel = True
End If

End Sub

Private Sub GTdIniReal_Change()
    On Error Resume Next
    If MBCalcularFin Then
        CalcularFin
        MbHuboCambios = True
    End If
End Sub

Private Sub GTdIniReal_DropDown()
    If Trim(GTdIniReal.Text) = "/  /" Or Trim(GTdIniReal.Text) = "-  -" Then
        GAdam.ConfiguraGtDate GTdIniReal
    End If
End Sub

Private Sub GTdIniReal_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = vbKeyReturn Then GTdFinReal.SetFocus
End Sub

Private Sub imgListaAus_Click()
Dim sSql As String
Dim SCond As String
    If MbTrValido And MbCnValido Then
        Screen.MousePointer = vbHourglass
                
        sSql = "SELECT id_ausentismo, nombre" & _
        " FROM fco_ausentismos a, trabajadores t " & _
        " WHERE compania = '" & GsCveCia & "' AND a.trabajador = t.trabajador" & _
        " AND a.trabajador = '" & txtTrabajador & "' " & _
        " AND a.concepto = " & txtConcepto & " " & _
        " AND a.tipo <> 4"
        
        SCond = ""
        
        'If FCO2000.Tag <> "A" Then  'es trabajar con, no debe traer como prorroga el mismo
        If GsLlave <> "A" Then
            SCond = " AND id_ausentismo <> " & Me.lblIdAusentismo & ""
        End If
        
        GsParamIN(0) = sSql & SCond
        
        GsParamIN(1) = "id_ausentismo"
        GsParamIN(2) = "nombre"
        GsParamIN(3) = "Ausentismo"
        GsParamIN(4) = "Nombre Trabajador"
        GsParamIN(5) = "Codigo Ausentismos"
        GsParamIN(6) = ""
        frmLista.Show 1
        If GsParamOUT(0) <> "" Then
            txtProrroga = GsParamOUT(0)
            MbListaAus = True
            MbHuboCambios = True
            RecuperarIBC
        End If
    Else
        clsMsgbox.Mensaje "Debe seleccionar primero un trabajador y concepto validos.", mAceptar, mAdvierte, GsTitMsg
    End If
End Sub

Private Sub imgListaCon_Click()
    Screen.MousePointer = vbHourglass
    GsParamIN(0) = "SELECT concepto, descripcion" & _
    " FROM conceptos" & _
    " WHERE concepto in (SELECT concepto FROM rel_conceptos_agr" & _
    " WHERE compania = '" & GsCveCia & "' And agr_conceptos = '" & MsAgrAus & "')"
    GsParamIN(1) = "concepto"
    GsParamIN(2) = "descripcion"
    GsParamIN(3) = "Concepto"
    GsParamIN(4) = "Descripcion"
    GsParamIN(5) = "Conceptos de Ausentismo"
    GsParamIN(6) = ""
    frmLista.Show 1
    If GsParamOUT(0) <> "" Then
        txtConcepto = GsParamOUT(0)
        lblConc = GsParamOUT(1)
        MbHuboCambios = True
        MbCnValido = True
        HallarTipoRelacionado
        cboTipo.SetFocus
    End If
End Sub

Private Sub imgListaCon_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    MbBanderaCn = False
End Sub

Private Sub imgListaDx_Click()
    Screen.MousePointer = vbHourglass
    GsParamIN(0) = "SELECT diagnostico, descripcion" & _
    " FROM fco_diagnosticos" & _
    " WHERE 1=1"
    GsParamIN(1) = "diagnostico"
    GsParamIN(2) = "descripcion"
    GsParamIN(3) = "Diagnóstico"
    GsParamIN(4) = "Descripción"
    GsParamIN(5) = "Diagnósticos"
    GsParamIN(6) = ""
    frmListaDx.Show 1
    If GsParamOUT(0) <> "" Then
        txtDiagnostico = GsParamOUT(0)
        txtDiag = GsParamOUT(1)
        MbHuboCambios = True
        MbDxValido = True
        On Error Resume Next
        txtDias.SetFocus
    End If
    Screen.MousePointer = vbDefault
    
End Sub

Private Sub imgListaDx_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    MbBanderaDx = False
End Sub

Private Sub imgListaTra_Click()
    Screen.MousePointer = vbHourglass
    GsParamIN(0) = "SELECT t.trabajador, REPLACE(t.nombre,'/',' ')" & _
    " FROM trabajadores t, trabajadores_grales tg, rel_usu_clase_nom u " & _
    " WHERE t.trabajador = tg.trabajador" & _
    " AND tg.clase_nomina = u.clase_nomina " & _
    " AND u.usuario = '" & GsUid & "' " & _
    " AND tg.compania = " & "'" & GsCveCia & "'" & _
    " AND tg.sit_trabajador=1"
    GsParamIN(1) = "t.trabajador"
    GsParamIN(2) = "t.nombre"
    GsParamIN(3) = "Trabajador"
    GsParamIN(4) = "Nombre"
    GsParamIN(5) = "Trabajadores"
    GsParamIN(6) = ""
    frmLista.Show 1
    If GsParamOUT(0) <> "" Then
        txtTrabajador = GsParamOUT(0)
        lblTrab = Replace(GsParamOUT(1), "/", " ")
        MbHuboCambios = True
        MbTrValido = True
        txtConcepto.SetFocus
    End If
    Screen.MousePointer = vbDefault
End Sub

Private Sub imgListaTra_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    MbBanderaTr = True
End Sub

Private Sub optTipoDias_Click(Index As Integer)
    On Error Resume Next
    If MBCalcularFin Then CalcularFin
End Sub

Private Sub optTipoDias_KeyPress(Index As Integer, KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = vbKeyReturn Then SendEnter
End Sub

Private Sub txtConcepto_Change()
    lblConc = ""
    txtDias = 0
    MbCnValido = False
End Sub

Private Sub txtConcepto_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        SendEnter
    Else
        KeyAscii = iValidarDato(KeyAscii, "0123456789", True, True)
    End If
End Sub

Private Sub txtConcepto_Validate(Cancel As Boolean)
    If Trim(txtConcepto) = "" Then Exit Sub
    If MbBanderaCn Then Exit Sub
    If Not MbCnValido Then ValidarConcepto
    If Not MbCnValido Then Cancel = True
End Sub

Private Sub txtDiagnostico_Change()
    txtDiag = ""
    MbDxValido = False
End Sub

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

Private Sub txtDiagnostico_Validate(Cancel As Boolean)
    If Trim(txtDiagnostico) = "" Then Exit Sub
    If MbBanderaDx Then Exit Sub
    If Not MbDxValido Then ValidarDiagnostico
    If Not MbDxValido Then Cancel = True
End Sub

Private Sub txtDias_Change()
    If MBCalcularFin Then
        CalcularFin
        MbHuboCambios = True
    End If
End Sub

Private Sub txtDias_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        SendEnter
    Else
        KeyAscii = iValidarDato(KeyAscii, "0123456789.", True, True)
    End If
End Sub

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

End Sub

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

Private Sub txtProrroga_Change()
  MbListaAus = False
End Sub

Private Sub txtProrroga_KeyPress(KeyAscii As Integer)
Dim sSql As String
Dim SCond As String
    If KeyAscii = vbKeyReturn Then
        If MbTrValido And MbCnValido Then
            sSql = "SELECT id_ausentismo" & _
            " FROM fco_ausentismos" & _
            " WHERE id_ausentismo= " & Trim(txtProrroga) & "" & _
            " AND trabajador = '" & txtTrabajador & "' " & _
            " AND concepto = " & txtConcepto & " " & _
            " AND tipo <> 4"
            
            SCond = ""
            
            'If FCO2000.Tag <> "A" Then  'es trabajar con, no debe traer como prorroga el mismo
            If GsLlave <> "A" Then
                SCond = " AND id_ausentismo <> " & Me.lblIdAusentismo & ""
            End If
            
            sSql = sSql & SCond
            MAdo.Sql = sSql
            MAdo.SendSQL
            If MAdo.EOF Then
                clsMsgbox.Mensaje "No existe el codigo ausentismo que pretende grabar como prorroga", mAceptar, mAdvierte, GsTitMsg
            Else
                txtProrroga = MAdo.GetField(1)
                MbListaAus = True
                RecuperarIBC
            End If
            If MbListaAus Then SendEnter
        Else
            clsMsgbox.Mensaje "Debe seleccionar primero un trabajador y concepto validos.", mAceptar, mAdvierte, GsTitMsg
            Me.txtProrroga = ""
        End If
    Else
        KeyAscii = iValidarDato(KeyAscii, "0123456789", True, True)
    End If

End Sub

Private Sub txtTrabajador_Change()
    lblTrab = ""
    MbTrValido = False
End Sub

Private Sub txtTrabajador_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        SendEnter
    Else
        KeyAscii = iValidarDato(KeyAscii, "0123456789", True, True)
    End If
End Sub

Private Sub txtTrabajador_Validate(Cancel As Boolean)
    If Trim(txtTrabajador) = "" Then Exit Sub
    If MbBanderaTr Then Exit Sub
    If Not MbTrValido Then ValidarTrabajador
    If Not MbTrValido Then Cancel = True
End Sub

Private Sub ValidarIni()
Dim bDia As Byte
Dim sDate As Date

If MbValidaIni And UCase(MsDia31) = "NO" Then
  bDia = DatePart("D", GTdInicio.DateValue)
  
  If bDia = 31 Then
     sDate = GTdInicio.DateValue
     clsMsgbox.Mensaje "La fecha de inicio de amortización no puede comenzar en dia 31, se sumará un dia a la fecha de inicio.", mAceptar, minforma, GsTitMsg
     GTdInicio.Text = DateAdd("d", 1, sDate)
  End If
      
End If
End Sub

Private Sub ValidarFin()
Dim iDias As Integer
Dim sDate As Date
Dim bDia31 As Byte

If MbValidaIni And UCase(MsDia31) = "NO" Then
  
  If UCase(Left(GsDsn, 3)) = "SQL" Then
      MAdo.Sql = _
      " SELECT dbo.fn_dt_dias31(" & _
      "'" & Format(GTdInicio.DateValue, "YYYYMMDD") & "'," & _
      "'" & Format(GTdFin.DateValue, "YYYYMMDD") & "')"
      MAdo.SendSQL
      If Not MAdo.EOF Then iDias = MAdo.GetField(1)
      
  Else 'Oracle
      MAdo.Sql = _
      " SELECT fn_dt_dias31(" & _
      "'" & Format(GTdInicio.DateValue, "YYYYMMDD") & "'," & _
      "'" & Format(GTdFin.DateValue, "YYYYMMDD") & "') FROM DUAL"
      MAdo.SendSQL
      If Not MAdo.EOF Then iDias = MAdo.GetField(1)
  End If
        
  If iDias > 0 Then
     sDate = GTdFin.DateValue
     'clsMsgbox.Mensaje "Existen " & iDias & " dia(s) 31 entre el rango de fechas, se sumaran estos a la fecha final", mAceptar, minforma, GsTitMsg
     GTdFin.Text = DateAdd("d", iDias, sDate)
     
     'sin embargo, puede que este resultado final caiga en 31, hay que sumarle un dia
     bDia31 = DatePart("D", GTdFin.DateValue)
     If bDia31 = 31 Then
        sDate = GTdFin.DateValue
        GTdFin.Text = DateAdd("d", 1, sDate)
     End If
  End If
      
End If
End Sub

Private Sub CalcularFin()
    Dim sDate As Date
    Dim bDia As Byte
    
    If txtConcepto.Tag = "Horas" Then
        GTdFin.Text = GTdInicio.Text
        GTdFinReal.Text = GTdIniReal.Text
    Else
        
        'Fechas de Nómina
        sDate = GTdInicio.DateValue
        Select Case optTipoDias(0).Value
            Case True
                GTdFin.Text = DateAdd("d", Val(txtDias) - 1, sDate)
            Case False
                Screen.MousePointer = vbHourglass
                MAdo.Sql = "sp_fco_hallar_final_habil '" & _
                GsCveCia & "','" & txtTrabajador & "','" & Format(GTdInicio.DateValue, "yyyymmdd") & "'," & Val(txtDias)
                
                MAdo.ExecSQL
                
                MAdo.Sql = "SELECT fecha FROM fco_tmpfechafin"
                MAdo.SendSQL
                
                If Not MAdo.EOF Then GTdFin.Text = MAdo.GetFieldDate(1)
                Screen.MousePointer = vbDefault
        End Select
        
        'Fechas Reales
        sDate = GTdIniReal.DateValue
        Select Case optTipoDias(0).Value
            Case True
                GTdFinReal.Text = DateAdd("d", Val(txtDias) - 1, sDate)
            Case False
                Screen.MousePointer = vbHourglass
                MAdo.Sql = "sp_fco_hallar_final_habil '" & _
                GsCveCia & "','" & txtTrabajador & "','" & Format(GTdIniReal.DateValue, "yyyymmdd") & "'," & Val(txtDias)
                
                MAdo.ExecSQL
                
                MAdo.Sql = "SELECT fecha FROM fco_tmpfechafin"
                MAdo.SendSQL
                
                If Not MAdo.EOF Then GTdFinReal.Text = MAdo.GetFieldDate(1)
                Screen.MousePointer = vbDefault
        End Select

    End If
    
    'DCR, JUL-18-08, se valida la fecha final de amortizacion.
    ValidarFin
End Sub

Private Sub GuardarDatos()
    On Error GoTo MsgError
    
    Dim nRandom As Integer
    Dim Prorroga As String
    Dim sDias As String
    Dim sHoras As String
        
    If txtConcepto.Tag = "Horas" Then
        If Val(txtDias) > 24 Then
            clsMsgbox.Mensaje "Número incorrecto de horas", mAceptar, mAdvierte, GsTitMsg
            Exit Sub
        End If
        sHoras = Val(txtDias)
        sDias = "0"
    Else
        sHoras = "0"
        sDias = Val(txtDias)
    End If
        
    If GsLlave = "A" Then
        Randomize
        nRandom = Int((32000 * Rnd) + 1)
    Else
        nRandom = 0
    End If
    
    If Trim(GTdAccidente.Text) = "/  /" Or Trim(GTdAccidente.Text) = "-  -" Then
        GAdam.ConfiguraGtDate GTdAccidente
    End If
    
    GbRen = False
    If fbValidarDatos Then
        Screen.MousePointer = vbHourglass
        
        If Len(Trim(txtProrroga)) = 0 Then
           Prorroga = "Null"
        Else
           Prorroga = txtProrroga
        End If
        
        MAdo.Sql = "sp_fco_crea_ausentismo " & _
        "'" & GsCveCia & "'," & _
        lblIdAusentismo & "," & _
        "'" & txtTrabajador & "'," & _
        txtConcepto & "," & _
        cboTipo.ListIndex & "," & _
        "'" & Format(GTdInicio, "yyyymmdd") & "'," & _
        "'" & Format(GTdIniReal, "yyyymmdd") & "'," & _
        "'" & Format(GTdFin, "yyyymmdd") & "'," & _
        "'" & Format(GTdFin, "yyyymmdd") & "'," & _
        sDias & "," & _
        IIf(optTipoDias(0).Value, "1", "2") & "," & _
        "'" & txtDiagnostico & "'," & _
        "'" & txtObservaciones & "'," & _
        nRandom & "," & _
        Prorroga & "," & _
        Val(txtIBC) & "," & _
        cboIBC.ListIndex + 1 & "," & _
        "'" & Format(GTdIniReal, "yyyymmdd") & "'," & _
        "'" & Format(GTdFinReal, "yyyymmdd") & "'," & _
        "'" & Format(GTdAccidente, "yyyymmdd") & "'," & _
        "'" & txtNroDoc & "'," & _
        sHoras
        
        MAdo.ExecSQL
                
        GbRen = True
        
        Screen.MousePointer = vbDefault
        
        If GsLlave = "A" Then
            MAdo.Sql = _
            " SELECT id_ausentismo FROM fco_ausentismos_id_as" & _
            " WHERE clave = " & nRandom
            MAdo.SendSQL
            lblIdAusentismo = "" & MAdo.GetField(1)
            
            clsMsgbox.Mensaje "Registro correctamente grabado." & vbCrLf & vbCrLf & _
            " Id. del Ausentismo: " & lblIdAusentismo, mAceptar, mAdvierte, GsTitMsg
            
            GsLlave = ""
        Else
            clsMsgbox.Mensaje "Registro correctamente actualizado.", mAceptar, mAdvierte, GsTitMsg
        End If
        
        GsConcepto = txtConcepto
        GsTrabajador = txtTrabajador
        Unload Me
    End If
    Exit Sub
MsgError:
    Screen.MousePointer = vbDefault
    
    If Err > 0 Then
        clsMsgbox.Mensaje Err & " " & Err.Description, mAceptar, mAdvierte, GsTitMsg
    End If
    
End Sub

Private Sub HallarSiguienteId()
    MAdo.Sql = "SELECT id_ausentismo FROM fco_ausentismos_id" & _
    " WHERE compania = '" & GsCveCia & "'"
    MAdo.SendSQL
    If Not MAdo.EOF Then
        lblIdAusentismo = Val("" & MAdo.GetField(1)) + 1
    End If
End Sub

Private Sub HallarTipoRelacionado()
    MAdo.Sql = "SELECT item FROM criterios_valores_col" & _
    " WHERE campo = 'tipo_ausentismo' AND valor = " & Val(txtConcepto)
    If MAdo.SendSQL Then
        If MAdo.EOF Then
            cboTipo.ListIndex = -1
        Else
            cboTipo.ListIndex = Val("" & MAdo.GetField(1))
        End If
    End If
    'Hallar si el concepto es en horas o en días
    MAdo.Sql = "Select unidad_tiempo From conceptos_ns Where compania = '" & GsCveCia & "'" & _
    " And concepto = " & Val(txtConcepto)
    If MAdo.SendSQL Then
        If MAdo.EOF Then
            ActivarUnidad Dias
        Else
            If Val("" & MAdo.GetField(1)) = 2 Then
                ActivarUnidad Horas
            Else
                ActivarUnidad Dias
            End If
        End If
    End If
End Sub

Private Sub Inicializa()
    If clsMsgbox.Mensaje("¿Inicializar y perder los cambios?", mSiNoCancelar, mConfirma, GsTitMsg) <> vbYes Then Exit Sub
    MbHuboCambios = False
    MBCalcularFin = False
    txtTrabajador = "": lblTrab = "": MbTrValido = False
    txtConcepto = "": lblConc = "": MbCnValido = False
    cboTipo.ListIndex = -1
    txtDiagnostico = "": txtDiag = "": MbDxValido = False
    txtDias = ""
    GTdInicio.Text = Date
    GTdFin.Text = ""
    GTdIniReal.Text = GTdInicio.Text
    GTdFinReal.Text = ""
    GTdAccidente.Text = GTdInicio.Text
    MBCalcularFin = True
    txtTrabajador.SetFocus
    Me.txtProrroga = ""
    Me.txtIBC = ""
End Sub

Private Sub RecuperarDatos()
    MBCalcularFin = False
        
    'On error resume next
    MAdo.Sql = _
    " SELECT au.trabajador, t.nombre," & _
    " au.concepto, c.descripcion," & _
    " au.tipo, au.fecha_inicio," & _
    " au.fecha_causacion, au.fecha_pago," & _
    " au.fecha_fin, au.dias, au.tipo_dias," & _
    " au.diagnostico, dx.descripcion As desc_dx," & _
    " au.observaciones, au.id_origen, au.valor_ibc, au.calculo_ibc," & _
    " au.fecha_ini_real, au.fecha_fin_real, au.fecha_accidente, au.nro_incapacidad, au.horas" & _
    " FROM" & _
    " fco_ausentismos au, trabajadores t, conceptos c, fco_diagnosticos dx" & _
    " WHERE au.trabajador = t.trabajador" & _
    " AND au.concepto = c.concepto" & _
    IIf(UCase(Left(GsDsn, 3)) = "ORA", " AND au.diagnostico = dx.diagnostico (+)", " AND au.diagnostico *= dx.diagnostico") & _
    " AND compania = '" & GsCveCia & "'" & _
    " AND id_ausentismo = " & GsLlave 'FCO2000.Tag
    MAdo.SendSQL
    
    lblIdAusentismo = GsLlave 'FCO2000.Tag
    txtTrabajador = MAdo.GetField(1) 'trabajador
    txtTrabajador.Enabled = False
    lblTrab = Replace(MAdo.GetField(2), "/", " ") 'nombre
    imgListaTra.Enabled = False
    txtConcepto = MAdo.GetField(3) 'concepto
    lblConc = MAdo.GetField(4) 'descripcion
    cboTipo.ListIndex = MAdo.GetField(5)  'tipo
    If Val("" & MAdo.GetField(22)) > 0 Then
        ActivarUnidad Horas
        txtConcepto.Tag = "Horas"
    Else
        ActivarUnidad Dias
        txtConcepto.Tag = "Dias"
    End If
    txtDiagnostico = "" & MAdo.GetField(12) 'diagnostico
    txtDiag = "" & MAdo.GetField(13) 'desc_dx
    If txtConcepto.Tag = "Horas" Then
        txtDias = Val("" & MAdo.GetField(22)) 'horas
    Else
        txtDias = Val("" & MAdo.GetField(10)) 'dias
    End If
    If MAdo.GetField(11) = 1 Then 'tipo_dias
        optTipoDias(0).Value = True
    Else
        optTipoDias(1).Value = True
    End If
    
    If cboTipo.ListIndex = 4 Then
        If Not IsNull(MAdo.GetField(15)) Then 'id_origen
            Me.txtProrroga = MAdo.GetField(15)
        End If
        
        Me.lblProrroga.Visible = True
        Me.txtProrroga.Visible = True
        Me.imgListaAus.Visible = True
    End If
        
    GTdInicio = MAdo.GetFieldDate(6)   'fecha_inicio
    GTdFin = MAdo.GetFieldDate(9)   'fecha_fin

    txtObservaciones = "" & MAdo.GetField(14) 'observaciones
    
    Me.txtIBC = Format(MAdo.GetField(16), "0.00") 'valor_ibc
    If Not IsNull(MAdo.GetField(17)) And MAdo.GetField(17) <> "" Then cboIBC.ListIndex = MAdo.GetField(17) - 1 'calculo ibc
    
    GTdIniReal = MAdo.GetFieldDate(18)  'fecha_inicio_real
    GTdFinReal = MAdo.GetFieldDate(19)  'fecha_fin_real
    GTdAccidente = MAdo.GetFieldDate(20)  'fecha_accidente
    txtNroDoc = "" & MAdo.GetField(21)
    
    abToolbar.Bands(0).Tools(0).Enabled = False
    abToolbar.Bands(1).Tools(0).Enabled = False
    MbTrValido = True
    MbCnValido = True
    MbDxValido = True
    MBCalcularFin = True
    MbDatosOk = True
End Sub

Private Sub RecuperarParametros()
    MAdo.Sql = "SELECT dato FROM vw_fdt_parametros" & _
    " WHERE compania = '" & GsCveCia & "'" & _
    " AND parametro = 'otros' AND secuencia = 3"
    MAdo.SendSQL
    If MAdo.EOF Then
        MsAgrAus = "DAU"
    Else
        MsAgrAus = "" & MAdo.GetField(1)
    End If

    'DCR, JUL-16-08, para saber si se cuenta el dia 31 en las fechas de amortizacion
    MAdo.Sql = "SELECT dato FROM vw_fdt_parametros" & _
    " WHERE compania = '" & GsCveCia & "'" & _
    " AND parametro = 'otros' AND secuencia = 4"
    MAdo.SendSQL
    If MAdo.EOF Then
        MsDia31 = "SI"
    Else
        MsDia31 = "" & MAdo.GetField(1)
    End If



End Sub

Private Sub RecuperarTipos()
    cboTipo.Clear
    MAdo.Sql = _
    " SELECT DISTINCT item, descripcion FROM criterios_valores_col" & _
    " WHERE campo='tipo_ausentismo' ORDER BY item"
    MAdo.SendSQL
    MBCalcularFin = False
    Do Until MAdo.EOF
        cboTipo.AddItem MAdo.GetField(2) 'descripcion
        'cboTipo.ItemData(cboTipo.NewIndex) = dtDatos.Recordset("item")
        MAdo.Mnext
    Loop
    MBCalcularFin = True
End Sub

Private Sub RecuperarCalculoIBC()
    cboIBC.Clear
    MAdo.Sql = _
    " SELECT DISTINCT item, descripcion FROM criterios_valores_col" & _
    " WHERE campo='calculo_ibc' ORDER BY item"
    MAdo.SendSQL
    MBCalcularFin = False
    Do Until MAdo.EOF
        cboIBC.AddItem MAdo.GetField(2) 'descripcion
        'cboTipo.ItemData(cboTipo.NewIndex) = dtDatos.Recordset("item")
        MAdo.Mnext
    Loop
    MBCalcularFin = True
End Sub

Private Function fbValidarDatos() As Boolean
Dim sMaxHoras As String
Dim sTotalAux As String
Dim sTotalHoras As String
Dim sDias As String
Dim sHoras As String
Dim sAusMal As String

    fbValidarDatos = True
    'Trabajador
    If Trim(txtTrabajador) = "" Then
        clsMsgbox.Mensaje "Digite o seleccione el trabajador", mAceptar, minforma, GsTitMsg
        txtTrabajador.SetFocus
        fbValidarDatos = False
        Exit Function
    End If
    If Not MbTrValido Then ValidarTrabajador
    If Not MbTrValido Then
        clsMsgbox.Mensaje "Trabajador no existe", mAceptar, minforma, GsTitMsg
        txtTrabajador.SetFocus
        fbValidarDatos = False
        Exit Function
    End If
    
    'Concepto
    If Trim(txtConcepto) = "" Then
        clsMsgbox.Mensaje "Digite o seleccione el concepto", mAceptar, minforma, GsTitMsg
        txtConcepto.SetFocus
        fbValidarDatos = False
        Exit Function
    End If
    If Not MbCnValido Then ValidarConcepto
    If Not MbCnValido Then
        clsMsgbox.Mensaje "Concepto no existe", mAceptar, minforma, GsTitMsg
        txtConcepto.SetFocus
        fbValidarDatos = False
        Exit Function
    End If
    
    'Tipo
    If cboTipo.ListIndex = -1 Then
        clsMsgbox.Mensaje "Seleccione el tipo de ausentismo", mAceptar, minforma, GsTitMsg
        cboTipo.SetFocus
        fbValidarDatos = False
        Exit Function
    End If
    
    'Diagnóstico
    'If Trim(txtDiagnostico) = "" Then MbDxValido = True
    'If Not MbDxValido Then ValidarDiagnostico
    'If Not MbDxValido Then
    '    MostrarMsg "Diagnóstico no existe", Advierte
    '    txtDiagnostico.SetFocus
    '    fbValidarDatos = False
    '    Exit Function
    'End If
    
    'DCR:MAY-27-08: Se hace validación de las horas por dia a incorporar
    sMaxHoras = 0
    
    MAdo.Sql = "SELECT dato FROM vw_fdt_parametros" & _
    " WHERE compania = '" & GsCveCia & "'" & _
    " AND parametro = 'otros' AND secuencia = 5"
    
    MAdo.SendSQL

    If MAdo.EOF Then
      sMaxHoras = 8  'si no hay nada, maximo 8
    Else
      sMaxHoras = MAdo.GetField(1)
    End If
    
    If txtConcepto.Tag = "Horas" Then
        sHoras = Val(txtDias)
        sDias = 0
    Else
        sHoras = 0
        sDias = Val(txtDias)
    End If
    
    'los dias lo transformamos en horas
    sDias = Val(sDias) * Val(sMaxHoras)
    
    'Verificar que las fechas no se traslapen
    MAdo.Sql = "SELECT id_ausentismo FROM fco_ausentismos" & _
    " WHERE trabajador = '" & txtTrabajador & "'" & _
    " AND id_ausentismo <> " & lblIdAusentismo & _
    " AND (('" & Format(GTdInicio, "yyyymmdd") & "' >= fecha_inicio)" & _
     " and ('" & Format(GTdInicio, "yyyymmdd") & "' <= fecha_fin)" & _
    " OR ('" & Format(GTdFin, "yyyymmdd") & "' >= fecha_inicio)" & _
     " and ('" & Format(GTdFin, "yyyymmdd") & "' <= fecha_fin)" & _
    " OR fecha_inicio BETWEEN '" & Format(GTdInicio, "yyyymmdd") & "' AND '" & Format(GTdFin, "yyyymmdd") & "'" & _
    " OR fecha_fin BETWEEN '" & Format(GTdInicio, "yyyymmdd") & "' AND '" & Format(GTdFin, "yyyymmdd") & "')"
    MAdo.SendSQL
        
    If Not MAdo.EOF Then
       sAusMal = MAdo.GetField(1)
       If GTdInicio <> GTdFin Then
          clsMsgbox.Mensaje "Las fechas se traslapan con otro ausentismo de este trabajador." & _
          vbCrLf & " Conflicto con el ausentismo id. " & sAusMal, mAceptar, minforma, GsTitMsg
          fbValidarDatos = False
          Exit Function
       Else 'DCR:MAY-27-2008, si es el mismo dia para fecha inicial y final, se debe validar con horas
          'hallamos los ausentismos grabados en dias.
          MAdo.Sql = "SELECT SUM(dias) FROM fco_ausentismos" & _
          " WHERE trabajador = '" & txtTrabajador & "'" & _
          " AND id_ausentismo <> " & lblIdAusentismo & _
          " AND (('" & Format(GTdInicio, "yyyymmdd") & "' >= fecha_inicio)" & _
           " and ('" & Format(GTdInicio, "yyyymmdd") & "' <= fecha_fin)" & _
          " OR ('" & Format(GTdFin, "yyyymmdd") & "' >= fecha_inicio)" & _
           " and ('" & Format(GTdFin, "yyyymmdd") & "' <= fecha_fin)" & _
          " OR fecha_inicio BETWEEN '" & Format(GTdInicio, "yyyymmdd") & "' AND '" & Format(GTdFin, "yyyymmdd") & "'" & _
          " OR fecha_fin BETWEEN '" & Format(GTdInicio, "yyyymmdd") & "' AND '" & Format(GTdFin, "yyyymmdd") & "')"
          MAdo.SendSQL
          
          sTotalAux = 0
          sTotalHoras = 0
          
          If Not MAdo.EOF Then sTotalAux = Val(MAdo.GetField(1))
          sTotalHoras = Val(sTotalAux) * Val(sMaxHoras)
  
          'hallamos los ausentismos grabados en horas.
          MAdo.Sql = "SELECT SUM(horas) FROM fco_ausentismos" & _
          " WHERE trabajador = '" & txtTrabajador & "'" & _
          " AND id_ausentismo <> " & lblIdAusentismo & _
          " AND (('" & Format(GTdInicio, "yyyymmdd") & "' >= fecha_inicio)" & _
           " and ('" & Format(GTdInicio, "yyyymmdd") & "' <= fecha_fin)" & _
          " OR ('" & Format(GTdFin, "yyyymmdd") & "' >= fecha_inicio)" & _
           " and ('" & Format(GTdFin, "yyyymmdd") & "' <= fecha_fin)" & _
          " OR fecha_inicio BETWEEN '" & Format(GTdInicio, "yyyymmdd") & "' AND '" & Format(GTdFin, "yyyymmdd") & "'" & _
          " OR fecha_fin BETWEEN '" & Format(GTdInicio, "yyyymmdd") & "' AND '" & Format(GTdFin, "yyyymmdd") & "')"
          MAdo.SendSQL
          
          sTotalAux = 0
          
          If Not MAdo.EOF Then sTotalAux = Val(MAdo.GetField(1))
       
          'a las horas de los dias se le suman lo hallado
          sTotalHoras = Val(sTotalHoras) + Val(sTotalAux)
          
          'al total de horas, se le suma lo que se va a grabar
          sTotalHoras = Val(sTotalHoras) + Val(sHoras) + Val(sDias)
          
          'ahora comparamos el total de hoas, con el maximo permitido
          If Val(sTotalHoras) > Val(sMaxHoras) Then
              clsMsgbox.Mensaje "Las fechas se traslapan con otro ausentismo de este trabajador o se excede el maximo de horas permitidas por dia." & _
              vbCrLf & " Conflicto con el ausentismo id. " & sAusMal, mAceptar, minforma, GsTitMsg
              fbValidarDatos = False
              Exit Function
          End If
       
       End If 'DCR:MAY-27-2008,
    End If
     
    MAdo.Sql = "SELECT id_ausentismo FROM fco_ausentismos" & _
    " WHERE trabajador = '" & txtTrabajador & "'" & _
    " AND id_ausentismo <> " & lblIdAusentismo & _
    " AND (('" & Format(GTdIniReal, "yyyymmdd") & "' >= fecha_ini_real)" & _
     " and ('" & Format(GTdIniReal, "yyyymmdd") & "' <= fecha_fin_real)" & _
    " OR ('" & Format(GTdFinReal, "yyyymmdd") & "' >= fecha_ini_real)" & _
     " and ('" & Format(GTdFinReal, "yyyymmdd") & "' <= fecha_fin_real)" & _
    " OR fecha_ini_real BETWEEN '" & Format(GTdIniReal, "yyyymmdd") & "' AND '" & Format(GTdFinReal, "yyyymmdd") & "'" & _
    " OR fecha_fin_real BETWEEN '" & Format(GTdIniReal, "yyyymmdd") & "' AND '" & Format(GTdFinReal, "yyyymmdd") & "')"
    MAdo.SendSQL
     
      'Verificar que las fechas REALES no se traslapen
      If Not MAdo.EOF Then
        sAusMal = MAdo.GetField(1)
        If GTdIniReal <> GTdFinReal Then
          clsMsgbox.Mensaje "Las fechas REALES se traslapan con otro ausentismo de este trabajador." & _
          vbCrLf & " Conflicto con el ausentismo id. " & sAusMal, mAceptar, minforma, GsTitMsg
          fbValidarDatos = False
          Exit Function
        Else 'DCR:MAY-27-2008, si es el mismo dia para fecha inicial y final, se debe validar con horas
          'hallamos los ausentismos grabados en dias.
          MAdo.Sql = "SELECT SUM(dias) FROM fco_ausentismos" & _
          " WHERE trabajador = '" & txtTrabajador & "'" & _
          " AND id_ausentismo <> " & lblIdAusentismo & _
          " AND (('" & Format(GTdIniReal, "yyyymmdd") & "' >= fecha_ini_real)" & _
           " and ('" & Format(GTdIniReal, "yyyymmdd") & "' <= fecha_fin_real)" & _
          " OR ('" & Format(GTdFinReal, "yyyymmdd") & "' >= fecha_ini_real)" & _
           " and ('" & Format(GTdFinReal, "yyyymmdd") & "' <= fecha_fin_real)" & _
          " OR fecha_ini_real BETWEEN '" & Format(GTdIniReal, "yyyymmdd") & "' AND '" & Format(GTdFinReal, "yyyymmdd") & "'" & _
          " OR fecha_fin_real BETWEEN '" & Format(GTdIniReal, "yyyymmdd") & "' AND '" & Format(GTdFinReal, "yyyymmdd") & "')"
          MAdo.SendSQL
    
          sTotalAux = 0
          sTotalHoras = 0
          
          If Not MAdo.EOF Then sTotalAux = Val(MAdo.GetField(1))
          sTotalHoras = Val(sTotalAux) * Val(sMaxHoras)
        
          'hallamos los ausentismos grabados en horas.
          MAdo.Sql = "SELECT SUM(horas) FROM fco_ausentismos" & _
          " WHERE trabajador = '" & txtTrabajador & "'" & _
          " AND id_ausentismo <> " & lblIdAusentismo & _
          " AND (('" & Format(GTdIniReal, "yyyymmdd") & "' >= fecha_ini_real)" & _
           " and ('" & Format(GTdIniReal, "yyyymmdd") & "' <= fecha_fin_real)" & _
          " OR ('" & Format(GTdFinReal, "yyyymmdd") & "' >= fecha_ini_real)" & _
           " and ('" & Format(GTdFinReal, "yyyymmdd") & "' <= fecha_fin_real)" & _
          " OR fecha_ini_real BETWEEN '" & Format(GTdIniReal, "yyyymmdd") & "' AND '" & Format(GTdFinReal, "yyyymmdd") & "'" & _
          " OR fecha_fin_real BETWEEN '" & Format(GTdIniReal, "yyyymmdd") & "' AND '" & Format(GTdFinReal, "yyyymmdd") & "')"
          MAdo.SendSQL
        
          sTotalAux = 0
          
          If Not MAdo.EOF Then sTotalAux = Val(MAdo.GetField(1))
          
          'a las horas de los dias se le suman lo hallado
          sTotalHoras = Val(sTotalHoras) + Val(sTotalAux)
          
          'al total de horas, se le suma lo que se va a grabar
          sTotalHoras = Val(sTotalHoras) + Val(sHoras) + Val(sDias)
          
          'ahora comparamos el total de hoas, con el maximo permitido
          If Val(sTotalHoras) > Val(sMaxHoras) Then
              clsMsgbox.Mensaje "Las fechas REALES se traslapan con otro ausentismo de este trabajador o se excede el maximo de horas permitidas por dia." & _
              vbCrLf & " Conflicto con el ausentismo id. " & sAusMal, mAceptar, minforma, GsTitMsg
              fbValidarDatos = False
              Exit Function
          End If
        End If 'DCR:MAY-27-2008
    End If
    
    'Verificar que no digiten una licencia por maternidad a un man
    'tipo_ausentismo = 1
    If cboTipo.ListIndex = 1 Then
        MAdo.Sql = "SELECT sexo FROM trabajadores" & _
        " WHERE trabajador = '" & txtTrabajador & "'"
        MAdo.SendSQL
        If Val(MAdo.GetField(1)) = 1 Then
            clsMsgbox.Mensaje "Está tratando de grabar una licencia de maternidad a un hombre", mAceptar, minforma, GsTitMsg
            fbValidarDatos = False
            Exit Function
        End If
    End If
    
    If cboTipo.ListIndex = 4 Then 'prorroga
        If Len(Trim(txtProrroga)) = 0 Then
            clsMsgbox.Mensaje "Ha escogio el tipo prorroga y no ha seleccionado el codigo del ausentismo origen", mAceptar, minforma, GsTitMsg
            txtProrroga.SetFocus
            fbValidarDatos = False
            Exit Function
        End If
        'If MF2000.Tag = "A" Then
            If Not MbListaAus Then
                clsMsgbox.Mensaje "El codigo de ausentismo para la prorroga no existe", mAceptar, minforma, GsTitMsg
                txtProrroga.SetFocus
                fbValidarDatos = False
                Exit Function
            End If
        'End If
    End If
    
End Function

Private Sub ValidarConcepto()
    'On Error Resume Next
    MAdo.Sql = _
    " SELECT c.descripcion" & _
    " FROM conceptos c, rel_conceptos_agr r" & _
    " WHERE c.concepto = r.concepto" & _
    "  AND r.agr_conceptos = '" & MsAgrAus & "'" & _
    "  AND c.concepto = " & txtConcepto
    MAdo.SendSQL
    If MAdo.EOF Then
        clsMsgbox.Mensaje "No existe el concepto o no pertenece a la agrupacion de Ausentismos", mAceptar, minforma, GsTitMsg
    Else
        lblConc = MAdo.GetField(1)
        MbCnValido = True
        HallarTipoRelacionado
    End If
End Sub

Private Sub ValidarDiagnostico()
    'On Error Resume Next
    MAdo.Sql = "SELECT descripcion FROM fco_diagnosticos" & _
    " WHERE diagnostico = '" & txtDiagnostico & "'"
    MAdo.SendSQL
    If MAdo.EOF Then
        clsMsgbox.Mensaje "No existe el diagnóstico", mAceptar, minforma, GsTitMsg
    Else
        txtDiag = MAdo.GetField(1)
        MbDxValido = True
    End If
End Sub

Private Sub ValidarTrabajador()
    'On Error Resume Next
    MAdo.Sql = "SELECT T.trabajador, T.nombre" & _
    " FROM trabajadores T, trabajadores_grales TG, rel_usu_clase_nom u" & _
    " WHERE T.trabajador = TG.trabajador" & _
    "   AND tg.clase_nomina = u.clase_nomina " & _
    "   AND u.usuario = '" & GsUid & "' " & _
    "   AND TG.compania = '" & GsCveCia & "'" & _
    "   AND LTrim(RTrim(TG.trabajador)) = '" & Trim(txtTrabajador) & "'" & _
    "   AND TG.sit_trabajador = 1"
    MAdo.SendSQL
    If MAdo.EOF Then
        clsMsgbox.Mensaje "No existe el trabajador, no está activo o no tiene permisos a la clase de nomina", mAceptar, minforma, GsTitMsg
    Else
        txtTrabajador = MAdo.GetField(1)
        lblTrab = Replace(MAdo.GetField(2), "/", " ")
        MbTrValido = True
    End If
End Sub

Private Sub RecuperarIBC()
Dim sSql As String
If Len(Trim(Me.txtProrroga)) > 0 Then
    sSql = " SELECT valor_ibc FROM fco_ausentismos " & _
           " WHERE compania = '" & GsCveCia & "'" & _
           " AND id_ausentismo = " & Me.txtProrroga & ""

    MAdo.Sql = sSql
    MAdo.SendSQL
    If Not MAdo.EOF Then
        If Not IsNull(MAdo.GetField(1)) Then Me.txtIBC = Format(MAdo.GetField(1), "0.00")
    End If
End If

End Sub

Private Sub ConsultarIBC()
Dim iIdProc As Integer
Dim Prorroga As String

On Error GoTo NoPude

If fbValidarDatos Then

  Screen.MousePointer = vbHourglass
  BorrarIdRep
  'Hallar un id para este proceso
  Randomize
  iIdProc = Int((32000 * Rnd) + 1)
  GIdProc = iIdProc

  If Len(Trim(txtProrroga)) = 0 Then
     Prorroga = "Null"
  Else
     Prorroga = txtProrroga
  End If

  'se toma la fecha real del ausentismo
  MAdo.Sql = "sp_fco_ausentismos_IBC " & _
             GIdProc & ",'" & GsUid & "','" & GsCveCia & "'," & _
            "'" & txtTrabajador & "'," & _
            txtConcepto & "," & _
            "'" & Format(GTdIniReal, "yyyymmdd") & "'," & _
            cboIBC.ListIndex + 1 & "," & _
            Prorroga
        
  MAdo.ExecSQL
  
  'consultando lo que quedo en la tabla
  MAdo.Sql = "SELECT valor_ibc FROM fco_ausentismos_IBC WHERE id_rep = " & GIdProc & " AND " & _
             "usuariow = '" & GsUid & "' AND compania = '" & GsCveCia & "' AND " & _
             "trabajador = '" & txtTrabajador & "' AND concepto = " & txtConcepto & ""
  MAdo.SendSQL
  
  If Not MAdo.EOF Then
     Me.txtIBC = MAdo.GetField(1)
  End If
  Screen.MousePointer = vbDefault
End If
  
Exit Sub

NoPude:
  Screen.MousePointer = vbDefault
  If Err > 0 Then
      clsMsgbox.Mensaje Err.Description, mAceptar, mAdvierte, GsTitMsg
  End If
  
End Sub

Private Sub BorrarIdRep()

On Error GoTo NoPude
If GIdProc <> 0 Then
  
  'Por si el programador no crea reporte de borrado de tablas, borramos la tabla del proceso
  MAdo.Sql = "DELETE fco_ausentismos_IBC " & _
             "WHERE id_rep = " & GIdProc & " AND " & _
             "usuariow = '" & GsUid & "'"
    
  MAdo.SendSQL
  If UCase(Left(GsDsn, 3)) = "ORA" Then
    MAdo.Sql = "COMMIT"
    MAdo.SendSQL
  End If
                    
End If

Exit Sub

NoPude:
  Screen.MousePointer = vbDefault
  If Err > 0 Then
      clsMsgbox.Mensaje Err.Description, mAceptar, mAdvierte, GsTitMsg
  End If

End Sub

Private Sub ActivarUnidad(Unidad As UnidadTiempo)
    If Unidad = Horas Then
        lblLabels(5).Caption = "Nú&mero de Horas"
        fraFrame(0).Enabled = False
        lblLabels(12).Enabled = False
        GTdFinReal.Enabled = False
        lblLabels(6).Enabled = False
        GTdFin.Enabled = False
        txtConcepto.Tag = "Horas"
    Else
        lblLabels(5).Caption = "Nú&mero de Días"
        fraFrame(0).Enabled = True
        lblLabels(12).Enabled = True
        GTdFinReal.Enabled = True
        lblLabels(6).Enabled = True
        GTdFin.Enabled = True
        txtConcepto.Tag = "Dias"
    End If
End Sub


