Anda di halaman 1dari 27

www.

www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Aplikasi Laundry Dengan VB.Net


Membuat Database Dan Tabel-Tabel

Membuat Project dan Membuat Module


Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Module Module1

Public CONN As OleDbConnection


Public DA As OleDbDataAdapter
Public DS As DataSet
Public CMD As OleDbCommand
Public DR As OleDbDataReader

Public laporan As New ReportDocument


Public TabelLogon As
CrystalDecisions.Shared.TableLogOnInfo

Public Sub SetingLaporan()


Dim BacaTabel As
CrystalDecisions.CrystalReports.Engine.Table
For Each BacaTabel In laporan.Database.Tables
TabelLogon = BacaTabel.LogOnInfo
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

With TabelLogon.ConnectionInfo
.ServerName = Application.StartupPath &
"\DBLaundry.mdb"
.UserID = ""
.Password = ""
.DatabaseName = ""
End With
BacaTabel.ApplyLogOnInfo(TabelLogon)
Next BacaTabel
End Sub

Public Sub Koneksi()


CONN = New
OleDbConnection("provider=microsoft.jet.oledb.4.0;data
source=DBLaundry.mdb")
CONN.Open()
End Sub
End Module

Membuat Form Login

Imports System.Data.OleDb

Public Class Login

Dim Hitung As Integer = 0

Private Sub OK_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles OK.Click
Call Koneksi()
CMD = New OleDbCommand("select * from tbluser where
nama_user='" & TNama.Text & "' and pwd_user='" &
TPassword.Text & "'", CONN)
DR = CMD.ExecuteReader
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

DR.Read()
If Not DR.HasRows Then
MsgBox("Login gagal")
Hitung = Hitung + 1
If Hitung > 2 Then
End
End If
Exit Sub
Else
If TPassword.Text <> DR.Item("pwd_user") Then
MsgBox("password salah")
TPassword.Focus()
Exit Sub
End If
Me.Visible = False
MenuUtama.Show()

MenuUtama.Panel1.Text = DR.Item("kode_user")
MenuUtama.Panel2.Text = DR.Item("nama_user")
MenuUtama.Panel3.Text = DR.Item("status_user")
MenuUtama.Panel4.Text = Format(Today, "MMMM") & "
" & Format(Today, "yyyy")

If MenuUtama.Panel3.Text <> "ADMIN" Then


MenuUtama.Button1.Visible = False
MenuUtama.Button1.Visible = False
End If
End If
End Sub

Private Sub Cancel_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub

End Class

Membuat Menu Utama

3
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Membuat Form User

Imports System.Data.OleDb

Public Class User


www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Sub Kosongkan()
TextBox1.Clear()
TextBox2.Clear()
ComboBox1.Text = ""
TextBox3.Clear()
TextBox5.Clear()
TextBox1.Focus()
End Sub

Sub DataBaru()
TextBox2.Clear()
ComboBox1.Text = ""
TextBox3.Clear()
TextBox5.Clear()
TextBox2.Focus()
End Sub

Sub Ketemu()
On Error Resume Next
TextBox2.Text = DR.Item("nama_User")
ComboBox1.Text = DR.Item(2)
TextBox3.Text = DR.Item(3)
TextBox2.Focus()
End Sub

Sub TampilStatus_user()
CMD = New OleDbCommand("select distinct Status_user
from tblUser", CONN)
DR = CMD.ExecuteReader
ComboBox1.Items.Clear()
Do While DR.Read
ComboBox1.Items.Add(DR.Item("Status_user"))
Loop
End Sub

Sub TampilGrid()
DA = New OleDbDataAdapter("select * from tblUser",
CONN)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
End Sub

Sub CariKode()

5
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

CMD = New OleDbCommand("select * from tblUser where


kode_User='" & TextBox1.Text & "'", CONN)
DR = CMD.ExecuteReader
DR.Read()
End Sub

Private Sub User_Load(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles MyBase.Load
Call Koneksi()
Call Kosongkan()
Call TampilStatus_user()
Call TampilGrid()
End Sub

Private Sub TextBox1_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
TextBox1.MaxLength = 5
If e.KeyChar = Chr(13) Then
Call CariKode()
If DR.HasRows Then
Call Ketemu()
Else
Call DataBaru()
End If
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or
ComboBox1.Text = "" Or TextBox3.Text = "" Then
MsgBox("data belum lengkap")
Exit Sub
Else
Try
Call CariKode()
If Not DR.HasRows Then
Dim simpan As String = "insert into
tblUser values('" & TextBox1.Text & "','" & TextBox2.Text &
"','" & ComboBox1.Text & "','" & TextBox3.Text & "')"
CMD = New OleDbCommand(simpan, CONN)
CMD.ExecuteNonQuery()
Else
Dim edit As String = "update tblUser set
nama_User='" & TextBox2.Text & "',Status_user='" &

6
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

ComboBox1.Text & "',PWD_user='" & TextBox3.Text & "' where


kode_User='" & TextBox1.Text & "'"
CMD = New OleDbCommand(edit, CONN)
CMD.ExecuteNonQuery()
End If
Call Kosongkan()
Call TampilGrid()
Call TampilStatus_user()
Catch ex As Exception
MsgBox(ex.Message) ' jelaskan salahnya karena
apa...?
End Try
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = "" Then
MsgBox("Kode harus diisi")
TextBox1.Focus()
Exit Sub
End If

Call CariKode()
If Not DR.HasRows Then
MsgBox("Kode User tidak terdaftar")
TextBox1.Focus()
Exit Sub
End If

If MessageBox.Show("Yakin akan dihapus...?", "",


MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Dim hapus As String = "delete * from tblUser where
kode_User='" & TextBox1.Text & "'"
CMD = New OleDbCommand(hapus, CONN)
CMD.ExecuteNonQuery()
Call Kosongkan()
Call TampilGrid()
Call TampilStatus_user()
Else
Call Kosongkan()
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button3.Click
Call Kosongkan()

7
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

End Sub

Private Sub Button4_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()
End Sub

Private Sub TextBox5_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
TextBox5.TextChanged
DA = New OleDbDataAdapter("select * from tblUser where
nama_User like '%" & TextBox5.Text & "%'", CONN)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
End Sub

Private Sub DGV_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles
DGV.CellMouseClick
On Error Resume Next
TextBox1.Text = DGV.Rows(e.RowIndex).Cells(0).Value
Call CariKode()
If DR.HasRows Then
Call Ketemu()
End If
End Sub

End Class

Membuat Form Barang

8
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Imports System.Data.OleDb

Public Class Barang

Sub Kosongkan()
TextBox1.Clear()
TextBox2.Clear()
TextBox5.Clear()
TextBox1.Focus()
End Sub

Sub DataBaru()
TextBox2.Clear()
TextBox5.Clear()
TextBox2.Focus()
End Sub

Sub Ketemu()
On Error Resume Next
TextBox2.Text = DR.Item("nama_barang")
TextBox2.Focus()
End Sub

Sub TampilGrid()
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

DA = New OleDbDataAdapter("select * from tblbarang",


CONN)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
End Sub

Sub CariKode()
CMD = New OleDbCommand("select * from tblbarang where
kode_barang='" & TextBox1.Text & "'", CONN)
DR = CMD.ExecuteReader
DR.Read()
End Sub

Private Sub Barang_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
Call Koneksi()
Call kosongkan()
Call TampilGrid()
End Sub

Private Sub TextBox1_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
TextBox1.MaxLength = 5
If e.KeyChar = Chr(13) Then
Call CariKode()
If DR.HasRows Then
Call Ketemu()
Else
Call DataBaru()
End If
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("data belum lengkap")
Exit Sub
Else
Try
Call CariKode()
If Not DR.HasRows Then

10
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Dim simpan As String = "insert into


tblbarang values('" & TextBox1.Text & "','" & TextBox2.Text &
"')"
CMD = New OleDbCommand(simpan, CONN)
CMD.ExecuteNonQuery()
Else
Dim edit As String = "update tblbarang set
nama_barang='" & TextBox2.Text & "' where kode_barang='" &
TextBox1.Text & "'"
CMD = New OleDbCommand(edit, CONN)
CMD.ExecuteNonQuery()
End If
Call Kosongkan()
Call TampilGrid()

Catch ex As Exception
MsgBox(ex.Message) ' jelaskan salahnya karena
apa...?
End Try
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = "" Then
MsgBox("Kode harus diisi")
TextBox1.Focus()
Exit Sub
End If

Call CariKode()
If Not DR.HasRows Then
MsgBox("Kode barang tidak terdaftar")
TextBox1.Focus()
Exit Sub
End If

If MessageBox.Show("Yakin akan dihapus...?", "",


MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Dim hapus As String = "delete * from tblbarang
where kode_barang='" & TextBox1.Text & "'"
CMD = New OleDbCommand(hapus, CONN)
CMD.ExecuteNonQuery()
Call Kosongkan()
Call TampilGrid()
Else
Call Kosongkan()

11
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button3.Click
Call Kosongkan()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()
End Sub

Private Sub TextBox5_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
TextBox5.TextChanged
DA = New OleDbDataAdapter("select * from tblbarang
where nama_barang like '%" & TextBox5.Text & "%'", CONN)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
End Sub

Private Sub DGV_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles
DGV.CellMouseClick
On Error Resume Next
TextBox1.Text = DGV.Rows(e.RowIndex).Cells(0).Value
Call CariKode()
If DR.HasRows Then
Call Ketemu()
End If
End Sub

Private Sub TextBox3_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs)
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = vbBack) Then '0-9
e.Handled = True
End If
End Sub

Private Sub TextBox4_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs)

12
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or


e.KeyChar = vbBack) Then '0-9
e.Handled = True
End If
End Sub
End Class

Membuat Form Penerimaan Cucian

Imports System.Data.OleDb

Public Class Penerimaan

Sub Bersihkan()
txtHP.Clear()
txtNama.Clear()
txtAlamat.Clear()
txtBerat.Text = 0
LBLTotalHarga.Text = 0
txtUangMuka.Text = 0
LBLSisa.Text = 0
LBLKembali.Text = 0
DGV.Rows.Clear()
End Sub

Sub TampilBarang()
DA = New OleDbDataAdapter("select * from tblbarang",
CONN)
DS = New DataSet
DA.Fill(DS)
DGV1.DataSource = DS.Tables(0)
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

DGV1.ReadOnly = True
End Sub

Sub Nomor_TerimaOtomatis()
CMD = New OleDbCommand("select Nomor_Terima from
tblterima order by Nomor_Terima desc", CONN)
DR = CMD.ExecuteReader
DR.Read()
If Not DR.HasRows Then
LblNomor.Text = "00001"
Else
LblNomor.Text =
Format(Microsoft.VisualBasic.Left(DR.Item("Nomor_Terima"), 5)
+ 1, "00000")
End If
End Sub

Private Sub Penerimaan_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
Call Bersihkan()
Call Koneksi()
Call Nomor_TerimaOtomatis()
Call TampilBarang()
txtTanggal.Text = Today
End Sub

Private Sub DGV_CellEndEdit(ByVal sender As Object, ByVal


e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
DGV.CellEndEdit

If e.ColumnIndex = 0 Then 'kode


For barisatas As Integer = 0 To DGV.RowCount - 1
For barisbawah As Integer = barisatas + 1 To
DGV.RowCount - 1
If DGV.Rows(barisbawah).Cells(0).Value =
DGV.Rows(barisatas).Cells(0).Value Then
'MsgBox("Kode ini sudah dientri")
DGV.Rows(barisatas).Cells(2).Value =
DGV.Rows(barisatas).Cells(2).Value + 1
SendKeys.Send("{UP}")
DGV.Rows(barisbawah).Cells(0).Value =
""
Exit Sub
End If
Next
Next

14
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

CMD = New OleDbCommand("select * from tblbarang


where kode_barang='" & DGV.Rows(e.RowIndex).Cells(0).Value &
"'", CONN)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
DGV.Rows(e.RowIndex).Cells(1).Value =
DR.Item("nama_barang")
DGV.Rows(e.RowIndex).Cells(2).Value = 1
Else
MsgBox("Kode tidak terdaftar")
SendKeys.Send("{UP}")
DGV.Rows(e.RowIndex).Cells(0).Value = ""
End If
End If

Call FormatGrid()

End Sub

Sub FormatGrid()
DGV.Columns(2).DefaultCellStyle.Format = "#,###"
DGV.Columns(2).DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
End Sub

Private Sub BTNBatal_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles BTNBatal.Click
Call Bersihkan()
End Sub

Private Sub BTNTutup_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles BTNTutup.Click
Me.Close()
End Sub

Private Sub DGV_KeyPress(ByVal sender As Object, ByVal e


As System.Windows.Forms.KeyPressEventArgs) Handles
DGV.KeyPress
On Error Resume Next
If e.KeyChar = Chr(27) Then 'ESC
DGV.Rows.Remove(DGV.CurrentRow)
End If
If e.KeyChar = Chr(13) Then
txtUangMuka.Focus()
End If
End Sub

15
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Private Sub Txtuangmuka_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
txtUangMuka.KeyPress
'On Error Resume Next

If e.KeyChar = Chr(13) Then


If Val(txtUangMuka.Text) < Val(LBLTotalHarga.Text)
Then
LBLSisa.Text = Val(LBLTotalHarga.Text) -
Val(txtUangMuka.Text)
LBLKembali.Text = 0

ElseIf Val(txtUangMuka.Text) >=


Val(LBLTotalHarga.Text) Then
LBLSisa.Text = 0
LBLKembali.Text = Val(txtUangMuka.Text) -
Val(LBLTotalHarga.Text)
End If
BTNSimpan.Focus()
End If

If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or


e.KeyChar = vbBack) Then
e.Handled = True
End If
End Sub

Private Sub DGV1_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles
DGV1.CellMouseClick

Dim baris As Integer = DGV.RowCount - 1


DGV.Rows.Add(DGV1.Rows(e.RowIndex).Cells(0).Value,
DGV1.Rows(e.RowIndex).Cells(1).Value, 1)
TextBox1.Clear()
For barisatas As Integer = 0 To DGV.RowCount - 1
For barisbawah As Integer = barisatas + 1 To
DGV.RowCount - 1
If DGV.Rows(barisbawah).Cells(0).Value =
DGV.Rows(barisatas).Cells(0).Value Then
DGV.Rows(barisatas).Cells(2).Value =
DGV.Rows(barisatas).Cells(2).Value + 1
DGV.Rows.RemoveAt(barisbawah)
Exit Sub
End If

16
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Next
Next
Call FormatGrid()
TextBox1.Clear()
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
TextBox1.TextChanged
DA = New OleDbDataAdapter("select * from tblbarang
WHERE nama_barang like '%" & TextBox1.Text & "%'", CONN)
DS = New DataSet
DA.Fill(DS)
DGV1.DataSource = DS.Tables(0)
DGV1.ReadOnly = True
End Sub

Private Sub txtBerat_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
txtBerat.KeyPress
If e.KeyChar = Chr(13) Then
LBLTotalHarga.Text = Val(txtBerat.Text) * 6000 '
harga per kilo
LBLSisa.Text = LBLTotalHarga.Text
txtUangMuka.Focus()
End If

If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or


e.KeyChar = vbBack) Then
e.Handled = True
End If
End Sub

Private Sub txtHP_KeyDown(ByVal sender As Object, ByVal e


As System.Windows.Forms.KeyEventArgs) Handles txtHP.KeyDown
If e.KeyCode = Keys.Enter Then
CMD = New OleDbCommand("select * from tblterima
where nomor_hp='" & txtHP.Text & "'", CONN)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
txtNama.Text = DR.Item("nama_customer")
txtAlamat.Text = DR.Item("alamat")
txtNama.Focus()
Else
txtNama.Focus()
txtNama.Clear()

17
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

txtAlamat.Clear()
End If
End If
End Sub

Private Sub txtNama_KeyDown(ByVal sender As Object, ByVal


e As System.Windows.Forms.KeyEventArgs) Handles
txtNama.KeyDown
If e.KeyCode = Keys.Enter Then
txtAlamat.Focus()
End If
End Sub

Private Sub txtNama_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
txtNama.TextChanged
End Sub
End Class

Membuat Form Status Cucian


www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Imports System.Data.OleDb

Public Class CucianSelesai

Sub TampilCucianbelumselesai()
DGV1.Columns.Clear()
DA = New OleDbDataAdapter("select
Nomor_Terima,Tanggal_Terima,Nomor_HP,Nama_Customer,Alamat,Stat
us_Cucian from tblterima where status_Cucian='DALAM PROSES'",
CONN)
DS = New DataSet
DA.Fill(DS)
DGV1.DataSource = DS.Tables(0)
End Sub

Sub TampilCuciansudahselesai()
DA = New OleDbDataAdapter("select
Nomor_Terima,Tanggal_Terima,Nomor_HP,Nama_Customer,Alamat,Stat
us_Cucian from tblterima where status_Cucian LIKE
'%SELESAI%'", CONN)
DS = New DataSet
DA.Fill(DS)
DGV2.DataSource = DS.Tables(0)
End Sub
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Private Sub CucianSelesai_Load(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Call Koneksi()
Call TampilCucianbelumselesai()
Call TampilCuciansudahselesai()
End Sub

Private Sub BTNTutup_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs)
Me.Close()
End Sub

Private Sub DGV1_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles
DGV1.CellMouseClick
On Error Resume Next
Dim selesai As String = "update tblterima set
status_cucian='SELESAI' where nomor_terima='" &
DGV1.Rows(e.RowIndex).Cells(0).Value & "'"
CMD = New OleDbCommand(selesai, CONN)
CMD.ExecuteNonQuery()
Call TampilCucianbelumselesai()
Call TampilCuciansudahselesai()
End Sub

Private Sub DGV2_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles
DGV2.CellMouseClick
On Error Resume Next
Dim selesai As String = "update tblterima set
status_cucian='DALAM PROSES' where nomor_terima='" &
DGV2.Rows(e.RowIndex).Cells(0).Value & "'"
CMD = New OleDbCommand(selesai, CONN)
CMD.ExecuteNonQuery()
Call TampilCucianbelumselesai()
Call TampilCuciansudahselesai()
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
TextBox1.TextChanged
DA = New OleDbDataAdapter("select
Nomor_Terima,Tanggal_Terima,Nomor_HP,Nama_Customer,Alamat,Stat

20
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

us_Cucian from tblterima where nomor_terima LIKE '%" &


TextBox1.Text & "%' and status_cucian='DALAM PROSES'", CONN)
DS = New DataSet
DA.Fill(DS)
DGV1.DataSource = DS.Tables(0)

DA = New OleDbDataAdapter("select
Nomor_Terima,Tanggal_Terima,Nomor_HP,Nama_Customer,Alamat,Stat
us_Cucian from tblterima where nomor_terima LIKE '%" &
TextBox1.Text & "%' and status_cucian LIKE '%SELESAI%'", CONN)
DS = New DataSet
DA.Fill(DS)
DGV2.DataSource = DS.Tables(0)
End Sub
End Class

Membuat Form Pengambilan Cucian

Imports System.Data.OleDb

Public Class Pengambilan

Sub NomorFaktur()
CMD = New OleDbCommand("select nomor_terima from
tblterima where status_cucian='SELESAI'", CONN)
DR = CMD.ExecuteReader
ComboBox1.Items.Clear()
Do While DR.Read
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

ComboBox1.Items.Add(DR.Item(0))
Loop
End Sub

Sub Bersihkan()
ComboBox1.Text = ""
lbltotalharga.Text = 0
txtUangMuka.Text = 0
LBLSisa.Text = 0
txtHP.Clear()
txtNama.Clear()
txtAlamat.Clear()
txtBerat.Text = 0
LBLKembali.Text = 0
DGV.Columns.Clear()
End Sub

Private Sub Pengambilan_Load(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Call Koneksi()
Call NomorFaktur()
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
CMD = New OleDbCommand("select * from tblterima where
nomor_terima='" & ComboBox1.Text & "'", CONN)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
txtTanggal.Text = DR.Item("tanggal_terima")
txtHP.Text = DR.Item("nomor_hp")
txtNama.Text = DR.Item("nama_customer")
txtAlamat.Text = DR.Item("alamat")
txtBerat.Text = DR.Item("berat")
lbltotalharga.Text = DR.Item("total_harga")
txtUangMuka.Text = DR.Item("uang_muka")
LBLSisa.Text = DR.Item("sisa")
LBLKembali.Text = DR.Item("kembali")
'============= isi grid
DA = New OleDbDataAdapter("select
Nama_Barang,Jumlah_Terima from tblbarang,tbldetailterima where
tblbarang.kode_barang=tbldetailterima.kode_barang and
tbldetailterima.nomor_terima='" & ComboBox1.Text & "'", CONN)
DS = New DataSet

22
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
DGV.Columns(0).Width = 450
DGV.Columns(1).DefaultCellStyle.Format = "#,###"
DGV.Columns(1).DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
End If
End Sub

Private Sub BTNTutup_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles BTNTutup.Click
Me.Close()
End Sub

Private Sub BTNBatal_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles BTNBatal.Click
Call Bersihkan()
End Sub
End Class

Membuat Form Biaya

Imports System.Data.OleDb

Public Class Biaya


www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Sub NomorbIAYA()
CMD = New OleDbCommand("select Nomor_transaksi from
tbllabarugi order by Nomor_transaksi desc", CONN)
DR = CMD.ExecuteReader
DR.Read()
If Not DR.HasRows Then
lblnomorbiaya.Text = "00001"
Else
lblnomorbiaya.Text =
Format(Microsoft.VisualBasic.Left(DR.Item("Nomor_Transaksi"),
5) + 1, "00000")
End If
End Sub

Private Sub DGV_CellEndEdit(ByVal sender As Object, ByVal


e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
DGV.CellEndEdit
If e.ColumnIndex = 1 Then
DGV.Rows(e.RowIndex).Cells(1).Value =
UCase(DGV.Rows(e.RowIndex).Cells(1).Value)
DGV.Rows(e.RowIndex).Cells(0).Value =
TglBiaya.Text
DGV.CurrentCell = DGV(2, DGV.CurrentCell.RowIndex)
SendKeys.Send("{UP}")
End If

If e.ColumnIndex = 2 Then
DGV.CurrentCell = DGV(1, DGV.CurrentCell.RowIndex)
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button3.Click
DGV.Rows.Clear()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()
End Sub

Private Sub DGV_KeyPress(ByVal sender As Object, ByVal e


As System.Windows.Forms.KeyPressEventArgs) Handles
DGV.KeyPress
On Error Resume Next
If e.KeyChar = Chr(27) Then
DGV.Rows.Remove(DGV.CurrentRow)

24
www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

End If
End Sub

Private Sub Biaya_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
Call Koneksi()
Call NomorbIAYA()
End Sub
End Class

Membuat Laporan Penerimaan Cucian


www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Membuat Laporan Biaya


www.
www.belajarvb.
belajarvb.net
Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

Membuat Laporan Laba Rugi

Anda mungkin juga menyukai