VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form_Comparativo 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Tabla Comparativa Docente"
   ClientHeight    =   6750
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10830
   Icon            =   "Form_Comparativo.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   6750
   ScaleWidth      =   10830
   Begin VB.Frame Frame2 
      Height          =   495
      Left            =   4920
      TabIndex        =   4
      Top             =   6120
      Width           =   2895
      Begin VB.OptionButton Opt_destino_compprofe 
         Caption         =   "Impresora"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   1
         Left            =   1560
         TabIndex        =   6
         Top             =   180
         Width           =   1095
      End
      Begin VB.OptionButton Opt_destino_compprofe 
         Caption         =   "Pantalla"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   5
         Top             =   180
         Width           =   975
      End
   End
   Begin VB.CommandButton btn_gen_reporte_Compprofe 
      Caption         =   "Generar Informe"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   7920
      TabIndex        =   3
      Top             =   6240
      Width           =   1335
   End
   Begin VB.CommandButton btn_can_Compprofe 
      Caption         =   "Cerrar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   9360
      TabIndex        =   2
      Top             =   6240
      Width           =   1335
   End
   Begin VB.Frame Frame_Tablacomp 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   5895
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   10575
      Begin MSFlexGridLib.MSFlexGrid Grd_compprofe 
         Height          =   5535
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   10335
         _ExtentX        =   18230
         _ExtentY        =   9763
         _Version        =   393216
         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
      End
   End
   Begin VB.Label lbl_periodo 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   7
      Top             =   6240
      Width           =   3495
   End
End
Attribute VB_Name = "Form_Comparativo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btn_can_Compprofe_Click()
Form_EstadUTP2.cmb_per_Compprofe = ""
Unload Me
End Sub

Private Sub btn_gen_reporte_Compprofe_Click()
Call CreaBD(DirAplicacion & "\GesTemp.mdb")
columnasnum = Me.Grd_compprofe.Cols
Set Rendim = DBEngine.Workspaces(0).OpenDatabase(DirAplicacion & "\GesTemp.mdb")
Call CreaTabla(DirAplicacion & "\GesTemp.mdb", "Detalles", "16,10")
For R = 1 To Me.Grd_compprofe.Rows - 1
    detal = "": ins = "": horiz = ""
    For t = 0 To Me.Grd_compprofe.Cols - 1
        If Me.Grd_compprofe.TextMatrix(R, t) = "" Then
            detal = detal & "Null , "
            'horiz = horiz & "'____________________________________' ,"
        Else
            detal = detal & "'" & Me.Grd_compprofe.TextMatrix(R, t) & "' , "
            'horiz = horiz & "'____________________________________' ,"
        End If
        ins = ins & "C" & CStr(t + 1) & ", "
    Next t
    ins = Left(ins, Len(ins) - 2): ins = "(" & ins & ")"
    detal = Left(detal, Len(detal) - 2): detal = "(" & detal & ")"
    'horiz = Left(horiz, Len(horiz) - 2): horiz = "(" & horiz & ")"
    a = "insert into Detalles " & ins & " values " & detal
    Rendim.Execute a
    'horiz = Left(horiz, Len(horiz) - 2): horiz = "(" & horiz & ")"
'    a = "insert into Detalles " & ins & " values " & detal
'    Rendim.Execute a
    'b = "insert into Detalles " & ins & " values " & horiz
    'If R >= 1 Then
    '    Rendim.Execute b
    'End If
Next R
Rendim.Close
    Titulo = "TABLA DE ANALISIS COMPARATIVO DOCENTE " & periodo & " AŅO " & Anno
    Nombrecol = devuelvecampo("establecimientos", "", "nom_est", "nom_est <> ''", conn)
    Direccol = devuelvecampo("establecimientos", "", "dir_est", "dir_est <> ''", conn)
    ComunaCol = devuelvecampo("establecimientos", "", "localidad_est", "localidad_est <> ''", conn)
    Form_main.CrystalReport.WindowTitle = Titulo
    Form_main.CrystalReport.Formulas(0) = "nomcol = '" & Nombrecol & "'"
    Form_main.CrystalReport.Formulas(1) = "dircol = '" & Direccol & "'"
    Form_main.CrystalReport.Formulas(2) = "comunacol = '" & ComunaCol & "'"
    Form_main.CrystalReport.Formulas(3) = "titulo= '" & Titulo & "'"
    Form_main.CrystalReport.Formulas(4) = "hora = '" & Time & "'"
    Form_main.CrystalReport.Formulas(5) = "Subsector= '" & Form_EstadUTP2.cmb_asig_Compprofe & "'"
    Form_main.CrystalReport.Formulas(6) = "Periodo = '" & Form_EstadUTP2.cmb_per_Compprofe & "'"
    Form_main.CrystalReport.Formulas(7) = "Tipens = '" & Form_EstadUTP2.cmb_mod_Compprofe & "'"
    Form_main.CrystalReport.ReportFileName = DirAplicacion & "\rpt\comparativa_Prof.rpt"
    Form_main.CrystalReport.DataFiles(0) = DirAplicacion & "\GesTemp.mdb"
    Form_main.CrystalReport.WindowState = crptMaximized
    Form_main.CrystalReport.ReplaceSelectionFormula ("")
    Form_main.CrystalReport.Action = 1
    Form_main.CrystalReport.ReplaceSelectionFormula ("")
    Call LimpiaFormulas(Form_main.CrystalReport, 30)
    Kill (DirAplicacion & "\GesTemp.mdb")
    
End Sub

Private Sub Form_Load()
Me.Frame_Tablacomp.Top = 10
Me.Frame_Tablacomp.Left = 100
Me.Opt_destino_compprofe(0).Value = True
CentrarForma Me
End Sub

Private Sub Opt_destino_compprofe_Click(Index As Integer)
If Index = 0 Then
    Form_main.CrystalReport.Destination = crptToWindow
Else
    Form_main.CrystalReport.Destination = crptToPrinter
End If
End Sub
