Mi lista de blogs

jueves, 17 de noviembre de 2011

SALARIO DE UN TRABAJADOR

Private Sub Command1_Click()
HT = Val(Text2)
PH = Val(Text3)
salario = HT * PH
Text4 = salario
Descuento = 0.2 * Text4
Text5 = Descuento
SalarioNeto = SalarioBruto - Descuento
Text6 = SalarioNeto
End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
End Sub

Private Sub Command3_Click()
Beep
End
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text1.Text = "" Then
MsgBox ("digite el nombre del trabajador")
Text1.SetFocus
Else
Text2.SetFocus
End If
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text2.Text = "" Then
MsgBox ("digite el numero de horas trabajadas")
Text2.SetFocus
Else
Text3.SetFocus
End If
End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text3.Text = "" Then
MsgBox ("digite el pago por horas")
Text3.SetFocus
Else
Text4.SetFocus
End If
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text4.Text = "" Then
MsgBox ("digite el salario bruto")
Text4.SetFocus
Else
Text5.SetFocus
End If
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text5.Text = "" Then
MsgBox ("digite el descuento")
Text5.SetFocus
Else
Text6.SetFocus
End If
End If
End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text6.Text = "" Then
MsgBox ("digite el salario neto")
Text6.SetFocus
Else
Command1.SetFocus
End If
End If
End Sub

CALCULA LA EDAD DE UNA PERSONA

Private Sub Command1_Click()
Dim FecNac As Date, Edad As Integer
FecNac = CDate(Text1)
Edad = CInt((Date - FecNac) / 365)
Text2 = Str(Edad) & "años"
End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
End Sub

Private Sub Command3_Click()
Beep
End
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text1.Text = "" Then
MsgBox ("DIGITE LA FECHA DE NACIMIENTO")
Text1.SetFocus
Else
Text2.SetFocus
End If
End If

End Sub

RESTAURANTE

Dim h, g, c, e, s, r, so, p, vt, i As Integer
Private Sub Command1_Click()
h = Val(Text1)
g = Val(Text2)
c = Val(Text3)
e = Val(Text4)
s = Val(Text5)
r = Val(Text6)
so = Val(Text7)
p = Val(Text8)
vt = (h * 3500) + (g * 1200) + (c * 1300) + (e * 3500) + (s * 2000) + (r * 1000) + (so * 2000) + (p * 2800)
i = (18 / 100) * vt
Text9.Text = vt + i
Text10 = i



End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
End Sub

Private Sub Command3_Click()
Beep
End
End Sub

Private Sub Form_Load()
GrdMenu.Cols = 2
GrdMenu.Rows = 9
GrdMenu.FixedCols = 0
GrdMenu.FixedRows = 1
GrdMenu.TextArray(0) = "Menú2"
GrdMenu.TextArray(1) = "Precio"
GrdMenu.TextArray(2) = "Hamburguesa"
GrdMenu.TextArray(3) = "3500"
GrdMenu.TextArray(4) = "Cerveza"
GrdMenu.TextArray(5) = "1300"
GrdMenu.TextArray(6) = "Gaseosa"
GrdMenu.TextArray(7) = "1200"
GrdMenu.TextArray(8) = "Ensalada"
GrdMenu.TextArray(9) = "3500"
GrdMenu.TextArray(10) = "Salchichas"
GrdMenu.TextArray(11) = "2000"
GrdMenu.TextArray(12) = "Refresco"
GrdMenu.TextArray(13) = "1000"
GrdMenu.TextArray(14) = "Sopa"
GrdMenu.TextArray(15) = "2000"
GrdMenu.TextArray(16) = "Postre"
GrdMenu.TextArray(17) = "2800"
End Sub

Private Sub Text1_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text1.Text = "" Then
MsgBox ("Digite la cantidad de hamburguesas")
Text1.SetFocus
Else
Text2.SetFocus
End If
End If
End Sub

Private Sub Text2_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text2.Text = "" Then
MsgBox ("Digite la cantidad de Cervezas")
Text2.SetFocus
Else
Text3.SetFocus
End If
End If

End Sub

Private Sub Text3_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text3.Text = "" Then
MsgBox ("Digite la cantidad de gaseosas")
Text3.SetFocus
Else
Text4.SetFocus
End If
End If

End Sub

Private Sub Text4_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text4.Text = "" Then
MsgBox ("Digite la cantidad de ensalada")
Text4.SetFocus
Else
Text5.SetFocus
End If
End If

End Sub

Private Sub Text5_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text5.Text = "" Then
MsgBox ("Digite la cantidad de salchichas")
Text5.SetFocus
Else
Text6.SetFocus
End If
End If

End Sub

Private Sub Text6_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text6.Text = "" Then
MsgBox ("Digite la cantidad de refresco")
Text6.SetFocus
Else
Text7.SetFocus
End If
End If

End Sub

Private Sub Text7_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text7.Text = "" Then
MsgBox ("Digite la cantidad de sopa")
Text7.SetFocus
Else
Text8.SetFocus
End If
End If

End Sub

Private Sub Text8_keypress(keyascci As Integer)
If keyascci = 13 Then
If Text8.Text = "" Then
MsgBox ("Digite la cantidad de Postre")
Text8.SetFocus
Else
Command1.SetFocus
End If
End If
End Sub