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 FFaltantesSobrantesItem 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   2895
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6480
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2895
   ScaleWidth      =   6480
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdcancelar 
      Caption         =   "&Descartar"
      Height          =   570
      Left            =   4995
      Picture         =   "FFaltantesSobrantesItem.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   2205
      Width           =   1260
   End
   Begin VB.CommandButton cmdaceptar 
      Caption         =   "&Grabar"
      Height          =   570
      Left            =   3645
      Picture         =   "FFaltantesSobrantesItem.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   2205
      Width           =   1335
   End
   Begin VB.TextBox txtObservacion 
      Height          =   285
      Left            =   1395
      TabIndex        =   5
      Top             =   1710
      Width           =   4785
   End
   Begin MiControl.CtrlNumber ctnTotalMonto 
      Height          =   330
      Left            =   1395
      TabIndex        =   4
      Top             =   1260
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   582
      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.CommandButton cmdBusFaltaSobra 
      Height          =   375
      Left            =   4455
      MouseIcon       =   "FFaltantesSobrantesItem.frx":083C
      MousePointer    =   99  'Custom
      Picture         =   "FFaltantesSobrantesItem.frx":098E
      Style           =   1  'Graphical
      TabIndex        =   3
      ToolTipText     =   "Buscar Vendedor"
      Top             =   810
      Visible         =   0   'False
      Width           =   375
   End
   Begin MSDataListLib.DataCombo dtcFaltaSobra 
      Height          =   315
      Left            =   1395
      TabIndex        =   2
      Top             =   765
      Width           =   2985
      _ExtentX        =   5265
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin VB.CommandButton cmdBusVendedor 
      Height          =   375
      Left            =   4455
      MouseIcon       =   "FFaltantesSobrantesItem.frx":0EC0
      MousePointer    =   99  'Custom
      Picture         =   "FFaltantesSobrantesItem.frx":1012
      Style           =   1  'Graphical
      TabIndex        =   1
      ToolTipText     =   "Buscar Vendedor"
      Top             =   315
      Visible         =   0   'False
      Width           =   375
   End
   Begin MSDataListLib.DataCombo dtcVendedor 
      Height          =   315
      Left            =   1395
      TabIndex        =   0
      Top             =   315
      Width           =   2970
      _ExtentX        =   5239
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin VB.Image Image1 
      Height          =   510
      Left            =   5670
      Picture         =   "FFaltantesSobrantesItem.frx":1544
      Stretch         =   -1  'True
      Top             =   270
      Width           =   465
   End
   Begin VB.Label Label2 
      Caption         =   "Observación"
      Height          =   240
      Left            =   270
      TabIndex        =   11
      Top             =   1755
      Width           =   1050
   End
   Begin VB.Shape Shape1 
      Height          =   1995
      Left            =   180
      Top             =   135
      Width           =   6135
   End
   Begin VB.Label lblMonto 
      Caption         =   "Total Monto"
      Height          =   330
      Left            =   270
      TabIndex        =   10
      Top             =   1305
      Width           =   1005
   End
   Begin VB.Label Label1 
      Caption         =   "Tipo de Movimiento"
      Height          =   465
      Left            =   270
      TabIndex        =   9
      Top             =   720
      Width           =   915
   End
   Begin VB.Label lblVendecor 
      AutoSize        =   -1  'True
      Caption         =   "Vendedor"
      Height          =   195
      Left            =   315
      TabIndex        =   8
      Top             =   315
      Width           =   690
   End
End
Attribute VB_Name = "FFaltantesSobrantesItem"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Programador: Edgar Cancho Ruiz
' Empresa Texaco
' Registro de Faltantes-Sobrantes

Public MlngCorrelativo As Long
Public MstrCodAlmacen As String
Public MstrCodMoneda As String
Public MdatFecha As Date
Public MstrCodVendedor As String
Public MstrCodFaltaSobra As String
Public MdblMonto As Double
Public MstrObservacion As String

Public MblnModificando As Boolean

' Variables para las ayudas
Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As String
Public GrecibeColumnaOpcional2 As String
Public GrecibeColumnaOpcional3 As String
'*************************************

Public objVendedor As DB_OP_MANTENIMIENTOS.C_VENDEDOR
Public ObjFaltaSobra As DB_OP_MANTENIMIENTOS.C_FALTA_SOBRA

Private Sub cmdAceptar_Click()
On Error GoTo errhandler
    
    If Not MblnModificando Then
        ObjFaltaSobra.AgregaEnTemporal MlngCorrelativo, MstrCodAlmacen, MstrCodMoneda, MdatFecha, _
                                        dtcVendedor.BoundText, dtcFaltaSobra.BoundText, CDbl(ctnTotalMonto.Text), _
                                        Trim(txtObservacion.Text), GstrTipoCambioVentas, GstrCodMonedaBase, GstrMonedaExtranjeraModgen, GintDecResultado
    Else
        ObjFaltaSobra.ActualizaEnTemporal MlngCorrelativo, MstrCodAlmacen, MstrCodMoneda, MdatFecha, _
                                        dtcVendedor.BoundText, dtcFaltaSobra.BoundText, CDbl(ctnTotalMonto.Text), _
                                        Trim(txtObservacion.Text), GstrTipoCambioVentas, GstrCodMonedaBase, GstrMonedaExtranjeraModgen, GintDecResultado
    
    End If
   Unload Me
Exit Sub
errhandler:
    MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbCritical, "Error"
     
End Sub

Private Sub cmdBusFaltaSobra_Click()
    'Lineas que llaman al Formulario de Búsqueda
    
    Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
    ArrayBusqueda(1, 1) = "CCSALESPERSONTYPEID"
    ArrayBusqueda(1, 2) = "Código "
    ArrayBusqueda(1, 3) = 1500
    ArrayBusqueda(2, 1) = "DESCRCCSALESPERSONTYPE"
    ArrayBusqueda(2, 2) = "Descripción "
    ArrayBusqueda(2, 3) = 4000
      
    FBusquedasVta.GObtenerRegistros ObjFaltaSobra.ListarTipoCCVendedor, ArrayBusqueda, 2, 2
    FBusquedasVta.Show vbModal
    
    If GrecibeUbicacion <> 0 Then
        dtcFaltaSobra.BoundText = GrecibeColumnaID
    End If
End Sub

Private Sub cmdBusVendedor_Click()
    'Lineas que llaman al Formulario de Búsqueda
    
    Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
    ArrayBusqueda(1, 1) = "SALESPERID"
    ArrayBusqueda(1, 2) = "Código "
    ArrayBusqueda(1, 3) = 1500
    ArrayBusqueda(2, 1) = "SALESPERNAME"
    ArrayBusqueda(2, 2) = "Nombre "
    ArrayBusqueda(2, 3) = 4000
      
    FBusquedasVta.GObtenerRegistros objVendedor.ListarVendedoresAyuda, ArrayBusqueda, 2, 2
    FBusquedasVta.Show vbModal
    
    If GrecibeUbicacion <> 0 Then
        dtcVendedor.BoundText = GrecibeColumnaID
    End If
End Sub

Private Sub cmdcancelar_Click()
Unload Me
End Sub

Private Sub ctnTotalMonto_GotFocus()
ctnTotalMonto.BackColor = GC_ColorEnfoque
End Sub

Private Sub ctnTotalMonto_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtObservacion.SetFocus
    End If
End Sub

Private Sub ctnTotalMonto_LostFocus()
ctnTotalMonto.BackColor = GC_ColorDefecto
End Sub

Private Sub dtcFaltaSobra_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF2 Then cmdBusFaltaSobra_Click
End Sub

Private Sub dtcFaltaSobra_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        ctnTotalMonto.SetFocus
    End If
End Sub

Private Sub dtcVendedor_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF2 Then cmdBusVendedor_Click
End Sub

Private Sub dtcVendedor_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        dtcFaltaSobra.SetFocus
    End If
End Sub

Private Sub Form_Load()
    
    KeyPreview = True
    
    Set objVendedor = New DB_OP_MANTENIMIENTOS.C_VENDEDOR
    Set ObjFaltaSobra = New DB_OP_MANTENIMIENTOS.C_FALTA_SOBRA
    
    ctnTotalMonto.Enteros = 7
    ctnTotalMonto.Decimales = GintDecResultado
    
    Call CargaDataCombo(dtcVendedor, objVendedor.ListarVendedoresAyuda, "SALESPERID", "SALESPERNAME")
    Call CargaDataCombo(dtcFaltaSobra, ObjFaltaSobra.ListarTipoCCVendedor, "CCSALESPERSONTYPEID", "DESCRCCSALESPERSONTYPE")
    
    If MblnModificando Then
        dtcVendedor.BoundText = MstrCodVendedor
        dtcFaltaSobra.BoundText = MstrCodFaltaSobra
        ctnTotalMonto.Text = GFormatodeNumero(MdblMonto, GintDecResultado)
        txtObservacion.Text = MstrObservacion
        Habilita False
    Else
        Habilita True
    End If
    
End Sub

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


Private Sub txtObservacion_GotFocus()
txtObservacion.BackColor = GC_ColorEnfoque
End Sub

Private Sub txtObservacion_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        cmdaceptar.SetFocus
    End If
End Sub

Private Sub Habilita(valor As Boolean)
    dtcVendedor.Enabled = valor
    cmdBusVendedor.Enabled = valor
    dtcFaltaSobra.Enabled = valor
    cmdBusFaltaSobra.Enabled = valor
End Sub

Private Sub txtObservacion_LostFocus()
txtObservacion.BackColor = GC_ColorDefecto
End Sub
