VERSION 5.00
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "MiControl.ocx"
Begin VB.Form fcstorevuelto 
   Caption         =   "Vuelto"
   ClientHeight    =   2160
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5130
   LinkTopic       =   "Form1"
   ScaleHeight     =   2160
   ScaleWidth      =   5130
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame2 
      Caption         =   "Efectivo"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1155
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   4875
      Begin VB.TextBox txt_tc 
         Alignment       =   1  'Right Justify
         Enabled         =   0   'False
         Height          =   320
         Left            =   3780
         TabIndex        =   3
         TabStop         =   0   'False
         Top             =   240
         Width           =   855
      End
      Begin MiControl.CtrlNumber txt_edolares 
         Height          =   390
         Left            =   1320
         TabIndex        =   4
         Top             =   180
         Width           =   1695
         _ExtentX        =   2990
         _ExtentY        =   688
         BackColor       =   -2147483643
         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
      End
      Begin MiControl.CtrlNumber txt_esoles 
         Height          =   390
         Left            =   1320
         TabIndex        =   5
         Top             =   600
         Width           =   1695
         _ExtentX        =   2990
         _ExtentY        =   688
         BackColor       =   -2147483643
         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
      End
      Begin VB.Label lbl_pen 
         Caption         =   "S/."
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   1020
         TabIndex        =   8
         Top             =   600
         Width           =   255
      End
      Begin VB.Label lbl_usd 
         Caption         =   "$"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   1200
         TabIndex        =   7
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label3 
         Caption         =   "T.C.:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3240
         TabIndex        =   6
         Top             =   240
         Width           =   495
      End
   End
   Begin VB.CommandButton cmdcancelar 
      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          =   795
      Left            =   2820
      Picture         =   "fcstorevuelto.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1320
      Width           =   1575
   End
   Begin VB.CommandButton cmdaceptar 
      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          =   795
      Left            =   480
      Picture         =   "fcstorevuelto.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   0
      Tag             =   "R ASDASD"
      Top             =   1320
      Width           =   1575
   End
End
Attribute VB_Name = "fcstorevuelto"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim gdbl_vueltooriginal As Double
Dim gstr_monedaorignal As String
Dim mobj_cventasgen As DB_OP_FACTURACION.C_VENTASGENERAL

Private Sub cmdAceptar_Click()
f_ventascstore.LDblTOTRETURNEDPEN = Val(txt_esoles.Text)
f_ventascstore.LDblTOTRETURNEDUSD = Val(txt_edolares.Text)
    
gbln_ventaefectuada = True
Unload Me
End Sub



Private Sub cmdCancelar_Click()
gbln_ventaefectuada = False
Unload Me
End Sub

Private Sub Form_Activate()
    
If Val(txt_edolares.Text) > 0 Then
    gdbl_vueltooriginal = Val(txt_edolares.Text)
    gstr_monedaorignal = GstrMonedaExtranjera
    txt_edolares.SetFocus
    txt_esoles.Enabled = False
Else
    gdbl_vueltooriginal = Val(txt_esoles.Text)
    gstr_monedaorignal = GstrCodMonedaBase
    txt_esoles.SetFocus
    txt_edolares.Enabled = False
End If
End Sub

Private Sub Form_Load()
Set mobj_cventasgen = New DB_OP_FACTURACION.C_VENTASGENERAL

txt_esoles.Enteros = 10
txt_esoles.PermitirNegativos = False
txt_esoles.Decimales = GintDecPrecio
txt_esoles.Text = 0
txt_edolares.Enteros = 10
txt_edolares.PermitirNegativos = False
txt_edolares.Decimales = GintDecPrecio
txt_edolares.Text = 0
End Sub

Private Sub txt_edolares_GotFocus()
txt_edolares.BackColor = vbCyan
End Sub

Private Sub txt_edolares_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If gdbl_vueltooriginal < Val(txt_edolares.Text) Then
            MsgBox "Monto Excede el vuelto original ", vbExclamation, "Dato Mal Ingresado"
            Exit Sub
        End If
    Call CALCULOVUELTOPEN
    End If
End Sub
Private Sub txt_edolares_Validate(Cancel As Boolean)
    Call CALCULOVUELTOPEN
End Sub
Sub CALCULOVUELTOUSD()
Dim ldbl_vueltousd As Double
ldbl_vueltousd = gdbl_vueltooriginal - Val(txt_esoles.Text)
If ldbl_vueltousd > 0 Then
    txt_edolares.Text = mobj_cventasgen.ConvertirMoneda(ldbl_vueltousd, GstrCodMonedaBase, GstrMonedaExtranjera, GDatFechaProcesoVentas, GstrTipoCambioVentas, GintDecPrecio)
Else
    txt_edolares.Text = "0"
End If
cmdaceptar.SetFocus
End Sub
Sub CALCULOVUELTOPEN()
Dim ldbl_vueltopen As Double
ldbl_vueltopen = gdbl_vueltooriginal - Val(txt_edolares.Text)
If ldbl_vueltopen > 0 Then
    txt_esoles.Text = mobj_cventasgen.ConvertirMoneda(ldbl_vueltopen, GstrMonedaExtranjera, GstrCodMonedaBase, GDatFechaProcesoVentas, GstrTipoCambioVentas, GintDecPrecio)
Else
    txt_esoles.Text = "0"
End If
cmdaceptar.SetFocus
End Sub
Private Sub txt_esoles_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If gdbl_vueltooriginal < Val(txt_esoles.Text) Then
            MsgBox "Monto Excede el vuelto original ", vbExclamation, "Dato Mal Ingresado"
            Exit Sub
     End If
    Call CALCULOVUELTOUSD
    End If
End Sub
Private Sub txt_esoles_Validate(Cancel As Boolean)
Call CALCULOVUELTOUSD
End Sub
