Rabu, 18 April 2012

TUGAS PRA UTS







 TUGAS PRA UTS 1


















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



TUGAS PRA UTS SENDIRI





Ketentuan soal
1.Buat sub-sub yang di butuhkan
2. Pada saat form dijalankan semua objek dalam kondisi aktif,text box tanggal berisi tanggal hari ini.Kursor berada pada text box nama pasien.
3. Pilih kode kamar dan kelas maka akan tampil jenis kamar dan harga  sesuai dengan ketentuan berikut
Kelas
Kode Kamar
Jenis Kamar
Harga
1

A
B
Mawar
Melati
250000
300000
2

A
B
Teratai
Kenanga
350000
400000





4.Lama Inap di input,jika ditekan enter maka
Total byar=Harga*Lama Inap
5.Uang kembali=Uang bayar-Total bayar
Listinng Program
Sub aktif()
tnama.Enabled = True
cmbkelas.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
tlama.Enabled = True
tubay.Enabled = True
End Sub
Sub nonaktif()
tnama.Enabled = False
cmbkelas.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
tjenis.Enabled = False
thrg.Enabled = False
tlama.Enabled = False
ttobay.Enabled = False
tubay.Enabled = False
tukem.Enabled = False
ttgl.Enabled = False
End Sub
Sub bersih()
tnama.Text = ""
cmbkelas.Text = ""
opt1.Value = 0
opt2.Value = 0
tjenis.Text = ""
thrg.Text = ""
tlama.Text = ""
ttobay.Text = ""
tubay.Text = ""
tukem.Text = ""
End Sub
Private Sub cmbkelas_Click()
If cmbkelas.Text = "1" Then
    If opt1.Value = True Then
    tjenis.Text = "Mawar"
    thrg.Text = 250000
    Else
    tjenis.Text = "Melati"
    thrg.Text = 300000
    End If
Else
    If opt1.Value = True Then
    tjenis.Text = "Teratai"
    thrg.Text = 350000
    Else
    tjenis.Text = "Kenanga"
    thrg.Text = 400000
    End If
End If
End Sub
Private Sub cmdclose_Click()
X = MsgBox("Anda Yakin Ingin Keluar?", vbYesNo + vbQuestion, "konfirmasi")
If X = vbYes Then
Unload Me
End If

End Sub

Private Sub cmdinput_Click()
bersih
aktif
cmbkelas.Text = "-pilih="
tnama.SetFocus
End Sub
Private Sub Form_Activate()
bersih
aktif
ttgl.Text = Date
cmbkelas.AddItem "1"
cmbkelas.AddItem "2"
cmdinput.Enabled = True
cmdclose.Enabled = True
End Sub

Private Sub tlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
ttobay.Text = Val(thrg.Text) * Val(tlama.Text)
tubay.SetFocus
End If
End Sub
Private Sub tubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
X = Val(ttobay.Text) - Val(tubay.Text)
If tubay.Text < ttobay.Text Then
MsgBox "Uang Anda Kurang" & X, vbOKOnly, "WARNING!"
tubay.Text = ""
tubay.SetFocus
Else
tukem.Text = Val(tubay.Text) - Val(ttobay.Text)
End If
End If
End Sub




TUGAS PRA UTS 2






LISTING


Sub aktif()
txtnama.Enabled = True
cmbkode.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txtlama.Enabled = True
txtbayar.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
txtbayar.Enabled = False
txtkembali.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 = ""
txtbayar.Text = ""
txtkembali.Text = ""
End Sub

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

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

Private Sub cmdkeluar_Click()
x = MsgBox("Tutup Form", vbYesNo + vbQuestion, “Konfirmasi”)
If x = vbYes Then
Unload Me
End If
End Sub

Private Sub Form_Activate()
bersih
aktif
txttgl.Text = Date
cmbkode.AddItem "SU01"
cmbkode.AddItem "BS01"
cmbkode.AddItem "PR01"
cmdisi.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 txtbayar_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 a = Val(txttotal.Text) - Val(txtbayar.Text)
If txtbayar.Text < txttotal.Text Then
MsgBox "Uang Anda Kurang" & a, vbOKOnly, "WARNING!"
txtbayar.Text = ""
txtbayar.SetFocus
Else
txtkembali.Text = Val(txtbayar.Text) - Val(txttotal.Text)
End If
End If
End Sub


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

Tidak ada komentar:

Posting Komentar