SOURCODE PROGRAM HOTEL DI VISUAL BASIC 6.0

FORM LOGIN

  KODE PROGRAM FORM LOGIN:

Private Sub cmdcancel_Click()
Unload Me
End Sub

Private Sub cmdok_Click()
If txtSERVER.Text = “SERVER” And txtusername.Text = “MARDIYANTO” And txtpassworduser.Text = “1” Then
MsgBox “Selamat Anda dapat melanjutkan!!!”, vbOKOnly
frmSplash.Show
frmlogin.Hide
Else
MsgBox “Nama dan password yang anda masukan salah!! Anda Pasti Pencuri ya !!.”, vbInformation
bersih
End If
End Sub
Private Sub bersih()
txtSERVER.Text = “SERVER”
txtusername.Text = “MARDIYANTO”
txtpassworduser.Text = “”
End Sub

Private Sub Form_Load()
bersih
End Sub
Private Sub txtpassworduser_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdok.SetFocus
End If
End Sub

FORM SPLASHE


KODE PROGRAM:

Option Explicit
Dim iSplash As Integer

Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
End Sub
Private Sub Frame1_Click()
Unload Me
End Sub

Private Sub Timer1_Timer()
On Error Resume Next
iSplash = iSplash + 1
prghotel.Value = prghotel.Value + 1000 / 1000
If iSplash > 100 Then
Timer1.Enabled = False
Screen.MousePointer = vbNormal
Me.WindowState = 0
Do
Me.Left = Me.Left + 3000
Me.Move Me.Left, Me.Top
DoEvents
Loop Until Me.Left > Screen.Width
Load frmmenu
frmmenu.Show
frmmenu.SetFocus
Unload Me
End If
End Sub

FORM MENU

   KODE PROGRAM:

Private Sub mnuexit_Click()
PSN = MsgBox(“ANDA YAKIN MAU KELUAR?”, vbCritical + vbYesNo, “PESAN”)
If PSN = vbYes Then
Unload Me
End If
End Sub

Private Sub mnujasa_Click()
frmjasa.Show
End Sub

Private Sub mnukamar_Click()
frmkamar.Show
End Sub

Private Sub mnulaporantamu_Click()
Form1.Show
End Sub

Private Sub mnutamu_Click()
frmtamu.Show
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If Button.Index = 1 Then
frmtamu.Show
ElseIf Button.Index = 2 Then
frmkamar.Show
ElseIf Button.Index = 3 Then
frmjasa.Show
ElseIf Button.Index = 4 Then
PSN = MsgBox(“ANDA YAKIN MAU KELUAR?”, vbQuestion + vbYesNo, “PESAN”)
If PSN = vbYes Then
Unload Me
End If
End If
End Sub

FORM TAMU

KODE PROGRAM:
Private Sub cmdtutup_Click()
PSN = MsgBox(“ANDA YAKIN MAU KELUAR?”, vbQuestion + vbYesNo, “PESAN”)
If PSN = vbYes Then
Unload Me
End If
End Sub
Private Sub Command1_Click()
txtkodetamu.Text = “”
txtnamatamu.Text = “”
txtnoidentitas = “”
txtnotelp.Text = “”
txtalamat.Text = “”
Command2.Enabled = True
txtkodetamu.SetFocus
Dim A As String
Dim B As String
Dim C As String
Dim D As String
Dim E As String
Dim F As String
Dim G As String
Dim H As String
Dim I As String
Dim J As String

A = Random
B = Random
C = Random
D = Random
E = Random
F = Random
G = Random
H = Random
I = Random
J = Random

txtkodetamu.Text = A + B + C + D + E + F + G + H + I + J
End Sub

Function RandomNum() As Integer
RandomNum = Int((9 – 1 + 1) * Rnd + 1)
End Function

Function RandomChar() As String
Dim Char As Integer
Char = Int((26 – 1 + 1) * Rnd + 1)
If Char = 1 Then RandomChar = “1”: Exit Function
If Char = 2 Then RandomChar = “B”: Exit Function
If Char = 3 Then RandomChar = “3”: Exit Function
If Char = 4 Then RandomChar = “2”: Exit Function
If Char = 5 Then RandomChar = “E”: Exit Function
If Char = 6 Then RandomChar = “8”: Exit Function
If Char = 7 Then RandomChar = “0”: Exit Function
If Char = 8 Then RandomChar = “7”: Exit Function
If Char = 9 Then RandomChar = “I”: Exit Function
If Char = 10 Then RandomChar = “J”: Exit Function
If Char = 11 Then RandomChar = “4”: Exit Function
If Char = 12 Then RandomChar = “9”: Exit Function
If Char = 13 Then RandomChar = “M”: Exit Function
If Char = 14 Then RandomChar = “N”: Exit Function
If Char = 15 Then RandomChar = “O”: Exit Function
If Char = 16 Then RandomChar = “P”: Exit Function
If Char = 17 Then RandomChar = “6”: Exit Function
If Char = 18 Then RandomChar = “R”: Exit Function
If Char = 19 Then RandomChar = “S”: Exit Function
If Char = 20 Then RandomChar = “T”: Exit Function
If Char = 21 Then RandomChar = “U”: Exit Function
If Char = 22 Then RandomChar = “V”: Exit Function
If Char = 23 Then RandomChar = “5”: Exit Function
If Char = 24 Then RandomChar = “X”: Exit Function
If Char = 25 Then RandomChar = “Y”: Exit Function
If Char = 26 Then RandomChar = “Z”: Exit Function
End Function

Function Random() As Variant
Dim Randm As Integer
Randm = Int((3 – 1 + 1) * Rnd + 1)
If Randm = 1 Then
Random = RandomNum
Else
Random = RandomChar
End If
End Function

Private Sub Command10_Click()
Form1.Show
End Sub

Private Sub Command2_Click()
With Data1.Recordset
.AddNew
.Fields(“kodetamu”) = txtkodetamu.Text
.Fields(“namatamu”) = txtnamatamu.Text
.Fields(“no”) = txtnoidentitas.Text
.Fields(“telpone”) = txtnotelp.Text
.Fields(“alamat”) = txtalamat.Text
.Update
End With
Command2.Enabled = False
Command1.SetFocus
End Sub

Private Sub Command3_Click()
If Command3.Caption = “&Edit” Then
txtkodetamu.SetFocus
Command3.Caption = “&Ok”
Else
With Data1.Recordset
.Edit
.Fields(“kodetamu”) = txtkodetamu.Text
.Fields(“namatamu”) = txtnamatamu.Text
.Fields(“no”) = txtnoidentitas.Text
.Fields(“telpone”) = txtnotelp.Text
.Fields(“alamat”) = txtalamat.Text
.Update
End With
Command3.Caption = “&Edit”
End If
End Sub

Private Sub Command4_Click()
A = MsgBox(“benar data mau di hapus…??”, vbYesNo, “PERINGATAN…!!!”)
If A = 6 Then
Data1.Recordset.Delete
End If
End Sub

Private Sub Command5_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MoveFirst
txtkodetamu.Text = .Fields(“kodetamu”)
txtnamatamu.Text = .Fields(“namatamu”)
txtnoidentitas.Text = .Fields(“no”)
txtnotelp.Text = .Fields(“telpone”)
txtalamat.Text = .Fields(“alamat”)
End If
End With
End Sub

Private Sub Command6_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MovePrevious
If .BOF Then
.MoveFirst
End If
txtkodetamu.Text = .Fields(“kodetamu”)
txtnamatamu.Text = .Fields(“namatamu”)
txtnoidentitas.Text = .Fields(“no”)
txtnotelp.Text = .Fields(“telpone”)
txtalamat.Text = .Fields(“alamat”)
End If
End With
End Sub

Private Sub Command7_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MoveNext
If .EOF Then
.MoveLast
End If
txtkodetamu.Text = .Fields(“kodetamu”)
txtnamatamu.Text = .Fields(“namatamu”)
txtnoidentitas.Text = .Fields(“no”)
txtnotelp.Text = .Fields(“telpone”)
txtalamat.Text = .Fields(“alamat”)
End If
End With
End Sub

Private Sub Command8_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MoveLast
txtkodetamu.Text = .Fields(“kodetamu”)
txtnamatamu.Text = .Fields(“namatamu”)
txtnoidentitas.Text = .Fields(“no”)
txtnotelp.Text = .Fields(“telpone”)
txtalamat.Text = .Fields(“alamat”)
End If
End With
End Sub

Private Sub Command9_Click()
With Data1.Recordset
.Index = “namatamu”
.Seek “=”, Text1.Text
If .NoMatch Then
MsgBox “data gak ada..men ??”
Text1.SetFocus
Else
txtkodetamu.Text = .Fields(“kodetamu”)
txtnamatamu.Text = .Fields(“namatamu”)
txtnoidentitas.Text = .Fields(“no”)
txtnotelp.Text = .Fields(“telpone”)
txtalamat.Text = .Fields(“alamat”)
Command3.Enabled = True
Command3.SetFocus
End If
End With
End Sub
Private Sub Form_Activate()
txtkodetamu.Text = “”
txtnamatamu.Text = “”
txtnoidentitas = “”
txtnotelp.Text = “”
txtalamat.Text = “”
Text1.Text = “”
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
Command1.SetFocus
End Sub
Private Sub txtnamatamu_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
With Data1.Recordset
.Index = “namatamu”
.Seek “=”, txtnamatamu.Text
If .NoMatch Then
txtnamatamu.SetFocus
Else
MsgBox “data gak ada..men ??”
txtnamatamu.SetFocus
End If
End With
End If
End Sub

FORM KAMAR

KODE PROGRAM:

Private Sub cmdtutup_Click()
PSN = MsgBox(“ANDA YAKIN MAU KELUAR?”, vbQuestion + vbYesNo, “PESAN”)
If PSN = vbYes Then
Unload Me
End If
End Sub

Private Sub CMDHAPUS_Click()
Data1.Recordset.Delete
End Sub

Private Sub CMDSIMPAN_Click()
Data1.Recordset.AddNew
End Sub

Private Sub Form_Load()
cbojeniskamar.AddItem “utama-1”
cbojeniskamar.AddItem “utama-2”
cbojeniskamar.AddItem “utama-3”
cbojeniskamar.AddItem “kelas-1”
cbojeniskamar.AddItem “kelas-2”
cbojeniskamar.AddItem “kelas-3”

cbonokamar.AddItem “2”
cbonokamar.AddItem “3”
cbonokamar.AddItem “4”
cbonokamar.AddItem “5”
cbonokamar.AddItem “9”
cbonokamar.AddItem “20”
cbonokamar.AddItem “21”
cbonokamar.AddItem “22”
cbonokamar.AddItem “23”
cbonokamar.AddItem “24”
cbonokamar.AddItem “25”
cbonokamar.AddItem “26”
cbonokamar.AddItem “27”
cbonokamar.AddItem “28”
cbonokamar.AddItem “29”
cbonokamar.AddItem “30”
cbonokamar.AddItem “31”
cbonokamar.AddItem “32”
cbonokamar.AddItem “33”
cbonokamar.AddItem “34”
cbonokamar.AddItem “35”
cbonokamar.AddItem “36”
cbonokamar.AddItem “37”
cbonokamar.AddItem “38”
cbonokamar.AddItem “39”

cbolantai.AddItem “I”
cbolantai.AddItem “II”
cbolantai.AddItem “III”

cbofasilitas.AddItem “televisi + 4 single bed”
cbofasilitas.AddItem “televisi + double + single spring bed”
cbofasilitas.AddItem “televisi + 3 single bed”
cbofasilitas.AddItem “2 single bed”
cbofasilitas.AddItem “single + double spring bed”
cbofasilitas.AddItem “2 single bed”
cbofasilitas.AddItem “3 single bed”
cbofasilitas.AddItem “double + single bed”

cbotarif.AddItem “150000”
cbotarif.AddItem “130000”
cbotarif.AddItem “110000”
cbotarif.AddItem “100000”
cbotarif.AddItem “90000”
cbotarif.AddItem “70000”
End Sub

Private Sub bersih()
cbonokamar.Text = “”
cbojeniskamar.Text = “”
cbolantai.Text = “”
cbofasilitas.Text = “”
cbotarif.Text = “”

End Sub

Private Sub CMDBERSIH_Click()
bersih
End Sub

FORM JASA

KODE PROGRAM:
Private Sub cmdtutup_Click()
PSN = MsgBox(“ANDA YAKIN MAU KELUAR?”, vbQuestion + vbYesNo, “PESAN”)
If PSN = vbYes Then
Unload Me
End If
End Sub

Private Sub CMDHAPUS_Click()
M = MsgBox(“Benar anda akan menghapus data ini??”, vbYesNo, “peringatan..!!”)
If M = 6 Then
Data1.Recordset.Delete
End If
End Sub

Private Sub CMDSIMPAN_Click()
txtkodejasa.Text = “”
txtnamajasa.Text = “”
txtsatuan.Text = “”
txtharga.Text = “”
Command1.Enabled = True
txtkodejasa.SetFocus
Dim A As String
Dim B As String
Dim C As String
Dim D As String
Dim E As String
Dim F As String
Dim G As String
Dim H As String
Dim I As String
Dim J As String

A = Random
B = Random
C = Random
D = Random
E = Random
F = Random
G = Random
H = Random
I = Random
J = Random

txtkodejasa.Text = A + B + C + D + E + F + G + H + I + J
End Sub

Function RandomNum() As Integer
RandomNum = Int((9 – 1 + 1) * Rnd + 1)
End Function

Function RandomChar() As String
Dim Char As Integer
Char = Int((26 – 1 + 1) * Rnd + 1)
If Char = 1 Then RandomChar = “1”: Exit Function
If Char = 2 Then RandomChar = “2”: Exit Function
If Char = 3 Then RandomChar = “3”: Exit Function
If Char = 4 Then RandomChar = “4”: Exit Function
If Char = 5 Then RandomChar = “5”: Exit Function
If Char = 6 Then RandomChar = “6”: Exit Function
If Char = 7 Then RandomChar = “7”: Exit Function
If Char = 8 Then RandomChar = “8”: Exit Function
If Char = 9 Then RandomChar = “9”: Exit Function
If Char = 10 Then RandomChar = “0”: Exit Function
If Char = 11 Then RandomChar = “A”: Exit Function
If Char = 12 Then RandomChar = “B”: Exit Function
If Char = 13 Then RandomChar = “C”: Exit Function
If Char = 14 Then RandomChar = “D”: Exit Function
If Char = 15 Then RandomChar = “E”: Exit Function
If Char = 16 Then RandomChar = “F”: Exit Function
If Char = 17 Then RandomChar = “G”: Exit Function
If Char = 18 Then RandomChar = “R”: Exit Function
If Char = 19 Then RandomChar = “H”: Exit Function
If Char = 20 Then RandomChar = “T”: Exit Function
If Char = 21 Then RandomChar = “U”: Exit Function
If Char = 22 Then RandomChar = “V”: Exit Function
If Char = 23 Then RandomChar = “W”: Exit Function
If Char = 24 Then RandomChar = “X”: Exit Function
If Char = 25 Then RandomChar = “Y”: Exit Function
If Char = 26 Then RandomChar = “Z”: Exit Function
End Function

Function Random() As Variant
Dim Randm As Integer
Randm = Int((3 – 1 + 1) * Rnd + 1)
If Randm = 1 Then
Random = RandomNum
Else
Random = RandomChar
End If
End Function
Private Sub bersih()
txtkodejasa.Text = “”
txtnamajasa.Text = “”
txtsatuan.Text = “”
txtharga.Text = “”
End Sub

Private Sub CMDBERSIH_Click()
bersih
End Sub

Private Sub Command1_Click()
With Data1.Recordset
.AddNew
.Fields(“KODE_JASA”) = txtkodejasa.Text
.Fields(“NAMA_JASA”) = txtnamajasa.Text
.Fields(“SATUAN”) = txtsatuan.Text
.Fields(“HARGA”) = txtharga.Text
.Update
End With
Command1.Enabled = False
cmdsimpan.SetFocus
End Sub

Private Sub Command2_Click()
If Command2.Caption = “&Edit” Then
txtkodejasa.SetFocus
Command2.Caption = “&Ok”
Else
With Data1.Recordset
.Edit
.Fields(“KODE_JASA”) = txtkodejasa.Text
.Fields(“NAMA_JASA”) = txtnamajasa.Text
.Fields(“SATUAN”) = txtsatuan.Text
.Fields(“HARGA”) = txtharga.Text
.Update
End With
Command2.Caption = “&Edit”
End If
End Sub

Private Sub Command3_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MoveFirst
txtkodejasa.Text = .Fields(“KODE_JASA”)
txtnamajasa.Text = .Fields(“NAMA_JASA”)
txtsatuan.Text = .Fields(“SATUAN”)
txtharga.Text = .Fields(“HARGA”)
End If
End With
End Sub

Private Sub Command4_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MovePrevious
If .BOF Then
.MoveFirst
End If
txtkodejasa.Text = .Fields(“KODE_JASA”)
txtnamajasa.Text = .Fields(“NAMA_JASA”)
txtsatuan.Text = .Fields(“SATUAN”)
txtharga.Text = .Fields(“HARGA”)
End If
End With
End Sub

Private Sub Command5_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MoveNext
If .EOF Then
.MoveLast
End If
txtkodejasa.Text = .Fields(“KODE_JASA”)
txtnamajasa.Text = .Fields(“NAMA_JASA”)
txtsatuan.Text = .Fields(“SATUAN”)
txtharga.Text = .Fields(“HARGA”)
End If
End With
End Sub

Private Sub Command6_Click()
With Data1.Recordset
If .RecordCount <> 0 Then
.MoveLast
txtkodejasa.Text = .Fields(“KODE_JASA”)
txtnamajasa.Text = .Fields(“NAMA_JASA”)
txtsatuan.Text = .Fields(“SATUAN”)
txtharga.Text = .Fields(“HARGA”)
End If
End With
End Sub
Private Sub Form_Activate()
txtkodejasa.Text = “”
txtnamajasa.Text = “”
txtsatuan.Text = “”
txtharga.Text = “”
cmdsimpan.Enabled = True
Command1.Enabled = False
Command2.Enabled = True
cmdsimpan.SetFocus
End Sub
Private Sub txtnamajasa_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
With Data1.Recordset
.Index = “NAMA_JASA”
.Seek “=”, txtnamajasa.Text
If .NoMatch Then
txtkodejasa.SetFocus
Else
MsgBox “data gak ada..men ??”
txtnamajasa.SetFocus
End If
End With
End If
End Sub

FORM LAPORAN

KODE PROGRAM :

Private Sub Form_Activate()
Dim X As Integer
With frmtamu.Data1.Recordset
If frmtamu.Data1.Recordset.RecordCount = 0 Then
X = MsgBox(“data belum ada “, vbYesNo, “informasi”)
Else
frmtamu.Font = “ARIAL”
.MoveFirst
Form1.FontBold = True
Form1.FontBold = 16
Form1.Print Tab(2); “hotel barung kuring”
Form1.Print Tab(2); “hari “; Format(Date, “DDDD,DD MMMM YYYY”)
Form1.FontBold = True
Form1.FontSize = 10
Form1.Font = “Verdana”
Form1.ForeColor = HHH
Form1.Print
MGrs = String$(95, “,”)
Form1.Print MGrs
Form1.Print Tab(2); “kodetamu”
Form1.Print Tab(20); “namatamu”
Form1.Print Tab(45); “no”
Form1.Print Tab(75); “telpone”
Form1.Print Tab(85); “alamat”
Form1.Print MGrs
Form1.FontBold = False
For X = 1 To .RecordCount
Form1.Print Tab(2); .Fields(“kodetamu”)
Form1.Print Tab(20); .Fields(“namatamu”)
Form1.Print Tab(45); .Fields(“no”)
Form1.Print Tab(75); .Fields(“telpone”)
Form1.Print Tab(85); .Fields(“alamat”)
.MoveNext
Next X
Form1.Print MGrs
Form1.Print Tab(2); “mengetahui”
Form1.Print Tab(2); “kepala hotel”
Form1.Print
Form1.Print
Form1.Print Tab(2); “mardiyanto”
End If
End With
End Sub

Oleh onexcore

Tinggalkan komentar