Kamis, 19 April 2012

Tugas 1 Visual Basic

Tampilan Form Object Kalkulasi Gaji Karyawan PT. Sudah Makmur Jaya Unggul Lagi




















Tampilan Form Code Kalkulasi Gaji Karyawan PT. Sudah Makmur Jaya Unggul Lagi

Sub aktif()
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
txtjab.Enabled = False
txtgapok.Enabled = False
txttunjab.Enabled = False
txttrans.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtstatus.Enabled = False
txtgakot.Enabled = False
txtpph.Enabled = False
txtgaber.Enabled = False
End Sub

Sub bersih()
txtnip.Text = ""
txtnama.Text = ""
cmbgol.Text = ""
txtjab.Text = ""
txtgapok.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
End Sub

Private Sub cmbgol_Click()
If cmbgol.Text = "I" Then
txtjab.Text = "Pantry"
txtgapok.Text = "1000000"
txttunjab.Text = "200000"
txttrans.Text = "0"
ElseIf cmbgol.Text = "II" Then
txtjab.Text = "Staff"
txtgapok.Text = "1750000"
txttunjab.Text = "300000"
txttrans.Text = "200000"
ElseIf cmbgol.Text = "III" Then
txtjab.Text = "Supervisor"
txtgapok.Text = "2250000"
txttunjab.Text = "500000"
txttrans.Text = "300000"
ElseIf cmbgol.Text = "IV" Then
txtjab.Text = "Manajer"
txtgapok.Text = "5000000"
txttunjab.Text = "700000"
txttrans.Text = "500000"
Else
txtgapok.Text = "10000000"
txttunjab.Text = "1000000"
txttrans.Text = "1000000"
End If
End Sub

Private Sub cmdhitung_Click()
bersih
aktif
txtnip.SetFocus
txtnip.Text = 0
cmdhitung.Enabled = False
cmdkeluar.Enabled = True
End Sub

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

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

Private Sub opt1_Click()
If opt1.Value = True Then
txtstatus.Text = 300000
txtgakot.Text = Val(txtgapok.Text) + Val(txtjab.Text) + Val(txttrans.Text) + Val(txtstatus.Text)
txtpph.Text = 0.1 * Val(txtgakot.Text)
txtgaber.Text = Val(txtgakot.Text) - Val(txtpph.Text)
cmdhitung.Enabled = True
End If
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
txtstatus.Text = 0
txtgakot.Text = Val(txtgapok.Text) + Val(txtjab.Text) + Val(txttrans.Text) + Val(txtstatus.Text)
txtpph.Text = 0.1 * Val(txtgakot.Text)
txtgaber.Text = Val(txtgakot.Text) - Val(txtpph.Text)
cmdhitung.Enabled = True
End If
End Sub

Private Sub opt3_Click()
If opt3.Value = True Then
txtstatus.Text = 100000
txtgakot.Text = Val(txtgapok.Text) + Val(txtjab.Text) + Val(txttrans.Text) + Val(txtstatus.Text)
txtpph.Text = 0.1 * Val(txtgakot.Text)
txtgaber.Text = Val(txtgakot.Text) - Val(txtpph.Text)
cmdhitung.Enabled = True
End If
End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmbgol.SetFocus
End If

End Sub

Private Sub txtnip_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub


Tampilan Form Run Kalkulasi Gaji Karyawan PT. Sudah Makmur Jaya Unggul Lagi

Tugas 2 Visual Basic

Tampilan Form Object Penginapan Hotel "BoBo Chiank" 

 

Tampilan Form code Penginapan Hotel “Bobo Chiank”

Sub aktif()
txtnama.Enabled = True
cmbkode.Enabled = True
txtjenis.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txthrg.Enabled = True
txtlama.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
txthrg.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
txthrg.Text = ""
txtlama.Text = ""
txttotal.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub

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

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

Private Sub Form_Activate()
aktif
cmbkode.AddItem "SU01"
cmbkode.AddItem "BS01"
cmbkode.AddItem "PR01"
txttgl.Text = Date
End Sub

Private Sub opt1_Click()
If opt1.Value = True Then
txtjenis.Text = "Suite"
txthrg.Text = 300000
ElseIf txtjenis.Text = "Bussines" Then
txthrg.Text = 500000
Else
txthrg.Text = 800000
End If
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
txtjenis.Text = "Suite"
txthrg.Text = 400000
ElseIf txtjenis.Text = "Bussines" Then
txthrg.Text = 600000
Else
txthrg.Text = 900000
End If
End Sub

Private Sub opt3_Click()
If opt1.Value = True Then
txtjenis.Text = "Suite"
txthrg.Text = 500000
ElseIf txtjenis.Text = "Bussines" Then
txthrg.Text = 700000
Else
txthrg.Text = 1000000
End If
End Sub

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

Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmbkode.SetFocus
End If
End Sub

Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtukem.Text = Val(txtubay.Text) - Val(txttotal.Text)
End If
End Sub

Private Sub txtukem_KeyPress(KeyAscii As Integer)
If txtubay.Text < txttotal.Text Then
MsgBox "Uang Anda Kurang Rp." & Val(txttotal.Text) - Val(txtubay.Text) & "Input Uang Kembali", vbQuetion, "Warning"
End If
End Sub

Tampilan Form Run Penginapan Hotel “BoBo Chiank”


Tugas Bebas Visual Basic

Tampilan Form Waroeng Coffe Sederhana




















Ketentuan Soal Waroeng Coffe Sederhana
11. Buat Sub Aktif, Non Aktif dan Bersih
22. Ketika Form dijalankan form dalam keadaan nonaktif. Tanggal muncul berdasarkan settingan hari ini (Kamis, 19 April 2012). Pilihan pada kode coffe : CS, CC, CM
33. Kilik Tombol Input, maka textbox & combobox dalam keadaan bersih dan aktif, kursor berada pada Combo Kode Coffe. Untuk tanggal  biarkan nonaktif dan tidak usah dibersihkan.
44. Jenis Coffe ditentukan berdasarkan Combo Kode Coffe, dengan ketentuan sbb :
Kode Coffe
Jenis Coffe
Harga
CS
Coffe Susu
5000
CC
Coffe Capucino
8000
CM
Coffe Mix
10000
Kode Coffe dipilih Kemudian kursor berada pada jumlah beli
55. Jumlah Beli diinput, tekan enter maka :
Total Bayar = Harga x jumlah beli
66. Uang bayar hanya diinput oleh angka, tekan enter maka :
Uang kembali = Uang bayar – Total bayar
Jika uang bayar < total bayar, maka akan tampil pesan :









17.  Klik tombol cancel kembali ke awal form (form activate)

Tampilan Code Waroeng Coffe Sederhana

Sub aktif()
cmbkode.Enabled = True
txtjumbel.Enabled = True
txtubay.Enabled = True
End Sub

Sub nonaktif()
txttgl.Enabled = False
cmbkode.Enabled = False
txtjenis.Enabled = False
txtharga.Enabled = False
txtjumbel.Enabled = False
txttobay.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
End Sub

Sub bersih()
txttgl.Text = ""
cmbkode.Text = ""
txtjenis.Text = ""
txtharga.Text = ""
txtjumbel.Text = ""
txttobay.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub

Private Sub cmbkode_Click()
If cmbkode.Text = "CS" Then
txtjenis.Text = "Coffe Susu"
txtharga.Text = 5000
ElseIf cmbkode.Text = "CC" Then
txtjenis.Text = "Coffe Capucino"
txtharga.Text = 8000
Else
txtjenis.Text = "Coffe Mix"
txtharga.Text = 10000
End If
End Sub

Private Sub cmdcancel_Click()
Call Form_Activate
bersih
End Sub

Private Sub cmdclose_Click()
Unload Me
End Sub

Private Sub cmdinput_Click()
aktif
bersih
cmbkode.Text = "-Daftar Coffe-"
cmbkode.SetFocus
cmdinput.Enabled = False
cmdcancel.Enabled = True
cmdclose.Enabled = False
End Sub

Private Sub Form_Activate()
aktif
bersih
txttgl.Text = Format(Date, "dd-mmmm-yyyy")
cmbkode.AddItem "CS"
cmbkode.AddItem "CC"
cmbkode.AddItem "CM"
cmbkode.SetFocus
cmdinput.Enabled = True
cmdcancel.Enabled = False
cmdclose.Enabled = True
End Sub

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

Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Val(txtubay.Text) < Val(txttobay.Text) Then
MsgBox "Maaf Uang Bayar Kurang Rp." & (Val(txttobay.Text) - Val(txtubay.Text)) & "," & "Silahkan Input Kembali", vbOKOnly + vbInformation, "informasi"
txtubay.Text = ""
txtubay.SetFocus
txtukem.Text = ""
Else
txtukem.Text = Val(txtubay.Text) - txttobay.Text
End If
cmdinput.Enabled = True
cmdcancel.Enabled = False
End If
If Not (KeyAscii <= Asc("9") And KeyAscii >= Asc("0") Or KeyAscii = vbKeyBack) Then
KeyAscii = 0
End If
End Sub


Tampilan Running Waroeng Coffe Sederhana