Thursday, April 26, 2018

TUGAS UTS PEMROGRAMAN I 


1.Deskripsi Aplikasi

    Aplikasi Penghitungan biaya cuci mobil dan resto, yang dimana aplikasi ini digunakan untuk membayar dan menghitung pesanan customer.

Biaya Mobil : Jika jenis mobil mini bus maka  Rp. 15000
                       Jika jenis mobil bus maka Rp.25000
dan seterusnya


Biaya Tambahan (Boleh Dipilih atau Tidak)
                             Cuci Kolong : 10000
                             Cuci Mesin   : 15000
                             Cuci Polish   : 20000

Makanan / Minuman (Boleh dipilih atau Tidak)
                                   Nasi Goreng Rp. 17000
                                   Nasi Goreng Special Rp 21000
                                   Mie Goreng Rp. 16000
                                   Jus Jeruk Rp. 10000
                                   Minuman Dingin Rp.5000
Total Bayar :

Biaya Cuci + Total Biaya Tambah + Total Biaya Makan

Bayar : Masukan Uang pembayaran

Kembalian : (Didapat setelah menekan tombol enter)


2. Data Input, Proses ,Output 

    Data Input     : Jenis Mobil, Control, Makanan/Minuman, biaya cuci, biaya tambahan
    Proses           : Hitung, Reset
    Data Output  : Total Biaya 



3.Screenshoot dan Form


















4. Source Code


 Dim i As Integer
        makan = New CheckBox() {makan1, makan2, makan3, makan4, makan5}
        txtmakan = New TextBox() {txtmakan1, txtmakan2, txtmakan3, txtmakan4, txtmakan5}
        txtjumlah = New TextBox() {txtjumlah1, txtjumlah2, txtjumlah3, txtjumlah4, txtjumlah5}
        tambah = New CheckBox() {tambah1, tambah2, tambah3}
        txttambah = New TextBox() {txttambah1, txttambah2, txttambah3}

        For i = 0 To 4
            txtmakan(i).Text = "Rp. " & Format(hargamakan(i), "#,#.##")

        Next

        For i = 0 To 2
            txttambah(i).Text = "Rp. " & Format(hargatambah(i), "#,#.##")

        Next
        bycuci = 0

    End Sub

    Private Sub jenis1_CheckedChanged(sender As Object, e As EventArgs) Handles jenis1.CheckedChanged
        bycuci = 15000
        TxtByCuci.Text = "Rp. " & Format(bycuci, "#,#.##")
        myimage.Image = My.Resources.minibus
    End Sub

    Private Sub jenis2_CheckedChanged(sender As Object, e As EventArgs) Handles jenis2.CheckedChanged
        bycuci = 25000
        TxtByCuci.Text = "Rp. " & Format(bycuci, "#,#.##")
        myimage.Image = My.Resources.bus
    End Sub

    Private Sub jenis3_CheckedChanged(sender As Object, e As EventArgs) Handles jenis3.CheckedChanged
        bycuci = 30000
        TxtByCuci.Text = "Rp. " & Format(bycuci, "#,#.##")
        myimage.Image = My.Resources.truck
    End Sub

    Private Sub jenis4_CheckedChanged(sender As Object, e As EventArgs) Handles jenis4.CheckedChanged
        bycuci = 50000
        TxtByCuci.Text = "Rp. " & Format(bycuci, "#,#.##")
        myimage.Image = My.Resources.Car_wash
    End Sub

    Private Sub btnhitung_Click(sender As Object, e As EventArgs) Handles btnhitung.Click
        Dim i As Integer
        totmakan = 0
        tottambah = 0
        For i = 0 To 2
            If tambah(i).Checked Then
                tottambah = tottambah + hargatambah(i)
            End If
        Next
        For i = 0 To 4
            If makan(i).Checked Then
                totmakan = totmakan + (hargamakan(i) * Val(txtjumlah(i).Text))
            End If
        Next
        total = bycuci + tottambah + totmakan
        txttotal.Text = "Rp. " & Format(total, "#,#.##")
    End Sub

    Private Sub txtbayar_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtbayar.KeyPress
        If e.KeyChar = Chr(13) Then
            kembali = Val(txtbayar.Text) - total
            txtkembali.Text = "Rp. " & Format(kembali, "#,#.##")
        End If
    End Sub

    Private Sub btnreset_Click(sender As Object, e As EventArgs) Handles btnreset.Click
        Dim i As Integer
        For i = 0 To 4
            makan(i).Checked = False
        Next
        For i = 0 To 4
            txtjumlah(i).Text = 0
        Next
        For i = 0 To 2
            tambah(i).Checked = False
        Next
        txttotal.Clear()
        txtbayar.Clear()
        txtkembali.Clear()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnWord.Click
        Dim wordapp As New word.Application
        Dim Doku As word.Document
        Doku = wordapp.Documents.Open("C:\Users\AKBAR\Documents\Visual Studio 2013\Projects\WindowsApplication7\Primary.docx")
        Doku.Bookmarks("TotalBiaya").Select()
        wordapp.Selection.TypeText(txttotal.Text)
        Doku.Bookmarks("Bayar").Select()
        wordapp.Selection.TypeText(txtbayar.Text)
        Doku.Bookmarks("Kembali").Select()
        wordapp.Selection.TypeText(txtkembali.Text)
        Doku.SaveAs("D:\Data Output\Word\Struks.docx")

        MsgBox("Your Receipt Has Been Printed", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "Information")
        wordapp.Visible = True

    End Sub

    Private Sub btnExcel_Click(sender As Object, e As EventArgs) Handles btnExcel.Click
        Dim AppExcelnya As New excel.Application
        Dim ExcelWB As excel.Workbook
        ExcelWB = AppExcelnya.Workbooks.Open("C:\Users\AKBAR\Documents\Visual Studio 2013\Projects\WindowsApplication7\Secondary.xlsx")
        AppExcelnya.Range("C1").Value = txttotal.Text
        AppExcelnya.Range("C3").Value = txtbayar.Text
        AppExcelnya.Range("C5").Value = txtkembali.Text
        ExcelWB.SaveAs("D:\Data Output\Excel\Databasi.xlsx")

        MsgBox("Your Data Has Been Saved", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "Information")
        AppExcelnya.Visible = True
    End Sub
End Class







No comments:

Post a Comment