Attribute VB_Name = "mExecFCO"
Option Explicit
'Public Const GcModuloConst = "SU"
Public GcModuloConst As String * 2
Public Const GcDescripcionConst = 17

Public Sub EjecutaOperacionRelacion(sOperacion As String, ByRef FFC0010C As Form, Optional objBitacora As Bitacora)
Dim sDescripcion As String   'Descripción del campo
Dim iValorReal As Integer    'Parámetro para la rutina ValorReal
Dim sSql As String           'Sentencia SQL
Dim ADAM As New ADAM.clsADAM

Select Case sOperacion
Case "RH0070C", "RH0080C", "RH0090C", "RH1020C"
   
   With FFC0010C.UCTFc0020
           FFC0010C.MsCaption = "56"
           .SprTag = "0,56,78"
      Select Case .Tabla
         Case "rel_agr_companias"
            objBitacora.mTablaSPInfo 0, "sp_alta_rel_agr_companias", ADAM.ValorReal(.Clave, 2), 2
            objBitacora.mTablaSPInfo 1, "sp_baja_rel_agr_companias", ADAM.ValorReal(.Clave, 2), 2
            sDescripcion = "descripcion"
            .Campo = "agrupacion"
            .Tablac = "agrupaciones_trab"
            .CboTag = "23,78"     'Agrupaciones
            iValorReal = 2
         Case "rel_col_companias"
            objBitacora.mTablaSPInfo 0, "sp_alta_rel_col_companias", ADAM.ValorReal(.Clave, 2), 2
            objBitacora.mTablaSPInfo 1, "sp_baja_rel_col_companias", ADAM.ValorReal(.Clave, 2), 2
            sDescripcion = "descripcion"
            .Campo = "coleccion"
            .Tablac = "colecciones"
            .CboTag = "2025,78"      'Colecciones
            iValorReal = 2
         Case "rel_ind_inf_soc_cias"
            objBitacora.mTablaSPInfo 0, "sp_alta_rel_ind_inf_soc_cias", ADAM.ValorReal(.Clave, 2), 2
            objBitacora.mTablaSPInfo 1, "sp_baja_rel_ind_inf_soc_cias", ADAM.ValorReal(.Clave, 2), 2
            sDescripcion = "descripcion"
            .Campo = "indice_inf_soc"
            .Tablac = "indices_inf_soc"
            iValorReal = 2
          Case "rel_puestos_cias"
            objBitacora.mTablaSPInfo 0, "sp_alta_rel_puestos_cias", ADAM.ValorReal(.Clave, 2), 2
            objBitacora.mTablaSPInfo 1, "sp_baja_rel_puestos_cias", ADAM.ValorReal(.Clave, 2), 2
            sDescripcion = "descripcion"
            .Campo = "puesto"
            .Tablac = "puestos"
            iValorReal = 2
          Case "rel_comision_cia"
            objBitacora.mTablaSPInfo 0, "sp_alta_rel_comision_cia", ADAM.ValorReal(.Clave, 1), 2
            objBitacora.mTablaSPInfo 1, "sp_baja_rel_comision_cia", ADAM.ValorReal(.Clave, 1), 2
            sDescripcion = "descripcion"
            .CboTag = "9023,78"     'Comisiones
            .Campo = "comision"
            .Tablac = "comisiones_mixtas"
            iValorReal = 1
          Case "rel_sindicato_cia"
            objBitacora.mTablaSPInfo 0, "sp_alta_rel_sindicato_cia", ADAM.ValorReal(.Clave, 2), 2
            objBitacora.mTablaSPInfo 1, "sp_baja_rel_sindicato_cia", ADAM.ValorReal(.Clave, 2), 2
            sDescripcion = "nombre"
            .CboTag = "9024,140"     'Sindicatos
            .Campo = "sindicato"
            .Tablac = "sindicatos"
            iValorReal = 2
      End Select
      End With
    End Select
End Sub
Sub EjecutaOperacionADAM(operacion As String)
'Título: Rutina Ejecuta Operación ADAM
'Módulo: Ejecuta.bas
'versión: 1.01
'Fecha: 06/08/97
'Autor: Buendía González Julio Cesar
'---------------------------------------
'Descripción: Este modulo provee rutinas de ejecución de
'             operaciones
'---------------------------------------
'Pirated by JCL Software de Calidad
On Error GoTo ErrorEjecutaOpeADAMMF
    Screen.MousePointer = vbHourglass

    GsOper = operacion
    Select Case operacion
        Case "FCO1010"
            NuevaVentana 2
            Dim FFCO1010 As New FCO1010
            Load FFCO1010
            If GbAError Then
                Unload FFCO1010
                Set FFCO1010 = Nothing
            Else
                FFCO1010.Show
            End If
        
        Case "FCO1020"
            GsTipo = "EPS"
            NuevaVentana 2
            Dim FFCO1020 As New FCO1020
            Load FFCO1020
            If GbAError Then
                Unload FFCO1020
                Set FFCO1020 = Nothing
            Else
                FFCO1020.Show
            End If

        Case "FCO1030"
            GsTipo = "AFP"
            NuevaVentana 2
            Dim FFCO1030 As New FCO1020
            Load FFCO1030
            If GbAError Then
                Unload FFCO1030
                Set FFCO1030 = Nothing
            Else
                FFCO1030.Show
            End If

        Case "FCO1035"
            GsTipo = "CCF"
            NuevaVentana 2
            Dim FFCO1035 As New FCO1020
            Load FFCO1035
            If GbAError Then
                Unload FFCO1035
                Set FFCO1035 = Nothing
            Else
                FFCO1035.Show
            End If

        Case "FCO1040"
            NuevaVentana 2
            Dim FFCO1040 As New FCO1040
            Load FFCO1040
            If GbAError Then
                Unload FFCO1040
                Set FFCO1040 = Nothing
            Else
                FFCO1040.Show
            End If

        Case "FCO1045"
            NuevaVentana 2
            Dim FFCO1045 As New FCO1045
            Load FFCO1045
            If GbAError Then
                Unload FFCO1045
                Set FFCO1045 = Nothing
            Else
                FFCO1045.Show
            End If

        Case "FCO1050"
            NuevaVentana 2
            Dim FFCO1050 As New FCO1050
            Load FFCO1050
            If GbAError Then
                Unload FFCO1050
                Set FFCO1050 = Nothing
            Else
                FFCO1050.Show
            End If

        Case "FCO1060"
            NuevaVentana 2
            Dim FFCO1060 As New FCO1060
            Load FFCO1060
            If GbAError Then
                Unload FFCO1060
                Set FFCO1060 = Nothing
            Else
                FFCO1060.Show
            End If

        
        Case "FCO1070"
            NuevaVentana 2
            Dim FFCO1070 As New FCO1070
            Load FFCO1070
            If GbAError Then
                Unload FFCO1070
                Set FFCO1070 = Nothing
            Else
                FFCO1070.Show
            End If
        
        Case "FCO1080"
            NuevaVentana 2
            Dim FFCO1080 As New FCO1080
            Load FFCO1080
            If GbAError Then
                Unload FFCO1080
                Set FFCO1080 = Nothing
            Else
                FFCO1080.Show
            End If
                
        Case "FCO2000"
            NuevaVentana 2
            Dim FFCO2000 As New FCO2000
            Load FFCO2000
            If GbAError Then
                Unload FFCO2000
                Set FFCO2000 = Nothing
            Else
                FFCO2000.Show
            End If
        
        Case "FCO2005"
            NuevaVentana 2
            Dim FFCO2005 As New FCO2005
            Load FFCO2005
            If GbAError Then
                Unload FFCO2005
                Set FFCO2005 = Nothing
            Else
                FFCO2005.Show
            End If

        Case "FCO2010"
            NuevaVentana 2
            Dim FFCO2010 As New FCO2010
            Load FFCO2010
            If GbAError Then
                Unload FFCO2010
                Set FFCO2010 = Nothing
            Else
                FFCO2010.Show
            End If

        Case "FCO2020"
            NuevaVentana 2
            Dim FFCO2020 As New FCO2020
            Load FFCO2020
            If GbAError Then
                Unload FFCO2020
                Set FFCO2020 = Nothing
            Else
                FFCO2020.Show
            End If

        Case "FCO2030"
            GsTipo = "EPS"
            NuevaVentana 2
            Dim FFCO2030 As New FCO2030
            Load FFCO2030
            If GbAError Then
                Unload FFCO2030
                Set FFCO2030 = Nothing
            Else
                FFCO2030.Show
            End If

        Case "FCO2040"
            GsTipo = "AFP"
            NuevaVentana 2
            Dim FFCO2040 As New FCO2030
            Load FFCO2040
            If GbAError Then
                Unload FFCO2040
                Set FFCO2040 = Nothing
            Else
                FFCO2040.Show
            End If

        Case "FCO2060"
            NuevaVentana 2
            Dim FFCO2060 As New FCO2060
            Load FFCO2060
            If GbAError Then
                Unload FFCO2060
                Set FFCO2060 = Nothing
            Else
                FFCO2060.Show
            End If

        Case "FCO2070"
            NuevaVentana 2
            Dim FFCO2070 As New FCO2070
            Load FFCO2070
            If GbAError Then
                Unload FFCO2070
                Set FFCO2070 = Nothing
            Else
                FFCO2070.Show
            End If

        Case "FCO2080"
            NuevaVentana 2
            Dim FFCO2080 As New FCO2080
            Load FFCO2080
            If GbAError Then
                Unload FFCO2080
                Set FFCO2080 = Nothing
            Else
                FFCO2080.Show
            End If

        Case "FCO2085"
            NuevaVentana 2
            Dim FFCO2085 As New FCO2085
            Load FFCO2085
            If GbAError Then
                Unload FFCO2085
                Set FFCO2085 = Nothing
            Else
                FFCO2085.Show
            End If

        Case "FCO2090"
            NuevaVentana 2
            Dim FFCO2090 As New FCO2090
            Load FFCO2090
            If GbAError Then
                Unload FFCO2090
                Set FFCO2090 = Nothing
            Else
                FFCO2090.Show
            End If

        Case "FCO2095"
            NuevaVentana 2
            Dim FFCO2095 As New FCO2095
            Load FFCO2095
            If GbAError Then
                Unload FFCO2095
                Set FFCO2095 = Nothing
            Else
                FFCO2095.Show
            End If
        
        Case "FCO2096"
            NuevaVentana 2
            Dim FFCO2096 As New FCO2096
            Load FFCO2096
            If GbAError Then
                Unload FFCO2096
                Set FFCO2096 = Nothing
            Else
                FFCO2096.Show
            End If
        
        Case "FCO2098"
            NuevaVentana 2
            Dim FFCO2098 As New FCO2098
            Load FFCO2098
            If GbAError Then
                Unload FFCO2098
                Set FFCO2098 = Nothing
            Else
                FFCO2098.Show
            End If
        
        Case "FCO3010"
            NuevaVentana 2
            Dim FFCO3010 As New FCO3010
            Load FFCO3010
            If GbAError Then
                Unload FFCO3010
                Set FFCO3010 = Nothing
            Else
                FFCO3010.Show
            End If

        Case "FCO3040"
            NuevaVentana 2
            Dim FFCO3040 As New FCO3040
            Load FFCO3040
            If GbAError Then
                Unload FFCO3040
                Set FFCO3040 = Nothing
            Else
                FFCO3040.Show
            End If

        Case "FCO3050"
            NuevaVentana 2
            Dim FFCO3050 As New FCO3050
            Load FFCO3050
            If GbAError Then
                Unload FFCO3050
                Set FFCO3050 = Nothing
            Else
                FFCO3050.Show
            End If
        
        Case "FCO3051"
            NuevaVentana 2
            Dim FFCO3051 As New FCO3051
            Load FFCO3051
            If GbAError Then
                Unload FFCO3051
                Set FFCO3051 = Nothing
            Else
                FFCO3051.Show
            End If
        
        Case "FCO3052"
            NuevaVentana 2
            Dim FFCO3052 As New FCO3052
            Load FFCO3052
            If GbAError Then
                Unload FFCO3052
                Set FFCO3052 = Nothing
            Else
                FFCO3052.Show
            End If
        
        Case "FCO3060", "FCO3070"
            NuevaVentana 2
            Dim FFCO3060 As New FCO3060
            Load FFCO3060
            If GbAError Then
                Unload FFCO3060
                Set FFCO3060 = Nothing
            Else
                FFCO3060.Show
            End If
        
        Case "FCO3080", "FCO3090"
            NuevaVentana 2
            Dim FFCO3080 As New FCO3080
            Load FFCO3080
            If GbAError Then
                Unload FFCO3080
                Set FFCO3080 = Nothing
            Else
                FFCO3080.Show
            End If
        
        Case "FCO5010"
            NuevaVentana 2
            Dim FFCO5010 As New FCO5010
            Load FFCO5010
            If GbAError Then
                Unload FFCO5010
                Set FFCO5010 = Nothing
            Else
                FFCO5010.Show
            End If
        
        Case "FCO5015"
            NuevaVentana 2
            Dim FFCO5015 As New FCO5015
            Load FFCO5015
            If GbAError Then
                Unload FFCO5015
                Set FFCO5015 = Nothing
            Else
                FFCO5015.Show
            End If
        
        Case "FCO5016"
            NuevaVentana 2
            Dim FFCO5016 As New FCO5016
            Load FFCO5016
            If GbAError Then
                Unload FFCO5016
                Set FFCO5016 = Nothing
            Else
                FFCO5016.Show
            End If
        
        Case "FCO5020"
            NuevaVentana 2
            Dim FFCO5020 As New FCO5020
            Load FFCO5020
            If GbAError Then
                Unload FFCO5020
                Set FFCO5020 = Nothing
            Else
                FFCO5020.Show
            End If

        Case "FCO5030"
            NuevaVentana 2
            Dim FFCO5030 As New FCO5030
            Load FFCO5030
            If GbAError Then
                Unload FFCO5030
                Set FFCO5030 = Nothing
            Else
                FFCO5030.Show
            End If

    End Select
    Screen.MousePointer = vbDefault

Exit Sub

ErrorEjecutaOpeADAMMF:
Screen.MousePointer = vbDefault
Exit Sub

End Sub
Public Sub EjecutaLlamadaF4(ByVal sFormaF4 As String)

    Select Case RTrim(sFormaF4)
        Case "RH0020", "RH0030", "RH0040", "RH0050", "RH0060", "RH1010DI", "SU0000"
    '        Dim FFC0010 As New FC0010
    '        Dim objBitacora As New ADAMbitacora.Bitacora
    '        EjecutaOperacionCatalogo sFormaF4, FFC0010, objBitacora
    '        Load FFC0010
    '        If GbAError Then
    '            Unload FFC0010
    '        Else
    '            FFC0010.Show
    '            LlamadaF4 Screen.ActiveForm.hwnd, Val(FFC0010.hwnd)
    '        End If
    '        Set objBitacora = Nothing
        Case "RH1010NR"
    '    If sFormaF4 = "RH1010NR" Then
    '        Dim FRH1010NR As New RH1010NR 'Crea una instancia de la forma RH0070
    '        Load FRH1010NR
    '        If GbAError Then
    '            Unload FRH1010NR
    '        Else
    '            FRH1010NR.Show
    '            LlamadaF4 Screen.ActiveForm.hwnd, Val(FRH1010NR.hwnd)
    '        End If
    '    End If
            
        Case "RH0070"
    '        Dim FRH0070 As New RH0070
    '        Load FRH0070
    '        If GbAError Then
    '            Unload FRH0070
    '        Else
    '            FRH0070.Show
    '            LlamadaF4 Screen.ActiveForm.hwnd, Val(FRH0070.hwnd)
    '        End If
    '
    '    Case "RH1020"
'            Dim FRH1020 As New RH1020: FRH1020.Show
'            Load FRH1020
'            If GbAError Then
'                Unload FRH1020
'            Else
'                FRH1020.Show
'                LlamadaF4 Screen.ActiveForm.hwnd, Val(FRH1020.hwnd)
'            End If
        Case "RH1020SP"
'            Dim FRH1020SP As New RH1020SP
'            Load FRH1020SP
'            If GbAError Then
'                Unload FRH1020SP
'            Else
'                FRH1020SP.Show
'                LlamadaF4 Screen.ActiveForm.hwnd, Val(FRH1020SP.hwnd)
'            End If
        Case "NS0010"
'            Dim FNS0010 As New NS0010
'            Load FNS0010
'            If GbAError Then
'                Unload FNS0010
'            Else
'                FNS0010.Show
'                LlamadaF4 Screen.ActiveForm.hwnd, Val(FNS0010.hwnd)
'            End If
        Case "NS0070"
'            Dim FNS0070 As New NS0070
'            Load FNS0070
'            If GbAError Then
'                Unload FNS0070
'            Else
'                FNS0070.Show
'                LlamadaF4 Screen.ActiveForm.hwnd, Val(FNS0070.hwnd)
'            End If
        Case "NS0060"
'            Dim FNS0060 As New NS0060
'            Load FNS0060
'            If GbAError Then
'                Unload FNS0060
'            Else
'                FNS0060.Show
'                LlamadaF4 Screen.ActiveForm.hwnd, Val(FNS0060.hwnd)
'            End If
    End Select


End Sub
Public Sub EjecutaOperacionCatalogo(sOperacion As String, FFC0010 As Form, Optional objBitacora As Bitacora)


FFC0010.MsForma = sOperacion 'Variable que contiene el nombre de la forma
                            'y utilizada para conocer que seguridad tiene
                            'el usuario sobre esa forma.

Select Case sOperacion
   
    Case "SU0000"
        
        With FFC0010
           .MsSql = "select distinct a.compania, a.nombre_cia " & _
                    "from companias a, aut_companias b " & _
                    "where b.usuario = " & GAdam.ValorReal(Gtc(Gicx).Ado.UserName, 2) & _
                    " and b.compania = a.compania "
           .MsCaption = "9158"
           .MsSprTag = "56,140,9"
           .MiMaxCols = 3
           .MbSpreadBloqueado = True
        End With
        
    Case "RH1010CC" 'Trabajadores
    
        With FFC0010
            .MsSql = "select tg.trabajador , t.nombre , tg.sit_trabajador " & _
                    " from trabajadores_grales tg , trabajadores t " & _
                    " where tg.trabajador = t.trabajador and tg.compania = " & GAdam.ValorReal(Gtc(Gicx).sCompania, 2)
            .MsCaption = "11055" 'Seleccion de Trabajadores
            .MsSprTag = "207,140,11029"
            .MiMaxCols = 3
            .MsSizeCols = "10-10,30-40,10-5" 'El ancho - Número de Caracteres a capturar
            .MbSpreadBloqueado = True
        End With
   
   
   Case "RH1010DI" 'Descripción de índices
      objBitacora.mDefineLlave 1
            
      With FFC0010
         .MsSql = "Select dato_ind_inf_soc from datos_ind_inf_soc " + _
                  "where indice_inf_soc ='" + GvParametros(2) + "'"
         .MsCaption = "2274"
         .MsSprTag = "2274"
         .MiMaxCols = 1
      End With
    
   
    Case "EO0010"
      objBitacora.mDefineLlave 1, 2
      objBitacora.mTablaSPInfo 0, "sp_alta_indices_des_puestos", 1, 2
      objBitacora.mTablaSPInfo 1, "sp_baja_indices_des_puestos", 1, 2
      objBitacora.mTablaSPInfo 2, "sp_cambio_indices_des_puestos", 1, 2
      objBitacora.mBloqueaCol 1
      
      With FFC0010
         .MsSql = "select * from indices_des_puestos "
         .MsCaption = "107"
         .MsSprTag = "107,78"
         .MiMaxCols = 2
      End With
   
   Case "EO0020"
      objBitacora.mDefineLlave 1, 2, 3, 4
      objBitacora.mTablaSPInfo 0, "sp_alta_tipos_plaza", 1, 2, 3, 4
      objBitacora.mTablaSPInfo 1, "sp_baja_tipos_plaza", 1, 2, 3, 4
      objBitacora.mTablaSPInfo 2, "sp_cambio_tipos_plaza", 1, 2, 3, 4
      objBitacora.mBloqueaCol 1
      
      With FFC0010
         .MsSql = "select * from tipos_plaza "
         .MsCaption = "194"
         .MsSprTag = "193,78,9,204"
         .MiMaxCols = 4
         .MsTipoCeldas = "0,0,0,10"
      End With

   Case "FC5000CR"
         objBitacora.mDefineLlave 1
         objBitacora.mTablaSPInfo 0, "sp_alta_reportes_desc", 1, 4, 3, 2, 5, 6
         objBitacora.mTablaSPInfo 1, "sp_baja_reportes_desc", 1, 2
         objBitacora.mTablaSPInfo 2, "sp_cambio_reportes_desc", 1, 4, 2, 3, 5, 6
         objBitacora.mBloqueaCol 1
         objBitacora.mColNoNulls 4
         
         With FFC0010
         .MsSql = "Select * from reportes_desc Where reporte_orig = " & GAdam.ValorReal(GvParametros(4), 2)
         .MsCaption = "2361"
         .MsSprTag = "174,78"
         .MiMaxCols = 6
         .MsHiddeCols = "2,4,5,6"
         .MsSizeCols = "10-10,10-10,30-40" 'El ancho - Número de Caracteres a capturar
         .MiAjusta = 3
         End With
  
  Case "CA5110CA" 'Representante trabajador
        objBitacora.mDefineLlave 1
            
        With FFC0010
             .MsSql = "select " & GvParametros(3) & " from representantes a, comisiones_mixtas c, " & _
                      "trabajadores b, trabajadores_grales d " & _
                      " where a.firma = 1 and a.tipo_representante = 1 " & _
                      " and a.trabajador = b.trabajador and a.trabajador = d.trabajador " & _
                      " and d.trabajador  = d.trabajador and a.compania  = d.compania " & _
                      " and a.comision =  c.comision " & _
                      " and d.compania = " & GAdam.ValorReal(GvParametros(2), 2)
            
            .MsSizeCols = "10-10,30-40,10-10,15-30"
            .MsCaption = "9236"
            .MsSprTag = "196,140,9034,78"
            .MiMaxCols = 4
        End With
        
    Case "CA5110CA_B" 'Representante legal
        objBitacora.mDefineLlave 1
            
        With FFC0010
           .MsSql = "select " & GvParametros(3) & " from representantes a, comisiones_mixtas c, " & _
                      "trabajadores b, trabajadores_grales d " & _
                      " where a.firma = 1 and a.tipo_representante = 2 " & _
                      " and a.trabajador = b.trabajador and a.trabajador = d.trabajador " & _
                      " and d.trabajador  = d.trabajador and a.compania  = d.compania " & _
                      " and a.comision =  c.comision " & _
                      " and d.compania = " & GAdam.ValorReal(GvParametros(2), 2)
            .MsSizeCols = "10-10,30-40,10-10,15-30"
            .MsCaption = "9236"
            .MsSprTag = "196,140,9034,78"
            .MiMaxCols = 4
        End With
        
    Case "CA5110CA_C" 'Plan capacitación
        objBitacora.mDefineLlave 1
            
        With FFC0010
            .MsSql = "select " & GvParametros(3) & " from planes_capacita "
            
            .MsCaption = "9235"
            .MsSprTag = "9235"
            .MiMaxCols = 1
        End With
        
     Case "RH1020CC" 'Puestos
        
        With FFC0010
            .MsSql = " select puestos.puesto , descripcion from puestos , rel_puestos_cias " & _
                    " where puestos.puesto = rel_puestos_cias.puesto " & _
                    " and rel_puestos_cias.compania = " & GAdam.ValorReal(Gtc(Gicx).sCompania, 2)
           .MsCaption = "2189"
           .MsSprTag = "163,78"
           .MiMaxCols = 2
           .MbSpreadBloqueado = True
        End With
        
        Case "RH4010AS" 'Consulta Universal
      
        objBitacora.mDefineLlave 2, 3
        objBitacora.mTablaSPInfo 0, "sp_alta_consultas_uni", 1, 2, 3
        objBitacora.mTablaSPInfo 1, "sp_baja_consultas_uni", 1, 2
        objBitacora.mTablaSPInfo 2, "sp_cambio_consultas_uni", 1, 2, 3
        objBitacora.mBloqueaCol 1
            
        With FFC0010
            .MsSql = "select * from consultas_uni where consulta_orig = " & GAdam.ValorReal(GvParametros(3), 2)
            .MsCaption = "9162"
            .MsSprTag = "0,5271,78"
            .MiMaxCols = 3
            .MsHiddeCols = "1"
            .MiAjusta = 3
        End With
               
End Select

Set FFC0010.objBitacora = objBitacora
FFC0010.MbF4 = False

End Sub



