quinta-feira, 17 de dezembro de 2009

Ficha 17-5



Private Sub Timer1_Timer()

Lbltime.Caption = Now()

End Sub

Function FU_Delay(Quanto As Double, PermiteDoEvents As Integer) As Double

Dim inicio As Double
Dim Check As Double
Dim Contador As Double
Contador = Timer
inicio = Timer
Do Until Check >= (inicio + Quanto)
Check = Timer
If PermiteDoEvents Then DoEvents
Loop

FU_Delay = (Timer - Contador)
End Function

Private Sub Form_Load()
Form3.Show
Form2.Hide
If res = sair Then
r = FU_Delay(3, True)
Beep
End
End If
End Sub




Private Sub Command1_Click()
Image1.Visible = True
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command10_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = True
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command11_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = True
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command12_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = True
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command13_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = True
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command14_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = True
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command15_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = True
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command16_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = True
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command17_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = True
Image18.Visible = False
End Sub

Private Sub Command18_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = True
End Sub

Private Sub Command19_Click()

Form1.Show
Form4.Hide

End Sub

Private Sub Command2_Click()
Image1.Visible = False
Image2.Visible = True
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command20_Click()
Dim confirmacao As Integer

confirmacao = MsgBox("Pretende mesmo sair?", vbYesNo + vbQuestion, "Deutsch-Fraktion - Confirmação")

If confirmacao = vbYes Then
Form3.Show
Form4.Hide
Else
End If

End Sub

Private Sub Command3_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = True
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command4_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = True
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command5_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = True
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command6_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = True
Image7.Visible = False
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command7_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = True
Image8.Visible = False
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command8_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = True
Image9.Visible = False
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub

Private Sub Command9_Click()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
Image7.Visible = False
Image8.Visible = False
Image9.Visible = True
Image10.Visible = False
Image11.Visible = False
Image12.Visible = False
Image13.Visible = False
Image14.Visible = False
Image15.Visible = False
Image16.Visible = False
Image17.Visible = False
Image18.Visible = False
End Sub




Private Sub cmd1_Click()

Dim matriz(1 To 3, 1 To 4), vendedor As Integer, trimestre As Integer, cont As Integer
Dim soma As Integer, i As Integer, total As Integer, total2 As Integer
Dim totalvendedor(1 To 3) As Integer, totaltrimestre(1 To 4) As Integer

cont = 0
total = 0
total2 = 0

' Preenchimento da matriz com números introduzidos pelo utilizador

For vendedor = 1 To 3
If vendedor = 1 Then
tipo = "Audi"
End If
If vendedor = 2 Then
tipo = "BMW"
End If
If vendedor = 3 Then
tipo = "Mercedes-Benz"
End If
Picture1.Print tipo
Picture1.Print "||";
For trimestre = 1 To 4
matriz(vendedor, trimestre) = Val(InputBox("Introduza as vendas da " & tipo & " no " & trimestre & "º Trimestre", "Notas"))
Picture1.Print matriz(vendedor, trimestre); "||";
cont = cont + 1
soma = soma + matriz(vendedor, trimestre)
If cont = 4 Then
Picture1.Print Chr(13);
cont = 0
End If
Next trimestre
Next vendedor

' Pesquisa do total de vendas de cada vendedor

For vendedor = 1 To 3
total2 = 0
For trimestre = 1 To 4
total = total + matriz(vendedor, trimestre)
total2 = total2 + matriz(vendedor, trimestre)
Next trimestre
If vendedor = 1 Then
tipo = "Audi"
End If
If vendedor = 2 Then
tipo = "BMW"
End If
If vendedor = 3 Then
tipo = "Mercedes-Benz"
End If
totalvendedor(vendedor) = total2
Picture2.Print "Venda de automóveis " & tipo & " -> " & totalvendedor(vendedor) & " unidades vendidas."
Next vendedor

' Pesquisa do total de vendas de cada trimestre

For trimestre = 1 To 4
total2 = 0
For vendedor = 1 To 3
total2 = total2 + matriz(vendedor, trimestre)
Next vendedor
totaltrimestre(trimestre) = total2
Picture3.Print trimestre & "ºtrimestre " & totaltrimestre(trimestre)
Next trimestre

Picture4.Print "O total de vendas das 3 marcas de automóveis -> " & soma & " unidades vendidas num ano."

cmd1.Enabled = False

End Sub

Private Sub Command1_Click()

Form1.Show
Form2.Hide

End Sub

Private Sub sair_click()
Dim confirmacao As Integer

confirmacao = MsgBox("Pretende mesmo sair?", vbYesNo + vbQuestion, "Deutsch-Fraktion - Confirmação")

If confirmacao = vbYes Then
Form3.Show
Form2.Hide
Else
End If

End Sub





Private Sub Command1_Click()

Form2.Show
Form1.Hide

End Sub

Private Sub Command2_Click()

Form4.Show
Form1.Hide

End Sub

Private Sub sair_click()
Dim confirmacao As Integer

confirmacao = MsgBox("Pretende sair?", vbYesNo + vbQuestion, "Deutsch-Fraktion - Confirmação")

If confirmacao = vbYes Then
Form3.Show
Form2.Hide
Else
End If

End Sub

Sem comentários:

Enviar um comentário