VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.2#0"; "MSCOMCTL.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Form_NTCR_elec 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Notas de Credito"
   ClientHeight    =   7830
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11685
   Icon            =   "Form_NTCR_elec.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   7830
   ScaleWidth      =   11685
   Begin VB.Frame Frame4 
      Caption         =   "Asociar Boleta"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2535
      Left            =   2640
      TabIndex        =   26
      Top             =   3000
      Visible         =   0   'False
      Width           =   4815
      Begin VB.CommandButton Command3 
         Caption         =   "Aceptar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   960
         TabIndex        =   31
         Top             =   1800
         Width           =   1335
      End
      Begin VB.CommandButton Command2 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2520
         MaskColor       =   &H00FFFFFF&
         TabIndex        =   30
         Top             =   1800
         Width           =   1335
      End
      Begin VB.TextBox txt_credito 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1200
         TabIndex        =   29
         Text            =   "Text4"
         Top             =   1110
         Width           =   1215
      End
      Begin MSComctlLib.ImageCombo cmb_glosa 
         Height          =   345
         Left            =   1200
         TabIndex        =   44
         Top             =   480
         Width           =   3375
         _ExtentX        =   5953
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         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 VB.Label lb_credito 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   1200
         TabIndex        =   37
         Top             =   840
         Width           =   1095
      End
      Begin VB.Label Label3 
         Caption         =   "Valor Detalle :"
         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             =   840
         Width           =   1095
      End
      Begin VB.Label Label7 
         Caption         =   "Valor Credito :"
         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        =   28
         Top             =   1200
         Width           =   1095
      End
      Begin VB.Label Label4 
         Caption         =   "Glosa :"
         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        =   27
         Top             =   480
         Width           =   495
      End
   End
   Begin VB.Frame Frame8 
      Caption         =   "Anular Detalle Nota de Credito"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1935
      Left            =   3000
      TabIndex        =   40
      Top             =   3360
      Visible         =   0   'False
      Width           =   4215
      Begin VB.CommandButton Command5 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2160
         MaskColor       =   &H00FFFFFF&
         TabIndex        =   42
         Top             =   1200
         Width           =   1335
      End
      Begin VB.CommandButton Command4 
         Caption         =   "Aceptar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   600
         TabIndex        =   41
         Top             =   1200
         Width           =   1335
      End
      Begin VB.Label Label5 
         Alignment       =   2  'Center
         Caption         =   "Se encuentra a punto de anular la linea de detalle seleccionada esta seguro de continuar?"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   720
         TabIndex        =   43
         Top             =   360
         Width           =   2775
      End
   End
   Begin VB.Frame Frame7 
      Caption         =   "Colegio"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   855
      Left            =   8400
      TabIndex        =   38
      Top             =   120
      Width           =   3135
      Begin MSComctlLib.ImageCombo ImageCombo2 
         Height          =   345
         Left            =   240
         TabIndex        =   39
         Top             =   360
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         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
         Locked          =   -1  'True
      End
   End
   Begin VB.ListBox List1 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   960
      TabIndex        =   12
      TabStop         =   0   'False
      Top             =   720
      Visible         =   0   'False
      Width           =   3975
   End
   Begin VB.ListBox List2 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   5400
      TabIndex        =   0
      TabStop         =   0   'False
      Top             =   720
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.Frame Frame6 
      Caption         =   "Alumno(s)"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1455
      Left            =   120
      TabIndex        =   32
      Top             =   1080
      Width           =   8175
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grilla 
         Height          =   1095
         Left            =   120
         TabIndex        =   33
         Top             =   240
         Width           =   7935
         _ExtentX        =   13996
         _ExtentY        =   1931
         _Version        =   393216
         FixedCols       =   0
         BackColorSel    =   14737632
         ForeColorSel    =   16711680
         BackColorBkg    =   -2147483643
         FocusRect       =   0
         FillStyle       =   1
         GridLines       =   0
         GridLinesFixed  =   1
         GridLinesUnpopulated=   1
         ScrollBars      =   2
         SelectionMode   =   1
         RowSizingMode   =   1
         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
         _NumberOfBands  =   1
         _Band(0).Cols   =   2
         _Band(0).GridLineWidthBand=   1
         _Band(0).TextStyleBand=   0
      End
   End
   Begin VB.Frame Frame_NTCR 
      Caption         =   "Emisión de Nota de Credito"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3855
      Left            =   8400
      TabIndex        =   19
      Top             =   1080
      Width           =   3135
      Begin VB.CommandButton Command6 
         Caption         =   "Ingresar N. de C. al Libro"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   1680
         TabIndex        =   45
         Top             =   2400
         Width           =   1335
      End
      Begin VB.CommandButton Command8 
         Caption         =   "Imprimir N. de C."
         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          =   495
         Left            =   1680
         TabIndex        =   10
         Top             =   1800
         Width           =   1335
      End
      Begin VB.Frame Frame18 
         Caption         =   "Forma de Pago"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   1335
         Left            =   120
         TabIndex        =   24
         Top             =   1440
         Width           =   1455
         Begin VB.OptionButton Option5 
            Caption         =   "Otro"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   9
            Top             =   840
            Value           =   -1  'True
            Width           =   1095
         End
         Begin VB.OptionButton Option4 
            Caption         =   "Contado"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   7
            Top             =   360
            Width           =   1095
         End
         Begin VB.OptionButton Option3 
            Caption         =   "Cheque(s)"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   8
            Top             =   600
            Width           =   1095
         End
      End
      Begin VB.Frame Frame17 
         Caption         =   "Folio Impreso"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   855
         Left            =   120
         TabIndex        =   22
         Top             =   2880
         Width           =   1455
         Begin VB.TextBox Text8 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   120
            TabIndex        =   23
            Top             =   360
            Width           =   1215
         End
      End
      Begin VB.Frame Frame16 
         Caption         =   "Fecha"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   975
         Left            =   120
         TabIndex        =   20
         Top             =   360
         Width           =   2895
         Begin MSComCtl2.DTPicker DTP_Fec_NTCR 
            Height          =   375
            Left            =   1440
            TabIndex        =   6
            Top             =   360
            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          =   51773441
            CurrentDate     =   38353
         End
         Begin VB.Label Label11 
            Caption         =   "Fecha N.de C."
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   120
            TabIndex        =   21
            Top             =   480
            Width           =   1335
         End
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Apoderado"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   855
      Left            =   120
      TabIndex        =   16
      Top             =   120
      Width           =   6735
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   840
         TabIndex        =   1
         Top             =   360
         Width           =   3975
      End
      Begin VB.TextBox Text2 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   5280
         TabIndex        =   2
         Top             =   360
         Width           =   1335
      End
      Begin VB.Label Label1 
         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            =   120
         TabIndex        =   18
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "Run"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   4920
         TabIndex        =   17
         Top             =   360
         Width           =   375
      End
   End
   Begin VB.Frame Frame12 
      Height          =   1215
      Left            =   8400
      TabIndex        =   14
      Top             =   6480
      Width           =   3135
      Begin VB.CommandButton Command1 
         Caption         =   "Salir"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   735
         Left            =   840
         MaskColor       =   &H00FFFFFF&
         Picture         =   "Form_NTCR_elec.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   240
         Width           =   1335
      End
   End
   Begin VB.Frame Frame13 
      Caption         =   "Año"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   855
      Left            =   6960
      TabIndex        =   13
      Top             =   120
      Width           =   1335
      Begin VB.ComboBox Combo1 
         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        =   3
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.Frame Frame5 
      Caption         =   "Detalle Boleta"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2295
      Left            =   4320
      TabIndex        =   34
      Top             =   2640
      Width           =   3975
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid grilladeta 
         Height          =   1935
         Left            =   120
         TabIndex        =   35
         Top             =   240
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   3413
         _Version        =   393216
         BackColor       =   16777215
         FixedCols       =   0
         BackColorSel    =   14737632
         ForeColorSel    =   16711680
         BackColorBkg    =   16777215
         AllowBigSelection=   0   'False
         HighLight       =   2
         FillStyle       =   1
         GridLinesUnpopulated=   2
         SelectionMode   =   1
         FormatString    =   "Monto|<Fecha Venc"
         RowSizingMode   =   1
         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
         _NumberOfBands  =   1
         _Band(0).Cols   =   2
         _Band(0).TextStyleBand=   0
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "Boletas Alumno"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2295
      Left            =   120
      TabIndex        =   15
      Top             =   2640
      Width           =   4095
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid GrdNtcr 
         Height          =   1935
         Left            =   120
         TabIndex        =   4
         Top             =   240
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   3413
         _Version        =   393216
         BackColor       =   16777215
         Cols            =   3
         FixedCols       =   0
         BackColorSel    =   14737632
         ForeColorSel    =   16711680
         BackColorBkg    =   16777215
         AllowBigSelection=   0   'False
         FocusRect       =   0
         FillStyle       =   1
         GridLinesUnpopulated=   2
         ScrollBars      =   2
         SelectionMode   =   1
         FormatString    =   "<Folio Boleta|<Fecha Boleta|<Monto Boleta"
         RowSizingMode   =   1
         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
         _NumberOfBands  =   1
         _Band(0).Cols   =   3
         _Band(0).TextStyleBand=   0
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Detalle Nota de Credito"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2655
      Left            =   120
      TabIndex        =   25
      Top             =   5040
      Width           =   8175
      Begin VB.OptionButton Option2 
         Caption         =   "Cerrada y Pendiente"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6240
         TabIndex        =   51
         Top             =   2280
         Width           =   1815
      End
      Begin VB.OptionButton Option1 
         Caption         =   "Abierta"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5160
         TabIndex        =   50
         Top             =   2280
         Value           =   -1  'True
         Width           =   975
      End
      Begin VB.TextBox Text_tot_ntcr 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   2160
         Locked          =   -1  'True
         TabIndex        =   49
         Top             =   2280
         Width           =   1455
      End
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid GrillaDetaNtcr 
         Height          =   1935
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   7935
         _ExtentX        =   13996
         _ExtentY        =   3413
         _Version        =   393216
         BackColor       =   16777215
         Cols            =   3
         FixedCols       =   0
         BackColorSel    =   14737632
         ForeColorSel    =   16711680
         BackColorBkg    =   16777215
         AllowBigSelection=   0   'False
         FillStyle       =   1
         GridLinesUnpopulated=   2
         SelectionMode   =   1
         FormatString    =   "<Folio Boleta|<Monto Credito|<Glosa"
         RowSizingMode   =   1
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _NumberOfBands  =   1
         _Band(0).Cols   =   3
         _Band(0).TextStyleBand=   0
      End
      Begin VB.Label Label6 
         Caption         =   "Total de la Nota de Crédito:"
         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        =   48
         Top             =   2280
         Width           =   2055
      End
   End
   Begin VB.Label lb_folio_dtll 
      Caption         =   "lb_folio_dtll"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   8400
      TabIndex        =   47
      Top             =   5640
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.Label lb_folio_boleta 
      Caption         =   "lb_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            =   8400
      TabIndex        =   46
      Top             =   5160
      Visible         =   0   'False
      Width           =   1095
   End
End
Attribute VB_Name = "Form_NTCR_elec"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Dim Flag_sub As Boolean

Private Sub cmb_glosa_Click()
    If cmb_glosa.SelectedItem.Key = "OTRO" Then
        Form_mant_glosa.Show
    End If
End Sub

Private Sub Combo1_Click()
    SeteaGrillaNtcr
    SeteaGrillaDETABol
    carga_blta
End Sub

Private Sub Command1_Click()
    Unload Me
End Sub

Private Sub Command2_Click()
    Frame4.Visible = False
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub

Private Sub Command3_Click()
    Dim montoactual As String
    If lb_folio_boleta.Caption = "0" Or lb_folio_boleta.Caption = "" Then
        MsgBox "Hay error en la seleccion de boleta"
        Exit Sub
    End If
    If cmb_glosa.Text = "" Then
        MsgBox "Debe seleccionar la glosa de la nota de credito"
        Exit Sub
    End If
    If cmb_glosa.SelectedItem.Key = "OTRO" Then
        MsgBox "Glosa no valida"
        Exit Sub
    End If

    If (CDbl(txt_credito.Text) > CDbl(lb_credito.Caption)) Then
        MsgBox "el monto de la nota de credito es superior al valor de la boleta", vbInformation
        Exit Sub
    End If
    
    CreaNTCR lb_folio_boleta.Caption, grilladeta.TextMatrix(grilladeta.Row, 2), txt_credito.Text, Text2.Text, Mid(cmb_glosa.SelectedItem.Key, 2), conn
    Command2_Click
End Sub

Private Sub Command4_Click()
    Dim Sql As String
    
    Sql = "DELETE FROM fnza_detalle_ntcr WHERE folio_dtll_ntcr = " & GrillaDetaNtcr.TextMatrix(GrillaDetaNtcr.Row, 3)
    conn.Execute Sql
    abonar_detalle GrillaDetaNtcr.TextMatrix(GrillaDetaNtcr.Row, 4), GrillaDetaNtcr.TextMatrix(GrillaDetaNtcr.Row, 1), Date, conn
    Command5_Click
End Sub

Private Sub Command5_Click()
    Frame8.Visible = False
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub

Private Sub Command6_Click()
    Dim Sql, Detalle, TipPag As String
    Dim linea As Integer
    Dim EstadoIMP As String
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Dim RsAux As ADODB.Recordset
    Set RsAux = New ADODB.Recordset
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim accion_detalle As String
    Dim cole As String
    
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    If cole = "HUE001" And Text8.Text < 1124 Then
        MsgBox "Folio debe ser mayor a 1124", vbInformation
        Exit Sub
    End If
    
    EstadoIMP = IIf(Option1.Value, "pend", "penf")
    
    If val(Text8.Text) = 0 Then
        MsgBox "", vbExclamation, "DATOS INCORRECTOS"
    End If
    
    If MsgBox("Estan todos los datos correctos, para ingresar al libro??", vbQuestion + vbYesNo) = vbNo Then
        Exit Sub
    End If
    
    If Option3.Value = False And Option4.Value = False And Option5.Value = False Then
        MsgBox "Debe Seleccionar tipo de pago"
        Exit Sub
    End If
    If Option3.Value Then
        TipPag = "chqu"
    End If
    If Option4.Value Then
        TipPag = "ctdo"
    End If
    If Option5.Value Then
        TipPag = "otro"
    End If
    If (Text8.Text = "") Then
        MsgBox "Ingrese el folio de la nota de credito"
        Exit Sub
    End If
    
    Sql = "SELECT * from fnza_ntcr WHERE folio_fisico_ntcr = " & Text8.Text & " AND colegio = '" & ImageCombo2.SelectedItem.Key & "' and tipo_ntcr = 3;"
    rs.Open Sql, conn
    If rs.RecordCount > 0 Then
        MsgBox "Folio de Nota de Crédito ya se encuentra ingresado a la Base de Datos", vbCritical
        rs.Close
        Exit Sub
    End If
    rs.Close
    
''        ''''''' Valido que la boleta no este en sofland
''    aaa = ConectarSQL(connSQL, "192.168.7.13", colegio, "sa", "passCORPsa.2024", True)
''    var_sql = "select folio,codbode from " & DevuelveCampo("fnza_temp_boleta_electronica", "", "sector", "1=1", conn) & ".softland.iw_gsaen where tipo = 'N' and folio = " & Text8.Text
''    objRS.Open var_sql, connSQL
''    If objRS.RecordCount > 0 Then
''        MsgBox "El folio " & objRS("folio") & " ya se encuentra ingresado en softland en la bodega " & objRS("codbode"), vbInformation
''         objRS.Close
''         connSQL.Close
''         Exit Sub
''    End If
''    objRS.Close
''    connSQL.Close
    
    
    FEmision = Format(DTP_Fec_NTCR.Value, "yyyy-mm-dd")
    
    Sql = "UPDATE fnza_ntcr SET folio_fisico_ntcr = " & Text8.Text & ", tipo_pago = '" & TipPag & "', fecha_ntcr = '" & Format(DTP_Fec_NTCR.Value, "yyyy-mm-dd") & "', estado_ntcr='aprb',tipo_ntcr = 3 WHERE run_apo = '" & Text2.Text & "' AND folio_fisico_ntcr = 0 and estado_ntcr = '" & EstadoIMP & "' AND colegio = '" & Mid(ImageCombo2.SelectedItem.Key, 1, 6) & "';"
    conn.Execute Sql
    
    '*****************************
    'Log
        accion_detalle = "Se ha generado la nota de credito con folio físico " & Text8.Text _
                       & " con monto " & Text_tot_ntcr.Text & " y con fecha " _
                       & FEmision
        Call Inserta_Vitacora_Finanza(Grilla.TextMatrix(Grilla.Row, 0), Text2.Text, _
        "Notas de Credito", accion_detalle, 0, 0)
    'Fin log
    
    Option1.Value = True
    LlenaBoletas
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
    
End Sub

Private Sub Command8_Click()
    Dim folio_blta As String
    Dim iniPrinter As String
    Dim ResetPrinter As String
    Dim FormFeed As String
    Dim Sql, Detalle, TipPag As String
    Dim linea As Integer
    
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Dim RsAux As ADODB.Recordset
    Set RsAux = New ADODB.Recordset
    
    Dim EnPalabras As clsNum2Let
    Set EnPalabras = New clsNum2Let
    
    Dim EstadoIMP As String
    EstadoIMP = IIf(Option1.Value, "pend", "penf")
    
    Dim ruta As String
    Dim ruta2 As String
    Dim registro0 As String
    Dim registro1 As String
    Dim registro2 As String
    Dim registro3 As String
    Dim registro4 As String
    Dim registro5 As String
    Dim Registro As String
    Dim registro6 As String
    Dim registro7 As String
    Dim sw As Boolean
    sw = True
    
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
'    If (cole = "FAR001" Or cole = "LON001" Or cole = "SNM001" Or cole = "FLO001" Or cole = "SNB001" Or cole = "ALT001") And Text8.Text < 281 Then
'        MsgBox "Folio debe ser mayor a 280", vbInformation
'        Exit Sub
'    End If
    If cole = "HUE001" And Text8.Text < 3120 Then
        MsgBox "Folio debe ser mayor a 3119, porque estos estan vencidos", vbInformation
        Exit Sub
    End If
    
    If cole <> "HUE001" And Text8.Text < 4864 Then
        MsgBox "Folio debe ser mayor a 4863", vbInformation
        Exit Sub
    End If
        
    If Option3.Value = False And Option4.Value = False And Option5.Value = False Then
        MsgBox "Debe Seleccionar tipo de pago"
        Exit Sub
    End If
    If Option3.Value Then
        TipPag = "chqu"
        forma_pago = "102" 'cheque
    End If
    If Option4.Value Then
        TipPag = "ctdo"
        forma_pago = "101" 'contado
    End If
    If Option5.Value Then
        TipPag = "otro"
        forma_pago = "108" 'otro
    End If
    If (Text8.Text = "") Then
        MsgBox "Ingrese el folio de la nota de credito"
        Exit Sub
    End If
    
    Sql = "SELECT * from fnza_ntcr WHERE folio_fisico_ntcr = " & Text8.Text _
        & " and colegio = '" & ImageCombo2.SelectedItem.Key & "' and tipo_ntcr = 3"
    rs.Open Sql, conn
    If rs.RecordCount > 0 Then
        MsgBox "Folio de boleta ya se encuentra ingresado a la Base de Datos", vbCritical
        Exit Sub
    End If
    rs.Close
    
    iniPrinter = Chr(27) + Chr(67) + Chr(51) + Chr(13) + Chr(27) + Chr(74) + Chr(120)
    ResetPrinter = Chr(27) + "@"
    FormFeed = Chr(12)
  
    'run_alu = Me.Grilla.TextMatrix(Grilla.Row, 0)    ' Rut del alumno
    alumno_curso = Me.Grilla.TextMatrix(Grilla.Row, 1) & "     Curso: " & Me.Grilla.TextMatrix(Grilla.Row, 2)
    alumno_curso = Chr(34) & alumno_curso & Chr(34)
    'MsgBox Me.Grilla.TextMatrix(Grilla.Row, 1) & " " & Me.Grilla.TextMatrix(Grilla.Row, 2)
    
    'Ruta Boleta
    'ruta = "\\192.168.7.192\Users\lriveros\Desktop\BOLETA ELEC\NC_electronica_base64.txt"
    ruta2 = DevuelveCampo("usuarios", "", "ruta_softland", "AUT_NOMBRE_USUARIO ='" & Nom_usu_ses & "'", conn)
    'ruta2 = Replace(ruta2, "Boleta", "NC")
    caja = DevuelveCampo("cfg", "", "valor", "param = 'Bodega_CAJA'", conn)
    
'    'MkDir "C:\Boleta_Electronica"
'    ruta = "C:\Boleta_Electronica\boleta_electronica_base64.txt"
    'ruta2 = "C:\Boleta Electronica\boleta_electronica.txt"
    'ruta = "\\192.168.7.12\departamentos\INFORMATICA\electronica.txt"
    'ruta = "\\sdsw02\wwwroot\sanbernardo_base64.txt"
    'ruta2 = "\\sdsw02\wwwroot\sanbernardo.txt"
    'Call Crear_Archivo_Cobranza(ruta)
    Call Crear_Archivo_Cobranza(ruta2)
    registro0 = "Tipo_de_Documento_de_Venta;Subtipo_del_Documento;Estado_del_Documento;Bodega_Origen_de_los_Productos;Numero_de_Documento;Fecha_de_Generacion_del_Documento;Concepto_del_Documento;Fecha_de_Vencimiento_del_Documento;Observacion;Moneda_del_Documento;Equivalencia_de_la_Moneda_de_Venta_del_Documento;" _
                & "NCredito_por_Devolucion_o_Refacturacion;Guia_de_Entrada_que_Referencia;Motivo_Anulacion;Nro_Documento_que_Referencia;Tipo_de_documento_que_referencia;" _
                & "Codigo_de_Cliente;Nombre_del_Cliente;Rut_del_Cliente;Giro_del_Cliente;Mail_DTE_del_Cliente;Direccion_del_Cliente;N_Direccion_del_Cliente;Comuna_del_Cliente;Ciudad_del_Cliente;Lugar_del_Documento;Direccion_del_Documento;Codigo_Comuna_del_Documento;Codigo_Ciudad_del_Documento;Codigo_Region_del_Documento;" _
                & "Codigo_Pais_del_Documento;Codigo_Lista_de_Precios;Codigo_de_Vendedor;Codigo_Centro_de_Costo;Codigo_Condicion_de_Pago;Codigo_de_Distribuidor;Nombre_de_Distribuidor;Codigo_Lugar_de_Despacho;Retirado_Por;Patente_del_Camion_de_Despacho;Solicitado_Por;Rut_Solicitante;Despachado_Por;Rut_Transportista;" _
                & "Cuenta_Contable_para_Notas_de_Debito;Porcentaje_de_Descuento_1;Valor_de_Descuento_1;Porcentaje_de_Descuento_2;Valor_de_Descuento_2;Porcentaje_de_Descuento_3;Valor_de_Descuento_3;Porcentaje_de_Descuento_4;Valor_de_Descuento_4;Porcentaje_de_Descuento_5;Valor_de_Descuento_5;Flete;Embalaje;" _
                & "Codigo_de_Canal_de_Ventas;Total_Final;Codigo_de_Producto;Codigo_Unidad_de_Medida;Detalle_del_Producto;Descripcion_del_Producto;Cantidad_Facturada;Cantidad_Despachada;Precio_Unitario_Moneda_Base;Precio_Unitario_Moneda_de_Venta;Equivalencia_de_la_moneda_del_producto_vs_base;Porcentaje_de_Descuento_de_Linea_1;" _
                & "Valor_de_Descuento_de_Linea_1;Porcentaje_de_Descuento_de_Linea_2;Valor_de_Descuento_de_Linea_2;Porcentaje_de_Descuento_de_Linea_3;Valor_de_Descuento_de_Linea_3;" _
                & "Porcentaje_de_Descuento_de_Linea_4;Valor_de_Descuento_de_Linea_4;Porcentaje_de_Descuento_de_Linea_5;Valor_de_Descuento_de_Linea_5;Valor_Total_Descuentos_de_Linea;Porcentaje_de_credito_Empresas_Constructoras;Valor_Total_de_Credito_Empresas_Constructoras;Partida_o_Talla;Pieza_o_Color;" _
                & "Fecha_de_Vencimiento_de_la_Partida_o_Pieza;Serie;Numero_Nota_de_Venta;Identificador_Impresora_Fiscal;Conserva_Folio_Asignado_al_DTE;Referencia_1_Tipo_Documento_SII;Referencia_1_Descripcion;Referencia_1_Numero_Documento;Referencia_1_Fecha_Documento;" _
                & "Referencia_1_Codigo_Referencia_Boleta;Referencia_2_Tipo_Documento_SII;Referencia_2_Descripcion;Referencia_2_Numero_Documento;Referencia_2_Fecha_Documento;Referencia_2_Codigo_Referencia_Boleta;Referencia_3_Tipo_Documento_SII;Referencia_3_Descripcion;Referencia_3_Numero_Documento;Referencia_3_Fecha_Documento;" _
                & "Referencia_3_Codigo_Referencia_Boleta;Referencia_4_Tipo_Documento_SII;Referencia_4_Descripcion;Referencia_4_Numero_Documento;Referencia_4_Fecha_Documento;Referencia_4_Codigo_Referencia_Boleta;Referencia_5_Tipo_Documento_SII;Referencia_5_Descripcion;Referencia_5_Numero_Documento;Referencia_5_Fecha_Documento;" _
                & "Referencia_5_Codigo_Referencia_Boleta;Tipo_de_Transaccion;Forma_Pago_SII;ExportacionIndicador_de_Servicio;ExportacionForma_de_Pago_Exportacion;ExportacionIdAdicional_Receptor_Extranjero;ExportacionRut_Chofer;ExportacionNombre_Chofer;ExportacionModalidad_de_Venta;ExportacionClausula_de_Exportacion;ExportacionTotal_Clausula_de_Ventas_Exportacion;ExportacionRecargo_sTotal_Clausula_de_Venta;ExportacionVia_de_Transporte;" _
                & "ExportacionIddel_Medio_de_Transporte;ExportacionRut_Compania_Transportista;ExportacionNombre_Compania_Transportadora;ExportacionIdAdicional_Cia_Transportadora;ExportacionBooking;ExportacionMotoNave;ExportacionCodigo_de_Operador;ExportacionPuerto_de_Embarque;ExportacionIdAdicional_Puerto_de_Embarque;" _
                & "ExportacionPuerto_de_Desembarque;ExportacionIdAdicional_Puerto_de_Desembarque;ExportacionTara;ExportacionUnidad_de_Medida_Tara;ExportacionTotal_Peso_Bruto;ExportacionUnidad_Peso_Bruto;ExportacionTotal_Peso_Neto;ExportacionUnidad_Peso_Neto;ExportacionTotal_Items;ExportacionTotal_Bultos;ExportacionTipo_de_Bulto;" _
                & "ExportacionMarca;ExportacionId_Container;ExportacionSello;ExportacionEmisor_Sello;ExportacionFlete;ExportacionSeguro;ExportacionCodigo_Pais_Receptor;ExportacionTipo_Moneda_Transaccion"
     registro6 = registro0
     Call AgregarRegistroCobranza(registro0, ruta2)
    
    
    
    
    'Open "LPT1:" For Output As 1
    'Open "C:\hola.txt" For Output As 1
        Dim salida As String
        Sql = "SELECT concat(a.noms_apo,' ',a.ape1_apo,' ',a.ape2_apo) as nombre, replace(a.dir_apo,',','') as dir_apo, cg.comuna, a.fon_c_apo,IF(LENGTH(a.email) > 9 AND a.email IS NOT NULL AND a.email LIKE '%@%' AND a.email LIKE '%.%',a.email,'apoderados.sin.correo@bostoncollege.cl') email FROM apoderados a, codigos__geograficos cg WHERE a.comuna_apo = cg.cod_geo AND a.rut_apo = '" & Text2.Text & "'"
        rs.Open Sql, conn
        Dim NomApo, RutApoBol, DireApo, ComuApo, TelApo, FEmision As String
        NomApo = rs("nombre")
        NomApo = Chr(34) & NomApo & Chr(34)
        RutApoBol = Text2.Text
        DireApo = rs("dir_apo")
        DireApo = Chr(34) & DireApo & Chr(34)
        'alumno_curso = Chr(34) & alumno_curso & Chr(34)
        ComuApo = rs("comuna")
        TelApo = rs("fon_c_apo")
        mail = rs("email")
        mail = Chr(34) & mail & Chr(34)
        Sql = "select sum(monto_pago)as total from fnza_detalle_ntcr fdn, fnza_ntcr fn, fnza_glosa fg where fdn.folio_ntcr = fn.folio_ntcr and fn.run_apo = '" & Text2.Text & "' and fg.cod_glosa = fdn.cod_glosa and fn.folio_fisico_ntcr = 0 and fn.estado_ntcr = '" & IIf(Option1.Value, "pend", "penf") & "' and fdn.nulo = 'NO' and fn.colegio = '" & ImageCombo2.SelectedItem.Key & "';"
        RsAux.Open Sql, conn
        MTotal = RsAux("total")
        RsAux.Close
        rs.Close
        EnPalabras.Numero = MTotal
        FEmision = CStr(DTP_Fec_NTCR.Value)

        'Letra = 1: TOTAL_LETRAS = 10: agno_v = 5
               
        salida = Chr(15) & _
        vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf & _
        vbCrLf + Space(15) + NomApo + Space(85 - Len(NomApo)) + FEmision & _
        vbCrLf + vbCrLf + Space(15) + DireApo + Space(85 - Len(DireApo)) + RutApoBol & _
        vbCrLf + vbCrLf + Space(15) + ComuApo & _
        vbCrLf + vbCrLf + Space(106) + TelApo & _
        vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf
        
        'ciclo para llenar glosa
        Sql = "select fdn.*, fg.* from fnza_detalle_ntcr fdn, fnza_ntcr fn, fnza_glosa fg where fdn.folio_ntcr = fn.folio_ntcr and fn.run_apo = '" & Text2.Text & "' and fg.cod_glosa = fdn.cod_glosa and fn.folio_fisico_ntcr = 0 and fn.estado_ntcr = 'pend' and fn.colegio = '" & ImageCombo2.SelectedItem.Key & "';"
        rs.Open Sql, conn
        linea = 0
        'Nota de credito electronica
        enumeracion_concepto = "B99"
        valor_concepto = 0
        desc_beca = ""
        desc_otros = ""
        MesBoleta = Format(FEmision, "yyyy")
        
        While Not rs.EOF
            Detalle = ""
            If rs("nulo") = "SI" Then
                Detalle = "(nulo)"
            End If
            
            folio_blta = DevuelveCampo("fnza_boletas", "", "folio_blta_fisico", "folio_blta = '" & rs("blta_rel") & "'", conn)
            
            
            'Detalle = Detalle & rs("descripcion") & " B: " & rs("blta_rel")
            Detalle = Detalle & rs("descripcion") & "          Boleta: " & folio_blta
            Detalle = Chr(34) & Detalle & Chr(34)
            'RC("monto_pago")
            salida = salida & Space(13) & Detalle & Space(93 - Len(Detalle)) & rs("monto_pago") & vbCrLf
            linea = linea + 1
            'rs.MoveNext
            
            'Nota de credito electronica
                        '1  2 3 4               5                                6                7              8CAM                  9        1011
            registro1 = "N;S;V;" & caja & ";" & Text8.Text & ";" & Format(FEmision, "dd") & "/" & Format(FEmision, "mm") & "/" & Format(FEmision, "yyyy") & ";0" & "2" & ";" & Format(FEmision, "dd") & "/" & Format(FEmision, "mm") & "/" & Format(FEmision, "yyyy") & ";" & alumno_curso & ";;;"
                           '12 - 16      17 ok            18              19                20             21ok            22ok
            registro2 = "1;;2;" & folio_blta & ";B;" & RutApoBol & ";" & NomApo & ";" & Replace(RutApoBol, "-", "") & ";" & MesBoleta & ";" & mail & ";" & DireApo & ";"
              '                  23                24ok               25ok      26 - 34            35         30 - 40
            registro3 = "" & Combo1.Text & ";" & ComuApo & ";" & "Santiago" & ";;;;;;;;;;" & forma_pago & ";;;;;;"
                            '41-53                59                     60             61       62      636465          66           676869    70          71       72
            registro4 = ";;;;;;;;;;;;;;;;;;" & MTotal & ";" & enumeracion_concepto & ";;" & Detalle & ";;1;1;" & rs("monto_pago") & ";;;;;;;;;;;;;;"
                            '81 - 153
            registro5 = ";;;;;;;;S;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
            Registro = registro1 & registro2 & registro3 & registro4 & registro5
            If sw = True Then
                registro6 = registro6 & vbCrLf & Registro
                sw = False
            Else
                registro6 = registro6 & vbCrLf & Registro
            End If
            Call AgregarRegistroCobranza(Registro, ruta2)
            rs.MoveNext
        Wend
        For I = linea To 22
            salida = salida & vbCrLf
        Next
        
        'Lleno tabla con base 64
        numero_coordinador = DevuelveCampo("usuarios", "", "numero_coordinador", "aut_nombre_usuario = '" & Nom_usu_ses & "'", conn)
        certificado_digital = DevuelveCampo("usuarios", "", "certificado_digital", "aut_nombre_usuario = '" & Nom_usu_ses & "'", conn)
        'var_sql = "update fnza_temp_boleta_electronica set boleta = '" & registro6 & "',boleta_64='" & Base64EncodeString(registro6) & "',certificado_digital = '" & certificado_digital & "';"
        
        If numero_coordinador = 1 Then var_sql = "update fnza_temp_boleta_electronica set boleta = '" & registro6 & "',boleta_64='" & Base64EncodeString(registro6) & "',certificado_digital = '" & certificado_digital & "';"
        If numero_coordinador = 2 Then var_sql = "update fnza_temp_boleta_electronica_2 set boleta = '" & registro6 & "',boleta_64='" & Base64EncodeString(registro6) & "',certificado_digital = '" & certificado_digital & "';"
        If numero_coordinador = 3 Then var_sql = "update fnza_temp_boleta_electronica_3 set boleta = '" & registro6 & "',boleta_64='" & Base64EncodeString(registro6) & "',certificado_digital = '" & certificado_digital & "';"
        If numero_coordinador = 4 Then var_sql = "update fnza_temp_boleta_electronica_4 set boleta = '" & registro6 & "',boleta_64='" & Base64EncodeString(registro6) & "',certificado_digital = '" & certificado_digital & "';"
        If numero_coordinador = 5 Then var_sql = "update fnza_temp_boleta_electronica_5 set boleta = '" & registro6 & "',boleta_64='" & Base64EncodeString(registro6) & "',certificado_digital = '" & certificado_digital & "';"
        
        conn.Execute var_sql

'        certificado_digital = DevuelveCampo("usuarios", "", "certificado_digital", "aut_nombre_usuario = '" & Nom_usu_ses & "'", conn)
'    var_sql = "update fnza_temp_boleta_electronica set boleta = '" & registro7 & "',boleta_64='" & Base64EncodeString(registro7) & "',certificado_digital = '" & certificado_digital & "';"
'    conn.Execute var_sql
    
        'Llamo aplicacion que se conecta con Web Service
        Shell App.Path & "\conector\WindowsApplication2.exe", vbNormalFocus
        
        'Call AgregarRegistroCobranza(Base64EncodeString(registro6), ruta)
       
        'pie de pagina
        salida = salida & Space(30) + EnPalabras.ALetra
        'subtotal
        salida = salida + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf
        salida = salida & Space(106) + CStr(MTotal)
        'total
        salida = salida + vbCrLf + vbCrLf + vbCrLf + vbCrLf
        salida = salida & Space(106) + CStr(MTotal)
        
        'Print #1, salida + vbCrLf; vbCrLf + vbCrLf + vbCrLf
        'Print #1, ResetPrinter
    Close 1
    If MsgBox("Si la impresión salio correctamente," & vbCrLf & "la Nota de Crédito será agregada al libro." & vbCrLf & vbCrLf & "¿Salio bien la impresión?", vbQuestion + vbYesNo, "Agregar al Libro.") = vbYes Then
        Sql = "UPDATE fnza_ntcr SET folio_fisico_ntcr = " & Text8.Text & ", tipo_pago = '" & TipPag & "', fecha_ntcr ='" & Format(FEmision, "yyyy-mm-dd") & "', estado_ntcr='aprb',tipo_ntcr = 3 WHERE run_apo = '" & Text2.Text & "' AND folio_fisico_ntcr = 0 and estado_ntcr = '" & EstadoIMP & "' AND colegio = '" & ImageCombo2.SelectedItem.Key & "';"
        conn.Execute Sql
    End If
    Option1.Value = True
    LlenaBoletas
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub

Private Sub Form_Load()
    LlenaComboGlosa
    DTP_Fec_NTCR.Value = Date
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    If cole = "FAR001" Then tabla = "LAFARFANA.softland.iw_gsaen"
    If cole = "LON001" Then tabla = "LONGITUDINAL.softland.iw_gsaen"
    If cole = "SNM001" Then tabla = "CORPORACIONBC.softland.iw_gsaen"
    If cole = "SNB001" Then tabla = "CORPORACIONBC.softland.iw_gsaen"
    If cole = "FLO001" Then tabla = "CORPORACIONBC.softland.iw_gsaen"
    If cole = "PUD001" Then tabla = "CORPORACIONBC.softland.iw_gsaen"
    If cole = "HUE001" Then tabla = "HUECHURABA.softland.iw_gsaen"
    If cole = "ALT001" Then tabla = "ALTOMACUL.softland.iw_gsaen"
    
    '''' Cambio el colegio de la boleta de corporación a colegio respectivo
    var_sql = "UPDATE fnza_boletas,(SELECT valor FROM cfg WHERE param = 'CODBC') c SET colegio = valor" _
            & " WHERE colegio = 'COR001'"
    conn.Execute var_sql
           
    aaa = ConectarSQL(connSQL, "192.168.7.13", colegio, "sa", "passCORPsa.2024", True)
    var_sql = "select max(folio) as folio from " & tabla & " where tipo = 'N'"
    objRS.Open var_sql, connSQL
    If objRS.RecordCount > 0 Then
        Text8.Text = IIf(IsNull(objRS("folio")), 1, objRS("folio") + 1)
        If cole = "ALT001" Then
            If objRS("folio") < 281 Then
                Text8.Text = 281
            Else
                Text8.Text = objRS("folio") + 1
            End If
        End If
        If cole = "HUE001" Then
            If objRS("folio") < 1000 Then
                Text8.Text = 1001
            Else
                Text8.Text = objRS("folio") + 1
            End If
        End If
        If cole <> "HUE001" And cole <> "ALT001" Then
            If objRS("folio") < 4564 Then
                Text8.Text = 4564
            Else
                Text8.Text = objRS("folio") + 1
            End If
        End If
        
    End If
    objRS.Close
    connSQL.Close
End Sub

Private Sub GrdNtcr_Click()
    If GrdNtcr.TextMatrix(GrdNtcr.Row, 2) <> "" Then
        lb_folio_boleta.Caption = GrdNtcr.TextMatrix(GrdNtcr.Row, 3)
        
        SeteaGrillaDETABol
        LlenaGrillaDETABol
        
    Else
        SeteaGrillaDETABol
    End If
End Sub

Private Sub Grilla_Click()
    SeteaGrillaNtcr
    carga_blta
End Sub

Private Sub grilladeta_DblClick()
    Dim montoactual As String
    If Not (Option1.Value) Then Exit Sub
    If Option1.Value And (GrillaDetaNtcr.Rows - 2) < 20 Then
        If GrdNtcr.TextMatrix(GrdNtcr.Row, 2) <> "" And grilladeta.TextMatrix(grilladeta.Row, 2) <> "" Then
            montoactual = RetornaCampo("fnza_detalle_ntcr", "sum(monto_pago) as monto", "nulo = 'NO' AND blta_rel=" & GrdNtcr.TextMatrix(GrdNtcr.Row, 3) & " AND folio_dtll_rel=" & grilladeta.TextMatrix(grilladeta.Row, 3), conn)
            montoactual = IIf(montoactual = "", "0", montoactual)
            lb_credito.Caption = grilladeta.TextMatrix(grilladeta.Row, 0) - montoactual
            txt_credito.Text = ""
            Frame4.Visible = True
        End If
    Else
        MsgBox "Esta Nota de Crédito esta llena, debe imprimirla antes de continuar.", vbInformation, "Nota de Crédito llena"
    End If
End Sub

Private Sub GrillaDetaNtcr_DblClick()
    If GrillaDetaNtcr.TextMatrix(GrillaDetaNtcr.Row, 1) <> "" And GrillaDetaNtcr.TextMatrix(GrillaDetaNtcr.Row, 5) = "NO" Then
        Frame8.Visible = True
    End If
End Sub

    

Private Sub ImageCombo2_Click()
    'buscar alumno
    SeteaGrilla
    LlenaGrilla
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub

Private Sub List1_DblClick()
    Dim RC As ADODB.Recordset
    
    Text1.Text = List1.Text
    List1.Visible = False
    List2.Visible = False
    Set RC = New ADODB.Recordset
    RC.Open "SELECT rut_apo FROM `apoderados` where left(CONCAT(ape1_apo,' ',ape2_apo,' ',noms_apo)," & Len(Text1.Text) & ")='" & Text1.Text & "' ORDER BY ape1_apo, ape2_apo, noms_apo;", conn
    RC.MoveFirst
    Flag_sub = True
    Text2.Text = RC("rut_apo")
    RC.Close
    Flag_sub = False
    LlenaBoletas
    SeteaGrillaDETABol
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub

Private Sub List2_DblClick()
    Dim RC As ADODB.Recordset
    Text2.Text = List2.Text
    List2.Visible = False
    List1.Visible = False
    Set RC = New ADODB.Recordset
    RC.Open "SELECT CONCAT(ape1_apo,' ',ape2_apo,' ',noms_apo) as nombre_apo FROM apoderados where rut_apo='" & Text2.Text & "' ORDER BY rut_apo;", conn
    RC.MoveFirst
    Flag_sub = True
    Text1.Text = RC("nombre_apo")
    RC.Close
    Flag_sub = False
    LlenaBoletas
    SeteaGrillaDETABol
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub


Private Sub Option1_Click()
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub

Private Sub Option2_Click()
    SeteaGrillaDETANtcr
    LlenaGrillaDETANtcr
End Sub

Private Sub Text1_Change()
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If Text1.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
    
    RC.Open "SELECT DISTINCT a.ape1_apo, a.ape2_apo, a.noms_apo FROM apoderados a, fnza_mensualidad fm where left(CONCAT(a.ape1_apo,' ',a.ape2_apo,' ',a.noms_apo)," & Len(Text1.Text) & ")='" & Text1.Text & "' and a.rut_apo=fm.run_apo ORDER BY a.ape1_apo, a.ape2_apo, a.noms_apo;", conn
    List1.Clear
    While Not (RC.EOF)
        List1.AddItem RC("ape1_apo") & " " & RC("ape2_apo") & " " & RC("noms_apo")
        RC.MoveNext
    Wend
    RC.Close
    List1.Visible = True
    List2.Visible = False
    
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If (List1.ListCount = 0) Then
            Exit Sub
        End If
        List1.Selected(0) = True
        Flag_sub = True
        Text1.Text = List1.Text
        Flag_sub = False
        Call List1_DblClick
    End If
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub


Private Sub Text2_Change()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If Text2.Text = "" Then Exit Sub
    
    Dim Str_Query As String
    RC.CursorLocation = adUseClient
    Str_Query = "SELECT DISTINCT fm.run_apo FROM apoderados a, fnza_mensualidad fm WHERE left(a.rut_apo," & Len(Text2.Text) & ")='" & Text2.Text & "' AND a.rut_apo=fm.run_apo ORDER BY a.rut_apo;"
    RC.Open Str_Query, conn
    List2.Clear
    While Not (RC.EOF)
        List2.AddItem RC("run_apo")
        RC.MoveNext
    Wend
    RC.Close
    List2.Visible = True
    List1.Visible = False
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If (List2.ListCount = 0) Then
            Exit Sub
        End If
        List2.Selected(0) = True
        Flag_sub = True
        Text2.Text = List2.Text
        Flag_sub = False
        Call List2_DblClick
    End If
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub LlenaBoletas()
    Dim Sql As String
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Sql = "select distinct year(fecha_blta) as agno from fnza_boletas where run_apo = '" & Text2.Text & "' and estado_blta<>'nula' and estado_blta<>'devo' order by fecha_blta DESC"
    rs.Open Sql, conn
    Combo1.Clear
    Combo1.ListIndex = -1
    If Not rs.EOF Then
        While Not rs.EOF
            Combo1.AddItem rs("agno")
            rs.MoveNext
        Wend
        rs.Close
        Combo1.ListIndex = 0
        Call LimpiaComboCol
        Call LlenaComboCol
        ImageCombo2.Refresh
        SeteaGrilla
        LlenaGrilla
    End If
End Sub

Private Sub carga_blta()
    Dim Sql As String
    Dim I As Integer
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Sql = "select * from fnza_boletas where run_apo = '" & Text2.Text & "' and run_alu = '" & Grilla.TextMatrix(Grilla.Row, 0) & "' and year(fecha_blta)=" & Combo1.Text & " and estado_blta<>'nula' and estado_blta<>'devo'"
    rs.Open Sql, conn
    I = 1
    While Not rs.EOF
        GrdNtcr.AddItem rs("folio_blta_fisico") & Chr(9) & rs("fecha_blta") & Chr(9) & rs("monto_blta") & Chr(9) & rs("folio_blta"), I
        rs.MoveNext
        I = I + 1
    Wend
    rs.Close
End Sub

Private Sub SeteaGrillaNtcr()
    GrdNtcr.ClearStructure
    GrdNtcr.Rows = 2
    GrdNtcr.FormatString = "<Folio Boleta|<Fecha Boleta|<Monto Boleta|<folio Boleta"
    GrdNtcr.ColWidth(0) = 1000
    GrdNtcr.ColWidth(1) = 1000
    GrdNtcr.ColWidth(2) = 1100
    GrdNtcr.ColWidth(3) = 0
End Sub

Private Sub SeteaGrillaDETANtcr()
    GrillaDetaNtcr.ClearStructure
    GrillaDetaNtcr.Rows = 2
    GrillaDetaNtcr.FormatString = "<Folio Boleta|<Monto Credito|<Glosa|>folio_deta_ntcr|>folioDTLL|>nulo|^Mes"
    GrillaDetaNtcr.ColWidth(0) = 1000
    GrillaDetaNtcr.ColWidth(1) = 1100
    GrillaDetaNtcr.ColWidth(2) = 3000
    GrillaDetaNtcr.ColWidth(3) = 0
    GrillaDetaNtcr.ColWidth(4) = 0
    GrillaDetaNtcr.ColWidth(5) = 0
    GrillaDetaNtcr.ColWidth(6) = 1000
    Text_tot_ntcr.Text = str(0)
End Sub

Private Sub LlenaGrillaDETANtcr()
On Error GoTo Controlerror

    Dim QR As String
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    Dim Estado As String
    
    Estado = IIf(Option1.Value, "pend", "penf")
    Command8.Enabled = True
    If IsNull(ImageCombo2.SelectedItem.Key) Then Exit Sub
    
    QR = "select fdn.*, fg.* from fnza_detalle_ntcr fdn, fnza_ntcr fn, fnza_glosa fg where fdn.folio_ntcr = fn.folio_ntcr and fn.run_apo = '" & Trim(Text2.Text) & "' and fg.cod_glosa = fdn.cod_glosa and fn.folio_fisico_ntcr = 0 and fn.estado_ntcr = '" & Estado & "' and fn.colegio = '" & ImageCombo2.SelectedItem.Key & "';"
    RC.Open QR, conn
    If RC.RecordCount = 0 Then
        RC.Close
        Command8.Enabled = False
        Exit Sub
    End If
    For I = 1 To RC.RecordCount
        GrillaDetaNtcr.AddItem RetornaCampo("fnza_boletas", "folio_blta_fisico", "folio_blta=" & RC("blta_rel"), conn) & Chr(9) & RC("monto_pago") & Chr(9) & RC("descripcion") & Chr(9) & RC("folio_dtll_ntcr") & Chr(9) & RC("folio_dtll_rel") & Chr(9) & RC("nulo") & Chr(9) & RetornaCampo("fnza_detalle_mensualidad", "date_format(fech_venc,'%m / %Y') as fvd", "folio_dtll=" & RC("folio_dtll_rel"), conn), I
        GrillaDetaNtcr.Col = 0
        GrillaDetaNtcr.Row = I
        GrillaDetaNtcr.RowSel = I
        GrillaDetaNtcr.ColSel = 3
        If (RC("nulo") = "SI") Then
            GrillaDetaNtcr.CellBackColor = &HC0C0FF
        Else
            Text_tot_ntcr.Text = str(val(Text_tot_ntcr.Text) + RC!Monto_Pago)
        End If
        RC.MoveNext
    Next I
    RC.Close
    grilladeta.SetFocus
    
Controlerror:
    If Err.Number = 91 Then
        MsgBox "El apoderado seleccionado no tiene boletas asociadas. Esposible que el alumno haya sufrido un cambio de apoderado. Por favor verifique el rut del apoderado al cual se le realizó la boleta.", vbInformation, "GesCol"
        Exit Sub
    End If
End Sub

Private Sub SeteaGrillaDETABol()
    grilladeta.ClearStructure
    grilladeta.Rows = 2
    grilladeta.FormatString = "Monto|<Fecha Venc|>FolioMVTO|>FolioDTLL"
    grilladeta.ColWidth(0) = 1000
    grilladeta.ColWidth(1) = 1000
    grilladeta.ColWidth(2) = 0
    grilladeta.ColWidth(3) = 0
End Sub
Private Sub LlenaGrillaDETABol()
    Dim QR As String
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    QR = "select fmm.* from fnza_movimientos_mensualidad fmm, fnza_dtll_mvto fdm, fnza_boletas fb where fb.folio_blta = fdm.folio_blta and fdm.folio_blta = " & GrdNtcr.TextMatrix(GrdNtcr.Row, 3) & " and fmm.folio_mvto = fdm.folio_mvto;"
    RC.Open QR, conn
    If RC.RecordCount = 0 Then
        RC.Close
        Exit Sub
    End If
    For I = 1 To RC.RecordCount
        grilladeta.AddItem RC("monto_pago") & Chr(9) & RC("fech_venc_cptos") & Chr(9) & RC("folio_mvto") & Chr(9) & RC("folio_dtll"), I
        RC.MoveNext
    Next I
    RC.Close
    grilladeta.SetFocus
End Sub

Private Sub SeteaGrilla()
    Grilla.ClearStructure
    Grilla.Rows = 2
    Grilla.FormatString = "<RUN|<Nombre|<Curso|<Colegio"
    Grilla.ColWidth(0) = 1200
    Grilla.ColWidth(1) = 4100
    Grilla.ColWidth(2) = 1000
End Sub

Private Sub LlenaGrilla()
    Dim QR As String
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    QR = "SELECT DISTINCT fdm.run_alu, CONCAT(p.ape_pat_alu,' ',p.ape_mat_alu,' ',p.nom_alu) as nombre FROM fnza_mensualidad fm, fnza_detalle_mensualidad fdm, postulantes p WHERE fm.folio_mens=fdm.folio_mens AND fm.run_apo='" & Text2.Text & "' AND p.ci_alu=fdm.run_alu AND fdm.colegio='" & ImageCombo2.SelectedItem.Key & "' AND fm.agno=fdm.agno order by fdm.run_alu"
    RC.Open QR, conn
    If RC.RecordCount = 0 Then
        RC.Close
        Exit Sub
    End If
    For I = 1 To RC.RecordCount
        Grilla.AddItem RC("run_alu") & Chr(9) & RC("nombre") & Chr(9) & CursoAlumno(RC("run_alu"), val(Combo1.Text), conn), I
        RC.MoveNext
    Next I
    RC.Close
    Frame2.Enabled = True
    Grilla.SetFocus
    
End Sub

Function CursoAlumno(ByVal RunAlu As String, ByVal agno As Integer, CNX As ADODB.Connection) As String
On Error GoTo Controlerror:
    Dim RC As ADODB.Recordset
    Dim QR As String
    Dim Ens As String
    Dim gra As String
    Dim Codens As Integer
    
    CursoAlumno = ""
    QR = "SELECT ce.cod_des,m.cod_ens,m.num_gra FROM matriculas m, codigos_ensenanza ce WHERE m.cod_ens=ce.cod_ens AND m.ci_alu='" & RunAlu & "' AND m.anno_mat='" & agno & "' ORDER BY m.fec_mat DESC LIMIT 1;"
    Set RC = New ADODB.Recordset
    RC.Open QR, CNX
    If RC.RecordCount = 0 Then
        CursoAlumno = "" '"No encontrado"
    Else
        RC.MoveFirst
        Codens = val(RC!Cod_Ens)
        Ens = RC!cod_des
        gra = RC!Num_Gra
        If Not (Codens = 996) Then
            CursoAlumno = gra & " " & Ens
        Else
            CursoAlumno = Ens
        End If
        RC.Close
        QR = "SELECT let_cur FROM alu_x_cur WHERE ci_alu='" & RunAlu & "' AND DATE_FORMAT(fec_mat,'%Y')='" & agno & "' AND fec_cam='1111-11-11' LIMIT 1;"
        RC.Open QR, CNX
        If RC.RecordCount = 0 Then
            RC.Close
            Set RC = Nothing
            Exit Function
        End If
        If (Codens = 996) Or (Codens = 10) Then
            CursoAlumno = Ens & " " & RC!Let_Cur
        Else
            CursoAlumno = gra & "º " & RC!Let_Cur & " " & Ens
        End If
    End If
    RC.Close
    Set RC = Nothing
    
    Exit Function
Controlerror:
    Set RC = Nothing
    Err.Raise Err.Number, Err.Source, Err.Description
End Function

Private Sub LlenaComboGlosa()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    Dim I As Integer
    Dim Sql As String
    cmb_glosa.ComboItems.Clear
    Sql = "SELECT * FROM fnza_glosa WHERE valido = 'SI'"
    RC.Open Sql, conn
    I = 1
    While Not RC.EOF
        cmb_glosa.ComboItems.Add I, "A" & RC("cod_glosa"), RC("descripcion")
        RC.MoveNext
        I = I + 1
    Wend
    Set cmb_glosa.SelectedItem = cmb_glosa.ComboItems.Item(1)
    cmb_glosa.ComboItems.Add I, "OTRO", "Agregar Nueva Glosa..."
    RC.Close
End Sub

Private Sub LimpiaComboCol()
    ImageCombo2.ComboItems.Clear
End Sub

Private Sub LlenaComboCol()
    Dim QR As String
    Dim RunApo As String
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    RunApo = Text2.Text
    QR = "SELECT DISTINCT hc.colegio,hc.nombre FROM hist_cod_colegio hc, fnza_mensualidad fm WHERE fm.run_apo='" & RunApo & "' AND hc.colegio=fm.colegio Order By colegio"
    RC.Open QR, conn
    If RC.RecordCount = 0 Then
        ImageCombo2.ComboItems.Add 1, "none", "Sin Alumnos para el año " & Trim(Me.Combo1.Text)
        Set ImageCombo2.SelectedItem = ImageCombo2.ComboItems.Item(1)
        ImageCombo2.Refresh
        ImageCombo2.Enabled = False
        RC.Close
        Exit Sub
    End If
    Frame6.Enabled = True
    RC.MoveFirst
    For I = 1 To RC.RecordCount
        ImageCombo2.ComboItems.Add I, RC("colegio"), RC("nombre")
        RC.MoveNext
    Next I
    RC.Close
    Set ImageCombo2.SelectedItem = ImageCombo2.ComboItems.Item(1)
    ImageCombo2.Refresh
    If ImageCombo2.ComboItems.count <= 1 Then
        ImageCombo2.Enabled = False
    Else
        ImageCombo2.Enabled = True
    End If
End Sub

Function Crear_Archivo_Cobranza(ruta As String) As Boolean
On Error GoTo Controlerror:
    'ArchBCI = "\\" & Form_main.Winsock1.LocalIP & "\Reg_Cobranza\" & "deuda.txt"
    ArchBCI = ruta
    Crear_Archivo_Cobranza = False
    Canc = FreeFile
    Open ArchBCI For Output As #Canc
    Close #Canc

    Crear_Archivo_Cobranza = True
    Exit Function
Controlerror:
    Err.Raise Err.Number, "CrearArchBCI->" & Err.Source, Err.Description
    Resume
End Function

Function AgregarRegistroCobranza(Registro As String, ruta As String) As Boolean
On Error GoTo Controlerror:
    Dim num_arch As Integer
    
    AgregarRegistroCobranza = False
    
    num_arch = FreeFile
    Arch = ruta
    Open Arch For Append As #num_arch
        Print #num_arch, Registro
    Close #num_arch
    AgregarRegistroCobranza = True
    Exit Function
Controlerror:
    Err.Raise Err.Number, "AgregarRegistroArchivoGeneracion->" & Err.Source, Err.Description
End Function
