VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form_Cheques 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Administración de Documentos según Boleta"
   ClientHeight    =   7995
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8670
   Icon            =   "Form_Cheques.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   7995
   ScaleWidth      =   8670
   Begin VB.Frame Frame_Cheque 
      Height          =   3135
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   8415
      Begin VB.CommandButton Btn_Otra_Bol 
         Caption         =   "Otra Boleta"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   5400
         TabIndex        =   13
         Top             =   2520
         Width           =   1335
      End
      Begin VB.TextBox txt_cod_bci 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   6360
         TabIndex        =   4
         Top             =   600
         Visible         =   0   'False
         Width           =   1815
      End
      Begin VB.CommandButton Btn_BuscaFolio 
         Caption         =   "Buscar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3240
         TabIndex        =   2
         Top             =   160
         Width           =   1335
      End
      Begin VB.CheckBox Chk_Cheque_Asoc 
         Caption         =   "Pago con cheque"
         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        =   15
         Top             =   2520
         Width           =   2535
      End
      Begin VB.TextBox txt_Mtotal 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   4200
         TabIndex        =   12
         Top             =   2040
         Width           =   1575
      End
      Begin VB.TextBox txt_Mexcencion 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1440
         TabIndex        =   11
         Top             =   2040
         Width           =   1575
      End
      Begin VB.TextBox txt_FechaBol 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   4200
         TabIndex        =   8
         Top             =   1320
         Width           =   1575
      End
      Begin VB.TextBox txt_nomalu 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   4200
         TabIndex        =   10
         Top             =   1680
         Width           =   3975
      End
      Begin VB.TextBox txt_rutalu 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1440
         TabIndex        =   9
         Top             =   1680
         Width           =   1575
      End
      Begin VB.TextBox txt_nomapo 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   4200
         TabIndex        =   6
         Top             =   960
         Width           =   3975
      End
      Begin VB.TextBox txt_rutapo 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1440
         TabIndex        =   5
         Top             =   960
         Width           =   1575
      End
      Begin VB.TextBox Txt_CursoAlu 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1440
         TabIndex        =   7
         Top             =   1320
         Width           =   1575
      End
      Begin VB.TextBox txt_colegio 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1440
         TabIndex        =   3
         Top             =   600
         Width           =   4815
      End
      Begin VB.TextBox Txt_Boleta 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1440
         TabIndex        =   1
         Top             =   240
         Width           =   1575
      End
      Begin VB.CommandButton Btn_Salir 
         Caption         =   "Salir"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   6840
         TabIndex        =   14
         Top             =   2520
         Width           =   1335
      End
      Begin VB.Label Label20 
         Caption         =   "Monto Total"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3240
         TabIndex        =   40
         Top             =   2040
         Width           =   975
      End
      Begin VB.Label Label19 
         Caption         =   "Monto Excención"
         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        =   39
         Top             =   2040
         Width           =   1575
      End
      Begin VB.Label Label18 
         Caption         =   "Fecha"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3240
         TabIndex        =   38
         Top             =   1320
         Width           =   735
      End
      Begin VB.Label Label11 
         Caption         =   "Nombre"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3240
         TabIndex        =   37
         Top             =   1680
         Width           =   735
      End
      Begin VB.Label Label7 
         Caption         =   "Rut Alumno"
         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        =   36
         Top             =   1680
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "Nombre"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3240
         TabIndex        =   35
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label5 
         Caption         =   "Rut Apoderado"
         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        =   34
         Top             =   960
         Width           =   1095
      End
      Begin VB.Label Label4 
         Caption         =   "Curso"
         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        =   33
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "Colegio"
         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        =   32
         Top             =   600
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "Folio Boleta"
         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        =   31
         Top             =   240
         Width           =   975
      End
   End
   Begin VB.Frame Frame_DatosCheque 
      Height          =   4455
      Left            =   120
      TabIndex        =   41
      Top             =   3360
      Width           =   8415
      Begin VB.CommandButton Btn_Grabar 
         Caption         =   "Grabar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   6840
         TabIndex        =   29
         Top             =   720
         Width           =   1335
      End
      Begin VB.TextBox txt_monto_Cheque 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3960
         MaxLength       =   10
         TabIndex        =   21
         Top             =   360
         Width           =   1095
      End
      Begin VB.CommandButton Btn_Elimina_Cheque 
         Caption         =   "Eliminar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   5400
         TabIndex        =   28
         Top             =   720
         Width           =   1335
      End
      Begin VB.CommandButton Btn_Limpiar 
         Caption         =   "Limpiar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   6840
         TabIndex        =   27
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton Btn_AceptaCheque 
         Caption         =   "Agregar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   5400
         TabIndex        =   26
         Top             =   240
         Width           =   1335
      End
      Begin VB.TextBox txt_rut_tit 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3960
         MaxLength       =   10
         TabIndex        =   23
         Top             =   1320
         Width           =   1815
      End
      Begin VB.TextBox txt_nom_tit 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3960
         MaxLength       =   40
         TabIndex        =   24
         Top             =   1680
         Width           =   4215
      End
      Begin VB.TextBox txt_Ncuenta 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1080
         MaxLength       =   20
         TabIndex        =   17
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox txt_ncheque 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1080
         MaxLength       =   10
         TabIndex        =   19
         Top             =   1560
         Width           =   1695
      End
      Begin VB.CheckBox Chk_Apod_Duenho 
         Caption         =   "Este es un Cheque Prestado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3000
         TabIndex        =   22
         Top             =   720
         Width           =   2655
      End
      Begin VB.TextBox Txt_FonoCheque 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3960
         TabIndex        =   25
         Top             =   2040
         Width           =   1815
      End
      Begin VB.TextBox txt_Nserie 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1080
         MaxLength       =   10
         TabIndex        =   18
         Top             =   1200
         Width           =   1695
      End
      Begin VB.ComboBox cmb_Banco 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   120
         Style           =   2  'Dropdown List
         TabIndex        =   16
         Top             =   480
         Width           =   2655
      End
      Begin MSFlexGridLib.MSFlexGrid Grd_Cheques 
         Height          =   1815
         Left            =   120
         TabIndex        =   30
         TabStop         =   0   'False
         Top             =   2520
         Width           =   8175
         _ExtentX        =   14420
         _ExtentY        =   3201
         _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
      Begin MSComCtl2.DTPicker dtp_Fecha_Cobro 
         Height          =   375
         Left            =   1440
         TabIndex        =   20
         Top             =   1920
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   661
         _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
         Format          =   265945089
         CurrentDate     =   40572
      End
      Begin VB.Label Label1 
         Caption         =   "Monto"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3000
         TabIndex        =   51
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label17 
         Caption         =   "Datos del Titular"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3000
         TabIndex        =   50
         Top             =   1080
         Width           =   2295
      End
      Begin VB.Label Label16 
         Caption         =   "Rut"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3000
         TabIndex        =   49
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label15 
         Caption         =   "Nombre"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3000
         TabIndex        =   48
         Top             =   1680
         Width           =   975
      End
      Begin VB.Label Label13 
         Caption         =   "Nº Cuenta"
         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        =   47
         Top             =   840
         Width           =   1335
      End
      Begin VB.Label Label14 
         Caption         =   "Nº Cheque"
         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        =   46
         Top             =   1560
         Width           =   1335
      End
      Begin VB.Label Label12 
         Caption         =   "Teléfono"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3000
         TabIndex        =   45
         Top             =   2040
         Width           =   855
      End
      Begin VB.Label Label10 
         Caption         =   "Fecha Cobro"
         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        =   44
         Top             =   2040
         Width           =   975
      End
      Begin VB.Label Label8 
         Caption         =   "Nº Serie"
         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        =   43
         Top             =   1200
         Width           =   1335
      End
      Begin VB.Label label9 
         Caption         =   "Banco"
         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        =   42
         Top             =   240
         Width           =   2655
      End
   End
End
Attribute VB_Name = "Form_Cheques"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fila As Long, ModiCheque As Boolean
Dim FonoApoCheque As String, Abancos() As Variant
Function SumaCol(Grilla As MSFlexGrid, Col As Long, Filaini As Long, Filafin As Long) As Long
Dim suma As Long
suma = 0
For t = Filaini To Filafin
    suma = suma + Val(Grilla.TextMatrix(t, Col))
Next t
SumaCol = suma
End Function
Function ValorenCol(Grilla As MSFlexGrid, valor As String, Col As Long, Filaini As Long, Filafin As Long) As Long
ValorenCol = 0
For t = Filaini To Filafin
    If Trim(Grilla.TextMatrix(t, Col)) = Trim(valor) Then
        ValorenCol = t
        Exit Function
    End If
Next t
End Function

Sub IniGrillaCheques()
Me.Grd_Cheques.Clear
Me.Grd_Cheques.Rows = 2
Me.Grd_Cheques.Cols = 12
Me.Grd_Cheques.FixedCols = 0
Me.Grd_Cheques.FixedRows = 1
                              ' 0          1          2        3         4         5        6         7       8      9     10
Me.Grd_Cheques.FormatString = "Banco  |Cod.Banco|Nº Cuenta |Nº Serie|Nº Cheque|Monto  |Fecha Cobro |Prestado|Rut |Nombre|Teléfono"
'Me.Grd_Cheques.ColWidth(0) = 400 ' este era el item.
Me.Grd_Cheques.ColWidth(0) = 2500
Me.Grd_Cheques.ColWidth(1) = 0 ' Cod Banco no debe verse
Me.Grd_Cheques.ColWidth(2) = 1000
Me.Grd_Cheques.ColWidth(3) = 1000
Me.Grd_Cheques.ColWidth(4) = 1000
Me.Grd_Cheques.ColWidth(5) = 1000 ' Monto
Me.Grd_Cheques.ColWidth(6) = 1200
Me.Grd_Cheques.ColWidth(7) = 800
Me.Grd_Cheques.ColWidth(8) = 2000
Me.Grd_Cheques.ColWidth(9) = 2000
Me.Grd_Cheques.ColWidth(10) = 2000

End Sub
Private Sub Btn_AceptaCheque_Click()
    Dim eBanco As Long, eCuenta As Long, eSerie As Long, eNcheque As Long
    Dim Filacheque As Long
    Filacheque = Me.Grd_Cheques.Rows - 1
    If Me.Cmb_Banco.Text = "" Then
        Me.Cmb_Banco.SetFocus
        SendKeys "{home}+{end}"
        MsgBox ("Seleccione un Banco")
        Exit Sub
    End If
    If Me.txt_Ncuenta.Text = "" Then Call validatexto(Me.txt_Ncuenta, "Ingrese Número de Cuenta del Banco"): Exit Sub
    If Me.txt_Nserie = "" Then Call validatexto(Me.txt_Nserie, "Ingrese Número de Serie del Cheque"): Exit Sub
    If Me.txt_ncheque.Text = "" Then Call validatexto(Me.txt_ncheque, "Ingrese Número del Cheque"): Exit Sub
    If Me.txt_rut_tit.Text = "" Then Call validatexto(Me.txt_rut_tit, "Ingrese Rut del Titular"): Exit Sub
    If Me.txt_nom_tit.Text = "" Then Call validatexto(Me.txt_nom_tit, "Ingrese Nombre del Titular"): Exit Sub
    If Me.Txt_FonoCheque.Text = "" Then Call validatexto(Me.Txt_FonoCheque, "Ingrese Número de Teléfono"): Exit Sub
    If Val(Me.txt_monto_Cheque) <= 0 Then Call validatexto(Me.txt_monto_Cheque, "Error en el monto"): Exit Sub
    ' Filacheque indica la fila final de la grilla
    If ModiCheque Then
        If (SumaCol(Me.Grd_Cheques, 5, 1, Filacheque) - Val(Me.Grd_Cheques.TextMatrix(fila, 5))) + Val(Me.txt_monto_Cheque) > Val(Me.txt_Mtotal) Then
            MsgBox ("La Suma de los cheques supera el Monto a Pagar")
            Exit Sub
        End If
    Else
        If (SumaCol(Me.Grd_Cheques, 5, 1, Filacheque) + Val(Me.txt_monto_Cheque)) > Val(Me.txt_Mtotal) Then
            MsgBox ("La Suma de los cheques supera el Monto a Pagar")
            Exit Sub
        End If
    End If
    eBanco = ValorenCol(Me.Grd_Cheques, Me.Cmb_Banco, 1, 1, Filacheque)
    eCuenta = ValorenCol(Me.Grd_Cheques, Me.txt_Ncuenta, 3, 1, Filacheque)
    
    If (eBanco + eCuenta) > 0 And (eBanco = eCuenta) Then
        eSerie = ValorenCol(Me.Grd_Cheques, Me.txt_Nserie, 4, eBanco, eBanco)
        If eSerie > 0 Then
            Call validatexto(Me.txt_Nserie, "Nº de serie ya existe en grilla"): Exit Sub
        End If
        eNcheque = ValorenCol(Me.Grd_Cheques, Me.txt_ncheque, 5, eBanco, eBanco)
        If eNcheque > 0 Then
            Call validatexto(Me.txt_ncheque, "Nº de Cheque ya existe en grilla"): Exit Sub
            Exit Sub
        End If
    End If
    ' Validar que el numero de cuenta no exista con otro rut
    CodBanco = Abancos(Me.Cmb_Banco.ListIndex)
    ' Ya no pregunto si existe en el sistema, porque cuando grabo elimino todos los cheques
    ' y vuelvo a grabarlos.
    'If Not ExistReg("cheques_x_apo", "cod_banco ='" & CodBanco & "' and num_cuenta ='" & Trim(Me.txt_Ncuenta) & "' and serie_cheque ='" & Trim(Me.txt_Nserie) & "' and num_cheque ='" & Trim(Me.txt_ncheque) & "'") Then
        If ModiCheque Then
            Call Btn_Elimina_Cheque_Click
        End If
        If Filacheque = 1 And Me.Grd_Cheques.TextMatrix(1, 1) <> "" Or Filacheque > 1 Then
            Me.Grd_Cheques.AddItem ""
            Filacheque = Filacheque + 1
        End If
        
        'Me.Grd_Cheques.TextMatrix(FilaCheque, 0) = FilaCheque
        Me.Grd_Cheques.TextMatrix(Filacheque, 0) = Me.Cmb_Banco
        Me.Grd_Cheques.TextMatrix(Filacheque, 1) = Abancos(Me.Cmb_Banco.ListIndex)
        Me.Grd_Cheques.TextMatrix(Filacheque, 2) = Me.txt_Ncuenta
        Me.Grd_Cheques.TextMatrix(Filacheque, 3) = Me.txt_Nserie
        Me.Grd_Cheques.TextMatrix(Filacheque, 4) = Me.txt_ncheque
        Me.Grd_Cheques.TextMatrix(Filacheque, 5) = Me.txt_monto_Cheque
        Me.Grd_Cheques.TextMatrix(Filacheque, 6) = Me.dtp_Fecha_Cobro
        Me.Grd_Cheques.TextMatrix(Filacheque, 7) = Me.Chk_Apod_Duenho.Value
        Me.Grd_Cheques.TextMatrix(Filacheque, 8) = Me.txt_rut_tit
        Me.Grd_Cheques.TextMatrix(Filacheque, 9) = Me.txt_nom_tit
        Me.Grd_Cheques.TextMatrix(Filacheque, 10) = Me.Txt_FonoCheque
        'AgregoCheque = IIf(FilaCheque > 0, True, False)
        Call Btn_Limpiar_Click
        Me.Chk_Apod_Duenho.Value = False
        Me.Cmb_Banco.SetFocus
    'Else
    '    MsgBox ("Cheque existe en el sistema")
    'End If
End Sub

Private Sub Btn_BuscaFolio_Click()
If Val(Me.Txt_Boleta) > 0 Then
    Call IniGrillaCheques
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open "select * from boletas_auxiliar b, codigos_ensenanza c, hist_cod_colegio h, apoderados a, apo_x_alu aa, postulantes p  where aa.rut_apo=a.rut_apo and aa.ci_alu=p.ci_alu and b.colegio=h.colegio and b.ci_alu= p.ci_alu and mid(b.curso,1,3)=c.cod_ens and b.folio_boleta =" & Me.Txt_Boleta & " limit 1", conn
    If rs.RecordCount > 0 Then
        Me.txt_colegio = rs!nombre
        If rs!cod_des = "PK" Or rs!cod_des = "K" Then
            curso = rs!CodDes & " " & Mid(rs!curso, 4, 2)
        Else
            curso = Mid(rs!curso, 4, 2) & " " & rs!cod_des
        End If
        Me.Txt_CursoAlu = curso
        Me.txt_FechaBol = rs!Fecha_emision
        Me.txt_cod_bci = rs!cod_conv_bci
        Me.txt_rutalu = rs!ci_alu
        Me.txt_nomalu = rs!Nom_Alu & " " & rs!ape_pat_alu & " " & rs!ape_mat_alu
        
        Me.txt_RutApo = rs!rut_apo_deuda
        Me.txt_nomapo = rs!Noms_Apo & " " & rs!ape1_apo & " " & rs!ape2_apo
    
        Me.txt_Mexcencion = rs!monto_excencion
        Me.txt_Mtotal = rs!monto_pagado
        Me.txt_rut_tit = rs!rut_apo_deuda
        Me.txt_nom_tit = rs!Noms_Apo & " " & rs!ape1_apo & " " & rs!ape2_apo
        FonoApoCheque = rs!fon_c_apo
        Me.Txt_FonoCheque = FonoApoCheque
        Me.Chk_Cheque_Asoc.Value = IIf(UCase(rs!estado_bol) = "PC", 1, 0)
        rs.MoveNext
        Set RsAux = New ADODB.Recordset
        RsAux.CursorLocation = adUseClient
        Call LlenaGrilla(Grd_Cheques, "Banco                                  , Cod.Banco, Nº Cuenta         , Nº Serie        , Nº Cheque      , Monto     , Fecha Cobro   , Prestado , Rut              , Nombre                                         , Teléfono        ", "cheques_x_apo ch, bancos b", "b.des_banco; b.cod_banco; ch.num_cuenta; ch.serie_cheque; ch.num_cheque; ch.monto; ch.fecha_cobro; ch.prestado; ch.rut_tit; ch.nom_tit; ch.fono_cheque", "ch.cod_banco=b.cod_banco and ch.folio =" & Me.Txt_Boleta, conn)
        Me.Grd_Cheques.ColWidth(1) = 0
        Call Btn_Limpiar_Click
    Else
        Call validatexto(Me.Txt_Boleta, "No se encuentra Boleta")
    End If
    Set rs = Nothing
Else
    Call validatexto(Txt_Boleta, "Ingrese Nº de Boleta")
End If
End Sub

Private Sub Btn_Elimina_Cheque_Click()
If fila > 1 Or (fila = 1 And Me.Grd_Cheques.Rows > 2) Then
    Me.Grd_Cheques.RemoveItem (fila)
    Filacheque = IIf(Filacheque > 1, Filacheque - 1, Filacheque)
    ModiCheque = False
    Me.Btn_AceptaCheque.Caption = "Agregar"
    Me.Btn_Elimina_Cheque.Enabled = False
ElseIf fila = 1 And Me.Grd_Cheques.Rows = 2 Then
    Me.Grd_Cheques.TextMatrix(fila, 0) = ""
    Me.Grd_Cheques.TextMatrix(fila, 1) = ""
    Me.Grd_Cheques.TextMatrix(fila, 2) = ""
    Me.Grd_Cheques.TextMatrix(fila, 3) = ""
    Me.Grd_Cheques.TextMatrix(fila, 4) = ""
    Me.Grd_Cheques.TextMatrix(fila, 5) = ""
    Me.Grd_Cheques.TextMatrix(fila, 6) = ""
    Me.Grd_Cheques.TextMatrix(fila, 7) = ""
    Me.Grd_Cheques.TextMatrix(fila, 8) = ""
    Me.Grd_Cheques.TextMatrix(fila, 9) = ""
    Me.Grd_Cheques.TextMatrix(fila, 10) = ""
    Filacheque = IIf(Filacheque > 1, Filacheque - 1, Filacheque)
    ModiCheque = False
    Me.Btn_AceptaCheque.Caption = "Agregar"
    Me.Btn_Elimina_Cheque.Enabled = False
End If
End Sub

Private Sub Btn_Guardar_Click()
For tc = 1 To Form_Aux.Grd_Cheques.Rows - 1
    CodBanco = Form_Aux.Grd_Cheques.TextMatrix(tc, 2)
    ncuenta = Form_Aux.Grd_Cheques.TextMatrix(tc, 3)
    Nserie = Form_Aux.Grd_Cheques.TextMatrix(tc, 4)
    ncheque = Form_Aux.Grd_Cheques.TextMatrix(tc, 5)
    Monto = Val(Form_Aux.Grd_Cheques.TextMatrix(tc, 6))
    Fecha_Cobro = InvierteFecha(CDate(Form_Aux.Grd_Cheques.TextMatrix(tc, 7)), "R")
    Prestado = Form_Aux.Grd_Cheques.TextMatrix(tc, 8)
    rut_tit = Form_Aux.Grd_Cheques.TextMatrix(tc, 9)
    nom_tit = Form_Aux.Grd_Cheques.TextMatrix(tc, 10)
    FonoCheque = Form_Aux.Grd_Cheques.TextMatrix(tc, 11)
    conn.Execute "INSERT INTO cheques_x_apo(RUT_APO, FOLIO, COD_CONV_BCI, FECHA_COBRO, NUM_CUENTA, SERIE_CHEQUE, NUM_CHEQUE, COD_BANCO, FONO_CHEQUE, PRESTADO, RUT_TIT, NOM_TIT, MONTO) values('" & RutApoCaja & "', '" & Folio & "', '" & CodConvBci & "', '" & Fecha_Cobro & "', '" & ncuenta & "', '" & Nserie & "', '" & ncheque & "', '" & CodBanco & "','" & FonoCheque & "','" & Prestado & "','" & rut_tit & "','" & nom_tit & "'," & Monto & ")"
Next tc
End Sub

Private Sub Btn_Grabar_Click()
If Filacheque >= 1 And Me.Grd_Cheques.TextMatrix(1, 1) <> "" Then
    Folio = FillconStr(Trim(Me.Txt_Boleta), 8, "0", "IZQ")
    conn.Execute "delete from cheques_x_apo where folio =" & Me.Txt_Boleta & " and cod_conv_bci ='" & Me.txt_cod_bci & "'"
    For tc = 1 To Me.Grd_Cheques.Rows - 1
        CodBanco = Me.Grd_Cheques.TextMatrix(tc, 1)
        ncuenta = Me.Grd_Cheques.TextMatrix(tc, 2)
        Nserie = Me.Grd_Cheques.TextMatrix(tc, 3)
        ncheque = Me.Grd_Cheques.TextMatrix(tc, 4)
        Monto = Val(Me.Grd_Cheques.TextMatrix(tc, 5))
        Fecha_Cobro = InvierteFecha(CDate(Me.Grd_Cheques.TextMatrix(tc, 6)), "R")
        Prestado = Me.Grd_Cheques.TextMatrix(tc, 7)
        rut_tit = Me.Grd_Cheques.TextMatrix(tc, 8)
        nom_tit = Me.Grd_Cheques.TextMatrix(tc, 9)
        FonoCheque = Me.Grd_Cheques.TextMatrix(tc, 10)
        conn.Execute "replace INTO cheques_x_apo(RUT_APO, FOLIO, COD_CONV_BCI, FECHA_COBRO, NUM_CUENTA, SERIE_CHEQUE, NUM_CHEQUE, COD_BANCO, FONO_CHEQUE, PRESTADO, RUT_TIT, NOM_TIT, MONTO) values('" & Trim(Me.txt_RutApo) & "', '" & Folio & "', '" & Trim(Me.txt_cod_bci) & "', '" & Fecha_Cobro & "', '" & ncuenta & "', '" & Nserie & "', '" & ncheque & "', '" & CodBanco & "','" & FonoCheque & "','" & Prestado & "','" & rut_tit & "','" & nom_tit & "'," & Monto & ")"
        conn.Execute "update boletas_auxiliar set ESTADO_BOL='PC' where folio_boleta=" & Me.Txt_Boleta
    Next tc
End If
End Sub

Private Sub Btn_Limpiar_Click()
Me.Cmb_Banco.ListIndex = -1
Me.txt_Ncuenta = ""
Me.txt_Nserie = ""
Me.txt_ncheque = ""
Me.txt_monto_Cheque = 0
Me.Chk_Apod_Duenho.Value = 1
Me.Btn_Elimina_Cheque.Enabled = False
Me.Btn_AceptaCheque.Caption = "Agregar"
ModiCheque = False
End Sub

Private Sub Btn_Otra_Bol_Click()
Unload Me
Load Form_Aux3
End Sub

Private Sub Btn_Salir_Click()
Unload Me
End Sub

Private Sub Chk_Apod_Duenho_Click()
If Me.Chk_Apod_Duenho.Value = 1 Then
    Me.txt_nom_tit.Locked = False: Me.Txt_FonoCheque.Locked = False
    Me.txt_rut_tit = "": Me.txt_nom_tit = "": Me.Txt_FonoCheque = ""
'    Me.txt_rut_tit.SetFocus
Else
    Me.txt_nom_tit.Locked = True: Me.Txt_FonoCheque.Locked = True
    Me.txt_rut_tit = Me.txt_RutApo
    Me.txt_nom_tit = Me.txt_nomapo
    Me.Txt_FonoCheque = FonoApoCheque
End If
End Sub

Private Sub Chk_Cheque_Asoc_Click()
Me.Frame_DatosCheque.Enabled = Me.Chk_Cheque_Asoc.Value
Me.Txt_Boleta.Enabled = IIf(Me.Chk_Cheque_Asoc.Value, False, True)
End Sub

Private Sub Form_Activate()
Call llenacomboconarreglo(Cmb_Banco, "bancos", "des_banco", "cod_banco", Abancos, conn)
Me.Btn_Elimina_Cheque.Enabled = False
Me.dtp_Fecha_Cobro.Value = Date
Me.Height = 7635
Me.Width = 8760
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub Form_Load()
AgregoCheque = False
Call IniGrillaCheques
Me.Frame_DatosCheque.Enabled = False
End Sub

Private Sub Grd_Cheques_DblClick()
fila = Me.Grd_Cheques.Row
If Me.Grd_Cheques.TextMatrix(fila, 0) <> "" Then
    Me.Cmb_Banco = Me.Grd_Cheques.TextMatrix(fila, 0)
    Me.txt_Ncuenta = Me.Grd_Cheques.TextMatrix(fila, 2)
    Me.txt_Nserie = Me.Grd_Cheques.TextMatrix(fila, 3)
    Me.txt_ncheque = Me.Grd_Cheques.TextMatrix(fila, 4)
    Me.txt_monto_Cheque = Me.Grd_Cheques.TextMatrix(fila, 5)
    Me.dtp_Fecha_Cobro = Me.Grd_Cheques.TextMatrix(fila, 6)
    Me.Chk_Apod_Duenho.Value = Me.Grd_Cheques.TextMatrix(fila, 7)
    Me.txt_rut_tit = Me.Grd_Cheques.TextMatrix(fila, 8)
    Me.txt_nom_tit = Me.Grd_Cheques.TextMatrix(fila, 9)
    Me.Txt_FonoCheque = Me.Grd_Cheques.TextMatrix(fila, 10)
    Me.Btn_Elimina_Cheque.Enabled = True
    ModiCheque = True
    Me.Btn_AceptaCheque.Caption = "Modificar"
Else
    Me.Btn_Elimina_Cheque.Enabled = False
End If
End Sub

Private Sub Txt_Boleta_KeyPress(KeyAscii As Integer)
If (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then
    Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
End If
KeyAscii = 0
End Sub

Private Sub txt_monto_Cheque_KeyPress(KeyAscii As Integer)
If (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then
    Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
End If
KeyAscii = 0
End Sub




