Jumat, 02 Januari 2015

Tugas kelompok pemrograman visual 1 ( PROGRAM PENYEWAAN HOTEL)

KELAS                           : 12.3B.04
NAMA ANGGOTA KELOMPOK : ALFA HUDZAIFAH - 12137633
                                                        KHAERUL UMAM - 12137232
                                                        MUHAMMAD IQBAL.R - 12133950
                                                         NOVI ANTONIO - 12133377
                                                       ANDREAS RUSMIANTO - 12137336
                                                        JOHAN - 12137683
                                                       ARIF PRIYO - 12135077
                                                       NURUL CAHYA - 12131913
                                                          ADHI KURNIAWAN - 12136242

JUDUL PROGRAM : PENYEWAAN HOTEL
DOWNLOAD PROGRAM PROGRAM PENYEWAAN HOTEL (pass winrar : 123)
                                                  DATABASE

1. MENU UTAMA


2. FORM KAMAR



Dim X As Control

Private Sub cmdbott_Click()
On Error Resume Next
dtakamar.Recordset.MoveLast
MsgBox "data sudah diakhir record!", 16, "Informasi"
End Sub

Private Sub Cmdnext_Click()
On Error Resume Next
dtakamar.Recordset.MoveNext
If dtakamar.Recordset.EOF Then
  dtakamar.Recordset.MoveLast
  MsgBox "Sudah diakhir record", vbCritical, "Informasi"
End If
End Sub

Private Sub Cmdprev_Click()
On Error Resume Next
dtakamar.Recordset.MovePrevious
If dtakamar.Recordset.BOF Then
  dtakamar.Recordset.MoveFirst
  MsgBox "Sudah diwal record", vbCritical, "Informasi"
End If
End Sub

Private Sub cmdtop_Click()
On Error Resume Next
dtakamar.Recordset.MoveFirst
MsgBox "data sudah diawal record!", 16, "Informasi"
End Sub

Private Sub Cmdnew_Click()
kosong
AKTIF
txtkode.SetFocus
cmdnew.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
cmdedit.Enabled = False
End Sub

Private Sub Cmdsave_Click()
On Error Resume Next
With dtakamar.Recordset
.AddNew
!kdkamar = txtkode.Text
!nmkamar = txtnama.Text
!hargasewa = Val(txtharga.Text)
.Update
.MoveLast
nonaktif
On Error GoTo 0
cmdnew.Enabled = True
cmdedit.Enabled = True
cmdsave.Enabled = False
End With
End Sub

Private Sub Cmdedit_Click()
AKTIF
txtkode.Enabled = False
cmdnew.Enabled = False
cmdsave.Enabled = True
cmddelete.Enabled = False
cmdedit.Enabled = False
End Sub

Private Sub Cmdcancel_Click()
p = MsgBox("Yakin akan membatalkan penginputan ??", vbQuestion + vbOKCancel, "Konfirmasi")
If p = vbOK Then
kosong
nonaktif
cmdsave.Enabled = False
cmdnew.Enabled = True
cmdedit.Enabled = False
cmdcancel.Enabled = False
End If
End Sub

Private Sub Cmddelete_Click()
p = MsgBox("YAKIN MAU DIAPUS?", vbQuestion + vbOKCancel, "Konfirmasi")
If p = vbOK Then
dtakamar.Recordset.Delete
dtakamar.Recordset.MovePrevious
nonaktif
End If
End Sub

Private Sub Cmdfind_Click()
a = InputBox("Masukan kode kamar", "Search Engine")
dtakamar.Recordset.Index = "KDkamar"
dtakamar.Recordset.Seek "=", a
If dtakamar.Recordset.NoMatch Then
tampil
nonaktif
Else
MsgBox "Data Ditemukan", , "informasi"
End If
cmddelete.Enabled = True
cmdcancel.Enabled = True
cmdedit.Enabled = True
End Sub
Sub tampil()
txtkode.Text = datakamar.Recordset!kodekamar
txtnama.Text = datakamar.Recordset!namakamar
txtharga.Text = datakamar.Recordset!hargasewa
End Sub


Private Sub cmdCLOSE_Click()
p = MsgBox("Are you sure to quit..? ", vbQuestion + vbOKCancel, "Khairul Umam")
If p = vbOK Then
MsgBox "Ok See You Next Time..!", vbInformation, "Khairul Umam"
End
End If
End Sub

Private Sub Form_load()
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmdedit.Enabled = False
cmddelete.Enabled = False
nonaktif
TxtTgl = Format(Date, "dddd, dd mmmm yyyy")
End Sub

Private Sub kosong()
For Each X In Me
If TypeName(X) = "TextBox" Then
X.Text = ""
End If
Next
End Sub

Private Sub AKTIF()
For Each X In Me
If TypeName(X) = "TextBox" Then
X.Enabled = True
End If
Next
End Sub

Private Sub nonaktif()
For Each X In Me
If TypeName(X) = "TextBox" Then
X.Enabled = False
End If
Next
End Sub

Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)

End Sub

Private Sub Label1_Click()

End Sub

Private Sub Timer1_Timer()
jam.Caption = Time
End Sub

Private Sub Timer2_Timer()
Label1.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Label2.Caption = Right(Label2.Caption, Len(Label2.Caption) - 1) & Left(Label2.Caption, 1)
End Sub


3. FORM TAMU




Private Sub Cmdcancel_Click()
Call normal
End Sub

Private Sub cmdCLOSE_Click()
p = MsgBox("Are you sure to quit..? ", vbQuestion + vbOKCancel, "Khairul Umam")
If p = vbOK Then
MsgBox "Ok See You Next Time..!", vbInformation, "Khairul Umam"
End
End If
End Sub

Private Sub Cmddelete_Click()
X = MsgBox("yakin akan menghapus data", vbQuestion + vbYesNo, "tanya")
If X = vbYes Then
datatamu.Recordset.Delete
normal
End If
End Sub

Private Sub Cmdedit_Click()
AKTIF
txtkode.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
cmdedit.Enabled = True
End Sub

Private Sub Cmdfind_Click()
a = InputBox("Masukan Kode", "mencari data")
datatamu.Recordset.FindFirst "kdtamu ='" & a & "'"
If Not datatamu.Recordset.NoMatch Then
tampil
nonaktif
cmddelete.Enabled = True
cmdcancel.Enabled = True
cmdedit.Enabled = True
Else
MsgBox "Data tidak ditemukan", , "informasi"
End If
End Sub
Private Sub Cmdfirst_Click()
datatamu.Recordset.MoveFirst
tampil
End Sub

Private Sub cmdlast_Click()
datatamu.Recordset.MoveLast
Call tampil
End Sub

Private Sub Cmdnew_Click()
AKTIF
bersih
nomor_urut
txtnama.SetFocus
cmdnew.Enabled = False
cmdfind.Enabled = False
cmdClose.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
End Sub

Private Sub Cmdnext_Click()
On Error Resume Next
datatamu.Recordset.MoveNext
tampil
If datatamu.Recordset.EOF Then
MsgBox "sudah diakhiri record", vbInformation, "info"
datatamu.Recordset.MoveLast
tampil
End If
End Sub

Private Sub Cmdprev_Click()
On Error Resume Next
datatamu.Recordset.MovePrevious
tampil
If datatamu.Recordset.BOF Then
MsgBox "Sudah diawal record", vbInformation, "info"
datatamu.Recordset.MoveFirst
tampil
End If
End Sub

Private Sub Cmdsave_Click()
On Error Resume Next
If txtkode.Text <> datakamar.Recordset!kode Then
datatamu.Recordset.AddNew
datatamu.Recordset!kdtamu = txtkode.Text
datatamu.Recordset!nmtamu = txtnama.Text
datatamu.Recordset!alamat = txtalamat.Text
datatamu.Recordset!nohp = txtnohp.Text
datatamu.Recordset.Update
MsgBox "data tersimpan", vbInformation, "info"
datatamu.Recordset.MoveLast
normal
tampil
Else
datatamu.Recordset.Edit
datatamu.Recordset!kdtamu = txtkode.Text
datatamu.Recordset!nmtamu = txtnama.Text
datatamu.Recordset!alamat = txtalamat.Text
datatamu.Recordset!nohp = txtnohp.Text
datatamu.Recordset.Update
MsgBox "data tersimpan", vbInformation, "info"
normal
tampil
End If
On Error GoTo 0
End Sub

Private Sub Form_Activate()
normal
End Sub


Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)

End Sub

Private Sub Timer1_Timer()
LBLjam = Time
End Sub

Private Sub Timer2_Timer()
Label1.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Label2.Caption = Right(Label2.Caption, Len(Label2.Caption) - 1) & Left(Label2.Caption, 1)
End Sub

Private Sub Txtalamat_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnohp.SetFocus
End If
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtalamat.SetFocus
End If
End Sub
Sub AKTIF()
txtnama.Enabled = True
txtalamat.Enabled = True
txtnohp.Enabled = True
End Sub
Sub nonaktif()
txtkode.Enabled = False
txtnama.Enabled = False
txtalamat.Enabled = False
txtnohp.Enabled = False
cmdnew.Enabled = False
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmdedit.Enabled = True
cmdfind.Enabled = False
cmdClose.Enabled = False
cmddelete.Enabled = False
End Sub
Sub tampil()
txtkode.Text = datatamu.Recordset!kdtamu
txtnama.Text = datatamu.Recordset!nmtamu
txtalamat.Text = datatamu.Recordset!alamat
txtnohp.Text = datatamu.Recordset!nohp
End Sub

Private Sub Form_load()
TxtTgl = Format(Date, "dddd, dd mmmm yyyy")
End Sub

Sub bersih()
txtkode = ""
txtnama = ""
txtalamat = ""
txtnohp = ""
End Sub

Public Sub normal()
bersih
nonaktif
cmdnew.Enabled = True
cmdfind.Enabled = True
cmdClose.Enabled = True
cmddelete.Enabled = True
End Sub
Sub nomor_urut()
Dim urut As String
Dim Hitung As Integer
With datatamu.Recordset
If .RecordCount = 0 Then
txtkode = "T" + "0001"
Else
.MoveLast
urut = Val(Right(!kdtamu, 4))
Hitung = urut + 1
If Hitung < 10 Then
txtkode = "T000" + Trim(Str(Hitung))
ElseIf Hitung < 100 Then
txtkode = "T00" + Trim(Str(Hitung))
ElseIf Hitung < 1000 Then
txtkode = "T0" + Trim(Str(Hitung))
Else
txtkode = "T" + Trim(Str(Hitung))
End If
End If
End With
End Sub


4. FORM CHECK IN



Sub AKTIF()
DBTAMU.Enabled = True
DBKAMAR.Enabled = True
dttglmasuk.Enabled = True
End Sub
Sub kondisiawal()
DBTAMU.Enabled = False
txtkodereservasi.Enabled = False
txtnamatamu.Enabled = False
DBKAMAR.Enabled = False
txtnamakamar.Enabled = False
txthargasewa.Enabled = False
cmdtambah.Enabled = True
cmdsimpan.Enabled = False
cmdbatal.Enabled = False
cmdclose.Enabled = True
Tanggal.Enabled = True
dttglmasuk.Enabled = False
txtkodereservasi.Visible = False
End Sub

Private Sub cmdBATAL_Click()
kondisiawal
End Sub

Private Sub cmdCLOSE_Click()
p = MsgBox("Are you sure to quit..? ", vbQuestion + vbOKCancel, "Khairul Umam")
If p = vbOK Then
MsgBox "Ok See You Next Time..!", vbInformation, "Khairul Umam"
End
End If
End Sub

Private Sub cmdSIMPAN_Click()
datamasuk.Recordset.AddNew
datamasuk.Recordset!kdreservasi = txtkodereservasi.Text
datamasuk.Recordset!kdtamu = DBTAMU.Text
datamasuk.Recordset!nmtamu = txtnamatamu.Text
datamasuk.Recordset!kodekamar = DBKAMAR.Text
datamasuk.Recordset!nmkamar = txtnamakamar.Text
datamasuk.Recordset!hargasewa = txthargasewa.Text
datamasuk.Recordset!Tanggal = Tanggal.Caption
datamasuk.Recordset!tglmasuk = dttglmasuk
datamasuk.Recordset.Update
MsgBox "data tersimpan", vbInformation, "info"
bersih
kondisiawal
End Sub

Private Sub cmdTAMBAH_Click()
AKTIF
txtkodereservasi.Visible = True
nomor
cmdtambah.Enabled = False
cmdclose.Enabled = False
cmdsimpan.Enabled = True
cmdbatal.Enabled = True
End Sub

Private Sub Dbkamar_Change()
datakamar.Recordset.Index = "kdkamar"
datakamar.Recordset.Seek "=", DBKAMAR.Text
If Not datakamar.Recordset.NoMatch Then
txtnamakamar.Text = datakamar.Recordset!nmkamar
txthargasewa.Text = datakamar.Recordset!hargasewa
End If
End Sub


Private Sub DBTAMU_Change()
datatamu.Recordset.Index = "KODEX"
datatamu.Recordset.Seek "=", DBTAMU.Text
If Not datatamu.Recordset.NoMatch Then
txtnamatamu.Text = datatamu.Recordset!nmtamu
End If
End Sub

Private Sub Form_Activate()
kondisiawal
End Sub

Private Sub Form_load()
Tanggal = Date
End Sub

Sub bersih()
DBTAMU.Text = "Pilih Kode"
DBKAMAR.Text = "Pilih Kode"
txtnamakamar.Text = ""
txthargasewa.Text = ""
txtnamatamu.Text = ""
End Sub

Sub nomor()
Dim Urutan As String
    Dim Hitung As Integer
    With datamasuk.Recordset
     If .RecordCount = 0 Then
            Urutan = "RSV" & Format(Date, "YY") & Format(Date, "mm") & "001"
            txtkodereservasi.Text = Urutan
        Else
        .MoveLast
                Hitung = Val(Right(!kdreservasi, 3)) + 1
                Urutan = "RSV" & Format(Date, "YY") & Format(Date, "mm") & Right("000" & Hitung, 3)
        txtkodereservasi.Text = Urutan
        End If
      End With
End Sub


Private Sub Label1_Click()

End Sub

Private Sub Timer1_Timer()
jam.Caption = Time
End Sub

Private Sub Timer2_Timer()
Label1.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Label2.Caption = Right(Label2.Caption, Len(Label2.Caption) - 1) & Left(Label2.Caption, 1)
End Sub



5. FORM CHECK OUT


Sub kondisiawal()
txtnotrans.Enabled = False
DBkdreservasi.Enabled = False
DTmasuk.Enabled = False
Txtnmkamar.Enabled = False
Txtnmtamu.Enabled = False
txtharga.Enabled = False
DTkeluar.Enabled = False
txtlama.Enabled = False
txttotal.Enabled = False
txtppn.Enabled = False
txttotbay.Enabled = False
Txtubay.Enabled = False
Txtukem.Enabled = False
cmdsimpan.Enabled = False
cmdbatal.Enabled = False
Tanggal.Enabled = True
cmdtambah.Enabled = True
cmdclose.Enabled = True
End Sub

Sub bersih()
txtnotrans.Text = ""
DBkdreservasi.Text = ""
Txtnmkamar.Text = ""
Txtnmtamu.Text = ""
txtharga.Text = ""
txtlama.Text = ""
txtppn.Text = ""
txttotal.Text = ""
txttotbay.Text = ""
Txtubay.Text = ""
Txtukem.Text = ""
End Sub

Sub AKTIF()
DBkdreservasi.Enabled = True
DTkeluar.Enabled = True
Txtubay.Enabled = True
End Sub

Private Sub cmdBATAL_Click()
kondisiawal
End Sub

Private Sub cmdSIMPAN_Click()
Datakeluar.Recordset.AddNew
Datakeluar.Recordset!notrans = txtnotrans.Text
Datakeluar.Recordset!tgltrans = Tanggal.Caption
Datakeluar.Recordset!kdreservasi = DBkdreservasi.Text
Datakeluar.Recordset!lamainap = txtlama.Text
Datakeluar.Recordset!ppn = txtppn.Text
Datakeluar.Recordset!total = txttotal.Text
Datakeluar.Recordset!tglmasuk = DTmasuk
Datakeluar.Recordset!tglkeluar = DTkeluar
Datakeluar.Recordset!totbay = txttotbay.Text
Datakeluar.Recordset.Update
MsgBox "data tersimpan", vbInformation, "info"
bersih
kondisiawal
End Sub


Private Sub DBkdreservasi_Change()
If DBkdreservasi = Datakeluar.Recordset!kdreservasi Then
MsgBox "datareservasi sudah tersimpan"
DBkdreservasi.Text = "++PILIH KODE++"
Txtnmkamar.Text = ""
Txtnmtamu.Text = ""
txtharga.Text = ""
Else
Datamasuk.Recordset.Index = "kdreservasi"
Datamasuk.Recordset.Seek "=", DBkdreservasi.Text
If Not Datamasuk.Recordset.NoMatch Then
DTmasuk = Datamasuk.Recordset!tglmasuk
Txtnmkamar.Text = Datamasuk.Recordset!nmkamar
Txtnmtamu.Text = Datamasuk.Recordset!nmtamu
txtharga.Text = Datamasuk.Recordset!hargasewa
End If
End If
End Sub

Private Sub cmdTAMBAH_Click()
AKTIF
nomor
cmdbatal.Enabled = True
End Sub

Private Sub DTkeluar_Change()
txtlama.Text = DTkeluar - DTmasuk
txttotal.Text = txtharga * txtlama
txtppn.Text = 0.1 * txttotal.Text
txttotbay.Text = Val(txttotal.Text) + Val(txtppn.Text)
Txtubay.SetFocus
End Sub

Private Sub Form_Activate()
Tanggal = Date
bersih
kondisiawal
End Sub

Sub nomor()
Dim Urutan As String
    Dim Hitung As Integer
    With Datakeluar.Recordset
     If .RecordCount = 0 Then
            Urutan = "TRS" & Format(Date, "YY") & Format(Date, "mm") & "001"
            txtnotrans.Text = Urutan
        Else
        .MoveLast
                Hitung = Val(Right(!notrans, 3)) + 1
                Urutan = "TRS" & Format(Date, "YY") & Format(Date, "mm") & Right("000" & Hitung, 3)
        txtnotrans.Text = Urutan
        End If
      End With
End Sub



Private Sub Image2_Click()

End Sub

Private Sub Txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Val(Txtubay.Text) < Val(txttotbay.Text) Then
MsgBox "uang bayar kurang", vbExclamation, "info"
Txtubay.Text = ""
Txtukem.Text = ""
Txtubay.SetFocus
Else
Txtukem.Text = Val(Txtubay.Text) - Val(txttotbay.Text)
cmdtambah.Enabled = False
cmdclose.Enabled = False
cmdsimpan.Enabled = True
cmdbatal.Enabled = True
End If
End If
End Sub

Private Sub cmdCLOSE_Click()
p = MsgBox("Are you sure to quit..? ", vbQuestion + vbOKCancel, "Khairul Umam")
If p = vbOK Then
MsgBox "Ok See You Next Time..!", vbInformation, "Khairul Umam"
End
End If
End Sub

Private Sub Form_load()
Tanggal = Format(Date, "dddd, dd mmmm yyyy")
End Sub

Private Sub Timer1_Timer()
jam.Caption = Time
End Sub

Private Sub Timer2_Timer()
Label1.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Label2.Caption = Right(Label2.Caption, Len(Label2.Caption) - 1) & Left(Label2.Caption, 1)
End Sub

Tidak ada komentar:

Posting Komentar