0% found this document useful (0 votes)
55 views5 pages

Problema 2-Visual Basic 6.0

The document contains code for a form that allows users to add items to lists by clicking a button. It includes code to populate dropdowns, calculate discounts and totals, and clear or summarize the form data. When the calculate button is clicked, it determines discounts and totals based on payment date and category. Another button click clears all form fields and lists, while another button click summarizes totals from the lists for small businesses.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views5 pages

Problema 2-Visual Basic 6.0

The document contains code for a form that allows users to add items to lists by clicking a button. It includes code to populate dropdowns, calculate discounts and totals, and clear or summarize the form data. When the calculate button is clicked, it determines discounts and totals based on payment date and category. Another button click clears all form fields and lists, while another button click summarizes totals from the lists for small businesses.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Diego Armando Mendoza Vicente 2005-12140

Sección: Q

PROBLEMA 2

Private Sub CmdAgregar_Click()

LstNit.AddItem TxtNit
LstDPago.AddItem TxtDPago
LstCPago.AddItem TxtCPago
LstCategoria.AddItem CmbCategoria.Text
LstDescuento.AddItem TxtD1
LstRecargo.AddItem TxtR
LstSubtotal.AddItem TxtSub
LstDPE.AddItem TxtDPE
LstTotal.AddItem TxtTotal

If Opt1 = True Then


LstRegi.AddItem "1"
ElseIf Opt2 = True Then
LstRegi.AddItem "2"
ElseIf Opt3 = True Then
LstRegi.AddItem "3"
End If

If ChkE.Value = 1 Then

LstE.AddItem (((Val(TxtEP)) * (Val(TxtTotal)) / 100))


Else
LstE.AddItem "0"
End If

If ChkCC.Value = 1 Then
LstC.AddItem (((Val(TxtCP)) * (Val(TxtTotal)) / 100))
Else
LstC.AddItem "0"
End If

If ChkBE.Value = 1 Then
LstBE.AddItem (((Val(TxtBE)) * (Val(TxtTotal)) / 100))
Else
LstBE.AddItem "0"
End If
End Sub

Private Sub CmdEvaluar_Click()


Dim i As Integer
Dim EF As Double
Dim CH As Double
Dim BE As Double

EF = 0
CH = 0
BE = 0

For i = 0 To LstCategoria.ListCount - 1
If LstCategoria.List(i) = "Pequeña Empresa" And LstRegi.List(i) = "1" Then
EF = EF + LstE.List(i)
CH = CH + LstC.List(i)
BE = BE + LstBE.List(i)
Else
EF = 0
CH = 0
BE = 0
End If
Next i

TxtEfectivo = Str(EF)
TxtCheque = Str(CH)
TxtBanca = Str(BE)

End Sub

Private Sub Form_Load()

CmbCategoria.AddItem "Contribuyente Individual"


CmbCategoria.AddItem "Pequeña Empresa"
CmbCategoria.AddItem "Empresa"

End Sub

Private Sub MnuCalcular_Click()


Dim Dia As Integer
Dim Des1 As Double
Dim Des2 As Double
Dim Subtotal As Double
Dim Total As Double
Dim Recargo As Double
Dim Pago As Double

Dia = Val(TxtDPago.Text)
Pago = Val(TxtCPago.Text)

Des1 = 0
Recargo = 0
Des2 = 0
Select Case Dia
Case Is >= 32
MsgBox "seleccione un dia habil", vbCritical, "seleccione Dia de Pago"
TxtDPago.SetFocus
Des1 = 0
Recargo = 0
Case Is >= 16
Recargo = Pago * 0.08
Case Is >= 6
Des1 = Pago * 0.05
Case Is > 0
Des1 = Pago * 0.1
Case Else
MsgBox "seleccione un dia", vbCritical, "seleccione Dia de Pago"
TxtDPago.SetFocus
Des1 = 0
Recargo = 0
End Select

Subtotal = Pago - Des1 + Recargo


TxtD1 = Str(Des1)
TxtR = Str(Recargo)
TxtSub = Str(Subtotal)

If ChkE.Value = 1 Then
Des2 = ((Subtotal * TxtEP) / 100) * 0.15
End If

Total = Subtotal - Des2


TxtDPE = Str(Des2)
TxtTotal = Str(Total)

End Sub

Private Sub MnuLimpiar_Click()


TxtNit = ""
TxtCPago = ""
TxtDPago = ""
CmbCategoria = ""
Opt1 = False
Opt2 = False
Opt3 = False
ChkE.Value = 0
ChkCC.Value = 0
ChkBE.Value = 0
TxtEP = ""
TxtCP = ""
TxtBE = ""
TxtR = ""
TxtD1 = ""
TxtSub = ""
TxtDPE = ""
TxtTotal = ""
TxtNit.SetFocus

End Sub

Private Sub MnuLimpiarT_Click()


TxtNit = ""
TxtCPago = ""
TxtDPago = ""
CmbCategoria = ""
Opt1 = False
Opt2 = False
Opt3 = False
ChkE.Value = 0
ChkCC.Value = 0
ChkBE.Value = 0
TxtEP = ""
TxtCP = ""
TxtBE = ""
TxtR = ""
TxtD1 = ""
TxtSub = ""
TxtDPE = ""
TxtTotal = ""
TxtEfectivo = ""
TxtCheque = ""
TxtBanca = ""
LstNit.Clear
LstCPago.Clear
LstDPago.Clear
LstCategoria.Clear
LstRegi.Clear
LstE.Clear
LstC.Clear
LstBE.Clear
TxtNit.SetFocus

End Sub

Private Sub MnuSalir_Click()

If MsgBox("Desea Salir?", vbYesNo + vbQuestion, "Salir") = vbYes Then


End
Else
Call MnuLimpiar_Click
End If

End Sub

You might also like