VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Object = "{F39CBE5C-2D1B-11D6-8D4A-0050043A2E60}#2.0#0"; "ProgBarProzent.ocx"
Begin VB.Form FrmTipPag 
   Caption         =   "Tipos de Pago"
   ClientHeight    =   5250
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10200
   LinkTopic       =   "Form1"
   ScaleHeight     =   5250
   ScaleWidth      =   10200
   StartUpPosition =   3  'Windows Default
   Begin VB.CheckBox ChkCurporHoja 
      Caption         =   "Un curso por hoja"
      Height          =   255
      Left            =   8400
      TabIndex        =   14
      Top             =   240
      Value           =   1  'Checked
      Width           =   1575
   End
   Begin VB.Frame Frame2 
      Caption         =   "Tipo de Pago"
      ForeColor       =   &H00FF0000&
      Height          =   855
      Left            =   6360
      TabIndex        =   12
      Top             =   120
      Width           =   1935
      Begin VB.ComboBox CmbTipPag 
         Enabled         =   0   'False
         Height          =   315
         Left            =   240
         Style           =   2  'Dropdown List
         TabIndex        =   13
         Top             =   360
         Width           =   1455
      End
   End
   Begin VB.CommandButton btnVerTipPag 
      Caption         =   "-->"
      Enabled         =   0   'False
      Height          =   255
      Left            =   8400
      TabIndex        =   11
      Top             =   720
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Caption         =   "Curso"
      ForeColor       =   &H00FF0000&
      Height          =   855
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   6135
      Begin VB.ComboBox Cmb_Let_Cur 
         Enabled         =   0   'False
         Height          =   315
         Left            =   4920
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   360
         Width           =   975
      End
      Begin VB.ComboBox Cmb_Grado 
         Enabled         =   0   'False
         Height          =   315
         Left            =   3120
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   360
         Width           =   1455
      End
      Begin VB.ComboBox Cmb_Cod_ens 
         Height          =   315
         Left            =   240
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   360
         Width           =   2475
      End
      Begin VB.Line Line5 
         BorderColor     =   &H00FFFFFF&
         X1              =   4695
         X2              =   4695
         Y1              =   120
         Y2              =   840
      End
      Begin VB.Line Line4 
         BorderColor     =   &H00FFFFFF&
         X1              =   2895
         X2              =   2895
         Y1              =   120
         Y2              =   840
      End
      Begin VB.Line Line2 
         BorderColor     =   &H00808080&
         X1              =   4680
         X2              =   4680
         Y1              =   120
         Y2              =   840
      End
      Begin VB.Line Line1 
         BorderColor     =   &H00808080&
         X1              =   2880
         X2              =   2880
         Y1              =   120
         Y2              =   840
      End
      Begin VB.Label Tipo 
         Caption         =   "Tipo de enseñanza"
         Height          =   195
         Left            =   1320
         TabIndex        =   8
         Top             =   120
         Width           =   1455
      End
      Begin VB.Label Label1 
         Caption         =   "Grado"
         Height          =   195
         Left            =   4080
         TabIndex        =   7
         Top             =   120
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "Letra - curso"
         Height          =   195
         Left            =   4920
         TabIndex        =   6
         Top             =   120
         Width           =   975
      End
   End
   Begin VB.CommandButton btnCanTipPag 
      Caption         =   "Cancelar"
      Height          =   375
      Left            =   7320
      TabIndex        =   1
      Top             =   4800
      Width           =   1335
   End
   Begin VB.CommandButton btnRptTipPag 
      Caption         =   "Generar Reporte"
      Enabled         =   0   'False
      Height          =   375
      Left            =   8760
      TabIndex        =   0
      Top             =   4800
      Width           =   1335
   End
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Height          =   3615
      Left            =   120
      TabIndex        =   9
      Top             =   1080
      Width           =   10035
      _ExtentX        =   17701
      _ExtentY        =   6376
      _Version        =   393216
      Cols            =   3
      ForeColorSel    =   16777215
      Enabled         =   0   'False
   End
   Begin ProgBarProzent.ProgBar ProgBar1 
      Height          =   375
      Left            =   120
      TabIndex        =   10
      Top             =   4800
      Width           =   7095
      _ExtentX        =   12515
      _ExtentY        =   661
      Appearance      =   0
   End
End
Attribute VB_Name = "FrmTipPag"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CodModalidad, Ngrado As String
Dim Rscuotas As ADODB.Recordset

Public Sub GrillaToRPT(Grilla As MSFlexGrid, NomREp As String, Titulo As String)
'***********************************************************************
'* Guarda matriz en base de datos temporal GesTem.mdb en el directorio *
'* de la aplicacion                                                    *
'***********************************************************************
Call CreaBD(DirAplicacion & "temp.mdb")
Call CreaTabla(DirAplicacion & "temp.mdb", "T", Grilla.Cols & ",10")
Dim dbsTemp As Database
Dim rsTemp As Recordset
Dim CamposInsert, ValoresInsert As String
Set dbsTemp = OpenDatabase(DirAplicacion & "temp.mdb")
'Set rsTemp = dbsTemp.OpenRecordset("T", dbOpenDynaset)

'Grilla.Col = 0
'Grilla.Row = 0
'Grilla.CellAlignment = 4
       
ValoresInsert = ""
CamposInsert = ""
For c = 1 To Grilla.Cols
CamposInsert = CamposInsert & "C" & c & ", "
Next c
CamposInsert = "(" & Mid(CamposInsert, 1, Len(CamposInsert) - 2) & ")"
    For f = 1 To Grilla.Rows - 1
        ValoresInsert = ""
        
        
        For i = 0 To Grilla.Cols - 1
            If InStr(1, Grilla.TextMatrix(f, i), "'") > 0 Then
                contenido = "'" & Replace(IIf(Trim(Grilla.TextMatrix(f, i)) = "", "N/D", Grilla.TextMatrix(f, i)), "'", "''") & "', "
            Else
                contenido = "'" & IIf(Trim(Grilla.TextMatrix(f, i)) = "", "N/D", Grilla.TextMatrix(f, i)) & "', "
            End If
            ValoresInsert = ValoresInsert & contenido
        Next i
        'contenido = "'" & Grilla.TextMatrix(f, i) & "', "
        'ValoresInsert = ValoresInsert & contenido
        
        'For camposNull = 1 To 9 - i
        '    contenido = "'N/D', "
        '    ValoresInsert = ValoresInsert & contenido
        'Next camposNull
        
        ValoresInsert = "(" & Mid(ValoresInsert, 1, Len(ValoresInsert) - 2) & ")"
        dbsTemp.Execute "INSERT INTO " & "T" & CamposInsert & " values" & Trim(ValoresInsert)
    Next f

Set dbsTemp = Nothing
'************ IMPRIMIR *************
    Call LimpiaFormulas(Form_main.CrystalReport, 10)
    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) = "nombrecolegio = '" & Nombrecol & "'"
    Form_main.CrystalReport.Formulas(1) = "direccioncolegio = '" & Direccol & "'"
    Form_main.CrystalReport.Formulas(2) = "comunacolegio = '" & ComunaCol & "'"
    Form_main.CrystalReport.Formulas(4) = "hora = '" & Time & "'"
    Form_main.CrystalReport.ReportFileName = DirAplicacion & "\rpt\" & NomREp
    Form_main.CrystalReport.DataFiles(0) = DirAplicacion & "temp.mdb"
    Form_main.CrystalReport.WindowState = crptMaximized
    Form_main.CrystalReport.Formulas(3) = "titulo= '" & Titulo & "'"
    Form_main.CrystalReport.ReplaceSelectionFormula ("")
    Form_main.CrystalReport.Action = 1
    Call LimpiaFormulas(Form_main.CrystalReport, 30)
    'CrystalReport.ReplaceSelectionFormula ("")
End Sub


Public Sub IniGrid(Grilla As String)
    With MSFlexGrid1
        .Clear
        .Rows = 1
        .ColAlignment(5) = 4
'        .ColAlignment(4) = 4
        .TextMatrix(0, 0) = "": .ColWidth(0) = 300
        .TextMatrix(0, 1) = "RUT ALU.": .ColWidth(1) = 950
        .TextMatrix(0, 2) = "NOMBRE ALU.": .ColWidth(2) = 3500
        .TextMatrix(0, 3) = "RUT APO.": .ColWidth(3) = 950
        .TextMatrix(0, 4) = "NOMBRE APO.": .ColWidth(4) = 3500
        .TextMatrix(0, 5) = "TIPO DE PAGO": .ColWidth(5) = 2000
    End With
End Sub

Private Sub btnCanMencur_Click()

End Sub

Private Sub btnCanTipPag_Click()
FrmTipPag.Hide
Unload FrmTipPag

End Sub

Private Sub btnRptTipPag_Click()
If Me.ChkCurporHoja.Value = 0 Then
    CodModalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.Cmb_Cod_ens.Text & "'", conn)
    Dim FromulaSelReg As String
    Select Case Me.CmbTipPag
        Case "Contado":  FromulaSelReg = "{matriculas.IND_CONT} = 1.00 and {alu_x_cur.COD_ENS} = '" & CodModalidad & "'"
        Case "Cuponera":  FromulaSelReg = "{matriculas.IND_CUP} = 1.00 and {alu_x_cur.COD_ENS} = '" & CodModalidad & "'"
        Case "Cheque":  FromulaSelReg = "{matriculas.IND_CHEQ} = 1.00 and {alu_x_cur.COD_ENS} = '" & CodModalidad & "'"
        Case "Pac":  FromulaSelReg = "{matriculas.IND_PAC} = 1.00 and {alu_x_cur.COD_ENS} = '" & CodModalidad & "'"
        Case "Beca":  FromulaSelReg = "{matriculas.IND_BECA} = 1.00 and {alu_x_cur.COD_ENS} = '" & CodModalidad & "'"
        Case "1/2 Beca":  FromulaSelReg = "{matriculas.IND_MBECA} = 1.00 and {alu_x_cur.COD_ENS} = '" & CodModalidad & "'"
    End Select
    '{alu_x_cur.COD_ENS} = "310" and {matriculas.IND_CONT} = 1.00
    '************ IMPRIMIR *************
    Call LimpiaFormulas(Form_main.CrystalReport, 10)
    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 = "Tipos de Pago - Listado General"
    Form_main.CrystalReport.Formulas(0) = "nombrecolegio = '" & Nombrecol & "'"
    Form_main.CrystalReport.Formulas(1) = "direccioncolegio = '" & Direccol & "'"
    Form_main.CrystalReport.Formulas(2) = "comunacolegio = '" & ComunaCol & "'"
    Form_main.CrystalReport.Formulas(3) = "titulo= 'Tipos de Pago - Listado General" & " - (" & Me.CmbTipPag & ")'"
    Form_main.CrystalReport.Formulas(4) = "hora = '" & Time & "'"
    Form_main.CrystalReport.Formulas(5) = "curso = '" & Me.Cmb_Cod_ens & "'"
    Form_main.CrystalReport.ReportFileName = DirAplicacion & "\rpt\tiposdepago2.rpt"
    'Form_main.CrystalReport.DataFiles(0) = DirAplicacion & "temp.mdb"
    Form_main.CrystalReport.WindowState = crptMaximized
    
    Form_main.CrystalReport.Destination = crptToWindow
    Form_main.CrystalReport.ReplaceSelectionFormula ("")
    Form_main.CrystalReport.ReplaceSelectionFormula (FromulaSelReg)
    Form_main.CrystalReport.Action = 1
    Call LimpiaFormulas(Form_main.CrystalReport, 30)
Exit Sub
End If




tippagtemp = Me.CmbTipPag.ListIndex
If Me.Cmb_Grado.ListIndex = 0 Then 'todos los niveles
    For Niveles = 1 To Me.Cmb_Grado.ListCount - 1
        Me.Cmb_Grado.ListIndex = Niveles
        For cursos = 1 To Me.Cmb_Let_Cur.ListCount - 1
            Me.Cmb_Let_Cur.ListIndex = cursos
            Me.CmbTipPag.ListIndex = tippagtemp
            btnVerTipPag.Enabled = False
            'Me.cmbMesGen(0).ListIndex = mesinitemp
            'Me.cmbMesGen(1).ListIndex = mesfintemp
            Call btnVerTipPag_Click
            '**** escribe el curso en la formula del RPT
            Select Case CodModalidad
                Case "996"
                    curso_des = "PK " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
                Case "010"
                    curso_des = "K " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
                Case "110", "310"
                    curso_des = Me.Cmb_Grado & " " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
            End Select
            '*******************************************
            Form_main.CrystalReport.Formulas(5) = "curso = '" & curso_des & "'"
            'Form_main.CrystalReport.Formulas(6) = "mes = '(" & Left(cmbMesGen(1), 3) & ")'"
            Form_main.CrystalReport.Destination = crptToPrinter
            Call GrillaToRPT(MSFlexGrid1, "tiposdepago.rpt", "TIPOS DE PAGO POR CURSO - (" & UCase(Me.CmbTipPag) & ")")
        Next cursos
    Next Niveles
Else
    If Me.Cmb_Let_Cur.ListIndex = 0 Then 'todos los cursos del nivel seleccionado
        For cursos = 1 To Me.Cmb_Let_Cur.ListCount - 1
            Me.Cmb_Let_Cur.ListIndex = cursos
            Me.CmbTipPag.ListIndex = tippagtemp
            btnVerTipPag.Enabled = False
            'Me.cmbMesGen(0).ListIndex = mesinitemp
            'Me.cmbMesGen(1).ListIndex = mesfintemp
            Call btnVerTipPag_Click
            '**** escribe el curso en la formula del RPT
            Select Case CodModalidad
                Case "996"
                    curso_des = "PK " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
                Case "010"
                    curso_des = "K " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
                Case "110", "310"
                    curso_des = Me.Cmb_Grado & " " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
            End Select
            '*******************************************
            
            Form_main.CrystalReport.Formulas(5) = "curso = '" & curso_des & "'"
            'Form_main.CrystalReport.Formulas(6) = "mes = '(" & Left(cmbMesGen(1), 3) & ")'"
            Form_main.CrystalReport.Destination = crptToPrinter
            Call GrillaToRPT(MSFlexGrid1, "tiposdepago.rpt", "TIPOS DE PAGO POR CURSO - (" & UCase(Me.CmbTipPag) & ")")
        Next cursos
    Else ' solo el curso del nivel seleccionado
            '**** escribe el curso en la formula del RPT
            Select Case CodModalidad
                Case "996"
                    curso_des = "PK " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
                Case "010"
                    curso_des = "K " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
                Case "110", "310"
                    curso_des = Me.Cmb_Grado & " " & Me.Cmb_Let_Cur & " - " & Me.Cmb_Cod_ens
            End Select
            '*******************************************
            Form_main.CrystalReport.Formulas(5) = "curso = '" & curso_des & "'"
            'Form_main.CrystalReport.Formulas(6) = "mes = '(" & Left(cmbMesGen(1), 3) & ")'"
        Call GrillaToRPT(MSFlexGrid1, "tiposdepago.rpt", "TIPOS DE PAGO POR CURSO - (" & UCase(Me.CmbTipPag) & ")")
    End If
End If

End Sub

Private Sub btnVerTipPag_Click()
    Dim CritTipPag As String
    Select Case Me.CmbTipPag
        Case "Contado":  CritTipPag = " and M.ind_cont =1 "
        Case "Cuponera":  CritTipPag = " and M.ind_cup =1 "
        Case "Cheque":  CritTipPag = " and M.ind_cheq =1 "
        Case "Pac":  CritTipPag = " and M.ind_pac =1 "
        Case "Beca":  CritTipPag = " and M.ind_beca =1 "
        Case "1/2 Beca":  CritTipPag = " and M.ind_mbeca =1 "
    End Select
        
    Me.btnCanTipPag = False
    Me.btnRptTipPag.Enabled = False
    alumno = 0
    a = "select p.ape_pat_alu, p.ape_mat_alu, p.nom_alu, p.ci_alu, M.IND_BECA, M.IND_MBECA, M.IND_CONT, M.IND_CUP, M.IND_CHEQ, M.IND_PAC, apa.rut_apo, ap.ape1_apo, ap.ape2_apo, ap.noms_apo from  postulantes p, alu_x_cur a, MATRICULAS M, apoderados ap, apo_X_alu apa where M.ci_alu=apa.ci_alu and apa.rut_apo = ap.rut_Apo and M.CI_ALU = p.CI_ALU AND p.ci_alu = a.ci_alu and M.activo_alu='SI' and a.cod_ens = '" & CodModalidad & "' and a.num_gra = '" & Ngrado & "' and a.let_cur ='" & Me.Cmb_Let_Cur & "'" & CritTipPag & " order by ape_pat_alu, ape_mat_alu, nom_alu"
    MSFlexGrid1.Enabled = True
    Set Rs = New ADODB.Recordset
    Rs.CursorLocation = adUseClient
    'Set Rscuotas = New ADODB.Recordset
    'Rscuotas.CursorLocation = adUseClient
    'Dim MesCuota As Integer
    'Dim mensualidades(4)
    'Dim pagadoAux() As Long
    Rs.Open a, conn
    If Rs.RecordCount > 0 Then
        With ProgBar1
            .ShowProgress 0
            .MaxValue = Rs.RecordCount
            .Richtung = mDir
            .ProgressStyle = mStyle
            .ShowProzent = 1
            .Zusatztext = "%"
            .ShowProgress 0
        End With
        MSFlexGrid1.Rows = 1
        For alumno = 1 To Rs.RecordCount
            If Rs(3) = "17708583-9" Then MsgBox "ok"
            MSFlexGrid1.AddItem ""
            MSFlexGrid1.Col = 0
            MSFlexGrid1.Row = alumno
            MSFlexGrid1.CellAlignment = 1
            MSFlexGrid1.TextMatrix(alumno, 0) = alumno
            MSFlexGrid1.TextMatrix(alumno, 1) = Rs(3)
            MSFlexGrid1.TextMatrix(alumno, 2) = Rs(0) & " " & Rs(1) & " " & Rs(2)
            MSFlexGrid1.TextMatrix(alumno, 3) = Rs(10)
            MSFlexGrid1.TextMatrix(alumno, 4) = Rs(11) & " " & Rs(12) & " " & Rs(13)
            MSFlexGrid1.TextMatrix(alumno, 5) = UCase(Me.CmbTipPag)
            Me.ProgBar1.ShowProgress alumno
            DoEvents
            
            Rs.MoveNext
        Next alumno
        Me.ProgBar1.ShowProgress Me.ProgBar1.MaxValue
    End If
    Rs.Close
    Me.btnCanTipPag.Enabled = True
    Me.btnRptTipPag.Enabled = True

End Sub

Private Sub ChkCurporHoja_Click()
If Me.ChkCurporHoja.Value = 0 Then
    Me.btnVerTipPag.Enabled = False
    Me.Cmb_Grado.Enabled = False
    Me.Cmb_Grado.Clear
    Me.Cmb_Let_Cur.Enabled = False
    Me.Cmb_Let_Cur.Clear
    Me.CmbTipPag.Enabled = True
    
    Me.MSFlexGrid1.Rows = 1
Else
    Me.btnVerTipPag.Enabled = True
    Me.Cmb_Cod_ens.ListIndex = 0
    Me.Cmb_Grado.Clear
    Me.Cmb_Grado.Enabled = False
    Me.Cmb_Let_Cur.Clear
    Me.Cmb_Let_Cur.Enabled = False
    Me.CmbTipPag.ListIndex = 0
    Me.CmbTipPag.Enabled = False
    Me.btnRptTipPag.Enabled = False
End If
End Sub

Private Sub Cmb_Cod_ens_Click()
If Len(Me.Cmb_Cod_ens) <> 0 And Me.ChkCurporHoja.Value = 1 Then
 CodModalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.Cmb_Cod_ens.Text & "'", conn)
 Nivel = devuelvecampo("codigos_ensenanza", "des_ens", "num_gra_max", "des_ens = " & "'" & Me.Cmb_Cod_ens.Text & "'", conn)
 Cmb_Grado.Enabled = True
 Cmb_Grado.Clear
 For t = 1 To Val(Nivel)
    Cmb_Grado.AddItem t
 Next t
Me.CmbTipPag.Enabled = False
Me.CmbTipPag.ListIndex = 0
End If
Me.Cmb_Grado.AddItem "Todos", 0
Cmb_Let_Cur.Clear
Me.btnVerTipPag.Enabled = False
Me.MSFlexGrid1.Rows = 1

End Sub

Private Sub Cmb_Grado_Click()
Ngrado = Me.Cmb_Grado.Text
Cmb_Let_Cur.Clear
Me.CmbTipPag.ListIndex = 0
Me.CmbTipPag.Enabled = False
Me.MSFlexGrid1.Rows = 1
Call llenacombo(Cmb_Let_Cur, "cursos", "let_cur", "where cod_ens = '" & CodModalidad & "' and num_gra = '" & Ngrado & "'", conn)
Me.Cmb_Let_Cur.AddItem "Todos", 0
Me.Cmb_Let_Cur.Enabled = True

If Me.Cmb_Grado.ListIndex = 0 Then
    Me.Cmb_Let_Cur.ListIndex = 0
    Me.Cmb_Let_Cur.Enabled = False
    Me.btnVerTipPag.Enabled = False
End If

End Sub

Private Sub Cmb_Let_Cur_Click()
Me.CmbTipPag.ListIndex = 0
Me.CmbTipPag.Enabled = True
Me.MSFlexGrid1.Rows = 1
End Sub

Private Sub CmbTipPag_Click()
If Me.CmbTipPag.ListIndex = 0 Then Me.btnRptTipPag.Enabled = False: Exit Sub
If Me.ChkCurporHoja.Value = 1 Then
    If Me.Cmb_Grado.ListIndex = 0 Or Me.Cmb_Let_Cur.ListIndex = 0 Then
        Me.btnRptTipPag.Enabled = True
        Me.btnVerTipPag.Enabled = False
    Else
        Me.btnVerTipPag.Enabled = True
    End If
Else
    If Me.Cmb_Cod_ens.ListIndex >= 0 Then Me.btnRptTipPag.Enabled = True
End If
End Sub

Private Sub Form_Load()
Me.MSFlexGrid1.Rows = 1
Me.MSFlexGrid1.Cols = 6
Call IniGrid(MSFlexGrid1)
Set Rs = New ADODB.Recordset
Rs.CursorLocation = adUseClient
'********* Llena combos ****************
    Call llenacombo(Cmb_Cod_ens, "codigos_ensenanza ce", "distinct ce.des_ens", "order by ce.ord_ens", conn)
For i = 0 To 1
    
    With Me.CmbTipPag
        .Clear
        .AddItem "Tipo de Pago"
        .AddItem "Cuponera"
        .AddItem "Pac"
        .AddItem "Contado"
        .AddItem "Cheque"
        .AddItem "Beca"
        .AddItem "1/2 Beca"
        .ListIndex = 0
    End With
Next i

End Sub
