VERSION 5.00
Object = "{90F3D7B3-92E7-44BA-B444-6A8E2A3BC375}#1.0#0"; "actskin4.ocx"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FtarjetaCredito 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Tarjeta de Crédito"
   ClientHeight    =   4020
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7170
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4020
   ScaleWidth      =   7170
   StartUpPosition =   3  'Windows Default
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2 
      Height          =   255
      Left            =   3240
      OleObjectBlob   =   "FtarjetaCredito.frx":0000
      TabIndex        =   7
      Top             =   240
      Width           =   735
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1 
      Height          =   255
      Left            =   3240
      OleObjectBlob   =   "FtarjetaCredito.frx":006A
      TabIndex        =   6
      Top             =   1080
      Width           =   3135
   End
   Begin ACTIVESKINLibCtl.Skin sknTarjetaCredito 
      Left            =   4320
      OleObjectBlob   =   "FtarjetaCredito.frx":00EA
      Top             =   2400
   End
   Begin VB.TextBox txtnumerotarj 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3240
      MaxLength       =   20
      TabIndex        =   3
      Top             =   1440
      Width           =   3495
   End
   Begin MSDataListLib.DataCombo dtcmoneda 
      Height          =   315
      Left            =   4080
      TabIndex        =   2
      Top             =   240
      Width           =   2655
      _ExtentX        =   4683
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   "DataCombo1"
   End
   Begin VB.Frame Frame1 
      Caption         =   "Tarjetas"
      Height          =   3735
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   2895
      Begin MSDataListLib.DataList DblTarjetas 
         Height          =   3375
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   5953
         _Version        =   393216
      End
   End
   Begin VB.CommandButton CMD_ACEPTAR 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Aceptar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1095
      Left            =   3240
      Picture         =   "FtarjetaCredito.frx":031E
      Style           =   1  'Graphical
      TabIndex        =   4
      Tag             =   "R ASDASD"
      Top             =   2640
      Width           =   1815
   End
   Begin VB.CommandButton CMD_CANCELAR 
      BackColor       =   &H00FFFFFF&
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1095
      Left            =   5160
      Picture         =   "FtarjetaCredito.frx":03B4
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   2640
      Width           =   1935
   End
End
Attribute VB_Name = "FtarjetaCredito"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private MobjMoneda As DB_MA_MANTENIMIENTOS.C_MONEDA
Private MObjTarjeta As DB_OP_MANTENIMIENTOS.C_TARJETA
Private MrsMoneda As ADODB.Recordset
Private MrsTarjeta As ADODB.Recordset
Public GBlnUsuarioTarjetaOK As Boolean

Private Sub cmd_aceptar_Click()
  'Validaciones de Datos
  
  If Trim(txtnumerotarj.Text) = Empty Then
     MsgBox "Ingrese Número de Tarjeta", vbDefaultButton1 + vbExclamation, "Advertencia"
     txtnumerotarj.SetFocus
     Exit Sub
  End If
  
  If Trim(dtcmoneda.Text) = Empty Then
     MsgBox "Ingrese Moneda de la Tarjeta", vbDefaultButton1 + vbExclamation, "Advertencia"
     dtcmoneda.SetFocus
     Exit Sub
  End If
  
  '******************************
  '********** GRABAR ************
  '******************************
     
  If (Trim(FDatosClientCombust.txtcara.Text)) = Empty Or GIntVentaAutoCombust = 0 Then
    
      FDatosClientCombust.GStrIdTarjeta = DblTarjetas.BoundText
      FDatosClientCombust.GStrNumeroTarjeta = txtnumerotarj.Text
      FDatosClientCombust.GStrMonedaenTarjeta = dtcmoneda.BoundText
      FDatosClientCombust.GstrDescripcionTarjeta = Trim(DblTarjetas.Text)
      
      If FDatosClientCombust.MrsGrilla.RecordCount < 1 Then
         MsgBox "No se ha Ingresado Ningún Producto", vbDefaultButton1 + vbExclamation, "Advertencia"
         Unload Me
         Exit Sub
      End If
        
      GBlnUsuarioTarjetaOK = False
      FingresoCodVend.GIntdepantalla = 1
      FingresoCodVend.Show vbModal
      
      If GBlnUsuarioTarjetaOK = False Then
         Exit Sub
      End If
        
      FDatosClientCombust.EmitirDocumentoDirectamente 1, dtcmoneda.BoundText, GStrCodVendedorVentaCombus, GStrCodUsuarioVentaCombus
      
      If GIntVentaAutoCombust = 1 Then
            FDatosClientCombust.cmdaceptarprodadi.Enabled = False 'Pablo N.
            FDatosClientCombust.cmdcancelar.Enabled = False 'Pablo N.
            FDatosClientCombust.cmddetalleproductos.Enabled = False 'Pablo N.
            FDatosClientCombust.cmdaceptarventa.Enabled = False 'Pablo N.
            FDatosClientCombust.txtcodcliente.Enabled = False 'Pablo N.
            FDatosClientCombust.txtcodigo.Enabled = False 'Pablo N.
            FDatosClientCombust.OptEfectivo.Enabled = False 'Pablo N.
            FDatosClientCombust.Opttarjeta.Enabled = False 'Pablo N.
            FDatosClientCombust.OptAdelanto.Enabled = False 'Pablo N.
            FDatosClientCombust.Optctacte.Enabled = False 'Pablo N.
            FDatosClientCombust.ctnmontofactu.Enabled = False 'Pablo N.

         Unload Me
'         Unload FDatosClientCombust
      Else
         Unload Me
         FDatosClientCombust.GLimpiarDatosdePantalla
      End If
  Else
     FDatosClientCombust.GStrIdTarjeta = DblTarjetas.BoundText
     FDatosClientCombust.GStrNumeroTarjeta = txtnumerotarj.Text
     FDatosClientCombust.GStrMonedaenTarjeta = dtcmoneda.BoundText
     FDatosClientCombust.GstrDescripcionTarjeta = Trim(DblTarjetas.Text)
      
     If GblnVienedePendientes = False Then
        FDatosClientCombust.GrabarDatosenTemporal
     Else  'Actualizar
        FDatosClientCombust.ActualizarDatosenTemporal
        FTranspendientes.GactualizarPendientes
     End If
      
     Unload Me
     Unload FDatosClientCombust
  End If
      
End Sub

Private Sub CMD_CANCELAR_Click()
  Unload Me
End Sub

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

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

Private Sub Form_Load()
    
   Dim Lrstemp As ADODB.Recordset
   Dim Lutil As UTIL_SETUP.C_SETUP
   Set Lutil = New UTIL_SETUP.C_SETUP
   Set Lrstemp = Lutil.Auxiliar3("SELECT CARDid,descr FROM Op_CARD where not cardadjust is null")
  
  
  sknTarjetaCredito.LoadSkin (App.Path & "\Skins\" & gstrSkin)
sknTarjetaCredito.ApplySkin (Me.hWnd)
  
   Me.Top = (Screen.Width - Me.Width) / 2
   Me.Left = (Screen.Height - Me.Height) / 2
      
    
   Set MobjMoneda = New DB_MA_MANTENIMIENTOS.C_MONEDA
   Set MObjTarjeta = New DB_OP_MANTENIMIENTOS.C_TARJETA


   Set MrsMoneda = MobjMoneda.ListarMonedas
   'Set MrsTarjeta = MObjTarjeta.ListartarjetaAyuda
       
   Set MrsTarjeta = Lrstemp
       
   ' Cargar la Lista de Tarjetas
    
   Set DblTarjetas.DataSource = MrsTarjeta
   DblTarjetas.DataField = "DESCR"
   Set DblTarjetas.RowSource = MrsTarjeta
   DblTarjetas.ListField = "DESCR"
   DblTarjetas.BoundColumn = "CARDID"
   If Not MrsTarjeta.EOF Then
     DblTarjetas.BoundText = MrsTarjeta.Fields("CARDID")
   End If
  
   ' Cargar la Moneda
     
   Set dtcmoneda.DataSource = MrsMoneda
   dtcmoneda.DataField = "DESCR"
   Set dtcmoneda.RowSource = MrsMoneda
   dtcmoneda.ListField = "DESCR"
   dtcmoneda.BoundColumn = "CURYID"
   If Not MrsMoneda.EOF Then
     'Hay que cargar por defecto la moneda del Cliente
     'Si no hay entonces la moneda de la Caja
     If Trim(FDatosClientCombust.GstrMonedaLimiteCredito) = Empty Then
        dtcmoneda.BoundText = GStrMonedaCaja
     Else
        dtcmoneda.BoundText = FDatosClientCombust.GstrMonedaLimiteCredito
     End If
   End If
   
   If GblnVienedePendientes = True Then
        ' Cargo los datos ingresado previos
        DblTarjetas.BoundText = FDatosClientCombust.GStrIdTarjeta
        txtnumerotarj.Text = Trim(FDatosClientCombust.GStrNumeroTarjeta)
        
        If Trim(FDatosClientCombust.GStrMonedaenTarjeta) = Empty Then
           If Trim(FDatosClientCombust.GstrMonedaLimiteCredito) = Empty Then
              dtcmoneda.BoundText = GStrMonedaCaja
           Else
              dtcmoneda.BoundText = FDatosClientCombust.GstrMonedaLimiteCredito
           End If
        Else
           dtcmoneda.BoundText = FDatosClientCombust.GStrMonedaenTarjeta
        End If
        
   End If
   
End Sub

Private Sub Form_Unload(Cancel As Integer)
   Set MobjMoneda = Nothing
   Set MObjTarjeta = Nothing

   Set MrsMoneda = Nothing
   Set MrsTarjeta = Nothing
End Sub

Private Sub txtnumerotarj_KeyPress(KeyAscii As Integer)
  KeyAscii = GBloqueaCaracter(KeyAscii)
  
  If Not IsNumeric(Chr(KeyAscii)) Then
    If (KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 32) Then
      If KeyAscii = 13 Then
       CMD_ACEPTAR.SetFocus
      End If
    Else
       KeyAscii = 0
    End If
  End If

End Sub
