Sabtu, 14 April 2012

TAMPILAN FORM, KETENTUAN SOAL, DAN LISTING TUGAS PRA UTS 3, VB

TAMPILAN FORM VB  BLACKFOREST




























KETENTUAN SOAL  Blackforest :
  1. Ketika Form dijalankan, semua objek dalam keadaan aktif. Textbox tanggal berisi tanggal hari ini, Dan kursor berada pada Textbox Nama Customer.
    2.   Pilih kode Blackforest, maka jenis Blackforest akan tampil, dengan ketentuan sebagai berikut:

KODE  BLACKFOREST
JENIS  BLACKFOREST
CKT01
Coklat
TRS01
Tiramisu
STRB01
Strawbery
COFF01
Coffe

    3.  Pilih Ukuran Blacforest, maka akan tampil harga sebagai berikut:

JENIS
UKURAN
HARGA
Coklat
Small
50000

Medium
70000

Large
100000
Tiramisu
Small
80000

Medium
125000

Large
150000
Strawbery
Small
45000

Medium
75000

Large
90000
Coffe
Small
30000

Medium
60000

Large
85000

     4.Jumlah beli dinput, lalu tekan enter,maka
        Total Harga= Harga Blackforest * Jumlah Beli
        Uang bayar di input lalu tekan enter, maka:
        Uang kembali = Uang bayar – Total harga
     5.Jika Uang Bayar kurang, maka tampil pesan sebagai berikut :
        OOO,,, Less Money Rp. 50000,Please Input Again
    6. Bila Form kita close, maka akan tampil pesan sebagai berikut :
        Going Out!!


Listing Tugas VB Pra UTS 3 (Blackforest)
Sub aktif()
txtnama.Enabled = True                                              
cmbkode.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txtjumbel.Enabled = True
txtubay.Enabled = True
End Sub

Sub nonaktif()
txtnama.Enabled = False
txttgl.Enabled = False
cmbkode.Enabled = False
txtjenis.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtharga.Enabled = False
txtjumbel.Enabled = False
txttotal.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
End Sub

Sub bersih()
txtnama.Text = ""
cmbkode.Text = ""
txtjenis.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
txtharga.Text = ""
txtjumbel.Text = ""
txttotal.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub

Private Sub cmbkode_Click()
If cmbkode.Text = "CKT01" Then
txtjenis.Text = "Coklat"
ElseIf cmbkode.Text = "TRS01" Then
txtjenis.Text = "Tiramisu"
ElseIf cmbkode.Text = "STRB01" Then
txtjenis.Text = "Strawbery"
Else
txtjenis.Text = "Coffe"
End If
End Sub

Private Sub cmdclose_Click()
X = MsgBox("Going Out?..", vbYesNo + vbQuestion, "Konfirmasi")
If X = vbYes Then
Unload Me
End If
End Sub

Private Sub cmdinput_Click()
bersih
aktif
cmbkode.Text = "-pilih-"
txtnama.SetFocus
End Sub

Private Sub Form_Activate()
bersih
nonaktif
txttgl.Text = Date
cmbkode.AddItem "CKT01"
cmbkode.AddItem "TRS01"
cmbkode.AddItem "STRB01"
cmbkode.AddItem "COFF01"
cmdinput.Enabled = True
cmdclose.Enabled = True
End Sub

Private Sub opt1_Click()
If opt1.Value = True Then
If txtjenis.Text = "Coklat" Then
txtharga.Text = 50000
ElseIf txtjenis.Text = "Tiramisu" Then
txtharga.Text = 80000
ElseIf txtjenis.Text = "Strawbery" Then
txtharga.Text = 45000
Else
txtharga.Text = 30000
End If
Else
txtjumbel.SetFocus
End If
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
If txtjenis.Text = "Coklat" Then
txtharga.Text = 70000
ElseIf txtjenis.Text = "Tiramisu" Then
txtharga.Text = 125000
ElseIf txtjenis.Text = "Strawbery" Then
txtharga.Text = 75000
Else
txtharga.Text = 60000
End If
Else
txtjumbel.SetFocus
End If
End Sub

Private Sub opt3_Click()
If opt3.Value = True Then
If txtjenis.Text = "Coklat" Then
txtharga.Text = 100000
ElseIf txtjenis.Text = "Tiramisu" Then
txtharga.Text = 150000
ElseIf txtjenis.Text = "Strawbery" Then
txtharga.Text = 90000
Else
txtharga.Text = 85000
End If
Else
txtjumbel.SetFocus
End If
End Sub

Private Sub txtjumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text = Val(txtharga.Text) * Val(txtjumbel.Text)
txtubay.SetFocus
End If
End Sub

Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
a = Val(txttotal.Text) - Val(txtubay.Text)
If txtubay.Text < txttotal.Text Then
MsgBox "OOO,,,Less Money Rp." & Val(txttotal.Text) - Val(txtubay.Text) & ",Please Input Again ", vbOKOnly, "Warning!!"
txtubay.Text = ""
txtubay.SetFocus
Else
txtukem.Text = Val(txtubay.Text) - Val(txttotal.Text)
End If
End If
End Sub




Jumat, 13 April 2012

TAMPILAN DAN LISTING TUGAS PRA UTS2
























Listing Tugas VB Pra UTS 2 ( PENGINAPAN)

Private Sub cmbkode_Click()
If cmbkode.Text = "SU01" Then
txtjenis.Text = "Suite"
ElseIf cmbkode.Text = "BS01" Then
txtjenis.Text = "Business"
Else
txtjenis.Text = "President"
End If
End Sub

Sub aktif() 
txtnama.Enabled = True
cmbkode.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txtlama.Enabled = True
txtubay.Enabled = True
End Sub

Sub nonaktif()
txtnama.Enabled = False
txttgl.Enabled = False
cmbkode.Enabled = False
txtjenis.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtharga.Enabled = False
txtlama.Enabled = False
txttotal.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
End Sub

Sub bersih()
txtnama.Text = ""
cmbkode.Text = ""
txtjenis.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
txtharga.Text = ""
txtlama.Text = ""
txttotal.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub

Private Sub cmdisidata_Click()
bersih
aktif
cmbkode.Text = "-Pilih-"
txtnama.SetFocus
End Sub

Private Sub cmdkeluar_Click()
X = MsgBox("TutupForm?",vbYesNo + vbQuestion, "Konfirmasi")
If X = vbYes Then
Unload Me
End If
End Sub

Private Sub Form_Activate()
bersih
nonaktif
txttgl.Text = Date
cmbkode.AddItem "SU01"
cmbkode.AddItem "BS01"
cmbkode.AddItem "PR01"
cmdisidata.Enabled = True
cmdkeluar.Enabled = True
End Sub

Private Sub opt1_Click()
If opt1.Value = True Then
If txtjenis.Text = "Suite" Then
txtharga.Text = 300000
ElseIf txtjenis.Text = "Business" 
Then
txtharga.Text = 400000
Else
txtharga.Text = 500000
End If
Else
txtharga.Text = 0
End If
txtlama.SetFocus
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
If txtjenis.Text = "Suite" Then
txtharga.Text = 500000
ElseIf txtjenis.Text = "Business" Then
txtharga.Text = 600000
Else
txtharga.Text = 700000
End If
Else
txtharga.Text = 0
End If
txtlama.SetFocus
End Sub

Private Sub opt3_Click()
If opt3.Value = True Then
If txtjenis.Text = "Suite" Then
txtharga.Text = 800000
ElseIf txtjenis.Text = "Business" Then
txtharga.Text = 900000
Else
txtharga.Text = 1000000
End If
Else
txtharga.Text = 0
End If
txtlama.SetFocus
End Sub


Private Sub txtlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text = Val(txtharga.Text) * Val(txtlama.Text)
txtubay.SetFocus
End If
End Sub

Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
a = Val(txttotal.Text) - Val(txtubay.Text)
If txtubay.Text < txttotal.Text  Then
MsgBox "Uang Anda Kurang RP." & Val(txttotal.Text) - Val(txtubay.Text) & " 
Input Uang Kembali", vbOKOnly, "Warning!"
txtubay.Text = ""
txtubay.SetFocus
Else
txtukem.Text = Val(txtubay.Text) - Val(txttotal.Text)
End If
End If
End Sub

Rabu, 11 April 2012

Tampilan dan Listing Tugas PRA UTS 1

Tampilan Tugas Pra UTS 1, Sebagai Berikut :



Listing Tugas Pra UTS 2, Sebagai Berikut:

Sub aktif()                                              
txtnip.Enabled = False
txtnama.Enabled = False
cmbgol.Enabled = False
txttgl.Enabled = False
txtjabatan.Enabled = False
txtgapok.Enabled = False
txttunjangan.Enabled = False
txttransport.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtstatus.Enabled = False
txtgator.Enabled = False
txtpph.Enabled = False
txtgaber.Enabled = False
End Sub

Sub nonaktif()
txtnip.Enabled = True
txtnama.Enabled = True
cmbgol.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
End Sub

Sub nonaktif()
txtnip.Enabled = False
txtnama.Enabled = False
cmbgol.Enabled = False
txttgl.Enabled = False
txtjabatan.Enabled = False
txtgapok.Enabled = False
txttunjangan.Enabled = False
txttransport.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtstatus.Enabled = False
txtgator.Enabled = False
txtpph.Enabled = False
txtgaber.Enabled = False
End Sub

Sub bersih()
txtnip.Text = ""
txtnama.Text = ""
cmbgol.Text = ""
txtjabatan.Text = ""
txtgapok.Text = ""
txttunjangan.Text = ""
txttransport.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
txtstatus.Text = ""
txtgator.Text = ""
txtpph.Text = ""
txtgaber.Text = ""
End Sub

Private Sub cmbgol_Click()
If cmbgol.Text = "I" Then
txtjabatan.Text = "Paintry"
txtgapok.Text = 1000000
txttunjangan.Text = 2000000
txttransport.Text = 0
ElseIf cmbgol.Text = "II" Then
txtjabatan.Text = "Staff"
txtgapok.Text = 1750000
txttunjangan.Text = 3000000
txttransport.Text = 200000
ElseIf cmbgol.Text = "III" Then
txtjabatan.Text = "Supervisor"
txtgapok.Text = 2250000
txttunjangan.Text = 5000000
txttransport.Text = 300000
ElseIf cmbgol.Text = "IV" Then
txtjabatan.Text = "Manager"
txtgapok.Text = 5000000
txttunjangan.Text = 7000000
txttransport.Text = 500000
Else
txtjabatan.Text = "Direktur"
txtgapok.Text = 100000000
txttunjangan.Text = 10000000
txttransport.Text = 1000000
End If
End Sub

Private Sub cmdhitunglagi_Click()
bersih
aktif
txtnip.SetFocus
cmbgol.Text = "-Pilih-"
End Sub

Private Sub cmdkeluar_Click()
X = MsgBox("Yakin Keluar", vbYesNo + vbQuestion, "Konfirmasi")
If X = vbYes Then
Unload Me
End If
End Sub

Private Sub Form_Activate()
bersih
nonaktif
txttgl.Text = Date
cmbgol.AddItem "I"
cmbgol.AddItem "II"
cmbgol.AddItem "III"
cmbgol.AddItem "IV"
cmbgol.AddItem "V"
cmdhitunglagi.Enabled = True
cmdkeluar.Enabled = True
End Sub

Private Sub opt1_Click()
If opt1.Value = True Then
txtstatus.Text = 300000
txtgator.Text = Val(txtgapok.Text) + Val(txttunjangan.Text) + Val(txttransport.Text) + Val(txtstatus.Text)
txtpph.Text = 0.1 * Val(txtgator.Text)
txtgaber.Text = Val(txtgator.Text) - Val(txtpph.Text)
End If
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
txtstatus.Text = 0
txtgator.Text = Val(txtgapok.Text) + Val(txttunjangan.Text) + Val(txttransport.Text) + Val(txtstatus.Text)
txtpph.Text = 0.1 * Val(txtgator.Text)
txtgaber.Text = Val(txtgator.Text) - Val(txtpph.Text)
End If
End Sub

Private Sub opt3_Click()
If opt3.Value = True Then
txtstatus.Text = 1000000
txtgator.Text = Val(txtgapok.Text) + Val(txttunjangan.Text) + Val(txttransport.Text) + Val(txtstatus.Text)
txtpph.Text = 0.1 * Val(txtgator.Text)
txtgaber.Text = Val(txtgator.Text) - Val(txtpph.Text)
End If
End Sub