VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FClienteTarjeta 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   3510
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6840
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3510
   ScaleWidth      =   6840
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdcancelar 
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      Height          =   735
      Left            =   5280
      Picture         =   "FClienteTarjeta.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   2520
      Width           =   1215
   End
   Begin VB.CommandButton cmdaceptar 
      Caption         =   "&Grabar"
      Height          =   735
      Left            =   3960
      Picture         =   "FClienteTarjeta.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   2520
      Width           =   1335
   End
   Begin VB.TextBox txtUsuarioTarjeta 
      Height          =   285
      Left            =   2160
      TabIndex        =   1
      Top             =   1200
      Width           =   4335
   End
   Begin VB.TextBox txtClaveTarjeta 
      Height          =   285
      Left            =   2160
      TabIndex        =   0
      Top             =   600
      Width           =   2895
   End
   Begin VB.TextBox txtDescUsuario 
      Height          =   285
      Left            =   77400
      TabIndex        =   6
      Top             =   2160
      Width           =   5415
   End
   Begin MSComCtl2.DTPicker dtpFechaVenc 
      Height          =   285
      Left            =   82800
      TabIndex        =   5
      Top             =   1680
      Width           =   8888
      _ExtentX        =   15690
      _ExtentY        =   503
      _Version        =   393216
      Format          =   62521345
      CurrentDate     =   37578
   End
   Begin MSComCtl2.DTPicker dtpFechaVencTarj 
      Height          =   375
      Left            =   2160
      TabIndex        =   2
      Top             =   1800
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      _Version        =   393216
      Format          =   62521345
      CurrentDate     =   37579
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   5520
      Picture         =   "FClienteTarjeta.frx":0614
      Top             =   480
      Width           =   480
   End
   Begin VB.Line Line2 
      X1              =   360
      X2              =   6480
      Y1              =   2400
      Y2              =   2400
   End
   Begin VB.Line Line1 
      X1              =   360
      X2              =   6480
      Y1              =   360
      Y2              =   360
   End
   Begin VB.Label Label5 
      Caption         =   "Fecha de Vencimiento"
      Height          =   255
      Left            =   360
      TabIndex        =   12
      Top             =   1800
      Width           =   1695
   End
   Begin VB.Label Label3 
      Caption         =   "Descripción de Usuario de Tarjeta"
      Height          =   495
      Left            =   360
      TabIndex        =   11
      Top             =   1200
      Width           =   1695
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Clave de Tarjeta"
      Height          =   195
      Left            =   360
      TabIndex        =   10
      Top             =   600
      Width           =   1170
   End
   Begin VB.Label lblClaveTarjeta 
      Caption         =   "Clave de Tarjeta"
      Height          =   255
      Left            =   75600
      TabIndex        =   9
      Top             =   1680
      Width           =   1695
   End
   Begin VB.Label lblDescUsuario 
      Caption         =   "Descripcion de Usuario de Tarjeta"
      Height          =   375
      Left            =   75600
      TabIndex        =   8
      Top             =   2160
      Width           =   1695
   End
   Begin VB.Label lblFechaVenc 
      Caption         =   "Fecha de Vencimiento"
      Height          =   255
      Left            =   81000
      TabIndex        =   7
      Top             =   1680
      Width           =   1695
   End
End
Attribute VB_Name = "FClienteTarjeta"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public GlngCorrelativo As Long
Public GstrcodCliente As String
Public GstrPassword As String
Public GblnModificando As Boolean
Public objCliente As DB_MA_MANTENIMIENTOS.C_CLIENTE

Private Sub cmdaceptar_Click()
On Error GoTo ErrorHandler

  If Trim(txtClaveTarjeta.Text) = Empty Then
     MsgBox "Ingrese Clave de Tarjeta", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     txtClaveTarjeta.SetFocus
     Exit Sub
  End If
  
  If Trim(txtUsuarioTarjeta.Text) = Empty Then
     MsgBox "Ingrese Descripción de Usuario de Tarjeta", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     txtUsuarioTarjeta.SetFocus
     Exit Sub
  End If
  
    If Not GblnModificando Then
        objCliente.AgregarTarjetaEnTmp GlngCorrelativo, Trim(txtClaveTarjeta.Text), dtpFechaVencTarj.Value, Trim(txtUsuarioTarjeta.Text)
    Else
        objCliente.ActualizarTarjetaEnTmp GlngCorrelativo, txtClaveTarjeta.Text, dtpFechaVencTarj.Value, Trim(txtUsuarioTarjeta.Text)
    End If
    
  Unload Me

Exit Sub

ErrorHandler:
    
   MsgBox MensajedeError(Err.Number, Err.Description), vbCritical + vbDefaultButton1, "Advertencia"
End Sub

Private Sub cmdcancelar_Click()
  Unload Me
  Set objCliente = Nothing
End Sub

Private Sub dtpFechaVencTarj_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        cmdaceptar.SetFocus
    End If
End Sub

Private Sub Form_Load()
 
    txtClaveTarjeta.Text = GstrPassword
    txtClaveTarjeta.Enabled = Not GblnModificando
 
 Set objCliente = New DB_MA_MANTENIMIENTOS.C_CLIENTE
End Sub

Private Sub Form_Unload(Cancel As Integer)
    GstrPassword = Empty
    GblnModificando = False
End Sub

Private Sub txtClaveTarjeta_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        txtUsuarioTarjeta.SetFocus
    End If
End Sub

Private Sub txtUsuarioTarjeta_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        dtpFechaVencTarj.SetFocus
    End If
End Sub
