VERSION 5.00
Object = "{90F3D7B3-92E7-44BA-B444-6A8E2A3BC375}#1.0#0"; "actskin4.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form f_ingresovalesadelanto 
   Caption         =   "Ingreso de Vales por Pago Adelantado"
   ClientHeight    =   5595
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6570
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   5595
   ScaleWidth      =   6570
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox TxtDescripcion 
      Height          =   375
      Left            =   2400
      Locked          =   -1  'True
      TabIndex        =   1
      Top             =   1200
      Visible         =   0   'False
      Width           =   3495
   End
   Begin VB.CommandButton CmdBusPro 
      Caption         =   "..."
      Height          =   375
      Left            =   1680
      TabIndex        =   25
      Top             =   1200
      Visible         =   0   'False
      Width           =   495
   End
   Begin VB.TextBox txtcodigo 
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   1200
      Visible         =   0   'False
      Width           =   1455
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2 
      Height          =   375
      Left            =   120
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":0000
      TabIndex        =   23
      Top             =   240
      Width           =   3255
   End
   Begin ACTIVESKINLibCtl.SkinLabel txttotvales 
      Height          =   375
      Left            =   4200
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":0094
      TabIndex        =   20
      Top             =   240
      Width           =   2295
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel6 
      Height          =   375
      Left            =   120
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":00F2
      TabIndex        =   19
      Top             =   720
      Width           =   1455
   End
   Begin ACTIVESKINLibCtl.SkinLabel Label7 
      Height          =   375
      Left            =   3480
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":0164
      TabIndex        =   18
      Top             =   240
      Width           =   495
   End
   Begin VB.TextBox txt_esoles 
      Alignment       =   1  'Right Justify
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   2760
      MaxLength       =   9
      TabIndex        =   6
      Top             =   2040
      Width           =   1935
   End
   Begin VB.TextBox txtdocumento 
      Height          =   420
      Left            =   1680
      Locked          =   -1  'True
      MaxLength       =   10
      TabIndex        =   15
      Top             =   720
      Width           =   2415
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1 
      Height          =   255
      Left            =   120
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":01C8
      TabIndex        =   14
      Top             =   1680
      Width           =   2055
   End
   Begin ACTIVESKINLibCtl.Skin sknIngresoVales 
      Left            =   5640
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":023C
      Top             =   5040
   End
   Begin VB.Frame Frame1 
      Height          =   15
      Left            =   120
      TabIndex        =   2
      Top             =   165
      Visible         =   0   'False
      Width           =   6045
      Begin VB.TextBox txtkilometraje 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   1800
         MaxLength       =   10
         TabIndex        =   4
         Top             =   840
         Visible         =   0   'False
         Width           =   2175
      End
      Begin VB.TextBox txtplaca 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   1800
         MaxLength       =   12
         TabIndex        =   3
         Top             =   360
         Visible         =   0   'False
         Width           =   2175
      End
      Begin VB.Label Label3 
         Caption         =   "Kilometraje"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   480
         TabIndex        =   11
         Top             =   840
         Visible         =   0   'False
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "Placa"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   480
         TabIndex        =   10
         Top             =   360
         Visible         =   0   'False
         Width           =   675
      End
   End
   Begin VB.CommandButton cmdcancelar 
      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          =   615
      Left            =   120
      Picture         =   "f_ingresovalesadelanto.frx":0470
      TabIndex        =   9
      Top             =   4560
      Width           =   1455
   End
   Begin VB.CommandButton cmdaceptarprodadi 
      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          =   615
      Left            =   1800
      Picture         =   "f_ingresovalesadelanto.frx":077A
      TabIndex        =   8
      Tag             =   "R ASDASD"
      Top             =   4560
      Width           =   1455
   End
   Begin VB.TextBox txtnrovale 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   120
      MaxLength       =   9
      TabIndex        =   5
      Top             =   2040
      Width           =   2385
   End
   Begin VB.CommandButton cmdregistrarvales 
      Caption         =   "Registrar Orden C.>>"
      Height          =   465
      Left            =   4800
      TabIndex        =   7
      Top             =   2008
      Width           =   1695
   End
   Begin ACTIVESKINLibCtl.SkinLabel Label6 
      Height          =   255
      Left            =   2760
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":0A84
      TabIndex        =   16
      Top             =   1680
      Width           =   1455
   End
   Begin ACTIVESKINLibCtl.SkinLabel txttotvalesacum 
      Height          =   375
      Left            =   3960
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":0AEC
      TabIndex        =   21
      Top             =   4560
      Width           =   2295
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel3 
      Height          =   375
      Left            =   3360
      OleObjectBlob   =   "f_ingresovalesadelanto.frx":0B4A
      TabIndex        =   22
      Top             =   4560
      Width           =   495
   End
   Begin MSDataGridLib.DataGrid DbVales 
      Height          =   1785
      Left            =   120
      TabIndex        =   24
      Top             =   2640
      Width           =   6375
      _ExtentX        =   11245
      _ExtentY        =   3149
      _Version        =   393216
      BackColor       =   -2147483624
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   3
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   3082
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   10250
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   3082
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
         BeginProperty Column02 
         EndProperty
      EndProperty
   End
   Begin VB.Label Label5 
      Caption         =   "Nro de Vale"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2760
      TabIndex        =   17
      Top             =   1680
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "Nro de Vale"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   13
      Top             =   1680
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.Label lblcorrelativo 
      Height          =   375
      Left            =   240
      TabIndex        =   12
      Top             =   5040
      Visible         =   0   'False
      Width           =   1545
   End
   Begin VB.Image Imgdetalle 
      Height          =   480
      Left            =   6000
      Picture         =   "f_ingresovalesadelanto.frx":0BAE
      Top             =   1080
      Visible         =   0   'False
      Width           =   480
   End
End
Attribute VB_Name = "f_ingresovalesadelanto"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private MrsTemVales As ADODB.Recordset
Private MobjVentascombustible As DB_OP_FACTURACION.C_VENTASPLAYA
Public GBlnUsuarioCreditoOK As Boolean

Public MrsListadoArticulos As ADODB.Recordset
Public Gintayuda As Integer
Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As Variant
Public GrecibeColumnaOpcional2 As Variant
Public GrecibeColumnaOpcional3 As Variant
 

Public GintStatus As Integer
Public GintBloqueaVentas As Integer
Public GintEsCombustible As Integer
Public GintVentCombenAutomatic As Integer
Private Sub cmdaceptarprodadi_Click()
   'Validación de Monto Total de Vale Acumulado
   
'   If CDbl(txttotvalesacum.Caption) <> CDbl(txttotvales.Caption) Then
'      MsgBox "El Total Acumulado no puede ser diferente al Monto Total de Vales", vbDefaultButton1 + vbExclamation, "Advertencia"
'      txtnrovale.SetFocus
'      Exit Sub
'   End If
   
   'Validación de Factura

   If Trim(txtdocumento.Text) = Empty Then
      MsgBox "Debe Ingresar el Nº Factura", vbDefaultButton1 + vbExclamation, "Advertencia"
      txtdocumento.SetFocus
      Exit Sub
   End If
   
   'Validacion de la Placa
   
'   If txtplaca.Enabled = True Then
'     If MobjVentascombustible.VerificarPlacadeCliente(f_ventascstore.TXT_IDCLIENTE, txtplaca.Text) = False Then
'        MsgBox "Número de Placa no existe para este Cliente", vbDefaultButton1 + vbExclamation, "Advertencia"
'        txtplaca.SetFocus
'        Exit Sub
'     Else
'        f_ventascstore.GSTRPLACA = txtplaca.Text
'     End If
'   End If
   
   'Validacion del Numero de Vale
   
''   If f_ventascstore.MintTipoCliente <> 0 Then ' EL CLIENTE NO ES CONTADO
''        If MrsTemVales.EOF Or IsNull(DbVales.Bookmark) Then
''           MsgBox "Debe Ingresar Número de Vale", vbDefaultButton1 + vbExclamation, "Advertencia"
''           txtnrovale.SetFocus
''           Exit Sub
''        End If
''   End If

   'Validacion del Kilometraje

'   If txtplaca.Enabled = True Then
'      If Trim(txtkilometraje.Text) = Empty Then
'         If f_ventascstore.MintTipoCliente <> 0 Then
'            MsgBox "Ingrese Kilometraje", vbDefaultButton1 + vbExclamation, "Advertencia"
'            txtkilometraje.SetFocus
'            Exit Sub
'         End If
'      End If
'   End If
    f_ventascstore.LDblTOTRETURNEDPEN = 0
    f_ventascstore.LDblTOTRETURNEDUSD = 0
    
  ' f_ventascstore.LDblTOTCASHPEN = LdblTotalBase
  ' f_ventascstore.LDblTOTCASHUSD = LdblTotalExt
      
    gbln_ventaefectuada = True
    Unload Me
  
End Sub

Private Sub CmdBusPro_Click()
     
           
     'If KeyCode = vbKeyF2 Then
       Dim LArrayBusqueda(1 To 4, 1 To 3) As Variant
              
       Gintayuda = 2
       
       LArrayBusqueda(1, 1) = "Codigo"
       LArrayBusqueda(1, 2) = "Código"
       LArrayBusqueda(1, 3) = 1200
       LArrayBusqueda(2, 1) = "Descripcion"
       LArrayBusqueda(2, 2) = "Descripción"
       LArrayBusqueda(2, 3) = 3500
       LArrayBusqueda(3, 1) = "PConvert"
       LArrayBusqueda(3, 2) = "Precio_Venta"
       LArrayBusqueda(3, 3) = 1200
       LArrayBusqueda(4, 1) = "StockActual"
       LArrayBusqueda(4, 2) = "Stock"
       LArrayBusqueda(4, 3) = 1200
       
       GrecibeUbicacion = 0
       GrecibeColumnaID = Empty
       GrecibeColumnaOpcional = Empty
       
       ' Inicializar Variables del Articulo
       GintStatus = 0
       GintBloqueaVentas = 0
       GintEsCombustible = 0
       GintVentCombenAutomatic = 0
  
       FBusquedaCombusS.GObtenerRegistros MrsListadoArticulos, LArrayBusqueda, 4, 2, 7500
       '@ Jorge: Modificada la presentacion
       FBusquedaCombusS.DBListar.BackColor = RGB(0, 65, 128)
       FBusquedaCombusS.DBListar.ForeColor = RGB(255, 255, 255)
       FBusquedaCombusS.Show vbModal
       If GrecibeUbicacion <> 0 Then
           'Verificar si Artículo está con Status Activo
           
           If GintStatus = 1 Then  ' Está Activo
             If GintBloqueaVentas = 1 Then
                MsgBox "Artículo Bloqueado para Venta", vbDefaultButton1 + vbExclamation, "Advertencia"
                Exit Sub
             End If

             If GIntVentaAutoCombust = 1 Then ' La Venta está en Automática
                ' No se pueden Seleccionar Combustibles
                If GintEsCombustible = 1 Then
                   If GintVentCombenAutomatic = 0 Then
                      MsgBox "No se puede Despachar Combustible en Venta Automática", vbDefaultButton1 + vbExclamation, "Advertencia"
                      Exit Sub
                   End If
                End If
             End If
           Else
              MsgBox "Artículo Desactivado, No se puede Vender ", vbDefaultButton1 + vbExclamation, "Advertencia"
              Exit Sub
           End If
           
           '*****************************************************************
           txtcodigo.Text = GrecibeColumnaID
           TxtDescripcion.Text = GrecibeColumnaOpcional
    
           txtnrovale.SetFocus
       End If
    'End If

End Sub

Private Sub cmdCancelar_Click()
  If MsgBox("Los Cambios realizados se perderán,Desea Continuar", vbYesNo + vbQuestion, "Advertencia") = vbYes Then
    MobjVentascombustible.EliminarAdelanto_Temporal 1, lblcorrelativo.Caption, 0
    gbln_ventaefectuada = False
    txttotvalesacum.Caption = GFormatodeNumero(0, 2)
    RefrescarGrilla
    Unload Me
  End If
End Sub
Sub RefrescarGrilla()
   Set MrsTemVales = MobjVentascombustible.ObtenerValesAdeTemp(lblcorrelativo.Caption)
   Set DbVales.DataSource = MrsTemVales
   If MrsTemVales.EOF Then
      txttotvalesacum.Caption = GFormatodeNumero("0", 2)
   Else
      txttotvalesacum.Caption = GFormatodeNumero("0", 2)
      MrsTemVales.MoveFirst
      Do While Not MrsTemVales.EOF
         txttotvalesacum.Caption = GFormatodeNumero(CDbl(txttotvalesacum.Caption) + CDbl(MrsTemVales.Fields("Monto_de_Orden_C")), 2)
         MrsTemVales.MoveNext
      Loop
   End If
   
   DbVales.Caption = "Registrar Vales - [F3] Eliminar "
   DbVales.Columns(0).Visible = False
   DbVales.Columns(1).Width = 1500
   DbVales.Columns(2).Alignment = dbgRight
   DbVales.Columns(2).Width = 1500
'   DbVales.Columns(3).Width = 1200
'   DbVales.Columns(4).Width = 2000
   DbVales.Refresh
End Sub

Private Sub cmdregistrarvales_Click()
    If MobjVentascombustible.Verificar_ExisteValeRegistrado(CStr(f_ventascstore.TXT_IDCLIENTE.Text), CDbl(txtnrovale.Text)) = True Then
       MsgBox "El Nùmero de Vale ya a sido registrado anteriormente", vbDefaultButton1 + vbExclamation, "Advertencia"
       txtnrovale.SetFocus
       Exit Sub
    End If
    
    If MobjVentascombustible.Verificar_ExisteVale(CStr(f_ventascstore.TXT_IDCLIENTE.Text), CDbl(txtnrovale.Text)) = True Then
       MsgBox "El Nùmero de Vale ya a sido registrado anteriormente", vbDefaultButton1 + vbExclamation, "Advertencia"
       txtnrovale.SetFocus
       Exit Sub
    End If
    
    If Len(Trim(txtnrovale.Text)) > 0 Or Len(Trim(txt_esoles.Text)) > 0 Then
       If (CDbl(txttotvalesacum.Caption) + CDbl(txt_esoles.Text)) > CDbl(txttotvales.Caption) Then
          MsgBox "El Monto del Orden Compra sobrepasa el Monto Total de los Orden Compra", vbDefaultButton1 + vbExclamation, "Advertencia"
          txt_esoles.SetFocus
          Exit Sub
       Else
          MobjVentascombustible.GrabarValeA_Temporal Val(lblcorrelativo.Caption), CStr(f_ventascstore.TXT_IDCLIENTE.Text), CDbl(txtnrovale.Text), CDbl(txt_esoles.Text)
'          MobjVentascombustible.GrabarVale_Temporal Val(lblcorrelativo.Caption), CStr(f_ventascstore.TXT_IDCLIENTE.Text), CDbl(txtnrovale.Text), "NULL", 0, 0, 0, 0
          txtnrovale.Text = Empty
          txttotvalesacum.Caption = GFormatodeNumero(CDbl(txttotvalesacum.Caption) + CDbl(txt_esoles.Text), 2)
          txt_esoles.Text = 0
          Me.txtnrovale.Text = Empty
          Me.TxtDescripcion.Text = Empty
          RefrescarGrilla
          txtnrovale.SetFocus
       End If
    End If
End Sub


Private Sub Command1_Click()

End Sub

Private Sub DbVales_GotFocus()
  Imgdetalle.Visible = True
End Sub

Private Sub DbVales_KeyUp(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyF3 Then
     If Not IsNull(DbVales.Bookmark) Then
      If MsgBox("¿ Seguro que desea Eliminar el Vale :" + Trim(DbVales.Columns(1).Text) + " ?", vbYesNo + vbQuestion, "Advertencia") = vbYes Then
          MobjVentascombustible.EliminarAdelanto_Temporal 0, lblcorrelativo.Caption, CDbl(DbVales.Columns(1).Text)
          txttotvalesacum.Caption = GFormatodeNumero(CDbl(txttotvalesacum.Caption) - CDbl(DbVales.Columns(2).Value), 2)
          RefrescarGrilla
      End If
     End If
  End If
End Sub

Private Sub DbVales_LostFocus()
  Imgdetalle.Visible = False
End Sub

Private Sub Form_Activate()
    txtkilometraje.MaxLength = 10
    RefrescarGrilla
  '  txttotvalesacum.Caption = GFormatodeNumero(0, 2)
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
   If KeyCode = 27 Then
      If MsgBox("Los Cambios realizados se perderán,Desea Continuar", vbYesNo + vbQuestion, "Advertencia") = vbYes Then
         MobjVentascombustible.EliminarAdelanto_Temporal 1, lblcorrelativo.Caption, 0
         Unload Me
      End If
   End If
End Sub

Private Sub Form_Load()
    sknIngresoVales.LoadSkin (App.Path & "\Skins\B-Studio.skn")
    sknIngresoVales.ApplySkin (Me.hWnd)
    
    Me.KeyPreview = True
          
    Me.Top = (Screen.Width - Me.Width) / 2
    Me.Left = (Screen.Height - Me.Height) / 2
           
    'Instanciar Objeto
    Set MobjVentascombustible = New DB_OP_FACTURACION.C_VENTASPLAYA
    txtplaca.Enabled = f_ventascstore.GblnconPlacas
    txtkilometraje.Enabled = f_ventascstore.GblnconPlacas
    Set MrsListadoArticulos = MobjVentascombustible.ObtenerListadodeArticulos(GstrSiteProce, GStrMonedaCaja)
 '   MobjVentascombustible.EliminarAdelanto_Temporal 1, lblcorrelativo.Caption, 0
  
         
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set MobjVentascombustible = Nothing
End Sub

Private Sub txt_esoles_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyDown Then
        DbVales.SetFocus
    End If
End Sub


Private Sub txt_esoles_KeyPress(KeyAscii As Integer)
 KeyAscii = GBloqueaCaracter(KeyAscii)
 
 If KeyAscii = 13 Then
'''    cmdregistrarvales.SetFocus
''' End If
    If CDbl(txt_esoles.Text) = 0 Then
        MsgBox "Ingrese Monto mayor a Cero", vbCritical
        txt_esoles.SetFocus
        Exit Sub
    End If
    If Trim(txtnrovale.Text) = Empty Then
       MsgBox "Ingrese Número de Vale", vbCritical
       txtnrovale.SetFocus
       Exit Sub
    End If

  If Not IsNumeric(Chr(KeyAscii)) Then
    If (KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 32) Then
      If KeyAscii = 13 Then
            'Inicio de Validacion
            'Verificar si Numero de Vale no está repetido para ese cliente
             If Trim(txtnrovale.Text) = Empty Then
                MsgBox "Ingrese Número de Vale", vbDefaultButton1 + vbExclamation, "Advertencia"
                txtnrovale.SetFocus
                Exit Sub
              Else
                'MobjVentascombustible
                If MobjVentascombustible.VerificarOrdenCdeCliente(f_ventascstore.TXT_IDCLIENTE.Text, txtnrovale.Text, txtcodigo.Text) = False Then
                  'Hay que Insertarlo en el Temporal de OP_BONUS

                   ' Hay que verificar que no este en el Temporal
                    If MobjVentascombustible.VerificarOrdenCenTemp(lblcorrelativo.Caption, txtnrovale.Text, Trim(txtcodigo.Text)) = False Then
                       cmdregistrarvales.SetFocus
                    Else
                       MsgBox "Número de Orden Compra ya fue Registrado con ese Producto", vbDefaultButton1 + vbExclamation, "Advertencia"
                       txtcodigo.Text = Empty
                       TxtDescripcion.Text = Empty
                       txtcodigo.SetFocus
                       Exit Sub
                    End If
                Else
                  MsgBox "Número de Orden Compra ya fue registrado ", vbDefaultButton1 + vbExclamation, "Advertencia"
                  txtnrovale.Text = Empty
                  txtnrovale.SetFocus
                  Exit Sub
                End If
             End If

         ' Fin de Validacion

       End If
    Else
       KeyAscii = 0
    End If
  End If
  End If
End Sub


Private Sub txtcodigo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF2 Then
  '  Call cmdBuscaArticulo_Click
     Call CmdBusPro_Click
End If

End Sub


Private Sub txtkilometraje_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then
    txtplaca.SetFocus
End If
If KeyCode = vbKeyDown And Len(Trim(txtkilometraje.Text)) > 0 Then
    txtnrovale.SetFocus
End If
End Sub

Private Sub txtkilometraje_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
          ' Inicio de Validacion
          If txtplaca.Enabled = True Then
            If Trim(txtkilometraje.Text) = Empty Then
              If f_ventascstore.MintTipoCliente <> 0 Then ' Si el cliente no es contado
                 MsgBox "Ingrese Kilometraje", vbDefaultButton1 + vbExclamation, "Advertencia"
                 Exit Sub
              Else
                 cmdaceptarprodadi.SetFocus
                 Exit Sub
              End If
            End If
            txtnrovale.SetFocus
          End If
          ' Fin de Validacion
        End If
     Else
        KeyAscii = 0
     End If
   End If
End Sub


Private Sub txtnrovale_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDown Then
    txt_esoles.SetFocus
End If

If KeyCode = vbKeyUp Then
    txtkilometraje.SetFocus
End If

End Sub

Private Sub txtnrovale_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
         ' Inicio de Validacion
            'Verificar si Numero de Vale no está repetido para ese cliente
             If Trim(txtnrovale.Text) = Empty Then
                MsgBox "Ingrese Número de Vale", vbDefaultButton1 + vbExclamation, "Advertencia"
                Me.txtnrovale.SetFocus
               Exit Sub
             End If
             Me.txt_esoles.SetFocus
         ' Fin de Validacion
       End If
    Else
       KeyAscii = 0
    End If
  End If

End Sub
Private Sub txtplaca_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDown Then
    txtkilometraje.SetFocus
End If
End Sub

Private Sub txtplaca_KeyPress(KeyAscii As Integer)
   KeyAscii = GBloqueaCaracter(KeyAscii)
   If KeyAscii = 13 Or KeyAscii = vbKeyDown Then
      'Verificar si la Placa Existe para el Cliente
      If MobjVentascombustible.VerificarPlacadeCliente(f_ventascstore.TXT_IDCLIENTE.Text, txtplaca.Text) = True Then
          txtkilometraje.SetFocus
      Else
          MsgBox "Número de Placa no esiste para este Cliente", vbDefaultButton1 + vbExclamation, "Advertencia"
          Exit Sub
      End If
   End If
   
End Sub


