VERSION 5.00
Begin VB.Form frmConfiguraImpresora 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Configurar Impresora"
   ClientHeight    =   3150
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5520
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3150
   ScaleWidth      =   5520
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdAceptar 
      Caption         =   "&Aceptar"
      Height          =   435
      Left            =   1005
      TabIndex        =   4
      Top             =   2580
      Width           =   1290
   End
   Begin VB.CommandButton cmdSalir 
      Caption         =   "&Salir"
      Height          =   435
      Left            =   3060
      TabIndex        =   3
      Top             =   2580
      Width           =   1290
   End
   Begin VB.Frame Frame1 
      Height          =   2430
      Left            =   75
      TabIndex        =   0
      Top             =   -15
      Width           =   5340
      Begin VB.CheckBox ChkFlagcortaPapelAlterna 
         Caption         =   "Impresora Corta Papel"
         Height          =   315
         Left            =   150
         TabIndex        =   8
         Top             =   2040
         Width           =   2670
      End
      Begin VB.CheckBox ChkFlagcortaPapel 
         Caption         =   "Impresora Corta Papel"
         Height          =   315
         Left            =   180
         TabIndex        =   7
         Top             =   930
         Width           =   2670
      End
      Begin VB.ComboBox cboImpresora 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Index           =   1
         Left            =   135
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   1665
         Width           =   4605
      End
      Begin VB.ComboBox cboImpresora 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Index           =   0
         Left            =   150
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   540
         Width           =   4605
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "Seleccione la impresora alternativa"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   150
         TabIndex        =   6
         Top             =   1350
         Width           =   2895
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Seleccione la impresora que usará por default:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   165
         TabIndex        =   2
         Top             =   225
         Width           =   3855
      End
   End
End
Attribute VB_Name = "frmConfiguraImpresora"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub LoadPrinters()
On Error Resume Next
  Dim pr As Printer
  For Each pr In Printers
    cboImpresora(0).AddItem pr.DeviceName
    cboImpresora(1).AddItem pr.DeviceName
      
  Next pr
  cboImpresora(0).Text = kPAR_IMPRESORA
  cboImpresora(1).Text = kPAR_IMPRESORA_ALTERNA
  ChkFlagcortaPapel.Value = KImpresora
  ChkFlagcortaPapelAlterna.Value = KImpresoraALT
End Sub



Private Sub cboImpresora_Click(Index As Integer)
    Select Case Index
        Case 0
            If cboImpresora(0).ListIndex = -1 Then
                Me.ChkFlagcortaPapel.Value = 0
                Me.ChkFlagcortaPapel.Enabled = False
            Else
                Me.ChkFlagcortaPapel.Enabled = True
            End If
        Case 1
            If cboImpresora(1).ListIndex = -1 Then
                Me.ChkFlagcortaPapelAlterna.Value = 0
                Me.ChkFlagcortaPapelAlterna.Enabled = False
            Else
                Me.ChkFlagcortaPapelAlterna.Enabled = True
            End If
            
    End Select
    
End Sub

Private Sub cmdAceptar_Click()
  Dim sSql As String
   kPAR_IMPRESORA = cboImpresora(0).Text
   kPAR_IMPRESORA_ALTERNA = cboImpresora(1).Text
   KImpresora = ChkFlagcortaPapel.Value
   KImpresoraALT = ChkFlagcortaPapelAlterna.Value
 '  Set Printer = Printers(kPAR_IMPRESORA)
  
  'ACTUALIZA LOS DATOS EN CONFIGURACION
  '-------------------------------------
  sSql = "UPDATE Configuracion SET sImpresora = '" + kPAR_IMPRESORA + "', sImpresoraAlterna = '" + kPAR_IMPRESORA_ALTERNA + "', " & _
         "nFlagCortaPapel=" & Str(KImpresora) & ", nFlagCortaPapelALT=" & Str(KImpresoraALT)
  Call oDBAdmin.EjecutarSentencia(ADOCnn, sSql)
  
  Unload Me
End Sub

Private Sub cmdSalir_Click()
  Unload Me
End Sub


Private Sub Form_Load()
  cboImpresora(0).Clear
  cboImpresora(1).Clear
  LoadPrinters
  Call cboImpresora_Click(0)
  Call cboImpresora_Click(1)
End Sub

