VERSION 5.00
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "MiControl.ocx"
Begin VB.Form frmDescuentos 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Descuentos"
   ClientHeight    =   3165
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6210
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3165
   ScaleWidth      =   6210
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin MiControl.CtrlNumber ctnDes1 
      Height          =   375
      Left            =   4200
      TabIndex        =   12
      Top             =   240
      Width           =   1695
      _ExtentX        =   2990
      _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 VB.CommandButton cmdCancelar 
      Caption         =   "Cancelar"
      Height          =   375
      Left            =   4710
      TabIndex        =   2
      Top             =   2715
      Width           =   1335
   End
   Begin VB.CommandButton cmdAceptar 
      Caption         =   "Aceptar"
      Enabled         =   0   'False
      Height          =   375
      Left            =   3270
      TabIndex        =   1
      Top             =   2715
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "Descuento en"
      Height          =   1215
      Left            =   150
      TabIndex        =   0
      Top             =   75
      Width           =   2535
      Begin VB.OptionButton optMonto 
         Caption         =   "Monto"
         Height          =   255
         Left            =   360
         TabIndex        =   7
         Top             =   750
         Width           =   1335
      End
      Begin VB.OptionButton optPorcentaje 
         Caption         =   "Porcentaje"
         Height          =   255
         Left            =   360
         TabIndex        =   6
         Top             =   340
         Value           =   -1  'True
         Width           =   1335
      End
   End
   Begin MiControl.CtrlNumber ctnDes2 
      Height          =   375
      Left            =   4200
      TabIndex        =   13
      Top             =   600
      Width           =   1695
      _ExtentX        =   2990
      _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 ctnDes3 
      Height          =   375
      Left            =   4200
      TabIndex        =   14
      Top             =   960
      Width           =   1695
      _ExtentX        =   2990
      _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 VB.Label lblTotAct 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   300
      Left            =   4230
      TabIndex        =   11
      Top             =   1770
      Width           =   1815
   End
   Begin VB.Label lblApliTot 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   300
      Left            =   4230
      TabIndex        =   10
      Top             =   1410
      Width           =   1815
   End
   Begin VB.Line Line2 
      BorderColor     =   &H80000005&
      X1              =   150
      X2              =   6045
      Y1              =   2475
      Y2              =   2475
   End
   Begin VB.Line Line1 
      X1              =   150
      X2              =   6045
      Y1              =   2490
      Y2              =   2490
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "Total Actual"
      Height          =   195
      Left            =   2910
      TabIndex        =   9
      Top             =   1823
      Width           =   855
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "Aplicado al Total"
      Height          =   195
      Left            =   2910
      TabIndex        =   8
      Top             =   1463
      Width           =   1185
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "Descuento 3"
      Height          =   195
      Left            =   2910
      TabIndex        =   5
      Top             =   975
      Width           =   915
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "Descuento 2"
      Height          =   195
      Left            =   2910
      TabIndex        =   4
      Top             =   615
      Width           =   915
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Descuento 1"
      Height          =   195
      Left            =   2910
      TabIndex        =   3
      Top             =   255
      Width           =   915
   End
End
Attribute VB_Name = "frmDescuentos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Public Sub cmdAceptar_Click()
    'Grbando los cambios de descuentos
    montDescItem1PORC = ctnDes1.Text
    Call FDatosClientCombust.ActualizarCredito
    Unload Me
End Sub





Private Sub cmdCancelar_Click()
    Unload Me
End Sub


Public Sub ctnDes1_change()
    'Descontando por item
    Dim ntot As Double
    On Error Resume Next
    If descuentoItem = True Then
        If TipoDescuento = 1 Then                       'Porcentaje
            If Val(ctnDes1.Text) <> 0 Then
                ntot = Round(CDbl(FDatosClientCombust.dbdocumencliente.Columns(7).Text) - _
                                        (CDbl(FDatosClientCombust.dbdocumencliente.Columns(7).Text) * CDbl(ctnDes1.Text) / 100), GintDecResultado)
                lblApliTot.Caption = Format(ntot, GMascara(GintDecResultado))
            End If
        ElseIf TipoDescuento = 2 Then                   'Monto
                ntot = Round(CDbl(FDatosClientCombust.dbdocumencliente.Columns(7).Text) - CDbl(ctnDes1.Text), GintDecResultado)
                lblApliTot.Caption = Format(ntot, GMascara(GintDecResultado))
        End If
    End If
    If descuentoAdicional = True Then
    End If
End Sub

Public Sub ctnDes1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If Val(ctnDes1.Text) <> 0 Then
            cmdAceptar.Enabled = True
'            'cmdAceptar.SetFocus
            ctnDes2.Enabled = True
            On Error Resume Next
            ctnDes2.SetFocus
        End If
    End If
End Sub


Public Sub ctnDes1_LostFocus()
        If Val(ctnDes1.Text) <> 0 Then
            cmdAceptar.Enabled = True
            'cmdAceptar.SetFocus
            ctnDes2.Enabled = True
            ctnDes2.SetFocus
        End If
End Sub


Private Sub ctnDes2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
       If Val(ctnDes2.Text) <> 0 Then
          If ctnDes3.Visible = True Then
            ctnDes3.Enabled = True
            ctnDes3.SetFocus
          End If
       End If
    End If
End Sub


Private Sub ctnDes2_LostFocus()
    If Val(ctnDes1.Text) = 0 Then
       MsgBox "Ingrese el Descuento 1", vbInformation, "Descuentos"
       Exit Sub
    End If

End Sub


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


Public Sub Form_Load()
'Configurando el formato numerico de los descuentos
    ctnDes1.PermitirNegativos = False
    ctnDes1.Enteros = 9
    ctnDes1.Decimales = 3
    ctnDes1.ValorPorDefecto
    
    ctnDes2.PermitirNegativos = False
    ctnDes2.Enteros = 9
    ctnDes2.Decimales = 3
    ctnDes2.ValorPorDefecto
    
    ctnDes3.PermitirNegativos = False
    ctnDes3.Enteros = 9
    ctnDes3.Decimales = 3
    ctnDes3.ValorPorDefecto
    
    ctnDes2.Enabled = False
    ctnDes3.Enabled = False
    
    TipoDescuento = 1    'Descuento por porcentaje por default
End Sub


Private Sub optMonto_Click()
    'Decuento al monto
    TipoDescuento = 2
End Sub

Public Sub optPorcentaje_Click()
    TipoDescuento = 1    'Descuento porcentaje
End Sub


