Rabu, 17 Januari 2018

Program Penjualan Produk Sederhana VB.net 2013

Windows Form Baru Buat Klik kanan pada nama VB Yg dibuat (Uts01) Pilih   => Add => Windows Form => Flogin

Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class Flogin

    Private Sub Flogin_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Cblvl.DropDownStyle = ComboBoxStyle.DropDownList
        Cblvl.Items.Add("SuperAdmin")
        Cblvl.Items.Add("Admin")
        Cblvl.Items.Add("User")
        Cblvl.Items.Add("Guest")
    End Sub

    Private Sub Btnlogin_Click(sender As Object, e As EventArgs) Handles Btnlogin.Click
        Dim drLogin As SqlDataReader
        Dim CMDLogin As SqlCommand
        Dim SQL As String
        konekDB()
        SQL = "SELECT * FROM Tbl_login WHERE Id_User = '" & UCase(TxtIduser.Text) & "' " + " And pass = '" & Txtpass.Text & "'" + " and level = '" & Cblvl.Text & "'"
        CMDLogin = New SqlCommand
        CMDLogin.CommandType = CommandType.Text
        CMDLogin.Connection = konek
        CMDLogin.CommandText = SQL

        drLogin = CMDLogin.ExecuteReader()
        If drLogin.HasRows Then

            MsgBox("Selamat datang Admin")

            Me.Hide()
            FSplash.Hide()
            konek.Close()
            CMDLogin.Dispose()
            drLogin.Close()
            FHome.Show()
        Else
          
                MsgBox("Nama User atau Passsword salah", vbCritical, "Password salah")
                TxtNmUser.Focus()
            End If
    End Sub

    Private Sub Btncancel_Click(sender As Object, e As EventArgs) Handles Btnexit.Click
        Dispose()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        FAddEditLogin.Show()
    End Sub
End Class

 Windows Form Baru Buat Klik kanan pada nama VB Yg dibuat (Uts01) Pilih   => Add => Windows Forms => Buat Nama  : FPenjualan

Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class FPenjualan

    Private Property Nama_barang As Boolean

    Private Property Kode_Barang As Boolean

    Private Sub FPenjualan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DB_PT_ElyciumDataSet2.Tbl_Produksi' table. You can move, or remove it, as needed.
        Me.Tbl_ProduksiTableAdapter.Fill(Me.DB_PT_ElyciumDataSet2.Tbl_Produksi)

    End Sub

    Private Sub BtnSearchProduct_Click(sender As Object, e As EventArgs) Handles BtnSearchProduct.Click
        'TODO: This line of code loads data into the 'DB_PT_ElyciumDataSet2.Tbl_Produksi' table. You can move, or remove it, as needed.
        Me.Tbl_ProduksiTableAdapter.IsiBy(Me.DB_PT_ElyciumDataSet2.Tbl_Produksi, ComboBox1.Text)


        Me.DataGridView1.Refresh()
    End Sub

    Private Sub BtnResetProduct_Click(sender As Object, e As EventArgs) Handles BtnResetProduct.Click
        'TODO: This line of code loads data into the 'DB_PT_ElyciumDataSet2.Tbl_Produksi' table. You can move, or remove it, as needed.
        Me.Tbl_ProduksiTableAdapter.Fill(Me.DB_PT_ElyciumDataSet2.Tbl_Produksi)
        ComboBox1.Text = ""
        ComboBox2.Text = ""
        Me.DataGridView1.Refresh()
    End Sub

    Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles BtnExit.Click
        Dispose()
    End Sub
    Dim harga As Integer, total As Double
    Dim jumlah As Integer
    Dim diskon As Single
    Dim satuan As String
    Private Sub BtnOke_Click(sender As Object, e As EventArgs) Handles BtnOke.Click

        Dim baris As Integer
        With DataGridView1
            baris = .CurrentRow.Index
            LblKodeBarang.Text = .Item(0, baris).Value
            LblNamaBarang.Text = .Item(2, baris).Value
            LblNPWP.Text = .Item(3, baris).Value
            LblHargaBarang.Text = .Item(4, baris).Value.ToString
            LblDiskon.Text = .Item(5, baris).Value
            LblPPN.Text = .Item(9, baris).Value
        End With

        Me.Tbl_ProduksiTableAdapter.IsiBy(Me.DB_PT_ElyciumDataSet2.Tbl_Produksi, BtnOke.Text)
        If DataGridView1.Capture Then
            MsgBox("Anda Belum Memilih Barang")
            DataGridView1.DataSource = 0
            Exit Sub

        End If

        LblNamaPelanggan.Text = "Nama Pelanggan : " & TxtNamaPelanggan.Text
       

        LblJumlahBarang.Text = "" & TextBox1.Text & " " & satuan

        jumlah = TextBox1.Text

        Select Case jumlah
            Case Is < 5
                diskon = 0
            Case 5 To 10
                diskon = 0.15
            Case 10 To 20
                diskon = 0.15
            Case Else
                diskon = 0.2
        End Select

        MsgBox(LblHargaBarang.Text)
        harga = LblHargaBarang.Text
        total = jumlah * (harga * (1 - diskon))
        LblDiskon.Text = "Diskon : " & Format(diskon, "10 %")
        LblTotalBayar.Text = "Total Bayar : " & Format(total, "")

    End Sub

    Private Sub BtnCancel_Click(sender As Object, e As EventArgs) Handles BtnCancel.Click
        Call Bersih()
    End Sub
    Private Sub Bersih()
        LblNamaPelanggan.Text = ""
        LblKodeBarang.Text = ""
        LblNamaBarang.Text = ""
        LblNPWP.Text = ""
        LblHargaBarang.Text = ""
        LblDiskon.Text = ""
        LblJumlahBarang.Text = ""
        LblPPN.Text = ""
        LblTotalBayar.Text = ""
       
        LblNamaPelanggan.Enabled = True
        LblNamaPelanggan.Enabled = True
        LblNamaBarang.Enabled = True
        LblNPWP.Enabled = True
        LblHargaBarang.Enabled = True
        LblDiskon.Enabled = True
        LblJumlahBarang.Enabled = True
        LblPPN.Enabled = True
        LblTotalBayar.Enabled = True
        DTPTglKeluarBarang.Enabled = True
    End Sub


    Private Sub DataGridView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseClick

    End Sub


    Private Sub BtnOke_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles BtnOke.MouseClick


    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
        Fmenu.Show()
        Me.Hide()
    End Sub

    Private Sub BtnSaveDBMS_Click(sender As Object, e As EventArgs) Handles BtnSaveDBMS.Click
        Dim sqlquery As New OleDb.OleDbCommand
        Call koneksi()
        If LblKodeBarang.Text = "" Or LblNamaPelanggan.Text = "" Or LblNamaBarang.Text = "" Then
            MsgBox(" Kode_Barang , Nama_Pelanggan, Nama_Barang tidak Boleh Kosong", MsgBoxStyle.Information, vbOK)
        Else
            sqlquery.Connection = database
            sqlquery.CommandType = CommandType.Text
            sqlquery.CommandText = "insert into Tbl_DataPenjualan values('" & UCase(LblKodeBarang.Text) & "', '" & UCase(TxtNamaPelanggan.Text) & "','" & UCase(LblNamaBarang.Text) & "','" & LblNPWP.Text & "', '" & LblHargaBarang.Text & "', '" & LblDiskon.Text & "', '" & LblJumlahBarang.Text & "', '" & LblPPN.Text & "', '" & DTPTglKeluarBarang.Text & "', '" & LblTotalBayar.Text & "')"
            sqlquery.ExecuteNonQuery()
            MsgBox("Data Tersimpan")

        End If
    End Sub

    Private Sub BtnViewDataPenjualan_Click(sender As Object, e As EventArgs) Handles BtnViewDataPenjualan.Click
        FViewDataPenjualan.Show()
    End Sub
End Class




Jika Anda mau Project Penjualan Sederhana ini dan Databases SQL Server ; Silakan Kirim Pesan Ke;
Ronnyday77@gmail.com  Terimakasih

Tidak ada komentar:

Posting Komentar