VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "ControlNumber.ocx"
Begin VB.Form F_fondocaja 
   Caption         =   "Fondo Caja"
   ClientHeight    =   3075
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4935
   LinkTopic       =   "Form1"
   ScaleHeight     =   3075
   ScaleWidth      =   4935
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton CMD_ACEPTAR 
      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          =   855
      Left            =   240
      Picture         =   "F_fondocaja.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   3
      Tag             =   "R ASDASD"
      Top             =   2100
      Width           =   1815
   End
   Begin VB.CommandButton CMD_CANCELAR 
      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          =   855
      Left            =   2880
      Picture         =   "F_fondocaja.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   2100
      Width           =   1935
   End
   Begin MSDataListLib.DataCombo dtc_vendedor 
      Height          =   480
      Left            =   1620
      TabIndex        =   0
      Top             =   180
      Width           =   3255
      _ExtentX        =   5741
      _ExtentY        =   847
      _Version        =   393216
      Style           =   2
      Text            =   ""
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSDataListLib.DataCombo DTC_MONEDA 
      BeginProperty DataFormat 
         Type            =   0
         Format          =   """S/."" #,##0.00"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   10250
         SubFormatType   =   0
      EndProperty
      Height          =   480
      Left            =   1620
      TabIndex        =   4
      Top             =   780
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   847
      _Version        =   393216
      IntegralHeight  =   0   'False
      MatchEntry      =   -1  'True
      Style           =   2
      Text            =   ""
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MiControl.CtrlNumber ctn_monto 
      Height          =   525
      Left            =   1620
      TabIndex        =   5
      Top             =   1380
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   926
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      AutoSize        =   -1  'True
      Caption         =   "Monto:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   720
      TabIndex        =   7
      Top             =   1440
      Width           =   870
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      AutoSize        =   -1  'True
      Caption         =   "Moneda:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   480
      TabIndex        =   6
      Top             =   840
      Width           =   1125
   End
   Begin VB.Label Label8 
      Alignment       =   1  'Right Justify
      AutoSize        =   -1  'True
      Caption         =   "Vendedor:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   1350
   End
End
Attribute VB_Name = "F_fondocaja"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public mobj_cventasgen As DB_OP_FACTURACION.C_VENTASGENERAL
Private Sub CMD_ACEPTAR_Click()

Dim dat_DATEPROCE As Date
Dim str_SALESPOINT As String
Dim str_SALESPERID As String
Dim dat_DATEDOC As Date
Dim str_CURYID As String
Dim dou_TOTALPEN As Double
Dim dou_TOTALUSD As Double
Dim dou_TOTAL As Double
Dim str_DATEPROCESALES  As String

If Val(ctn_monto.Text) <= 0 Then
    MsgBox "Debe Ingresar un Monto", vbExclamation, "Atencion"
    ctn_monto.SetFocus
    Exit Sub
End If

str_SALESPERID = dtc_vendedor.BoundText
dat_DATEPROCE = GDatFechaProcesoVentas
'dat_DATEDOC = CStr(DateTime.Date) + " " + CStr(DateTime.Time) mal solo se  recibe fecha corta
dat_DATEDOC = CStr(DateTime.Date)

str_SALESPOINT = GstrPuntodeVenta
str_CURYID = DTC_MONEDA.BoundText
str_DATEPROCESALES = CStr(GDatFechaProceso)

If str_CURYID = GstrCodMonedaBase Then
    dou_TOTALPEN = Val(ctn_monto.Text)
    dou_TOTALUSD = mobj_cventasgen.ConvertirMoneda(dou_TOTALPEN, GstrCodMonedaBase, GstrMonedaExtranjera, str_DATEPROCESALES, GstrTipoCambioVentas, GintDecResultado)
    dou_TOTAL = dou_TOTALPEN
Else
    dou_TOTALUSD = Val(ctn_monto.Text)
    dou_TOTALPEN = mobj_cventasgen.ConvertirMoneda(dou_TOTALUSD, GstrMonedaExtranjera, GstrCodMonedaBase, str_DATEPROCESALES, GstrTipoCambioVentas, GintDecResultado)
    dou_TOTAL = dou_TOTALUSD
End If

mobj_cventasgen.grabar_fondocaja dat_DATEPROCE, str_SALESPOINT, str_SALESPERID, _
                                 dat_DATEDOC, str_CURYID, dou_TOTALPEN, dou_TOTALPEN
                            
'Call Imprimir_Ticketfondocaja(CStr(dat_DATEPROCE), str_SALESPOINT, dtc_vendedor.Text, _
                                 dat_DATEDOC, DTC_MONEDA.Text, dou_TOTAL, 40)

Unload Me
End Sub

Private Sub cmd_Cancelar_Click()
Unload Me
End Sub


Private Sub ctn_monto_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = vbKeyDown Then
    CMD_ACEPTAR.SetFocus
End If
End Sub

Private Sub DTC_MONEDA_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = vbKeyDown Then
    ctn_monto.SetFocus
    KeyCode = 0
End If
End Sub


Private Sub dtc_vendedor_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = vbKeyDown Then
    DTC_MONEDA.SetFocus
    KeyCode = 0
End If
End Sub

Private Sub Form_Load()
    Set mobj_cventasgen = New DB_OP_FACTURACION.C_VENTASGENERAL
    
    Call CargaDataCombo(dtc_vendedor, mobj_cventasgen.ListarvendedorAyuda, "SALESPERID", "SALESPERNAME")
    Call CargaDataCombo(DTC_MONEDA, mobj_cventasgen.ListarmonedaAyuda, "CURYID", "DESCR")
    DTC_MONEDA.BoundText = GstrCodMonedaBase
    ctn_monto.Enteros = 9
    ctn_monto.PermitirNegativos = False
    ctn_monto.Decimales = 2
    dtc_vendedor.BoundText = Trim(GstrCodigoVENDEDOR) + Space(20 - Len(Trim(GstrCodigoVENDEDOR)))
End Sub
