Vous êtes sur la page 1sur 8

Private Sub cmdcalcular_Click() 'calculo del subtotal descuento recargo y total

Dim subtotal As Double


Dim descuento As Double
Dim recargo As Double
Dim total As Double

crosas = 4
cclaveles = 1.5
clilis = 2
cazucenas = 6
subtotal = 0
descuento = 0
recargo = 0
total = 0

subtotal = (Val(txtrosas) * crosas) + (Val(txtclaveles) * cclaveles) + (Val(txtlilis) * clilis) + (Val(txtazucenas) * cazucenas)


txtsubtotal = Str(Round(subtotal, 2))

If (Val(txttotalflores) <= 24) Then


recargo = subtotal * 0.025
txtrecargo = Str(Round(recargo, 2))
Else
recargo = recargo
txtrecargo = Str(Round(recargo, 2))
End If

If (optefectivo.Value = True) Or (optdebito.Value = True) Then


descuento = subtotal * 0.05
ElseIf optcredito.Value = True Then
descuento = subtotal * 0.01
ElseIf optcheque.Value = True Then
descuento = subtotal * 0.03
Else
descuento = descuento
End If

txtdescuento = Str(Round(descuento, 2))

total = subtotal + recargo - descuento


txtgrantotal = Str(Round(total, 2))

End Sub
Private Sub cmdlimpiar_Click() 'limpia todas las cacillas o inicializa el programa

optefectivo.Value = False
optcredito.Value = False
optdebito.Value = False
optcheque.Value = False
chkrosas.Value = 0
chklilis.Value = 0
chkazucena.Value = 0
chkclavel.Value = 0
txtremitente = ""
txtdestinatario = ""
txtmensaje = ""
txtrosas = ""
txtlilis = ""
txtazucenas = ""
txtclaveles = ""
txttotalflores = ""
txtsubtotal = ""
txtrecargo = ""
txtdescuento = ""
txtgrantotal = ""
frmflores.Visible = False
frmpago.Visible = False
cmdcalcular.Visible = False

End Sub

Private Sub cmdok_Click() 'aparece el tipo y cantidad de flores


frmflores.Visible = True
End Sub

Private Sub cmdokflores_Click() 'aparecer forma de pago y verificar cantidad de flores


Dim a As Integer

a=0

If (chkrosas.Value = 0) And (chkclavel.Value = 0) And (chklilis.Value = 0) And (chkazucena.Value = 0) Then


MsgBox "Seleccion las flores que desee agregar", vbCritical, "Valor Invalido"
End If

If chkrosas.Value = 1 Then
If IsNumeric(txtrosas) Then
frmpago.Visible = True
a = a + Val(txtrosas)
Else
MsgBox "Ingrese cuantas rosas desea", vbCritical, "Valor Invalido"
txtrosas = ""
txtrosas.SetFocus
End If
End If

txttotalflores = Str(a)

If chkclavel.Value = 1 Then
If IsNumeric(txtclaveles) Then
frmpago.Visible = True
a = a + Val(txtclaveles)
Else
MsgBox "Ingrese cuantos claveles desea", vbCritical, "Valor Invalido"
txtclaveles = ""
txtclaveles.SetFocus
End If
End If

txttotalflores = Str(a)

If chklilis.Value = 1 Then
If IsNumeric(txtlilis) Then
frmpago.Visible = True
a = a + Val(txtlilis)
Else
MsgBox "Ingrese cuantos lilis desea", vbCritical, "Valor Invalido"
txtlilis = ""
txtlilis.SetFocus
End If
End If
txttotalflores = Str(a)

If chkazucena.Value = 1 Then
If IsNumeric(txtazucenas) Then
frmpago.Visible = True
a = a + Val(txtazucenas)
Else
MsgBox "Ingrese cuantas azucenas desea", vbCritical, "Valor Invalido"
txtazucenas = ""
txtazucenas.SetFocus
End If
End If

txttotalflores = Str(a)

End Sub
Private Sub cmdsalir_Click() 'finaliza el programa
End
End Sub

Private Sub chkazucena_Click() 'selecciona el tipo y cantidad de azucenas y da el total


If chkazucena.Value = 1 Then
txtazucenas.Visible = True
txtazucenas.SetFocus
Else
txtazucenas = ""
txtazucenas.Visible = False
End If
End Sub

Private Sub chkclavel_Click() 'selecciona el tipo y cantidad de claveles y da el total


If chkclavel.Value = 1 Then
txtclaveles.Visible = True
txtclaveles.SetFocus
Else
txtclaveles = ""
txtclaveles.Visible = False
End If
End Sub

Private Sub chklilis_Click() 'selecciona el tipo y cantidad de lilis y da el total


If chklilis.Value = 1 Then
txtlilis.Visible = True
txtlilis.SetFocus
Else
txtlilis = ""
txtlilis.Visible = False
End If
End Sub

Private Sub chkrosas_Click() 'selecciona el tipo y cantidad de rosas y da el total


If chkrosas.Value = 1 Then
txtrosas.Visible = True
txtrosas.SetFocus
Else
txtrosas = ""
txtrosas.Visible = False
End If
End Sub

Private Sub optcredito_Click() 'aparecer boton calcular si esta selecciona una forma de pago
cmdcalcular.Visible = True
End Sub

Private Sub optcheque_Click() 'aparecer boton calcular si esta selecciona una forma de pago
cmdcalcular.Visible = True
End Sub

Private Sub optdebito_Click() 'aparecer boton calcular si esta selecciona una forma de pago
cmdcalcular.Visible = True
End Sub

Private Sub optefectivo_Click() 'aparecer boton calcular si esta selecciona una forma de pago
cmdcalcular.Visible = True
End Sub

Vous aimerez peut-être aussi