Anda di halaman 1dari 7

Program Cashier Hotel

A. Membuat Design Form awal


Membuat design 2 form sebagai berikut:
Design 1

Mengubah properties form sebagai berikut:


No.
1

Objek
Solution Explorer
Form1

Properti
Name
Name

Label1
Label2
Label3
Label4
Label5
DateTimePicker1
ComboBox1
ComboBox2

Text
Text
Text
Text
Text
Value
Text
Collections
Collections

Combobox3

Collections

Button1
Button2
ProgressBar1

Text
Text
Max Value

Nilai Properti
Tugas2ProkomHote
l
Cashier1
RIYNU HOTEL
Tanggal
Jam
Shift
Cashier
Today
Masukkan Jam
0 to 23
Shift 1 08.00-16.00
Shift 2 16.00-24.00
Shift 3 00.00-08.00
Riyan Nugroho
Ilham Akbar Surya
Ahmad Ridhoni
Confirm
Next
50

Design 2

Mengubah properties form sebagai berikut:


No.
1

Objek
Solution Explorer
Form1

Properti
Name
Name

Nilai Properti
Tugas2ProkomHote
l
Cashier2
Lama Menginap
Tipe Kamar
Harga Sewa Perhari
Biaya Sewa Kamar
Jumlah Bayar
Kembali

Label1
Label2
Label3
Label4
Label5
Label6
Label7

Text
Text
Text
Text
Text
Text
Text

Label8

Text

RIYNU HOTEL

ComboBox2

Collections

Button1
Button2

Text
Text

Standard Room
Deluxe Room
Presidential Room
Hitung
Keluar

By: + + Cashier
.ComboBox3.Text

B. Memasukkan Coding Pada Event


Coding Form Cashier1.vb
1. Event Form Cashier1
Private Sub Cashier_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Dim i As Integer
For i = 0 To 23
Coding
di atas digunakan untuk menambahkan Collections pada Cashier1.ComboBox1
ComboBox1.Items.Add(i)
2. Event
Button1
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim var_a As String
var_a = ComboBox1.Text
If var_a >= 8 And var_a < 16 Then
Me.ComboBox2.Text = "Shift I 08.00-16.00"
ElseIf var_a > 16 Then
Me.ComboBox2.Text = "Shift II 16.00-24.00"
ElseIf var_a < 8 Then
Me.ComboBox2.Text = "Shift III 00.00-08.00"
End If
If Me.ComboBox2.Text = "Shift I 08.00-16.00" Then
Me.ComboBox3.Text = "Riyan Nugroho"
ElseIf Me.ComboBox2.Text = "Shift II 16.00-24.00" Then
Me.ComboBox3.Text = "Ilham Akbar Surya"
ElseIf Me.ComboBox2.Text = "Shift III 00.00-08.00" Then
Me.ComboBox3.Text = "Ahmad Ridhoni"
End If

Coding Untuk mengisi


ComboBox2 Secara
Otomatis dengan mengisi
ComboBox1 Secara
Manual

Coding untuk
mengisi
ComboBox3
Secara otomatis
setelah
ComboBox2

Label6.Text = "Selamat datang, yang bertugas pada" + " " + DateTimePicker1.Value


Coding
mengisi
sesuai
+ " " + ComboBox2.Text
+ " untuk
" + "adalah"
+ Label6
" " + ComboBox3.Text
DateTimePicker1, ComboBox2 dan
End Sub

ComboBox3

3. Event Button2
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
For i = 0 To 50
ProgressBar1.Value = i
If ProgressBar1.Value = 50 Then
Cashier2.Show()
End If
Coding untuk menampilkan Form Cashier2 dengan klik
Next
End Sub
Button2

Coding Form Cashier2.vb


1. Event TextBox2, TextBox3, TextBox4, dan TextBox5
Untuk merubah format angka menjadi format mata uang (Currency) Rupiah.
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
Dim j As Long
If TextBox2.Text = "" Or Not IsNumeric(TextBox2.Text) Then
Exit Sub
End If
j = TextBox2.Text
TextBox2.Text = Format(j, "Rp, ##,##0")
TextBox2.SelectionStart = Len(TextBox2.Text)
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox3.TextChanged
Dim k As Long
If TextBox3.Text = "" Or Not IsNumeric(TextBox3.Text) Then
Exit Sub
End If
k = TextBox3.Text
TextBox3.Text = Format(k, "Rp, ##,##0")
TextBox3.SelectionStart = Len(TextBox3.Text)
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox4.TextChanged
Dim l As Long
If TextBox4.Text = "" Or Not IsNumeric(TextBox4.Text) Then
Exit Sub
End If
l = TextBox4.Text
TextBox4.Text = Format(l, "Rp, ##,##0")
TextBox4.SelectionStart = Len(TextBox4.Text)
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox5.TextChanged
Dim m As Long
If TextBox5.Text = "" Or Not IsNumeric(TextBox5.Text) Then
Exit Sub
End If
m = TextBox5.Text
TextBox5.Text = Format(m, "Rp, ##,##0")
TextBox5.SelectionStart = Len(TextBox5.Text)
End Sub

2. Event ComboBox1, coding untuk mengisi TextBox2 sesuai collections ComboBox1


Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If Me.ComboBox1.Text = "Standard Room" Then
Me.TextBox2.Text = "280000"
ElseIf Me.ComboBox1.Text = "Deluxe Room" Then
Me.TextBox2.Text = "360000"
ElseIf Me.ComboBox1.Text = "Presidential Room" Then
Me.TextBox2.Text = "560000"
End If
End Sub

3. Event form Cashier2


Untuk menampilkan text label6 sesuai dengan ComboBox3 pada form Cashier1
.

Private Sub Cashier2_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Label7.Text = "By:" + " " + Cashier1.ComboBox3.Text
End Sub

4. Event Button1
Untuk menentukan harga sewa kamar perhari, menghitung biaya sewa kamar dan
kembali.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim var_a, var_b, var_c, var_D, var_E As Single
var_a = TextBox1.Text
var_b = TextBox2.Text
var_c = var_a * var_b
var_D = TextBox4.Text
var_E = var_D - var_c
TextBox3.Text = var_c
TextBox5.Text = var_E
End Sub

5. Event Button2
Untuk menutup jendela form cashier2
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Me.Close()
End Sub

C. Design Form Akhir

D. Debugging Aplikasi
1.Pada UI form Cashier1, isi textbox Tanggal dan Jam kemudian klik button Confirm.
Setelah diklik maka akan muncul Label6, Shift dan nama Cashier seperti di bawah ini:

2. Kemudian klik button Next untuk membuka form Cashier2

3. Masukkan data Lama Menginap, Tipe Kamar dan Jumlah Bayar,

lalu klik button Hitung maka akan muncul hasil Biaya Sewa Kamar dan Kembali

Anda mungkin juga menyukai