VERSION 5.00
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "MiControl.ocx"
Begin VB.Form FEditarCtrlFuel2 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Edicion de Registro de Combustible"
   ClientHeight    =   4110
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6615
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4110
   ScaleWidth      =   6615
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtObs 
      Height          =   285
      Left            =   1260
      TabIndex        =   9
      Top             =   3060
      Width           =   5010
   End
   Begin MiControl.CtrlNumber ctnPorcentaje 
      Height          =   330
      Left            =   4455
      TabIndex        =   8
      Top             =   2655
      Width           =   1140
      _ExtentX        =   2011
      _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 MiControl.CtrlNumber ctnFisico 
      Height          =   375
      Left            =   4455
      TabIndex        =   6
      Top             =   2070
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   661
      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 ctnValor 
      Height          =   375
      Left            =   1260
      TabIndex        =   5
      Top             =   2070
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   661
      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 ctnSalidas 
      Height          =   375
      Left            =   4455
      TabIndex        =   2
      Top             =   1350
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   661
      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 ctnIngresos 
      Height          =   285
      Left            =   1260
      TabIndex        =   1
      Top             =   1350
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   503
      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 ctnInicial 
      Height          =   285
      Left            =   1260
      TabIndex        =   0
      Top             =   945
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   503
      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 cmdDescartar 
      Caption         =   "&Descartar"
      Height          =   330
      Left            =   4830
      TabIndex        =   11
      Top             =   3645
      Width           =   1335
   End
   Begin VB.CommandButton cmdAceptar 
      Caption         =   "&Aceptar"
      Height          =   330
      Left            =   3510
      TabIndex        =   10
      Top             =   3645
      Width           =   1335
   End
   Begin MiControl.CtrlNumber ctnVenta 
      Height          =   285
      Left            =   1260
      TabIndex        =   3
      Top             =   1710
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   503
      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 ctnTeorico 
      Height          =   330
      Left            =   4455
      TabIndex        =   4
      Top             =   1710
      Width           =   1815
      _ExtentX        =   3201
      _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 MiControl.CtrlNumber ctnDiferencia 
      Height          =   255
      Left            =   1260
      TabIndex        =   7
      Top             =   2700
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   450
      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.Shape Shape1 
      Height          =   3300
      Left            =   90
      Top             =   225
      Width           =   6405
   End
   Begin VB.Label lblObs 
      Caption         =   "Observación"
      Height          =   285
      Left            =   270
      TabIndex        =   25
      Top             =   3060
      Width           =   960
   End
   Begin VB.Label Label2 
      Caption         =   "% Diferen."
      Height          =   330
      Left            =   3690
      TabIndex        =   24
      Top             =   2700
      Width           =   780
   End
   Begin VB.Label lblFisico 
      Caption         =   "Fisico"
      Height          =   240
      Left            =   3735
      TabIndex        =   23
      Top             =   2160
      Width           =   645
   End
   Begin VB.Label lblAforo 
      Caption         =   "Aforo"
      Height          =   240
      Left            =   315
      TabIndex        =   22
      Top             =   2070
      Width           =   735
   End
   Begin VB.Label lblUnidad 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2970
      TabIndex        =   21
      Top             =   2115
      Width           =   420
   End
   Begin VB.Label lblSalida 
      Caption         =   "Salida"
      Height          =   240
      Left            =   3735
      TabIndex        =   20
      Top             =   1350
      Width           =   600
   End
   Begin VB.Label lblIngreso 
      Caption         =   "Ingreso"
      Height          =   285
      Left            =   315
      TabIndex        =   19
      Top             =   1305
      Width           =   780
   End
   Begin VB.Label Label1 
      Caption         =   "Inicial"
      Height          =   285
      Left            =   315
      TabIndex        =   18
      Top             =   945
      Width           =   915
   End
   Begin VB.Label lblTeorico 
      Caption         =   "Teórico"
      Height          =   285
      Left            =   3735
      TabIndex        =   17
      Top             =   1755
      Width           =   600
   End
   Begin VB.Label lblVenta 
      Caption         =   "Venta"
      Height          =   285
      Left            =   315
      TabIndex        =   16
      Top             =   1710
      Width           =   735
   End
   Begin VB.Label lblCodigo 
      Caption         =   "Articulo"
      Height          =   240
      Left            =   360
      TabIndex        =   15
      Top             =   405
      Width           =   600
   End
   Begin VB.Label lblCod 
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1260
      TabIndex        =   14
      Top             =   360
      Width           =   1095
   End
   Begin VB.Label lblDescripcion 
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   2430
      TabIndex        =   13
      Top             =   360
      Width           =   3210
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   5760
      Picture         =   "FEditarCtrlFuel2.frx":0000
      Top             =   225
      Width           =   480
   End
   Begin VB.Label lblDiferencia 
      Caption         =   "Diferencia"
      Height          =   240
      Left            =   270
      TabIndex        =   12
      Top             =   2700
      Width           =   870
   End
End
Attribute VB_Name = "FEditarCtrlFuel2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Programador: Edgar Cancho Ruiz
' Empresa Texaco
' EDICION DE CONTROL DE STOCK - COMBUSTIBLE

Public MlngCorrelativo As Long
Public MblnAgregando As Boolean

Public MstrCodAlmacen As String
Public MdatFecha As Date
Public MstrCodArticulo As String
Public MstrDesArticulo As String
Public MdblInicial As Double
Public MdblIngresos As Double
Public MdblSalidas As Double
Public MdblVenta As Double
Public MdblTeorico As Double
Public MdblValor As Double
Public MstrCodUni As String
Public MdblFisico As Double
Public MdblDiferencia As Double
Public MdblPorcentaje As Double
Public MstrObservacion As String

Private ObjCtrlFuel As DB_OP_MANTENIMIENTOS.C_CTRLFUEL

Private Sub cmdAceptar_Click()
On Error GoTo errhandler

    ObjCtrlFuel.ActualizaTemporal2 MlngCorrelativo, MstrCodAlmacen, MdatFecha, MstrCodArticulo, GFormatodeNumero(CDbl(ctnInicial.Text), GintDecStock), _
                                   GFormatodeNumero(CDbl(ctnIngresos.Text), GintDecStock), GFormatodeNumero(CDbl(ctnSalidas.Text), GintDecStock), _
                                   GFormatodeNumero(CDbl(ctnVenta.Text), GintDecStock), GFormatodeNumero(CDbl(ctnTeorico.Text), GintDecStock), lblUnidad.Caption, _
                                   GFormatodeNumero(CDbl(ctnValor.Text), GintDecStock), GFormatodeNumero(CDbl(ctnFisico.Text), GintDecStock), _
                                   GFormatodeNumero(CDbl(ctnDiferencia.Text), GintDecStock), GFormatodeNumero(CDbl(ctnPorcentaje.Text), GintDecStock), Trim(txtObs.Text)
                                   
    
    Unload Me

    Exit Sub

errhandler:
    MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbCritical, "Advertencia"

End Sub

Private Sub cmdDescartar_Click()
Unload Me
End Sub

Private Sub ctnFisico_change()
On Error Resume Next
If Len(ctnFisico.Text) = 0 Then
    ctnFisico.Text = GFormatodeNumero(0, GintDecStock)
End If

    ctnDiferencia.Text = GFormatodeNumero(CDbl(ctnFisico.Text) - CDbl(ctnTeorico.Text), GintDecStock)
    ctnPorcentaje.Text = GFormatodeNumero(CDbl(ctnDiferencia.Text) * 100 / CDbl(ctnVenta.Text), GintDecResultado)
End Sub

Private Sub ctnFisico_GotFocus()
    ctnFisico.BackColor = GC_ColorEnfoque
End Sub

Private Sub ctnFisico_KeyPress(KeyAscii As Integer)
KeyAscii = BloqueSignoMenos(KeyAscii)
If KeyAscii = 13 Then
    txtObs.SetFocus
End If
End Sub

Private Sub ctnFisico_LostFocus()
ctnFisico.BackColor = GC_ColorDefecto
End Sub

Private Sub ctnValor_GotFocus()
ctnValor.BackColor = GC_ColorEnfoque
End Sub

Private Sub ctnValor_KeyPress(KeyAscii As Integer)
KeyAscii = BloqueSignoMenos(KeyAscii)
If KeyAscii = 13 Then
    ctnFisico.SetFocus
End If
End Sub

Private Sub ctnValor_LostFocus()
ctnValor.BackColor = GC_ColorDefecto
End Sub

Private Sub ctnVenta_change()
On Error Resume Next
If Len(ctnVenta.Text) = 0 Then
    ctnVenta.Text = GFormatodeNumero(0, GintDecStock)
End If

ctnTeorico.Text = GFormatodeNumero(CDbl(ctnInicial.Text) + CDbl(ctnIngresos.Text) - CDbl(ctnSalidas.Text) - CDbl(ctnVenta.Text), GintDecStock)
ctnDiferencia.Text = GFormatodeNumero(CDbl(ctnFisico.Text) - CDbl(ctnTeorico.Text), GintDecStock)

If CDbl(ctnVenta.Text) = 0 Then
    ctnPorcentaje.Text = GFormatodeNumero(0, GintDecResultado)
Else
    ctnPorcentaje.Text = GFormatodeNumero(CDbl(ctnDiferencia.Text) * 100 / CDbl(ctnVenta.Text), GintDecResultado)
End If

End Sub

Private Sub ctnVenta_GotFocus()
ctnVenta.BackColor = GC_ColorEnfoque
End Sub

Private Sub ctnVenta_KeyPress(KeyAscii As Integer)
KeyAscii = BloqueSignoMenos(KeyAscii)
If KeyAscii = 13 Then
    ctnValor.SetFocus
End If
End Sub

Private Sub ctnVenta_LostFocus()
ctnVenta.BackColor = GC_ColorDefecto
End Sub

Private Sub Form_Load()
    Controles
    Set ObjCtrlFuel = New DB_OP_MANTENIMIENTOS.C_CTRLFUEL
    
    lblCod.Caption = MstrCodArticulo
    lblDescripcion.Caption = MstrDesArticulo
    ctnInicial.Text = GFormatodeNumero(MdblInicial, GintDecStock)
    ctnIngresos.Text = GFormatodeNumero(MdblIngresos, GintDecStock)
    ctnSalidas.Text = GFormatodeNumero(MdblSalidas, GintDecStock)
    ctnVenta.Text = GFormatodeNumero(MdblVenta, GintDecStock)
    ctnTeorico.Text = GFormatodeNumero(MdblTeorico, GintDecStock)
    ctnValor.Text = GFormatodeNumero(MdblValor, 3)
    lblUnidad.Caption = MstrCodUni
    ctnFisico.Text = GFormatodeNumero(MdblFisico, GintDecStock)
    ctnDiferencia.Text = GFormatodeNumero(MdblDiferencia, GintDecStock)
    ctnPorcentaje.Text = GFormatodeNumero(MdblPorcentaje, GintDecResultado)
    txtObs.Text = MstrObservacion
    
    If GStrTipoControlCombustible = "0" Then  ' Está en Automático
        ctnVenta.Enabled = False
    End If
    
End Sub
 
Private Sub Controles()

  
    ctnInicial.Enteros = 7
    ctnInicial.Decimales = GintDecStock
    ctnInicial.ValorPorDefecto
    ctnInicial.Enabled = False
  
    ctnIngresos.Enteros = 7
    ctnIngresos.Decimales = GintDecStock
    ctnIngresos.ValorPorDefecto
    ctnIngresos.Enabled = False
  
    ctnSalidas.Enteros = 7
    ctnSalidas.Decimales = GintDecStock
    ctnSalidas.ValorPorDefecto
    ctnSalidas.Enabled = False
  
    ctnDiferencia.Enteros = 7
    ctnDiferencia.Decimales = GintDecStock
    ctnDiferencia.ValorPorDefecto
    ctnDiferencia.Enabled = False

    ctnPorcentaje.Enteros = 7
    ctnPorcentaje.Decimales = GintDecResultado
    ctnPorcentaje.ValorPorDefecto
    ctnPorcentaje.Enabled = False
  
    ctnTeorico.Enteros = 7
    ctnTeorico.Decimales = GintDecStock
    ctnTeorico.ValorPorDefecto
    ctnTeorico.Enabled = False

    ctnValor.Enteros = 7
    ctnValor.Decimales = 3
    ctnValor.ValorPorDefecto
    ctnValor.Enabled = True
    
    ctnVenta.Enteros = 7
    ctnVenta.Decimales = GintDecStock
    ctnVenta.ValorPorDefecto
    ctnVenta.Enabled = True

    ctnFisico.Enteros = 7
    ctnFisico.Decimales = GintDecStock
    ctnFisico.ValorPorDefecto
    ctnFisico.Enabled = True

    
End Sub

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

Private Function BloqueSignoMenos(KeyAscii As Integer) As Integer
    If KeyAscii = 45 Then
        BloqueSignoMenos = 0
    Else
        BloqueSignoMenos = KeyAscii
    End If
End Function

Private Sub txtObs_GotFocus()
txtObs.BackColor = GC_ColorEnfoque
End Sub

Private Sub txtObs_KeyPress(KeyAscii As Integer)
KeyAscii = GBloqueaCaracter(KeyAscii)
If KeyAscii = 13 Then
   cmdAceptar.SetFocus
End If
End Sub

Private Sub txtObs_LostFocus()
txtObs.BackColor = GC_ColorDefecto
End Sub
