Monday, June 1, 2015

UAS KONSEP PEMROGRAMAN TSI B

Form untuk Sales Order Mc Donalds Indonesia.
Terdapat 6 Form,
1. Form untuk Login.
2. Form utama untuk mengakses beberapa form lainnya.
3. Form untuk melakukan input order.
4. Form untuk mengetahui promo apa yang sedang berlaku.
5. Form untuk hasil cetak dari input order.
6. Form menu makanan yang tersedia.


Form untuk Login.

Username yang digunakan bebas, sesuai dengan nama masing-masing pegawai yang sedang bertugas,
tapi Password yang digunakan harus sesuai, untuk memastikan tidak ada yang bisa mengakses aplikasi ini kecuali mereka yang memiliki wewenang untuk membukanya.

Button reset di bagian atas digunakan untuk mengosongkan text box username dan textbox password. Button reset menggunakan procedur, bisa dilihat secara lengkap pada source code dibawah ini.



Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox2.Text = "mcdindonesia" Then
            Form1.Show()
            Me.Hide()
        End If
    End Sub

    Sub bersih()
        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Call bersih()
    End Sub
End Class


Form utama yang dapat terakses jika memasukan Password yang sesuai.
Form ini digunakan untuk mengakses beberapa form lainnya.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form3.Show()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form4.Show()

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.Close()
        Form3.Close()
        Form4.Close()
        Form2.Close()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Form6.Show()
    End Sub
End Class




Form untuk menginput order.
Form ini akan terakses bila menekan button Order di form utama sebelumnya.

Waktu pemesanan menggunakan coding while, for, dan array.
Nama admin yang melayani customer akan langsung tercetak sesuai username yang diisikan saat login tadi. 
Selanjutnya, mengisi data data yang diperlukan seperti nama, alamat, no telp, email, dll.
Memasukkan order, menu sudah ada di combo box sehingga tinggal dipilih saja.
Saat memilih menu, harga makanan tersebut akan langsung muncul di sampingnya,
jangan lupa pula masukkan beapa banyak yang ingin dibeli, setelah memasukkan bilangannya,
akan langsung keluar nominal total dari satu/beberapa items yang tadi kita pilih.

Dalam perhitungan subtotal dan total, saya menggunakan coding function.
Di form ini digunakan juga coding select case dan if serta elseif.


Public Class Form3

   
    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label25.Text = Form2.TextBox1.Text

        For a = 1 To 31
            ComboBox1.Items.Add(a)
        Next

        Dim b As Integer
        b = 2013
        While b <= 2016
            ComboBox3.Items.Add(b)
            b = b + 1
        End While

        Dim bulan() As String = {"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Agustus", "September", "Oktober", "November", "Desember"}
        ComboBox2.Items.Add(bulan(0))
        ComboBox2.Items.Add(bulan(1))
        ComboBox2.Items.Add(bulan(2))
        ComboBox2.Items.Add(bulan(3))
        ComboBox2.Items.Add(bulan(4))
        ComboBox2.Items.Add(bulan(5))
        ComboBox2.Items.Add(bulan(6))
        ComboBox2.Items.Add(bulan(7))
        ComboBox2.Items.Add(bulan(8))
        ComboBox2.Items.Add(bulan(9))
        ComboBox2.Items.Add(bulan(10))
        ComboBox2.Items.Add(bulan(11))
    End Sub

    Dim yeyeye As String

    Private Sub cmborder2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmborder2.LostFocus
        yeyeye = cmborder1.Text
        Select Case yeyeye
            Case "Double Cheese Burger"
                lblharga2.Text = "35000"
            Case "Cheese Burger"
                lblharga2.Text = "30000"
            Case "Chicken Burger with Cheese"
                lblharga2.Text = "40000"
            Case "PaNas Special"
                lblharga2.Text = "30000"
            Case "PaNas"
                lblharga2.Text = "27000"
        End Select

        If cmborder2.Text = "Double Cheese Burger" Then
            lblharga2.Text = "35000"
        ElseIf cmborder2.Text = "Cheese Burger" Then
            lblharga2.Text = "30000"
        ElseIf cmborder2.Text = "Chicken Burger with Cheese" Then
            lblharga2.Text = "40000"
        ElseIf cmborder2.Text = "McNuggets" Then
            lblharga2.Text = "25000"
        ElseIf cmborder2.Text = "PaNas Special" Then
            lblharga2.Text = "30000"
        ElseIf cmborder2.Text = "PaNas" Then
            lblharga2.Text = "27000"
        End If
    End Sub

    Private Sub cmborder1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmborder1.LostFocus
        If cmborder1.Text = "Double Cheese Burger" Then
            lblharga1.Text = "35000"
        ElseIf cmborder1.Text = "Cheese Burger" Then
            lblharga1.Text = "30000"
        ElseIf cmborder1.Text = "Chicken Burger with Cheese" Then
            lblharga1.Text = "40000"
        ElseIf cmborder1.Text = "McNuggets" Then
            lblharga1.Text = "25000"
        ElseIf cmborder1.Text = "PaNas Special" Then
            lblharga1.Text = "30000"
        ElseIf cmborder1.Text = "PaNas" Then
            lblharga1.Text = "27000"
        End If

    End Sub

    Function hitung(ByVal harga, ByVal qty)
        hitung = harga * qty
    End Function


    Private Sub txtqty1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtqty1.TextChanged
        lblsub1.Text = hitung(lblharga1.Text, txtqty1.Text)
    End Sub

    Private Sub txtqty2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtqty2.TextChanged
        lblsub2.Text = hitung(lblharga2.Text, txtqty2.Text)

    End Sub

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click

        If TextBox1.Text = "ulangtahun" Then
            TextBox2.Text = 10 / 100 * (Val(lblsub1.Text) + Val(lblsub2.Text))
        ElseIf TextBox1.Text = "kejutanjuni" Then
            TextBox2.Text = 15 / 100 * (Val(lblsub1.Text) + Val(lblsub2.Text))
        End If

        Label17.Text = (Val(lblsub1.Text) + Val(lblsub2.Text)) - TextBox2.Text
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form5.Show()
        Me.Hide()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Hide()
    End Sub
End Class



Ada promo dari Mc Donald Indonesia, untuk keterangan lebih lanjut tentang promo bisa memilih button Info Promo pada form utama, terlebih dahulu tekanlah button Back pada form ini.


Jika sudah memasukkan kode kupon, maka tekan button Proses. Dan keluarlah total yang harus dibayarkan. Setelah itu klik tombol Print untuk mencetak hasil input order di form ini.



Form hasil input order / Form print.
Saat tadi kita menekan button print, maka data data di form input order tadi langsung tercetak di form prnt ini. Dan siap untuk dicetak.

Public Class Form5

    Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtadmin.Text = Form3.Label25.Text
        txtnama.Text = Form3.txtnama.Text
        txtpesanan.Text = Form3.cmborder1.Text
        txtpesanan2.Text = Form3.cmborder2.Text
        txttanggal.Text = Date.Now
        txttekp.Text = Form3.txttelp.Text
        txtqty.Text = Form3.txtqty1.Text
        txtqty2.Text = Form3.txtqty2.Text
        txtsub.Text = Form3.lblsub1.Text
        txtsub2.Text = Form3.lblsub2.Text
        TextBox2.Text = Form3.TextBox2.Text
        TextBox1.Text = (Val(txtsub.Text) + Val(txtsub2.Text)) - TextBox2.Text
    End Sub
End Class



Form Menu.
Form ini digunakan untuk melihat varian menu dan harga yang disediakan oleh Mcd Indonesia.

Public Class Form4

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub
End Class