Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Lampiran 1: Struktur Organiasi PT. Purinusa Ekapersada Bawen – Semarang
Lampiran 2: Source Code Dalam Setiap Form
Kode Program 1 Kode Program untuk Module
Imports System.DataImports System.Data.OleDbModule Module1
Public isi As StringPublic TabData() As ArrayPublic cn As OleDbConnectionPublic cmd As OleDbCommandPublic da As OleDbDataAdapterPublic brsrec As New BindingSourcePublic ds As DataSetPublic str As StringPublic dt As DataTable
Sub koneksi()str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &System.Environment.CurrentDirectory.ToString() & _
"\PuriReminder.mdb"cn = New OleDbConnection(str)
If cn.State = ConnectionState.Closed Thencn.Open()
End If
End Sub
End Module
Kode Program 2 Kode Program untuk Form LoginPublic Class F_Login
Private Sub F_Login_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
TextUser.PasswordChar = ""TextPass.PasswordChar = "*"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButCancel.ClickMe.Close()
End Sub
Private Sub ButOK_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButOK.Click
If Me.TextUser.Text = "purchasing" And Me.TextPass.Text = "system" ThenMsgBox("Login Berhasil")
F_Tampil.Show()Call bersih()
ElseMsgBox("Terjadi Kesalahan")
End If
End Sub
Sub bersih()TextUser.Text = ""TextPass.Text = ""
End SubPrivate Sub TextPass_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextPass.TextChangedDim pass As String
pass = Me.TextPass.PasswordChar
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles PictureBox1.Click
End SubEnd Class
Kode Program 3 Kode program untuk Form TampilPublic Class F_Tampil
Private Sub F_Tampil_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
Timer1.Enabled = TrueEnd Sub
Private Sub ButSJ_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButSJ.Click
F_SJ.Show()End Sub
Private Sub ButPO_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButTghn.Click
F_Faktur.Show()End Sub
Private Sub ButTghn_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButPO.Click
F_PO.Show()End Sub
Private Sub ButAlrm_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButAlrm.Click
F_Alarm.Show()End Sub
Private Sub ButSup_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButSup.Click
F_Pemasok.Show()End Sub
Private Sub ButBrg_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButBrg.Click
F_Barang.Show()End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Timer1.Tick
Label7.Text = Now.ToString("hh:mm:ss tt")Label8.Text = Format(Now, "dddd, dd-MMMM-yyyy")
End Sub
End Class
Kode Program 4 Kode Program untuk Form Surat JalanImports System.DataImports System.Data.OleDbPublic Class F_SJ
Sub bersih()TextSJ.Text = ""DTP_SJ.Text = ""
End Sub
Private Sub ButView_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButCancel.Clickbersih()
End Sub
Private Sub ButCancel_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButNext.Click
F_PO.TextSJ.Text = Me.TextSJ.TextF_PO.TextTgl.Text = Me.DTP_SJ.Text
F_PO.Show()
End SubEnd Class
Kode Program 5 Kode Program untuk Form PO Belum Terpenuhi
Imports System.DataImports System.Data.OleDbPublic Class F_PO
Inherits System.Windows.Forms.FormDim brs As Integer = 0Dim Jml_Baris As IntegerDim StrCari As StringDim i As IntegerPrivate Sub F_PO_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.LoadCall koneksi()Call listview()Call nampil()TextCari.MaxLength = 8TextCari.Text = ""
End SubSub nampil()
'tambahkan syarat where no faktur yang kosong pada perintah select berikutini
Dim sql1 = "SELECT T_DetailPO.No_PO, T_DetailPO.ID_Material,T_Barang.Nama_Material, T_DetailPO.QTY,T_DetailPO.No_Faktur,T_PO.ID_Vendor,T_SUPPLIER.NAMA_VENDOR " & _
"FROM T_DetailPO, T_Barang, T_PO, T_SupplieR "& _"WHERE T_DetailPO.No_PO=t_po.NO_PO AND
T_DetailPO.ID_Material=T_Barang.id_Material ANDT_PO.ID_Vendor=T_SUPPLIER.ID_VENDOR " & _" AND (t_DetailPO.No_Faktur Is Null) "
da = New Data.OleDb.OleDbDataAdapter(sql1, cn)dt = New DataTableda.Fill(dt)
For i As Integer = 0 To dt.Rows.Count - 1With ListView1
.Items.Add(dt.Rows(i)("No_PO"))With .Items(.Items.Count - 1).SubItems
.Add(dt.Rows(i)("ID_Material"))
.Add(dt.Rows(i)("Nama_Material"))
.Add(dt.Rows(i)("QTY"))
.Add(dt.Rows(i)("ID_VENDOR"))
.Add(dt.Rows(i)("NAMA_VENDOR"))End With
End WithNext
End Sub
Private Sub ButOK_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButOK.Click
Dim j As IntegerDim itemnya(5) As StringDim ItemList As ListViewItemj = 0For i As Integer = 0 To dt.Rows.Count - 1
'MsgBox(ListView1.Items.Item(i).SubItems(0).Text &ListView1.Items.Item(i).Selected)
If ListView1.Items.Item(i).Selected Thenitemnya(0) = ListView1.Items.Item(i).SubItems(0).Textitemnya(1) = ListView1.Items.Item(i).SubItems(1).Textitemnya(2) = ListView1.Items.Item(i).SubItems(2).Textitemnya(3) = ListView1.Items.Item(i).SubItems(3).Textitemnya(4) = ListView1.Items.Item(i).SubItems(3).Textitemnya(5) = "0"
ItemList = New ListViewItem(itemnya)F_Faktur.ListView1.Items.Add(ItemList)F_Faktur.TextVend.Text = ListView1.Items.Item(i).SubItems(5).TextF_Faktur.TextTIDVENDOR.Text =
ListView1.Items.Item(i).SubItems(4).TextF_Faktur.TextSJ.Text = Me.TextSJ.TextF_Faktur.TextTGLSJ.Text = Me.TextTgl.Text
End IfNextF_Faktur.Show()
End Sub
Sub listview()Me.ListView1.View = View.DetailsMe.ListView1.GridLines = TrueMe.ListView1.FullRowSelect = True
ListView1.Columns.Add("No PO", 100, HorizontalAlignment.Center)ListView1.Columns.Add("ID", 100, HorizontalAlignment.Center)ListView1.Columns.Add("Material", 100, HorizontalAlignment.Center)ListView1.Columns.Add("QTY", 100, HorizontalAlignment.Center)ListView1.Columns.Add("idVENDOR", 1, HorizontalAlignment.Center)ListView1.Columns.Add("VENDOR", 1, HorizontalAlignment.Center)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click
Dim kriteria As StringDim urut As IntegerDim ketemu As Boolean
kriteria = InputBox _("Masukkan PO yang akan dicari (1 karakter)")If kriteria = "" Then Exit Sub
ketemu = Falseurut = 0
For i = 2 To 0 Step -1'If TabData(i).IsFixedSize = kriteria Then
MsgBox("data '" & kriteria & _"' ditemukan setelah dibalik" &Chr(13) & _"berada pada urutan ke-" & urut + 1 & "", _
vbInformation)ketemu = True
F_Faktur.TextSJ.Text = Me.TextSJ.TextF_Faktur.TextVend.Text = Me.TextPengirim.TextF_Faktur.Show()'End If
urut = urut + 1Next iIf ketemu = False Then
MsgBox("Data " & kriteria & " tidak ditemukan", _vbCritical)
ElseExit Sub
End If
End Sub
Private Sub ButUbah_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButUbah.ClickListView1.SelectedItems(0).SubItems(3).Text = Me.Txt_No_Faktur.TextListView1.SelectedItems(0).SubItems(4).Text= Me.Txt_QTY_Faktur.TextListView1.SelectedItems(0).SubItems(5).Text= Me.Txt_Harga_Faktur.Text
End Sub
Private Sub ListView1_Click(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles ListView1.Click
If ListView1.SelectedItems.Count > 0 Then
End IfEnd Sub
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
If ListView1.SelectedItems.Count > 0 ThenMe.Txt_No_Faktur.Text = ListView1.SelectedItems(0).SubItems(0).TextMe.Txt_QTY_Faktur.Text = ListView1.SelectedItems(0).SubItems(0).TextMe.Txt_Harga_Faktur.Text = ListView1.SelectedItems(0).SubItems(0).TextMe.TextPengirim.Text = ListView1.SelectedItems(0).SubItems(5).Text
End IfEnd Sub
End Class
Kode Program 6 Kode Program untuk Form FakturImports System.DataImports System.Data.OleDbPublic Class F_Faktur
Inherits System.Windows.Forms.FormDim indeks As Byte = 0Private Jml_Data As Byte = 3Dim kode As StringDim Jml_Baris As Integer = 0Dim faktur() As StringDim SJ() As StringDim vendor() As StringDim wkt() As DateTimePicker
Private Sub F_Faktur_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
Call koneksi()Call hitung()
End SubSub hitung()
da = New Data.OleDb.OleDbDataAdapter("Select * From T_Barang", cn)ds = New DataSetda.Fill(ds)
Jml_Baris = ds.Tables(0).Rows.CountEnd Sub
Private Sub ButSave_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButSave.Click
TryCall koneksi()
da = New OleDbDataAdapter("Select * From T_SJ where No_SJ like '" & TextSJ.Text &"%'", cn)
Dim sj As New DataTablesj.Clear()da.Fill(sj)
If sj.Rows.Count = Nothing Then'simpan sjDim StrSimpanSJ As String = "Insert into T_SJ(No_SJ,Tgl_SJ) values
(" & _"'" & Me.TextSJ.Text & "'," & _"#" &CDate(Me.TextTGLSJ.Text) & "# " & _")"
Dim com_simpan As New OleDbCommandcom_simpan.Connection = cncom_simpan.CommandType = CommandType.Textcom_simpan.CommandText = StrSimpanSJcom_simpan.ExecuteNonQuery()
MsgBox("Berhasil Menyimpan Surat Jalan")
'simpan fakturDim StrSimpan As String = "Insert into T_FAKTUR(No_Faktur,
No_SJ,Tgl_Jth_Temp) values (" & _"'" & Me.TextFakt.Text & "', " & _"'" & Me.TextSJ.Text & "'," & _"#" &CDate(Me.DT_Temp.Text) & "# " & _")"Dim com_simpanf As New OleDbCommandcom_simpanf.Connection = cncom_simpanf.CommandType = CommandType.Textcom_simpanf.CommandText = StrSimpancom_simpanf.ExecuteNonQuery()
MsgBox("Berhasil Menyimpan Faktur")
'simpan detailPODim i As IntegerDim nofaktur As StringDim qtyfaktur As StringDim hrgfaktur As StringDim nopo As StringDim idmaterial As String
nofaktur = Me.TextFakt.TextFor i = 0 To Me.ListView1.Items.Count - 1
nopo = ListView1.Items.Item(i).SubItems(0).Textidmaterial = ListView1.Items.Item(i).SubItems(1).Textqtyfaktur = ListView1.Items.Item(i).SubItems(3).Texthrgfaktur = ListView1.Items.Item(i).SubItems(4).Text
Dim StrSimpanDF As String = "update T_DetailPO SET no_faktur='" & nofaktur & "' , qty_faktur= " & qtyfaktur & " , hrg_faktur=" & hrgfaktur &" " & _
"where no_po=" & CLng(nopo) & " and id_material=" &CLng(idmaterial) & " "
Dim com_simpanDF As New OleDbCommandcom_simpanDF.Connection = cncom_simpanDF.CommandType = CommandType.Textcom_simpanDF.CommandText = StrSimpanDFcom_simpanDF.ExecuteNonQuery()
Next
MsgBox("Berhasil Menyimpan detil faktur")
ElseMsgBox("No Surat Jalan Sudah Ada")
End IfCatch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Attention")End TryCall bersih()
End SubSub insert()
TextSJ.Text = ""Me.DT_Temp.Text = ""
End Sub
Private Sub ButCancel_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButCancel.Click
Call bersih()End SubSub bersih()
TextFakt.Text = ""TextSJ.Text = ""TextVend.Text = ""DT_Temp.Text = ""
End Sub
Private Sub ListView1_Click(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles ListView1.Click
If ListView1.SelectedItems.Count > 0 Then
End IfEnd Sub
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
If ListView1.SelectedItems.Count > 0 Then'MsgBox(ListView1.SelectedItems(0).SubItems(0).Text & "-" &ListView1.SelectedItems(0).SubItems(1).Text)
Me.txt_hrgsatfaktur.Text = ListView1.SelectedItems(0).SubItems(5).TextMe.txt_qtyfaktur.Text = ListView1.SelectedItems(0).SubItems(4).Text
End If'Close()
End SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ClickIf indeks > Jml_Data - 1 Then
MsgBox("List Sudah Penuh")Else
faktur(indeks) = TextFakt.TextSJ(indeks) = TextSJ.Textvendor(indeks) = TextVend.Text'wkt(indeks) = DT_Temp.Text
TextFakt.Text = ""indeks = indeks + 1
End IfEnd Sub
Private Sub BtnUbahItemFaktur_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles BtnUbahItemFaktur.ClickListView1.SelectedItems(0).SubItems(5).Text = Me.txt_hrgsatfaktur.TextListView1.SelectedItems(0).SubItems(4).Text = Me.txt_qtyfaktur.Text
End SubEnd Class
Kode Program 7 Kode Program untuk Form AlarmImports System.DataImports System.Data.OleDb'logika alarm'cek saat ini tgl brp'jika saat ini lebih dari tgl 25 bulan lalu atau kurang dari sama dengan tgl 10 mk' ambil dr tabel t_faktur utk tgl_jth_temp yg lebih dari tgl 25 bulan lalu ataukurang dari tgl 10 dan detilpo yg sdh berisi no_faktur'jika saat ini lebih dari tgl 10 dan kurang dari sama dengan tgl 25 mk' ambil dr tabel t_faktur utk tgl_jth_temp yg lebih dari tgl 10 dan kurang daritgl 25 dan detilpo yg sdh berisi no_faktur'tampilkan data nya di listview!
Public Class F_AlarmInherits System.Windows.Forms.FormDim TotalTenthDetik, TotalDetik, TentDetik, detik As IntegerDim sekarang As Date
Private Sub F_Alarm_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
Call koneksi()Call nampil()Call listview()Timer2.Enabled = TrueTimer1.Enabled = True
End Sub' ==============Setting Alarm===========================
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Timer2.Tick
Label1.Text = Format(Now, "dddd, dd-MMMM-yyyy")End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Timer1.Tick
'TotalTenthDetik = TotalTenthDetik + 1'TentDetik = TotalTenthDetik Mod 10'TotalDetik = Int(TotalTenthDetik / 10)'detik = TotalDetik Mod 60'If Len(detik) = 1 Then' detik = "0" & detik'End IfIf Date.Today > sekarang Then
nampil()End If
End Sub
Private Sub ButStart_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButStart.Click
'insalansi total sepersuluh detikTotalTenthDetik = -1Timer1.Enabled = True
'If ListView1.SelectedItems("Tgl_Jth_Temp") > Label1.Text Then'End If'Timer1.Enabled = True
End Sub
Private Sub ButStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles ButStop.Click
Timer1.Enabled = Not Timer1.Enabled
End SubSub nampil()
Dim BlnSkrg As Integer = Month(Now())Dim thnskrg As Integer = Year(Now())Dim tgl10Skrg As Date = CDate(Format("dd MMMM yyyy", "10 " &
MonthName(BlnSkrg) & " " & thnskrg))Dim tgl25Skrg As Date = CDate(Format("dd MMMM yyyy", "25 " &
MonthName(BlnSkrg) & " " & thnskrg))Dim tgl25Lalu As Date = DateAdd(DateInterval.Month, -1, CDate(Format("dd
MMMM yyyy", "25 " & MonthName(BlnSkrg) & " " & thnskrg)))
Dim Skrg As Date = Date.TodayDim HrSkrg As Integer = Skrg.DayDim strFaktur As String
'jika saat ini lebih dari tgl 25 bulan lalu atau kurang dari sama dengantgl 10 mk
If Date.Today > tgl25Lalu And Date.Today <= tgl10Skrg ThenstrFaktur = ("SELECT T_Faktur.No_Faktur, T_Faktur.Tgl_Jth_Temp " & _" FROM T_Faktur, T_DetailPO " & _"WHERE T_Faktur.No_Faktur=t_detailpo.no_faktur " & _" AND T_Faktur.tgl_jth_temp between #" & tgl25Lalu & "# and #" & tgl10Skrg & "#group by T_Faktur.No_Faktur, T_Faktur.Tgl_Jth_Temp")
ElseIf Date.Today > tgl10Skrg And Date.Today <= tgl25Skrg Then 'jika saat inilebih dari tgl 10 dan kurang dari sama dengan tgl 25 mkstrFaktur = ("SELECT T_Faktur.No_Faktur, T_Faktur.Tgl_Jth_Temp " & _
" FROM T_Faktur, T_DetailPO " & _"WHERE T_Faktur.No_Faktur=t_detailpo.no_faktur " & _" AND T_Faktur.tgl_jth_temp between #" & tgl10Skrg & "# AND #" & tgl25Skrg
& "# group by T_Faktur.No_Faktur, T_Faktur.Tgl_Jth_Temp")
End If
da = New Data.OleDb.OleDbDataAdapter(strFaktur, cn)dt = New DataTableda.Fill(dt)
For i As Integer = 0 To dt.Rows.Count - 1With ListView1
.Items.Add(dt.Rows(i)("No_Faktur"))With .Items(.Items.Count - 1).SubItems
.Add(dt.Rows(i)("Tgl_Jth_Temp"))End With
End WithNext
End SubSub listview()
Me.ListView1.View = View.DetailsMe.ListView1.GridLines = TrueMe.ListView1.FullRowSelect = True
ListView1.Columns.Add("No Faktur", 100, HorizontalAlignment.Center)ListView1.Columns.Add("Tgl Jatuh Tempo", 100, HorizontalAlignment.Center)
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Label2.Click
'label2 = Detik & ":" & TentDetik&""End Sub
End Class
Kode Program 8 Kode Program untuk Fom SupplierImports System.DataImports System.Data.OleDbPublic Class F_Pemasok
Inherits System.Windows.Forms.FormDim Jml_Baris As Integer = 0Dim brs As Integer
Private Sub F_Pemasok_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
Call koneksi()Call nampil()Call hitung()ButSave.Enabled = FalseTextID.MaxLength = 7TextID.Text = ""
End SubSub nampil()
da = New Data.OleDb.OleDbDataAdapter("Select * From T_Supplier order byNama_Vendor", cn)ds = New DataSetda.Fill(ds)
Dim sup As New DataTablesup.Clear()da.Fill(sup)
DGVPemasok.DataSource = supTry
TextID.Text = ds.Tables(0).Rows(brs).Item(0)TextNama.Text = ds.Tables(0).Rows(brs).Item(1)TextAlamat.Text = ds.Tables(0).Rows(brs).Item(2)TextKota.Text = ds.Tables(0).Rows(brs).Item(3)TextPos.Text = ds.Tables(0).Rows(brs).Item(4)TextTlp.Text = ds.Tables(0).Rows(brs).Item(5)TextFax.Text = ds.Tables(0).Rows(brs).Item(6)TextMail.Text = ds.Tables(0).Rows(brs).Item(7)
Catch ex As Exception
End TryEnd SubSub hitung()
da = New Data.OleDb.OleDbDataAdapter("Select * From T_Supplier", cn)ds = New DataSetda.Fill(ds)
Jml_Baris = ds.Tables(0).Rows.CountEnd SubSub tampilteks()
TextID.Text = ds.Tables(0).Rows(brs).Item(0)TextNama.Text = ds.Tables(0).Rows(brs).Item(1)TextAlamat.Text = ds.Tables(0).Rows(brs).Item(2)TextKota.Text = ds.Tables(0).Rows(brs).Item(3)TextPos.Text = ds.Tables(0).Rows(brs).Item(4)TextTlp.Text = ds.Tables(0).Rows(brs).Item(5)TextFax.Text = ds.Tables(0).Rows(brs).Item(6)TextMail.Text = ds.Tables(0).Rows(brs).Item(7)
End SubSub hidup()
TextID.ReadOnly = FalseTextAlamat.ReadOnly = FalseTextKota.ReadOnly = FalseTextPos.ReadOnly = FalseTextTlp.ReadOnly = FalseTextFax.ReadOnly = FalseTextMail.ReadOnly = FalseTextCari.ReadOnly = False
End SubSub mati()
TextID.ReadOnly = TrueTextAlamat.ReadOnly = TrueTextKota.ReadOnly = TrueTextPos.ReadOnly = TrueTextTlp.ReadOnly = TrueTextCari.ReadOnly = TrueTextMail.ReadOnly = True
End SubPrivate Sub ButCari_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ButCari.ClickIf Me.TextCari.Text = "" Then
MsgBox("Isi Kata Kunci Pencarian")Me.TextCari.Focus()
Exit SubEnd IfTry
If RDB_ID.Checked = True Thenda = New OleDbDataAdapter("Select * From T_Supplier where ID_Vendor like '" &TextCari.Text & "%'", cn)
Elseda = New OleDbDataAdapter("Select * From T_Supplier where Nama_Vendor like '" &TextCari.Text & "%'", cn)
End Ifdt = New DataTableda.Fill(dt)
If dt.Rows.Count = Nothing ThenMsgBox("Kata Kunci yang Anda Cari Tidak Ditemukan", MsgBoxStyle.Information,"Attention")Me.TextCari.Clear()Me.TextCari.Focus()
Exit Sub'Else
' TextID.Text = ds.Tables(0).Rows(brs).Item(0)'TextNama.Text = ds.Tables(0).Rows(brs).Item(1)'TextAlamat.Text = ds.Tables(0).Rows(brs).Item(2)'TextKota.Text = ds.Tables(0).Rows(brs).Item(3)
'TextPos.Text = ds.Tables(0).Rows(brs).Item(4)'TextTlp.Text = ds.Tables(0).Rows(brs).Item(5)'TextFax.Text = ds.Tables(0).Rows(brs).Item(6)'TextMail.Text = ds.Tables(0).Rows(brs).Item(7)
End IfDGVPemasok.DataSource = dt
ds = New DataSetda.Fill(ds)
Catch ex As ExceptionMsgBox(ex.Message, MsgBoxStyle.Information, "Attention")
End TryEnd Sub
Private Sub ButIns_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButIns.Click
Call bersih()Call koneksi()
hidup()ButEdt.Enabled = FalseButDelt.Enabled = FalseButSave.Enabled = True
End SubSub bersih()
TextID.Text = ""TextNama.Text = ""TextAlamat.Text = ""TextKota.Text = ""TextPos.Text = ""TextTlp.Text = ""TextFax.Text = ""TextMail.Text = ""TextCari.Text = ""
End Sub
Private Sub ButEdt_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButEdt.Click
ButEdt.Visible = TrueGroupBox1.Visible = TrueMe.ButEdt.Text = "OK"Me.ButEdt.ForeColor = Color.CornflowerBlueIf Me.TextID.Text = "" Then
MsgBox("Kode Vendor Belum Terisi")Me.TextID.Focus()
Exit SubEnd IfDim ComUpdate As New OleDbCommandDim StrUpdate As StringStrUpdate = "Update T_Supplier Set" & _"Nama_Vendor= '" & Me.TextNama.Text & "'," & _"Alamat = '" & Me.TextAlamat.Text & "'," & _"Kota = '" & Me.TextKota.Text & "'," & _"Kode_Pos = '" & Me.TextPos.Text & "'," & _"No_Tlp = '" & Me.TextTlp.Text & "'," & _"No_Fax = '" & Me.TextFax.Text & "'," & _"Email = '" & Me.TextMail.Text & "'," & _"Where ID_Vendor= '" & Me.TextID.Text & "'"
ComUpdate.Connection = cnda.SelectCommand.CommandText = StrUpdate
da.SelectCommand.ExecuteNonQuery()dt.Clear()da.Fill(ds)
Call hitung()Call bersih()
MsgBox("Data Berhasil Diupdate")Me.ButEdt.Text = "Edit"Me.ButEdt.ForeColor = Color.BlueViolet
Me.TextCari.Focus()GroupBox1.Visible = False
End SubSub ambildata()
da = New Data.OleDb.OleDbDataAdapter("Select * From T_Supplier order byNama_Vendor", cn)ds = New DataSetda.Fill(ds)
Jml_Baris = ds.Tables(0).Rows.CountDGVPemasok.DataSource = ds
End Sub
Private Sub ButSave_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButSave.Click
Tryda = New OleDbDataAdapter("Select * from T_Supplier where ID_Vendor like '" &TextID.Text & "%'", cn)
Dim vendor As New DataTablevendor.Clear()da.Fill(vendor)
If vendor.Rows.Count = Nothing ThenDim StrSimpan As String = "Insert into T_Supplier values(" & _"'" & Me.TextID.Text & "', " & _"'" & Me.TextNama.Text & "', " & _"'" & Me.TextAlamat.Text & "', " & _"'" & Me.TextKota.Text & "', " & _"'" & Me.TextPos.Text & "', " & _"'" & Me.TextTlp.Text & "'," & _"'" & Me.TextFax.Text & "'," & _"'" & Me.TextMail.Text & "') "Dim com_simpan As New OleDbCommandcom_simpan.Connection = cncom_simpan.CommandType = CommandType.Textcom_simpan.CommandText = StrSimpancom_simpan.ExecuteNonQuery()
MsgBox("Data Berhasil di simpan")Else
MsgBox("ID Vendor Sudah Ada")End If
Catch ex As ExceptionMsgBox(ex.Message, MsgBoxStyle.Information, "Attention")
'Call ambildata()Call hitung()Call bersih()GroupBox1.Visible = False
End Trymati()
ButSave.Enabled = FalseButEdt.Enabled = TrueButDelt.Enabled = True
End Sub
Private Sub ButClose_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButClose.ClickMe.Close()
End Sub
Private Sub ButDelt_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButDelt.Click
If TextCari.Text = "" ThenMsgBox("Kode Vendor Belum Terisi")TextCari.Focus()
Exit SubEnd IfTry
If MessageBox.Show("Yakin akan dihapus?", "", MessageBoxButtons.YesNo)= Windows.Forms.DialogResult.Yes Then
Dim ComDelt As New OleDbCommandComDelt.Connection = cnComDelt.CommandText = "Delete from T_Supplier where ID_Vendor =" &
_"'" & TextID.Text & "'"
ComDelt.ExecuteNonQuery()If Me.DGVPemasok.Visible = False ThenElse
Me.DGVPemasok.Visible = TrueEnd If
Me.TextID.Focus()Call bersih()Call hitung()
MsgBox("Data Berhasil Dihapus")End If
Catch ex As Exception
MsgBox(ex.ToString())End Try
End Sub
Private Sub DGVPemasok_Click(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles DGVPemasok.Click
ButIns.Enabled = FalseButSave.Enabled = FalseButEdt.Enabled = TrueButDelt.Enabled = TrueTry
brs = DGVPemasok.CurrentCell.RowIndextampilteks()
Catch ex As ExceptionMsgBox(ex.ToString())
End TryEnd Sub
Private Sub ButCancel_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButCancel.Click
Call bersih()End Sub
End Class
Kode Program 9 Kode Program untuk Form BarangImports System.DataImports System.Data.OleDbPublic Class F_Barang
Dim baris As IntegerDim brs As Integer = 0Dim StrCari As StringPrivate Sub F_Barang_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.LoadCall koneksi()Call tampil()Call hitung()ButSave.Enabled = FalseTxtID.MaxLength = 8TxtID.Text = ""TxtNama.Text = ""
End SubSub tampil()
'Jml_Baris()'TxtID.Text = ds.Tables(0).Rows(brs).Item(0)'TxtNama.Text = ds.Tables(0).Rows(brs).Item(1)
da = New Data.OleDb.OleDbDataAdapter("Select * From T_Barang order byID_Material", cn)ds = New DataSetda.Fill(ds)
Dim sup As New DataTablesup.Clear()da.Fill(sup)
DGVBrg.DataSource = supTry
TxtID.Text = ds.Tables(0).Rows(brs).Item(0)TxtNama.Text = ds.Tables(0).Rows(brs).Item(1)DGVBrg.AlternatingRowsDefaultCellStyle.BackColor = Color.AliceBlue
Catch ex As Exception
End Try
End SubSub hitung()
da = New Data.OleDb.OleDbDataAdapter("Select * From T_Barang", cn)ds = New DataSetda.Fill(ds)brs = ds.Tables(0).Rows.Count
End SubSub hidup()
TxtID.ReadOnly = FalseTxtNama.ReadOnly = False
End SubSub mati()
TxtID.ReadOnly = TrueTxtNama.ReadOnly = True
End SubSub bersih()
TxtID.Text = ""TxtNama.Text = ""
End SubPrivate Sub ButInsert_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ButInsert.ClickButSave.Enabled = TrueButSearch.Enabled = FalseCall bersih()'Call koneksi()
End Sub
Private Sub ButSave_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButSave.Click
If TxtID.Text = "" Or TxtNama.Text = "" ThenMsgBox("Data Belum Lengkap")
Exit SubEnd IfTry
da = New OleDbDataAdapter("Select * from T_Barang where ID_Material like '" &TxtID.Text & "%'", cn)
Dim barang As New DataTablebarang.Clear()da.Fill(barang)
If barang.Rows.Count = Nothing ThenDim StrSimpan As String = "Insert into T_Barang values(" & _"'" & Me.TxtID.Text & "', " & _"'" & Me.TxtNama.Text & "')"Dim com_simpan As New OleDbCommandcom_simpan.Connection = cncom_simpan.CommandType = CommandType.Textcom_simpan.CommandText = StrSimpancom_simpan.ExecuteNonQuery()
MsgBox("Data Berhasil di Simpan")Else
MsgBox("ID Material Sudah Ada")
End IfCatch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Attention")'Call ambildata()Call hitung()Call bersih()GroupBox1.Visible = False
End Trymati()
ButSave.Enabled = FalseButInsert.Enabled = True
End SubSub ambildata()
da = New Data.OleDb.OleDbDataAdapter("Select * from T_Barang order byID_Material", cn)ds = New DataSetda.Fill(ds)brs = ds.Tables(0).Rows.Count
DGVBrg.DataSource = dsEnd Sub
Private Sub ButSearch_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButSearch.Click
If Me.TextCari.Text = "" ThenMsgBox("Isi Kata Kunci Pencarian")Me.TextCari.Focus()
Exit SubEnd IfTry
If RDB_ID.Checked = True Thenda = New OleDbDataAdapter("Select * From T_Barang where ID_Material like '" &TextCari.Text & "%'", cn)
Elseda = New OleDbDataAdapter("Select * From T_Barang where Nama_Material like '" &TextCari.Text & "%'", cn)
End If
dt = New DataTableda.Fill(dt)
If dt.Rows.Count = Nothing ThenMsgBox("Kata Kunci yang Anda Cari Tidak Ditemukan", MsgBoxStyle.Information,"Attention")Me.TextCari.Clear()Me.TextCari.Focus()
Exit Sub
End IfDGVBrg.DataSource = dt
ds = New DataSetda.Fill(ds)
Catch ex As ExceptionMsgBox(ex.Message, MsgBoxStyle.Information, "Attention")
End TryEnd SubPrivate Sub ButClose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ButClose.ClickMe.Close()
End Sub
Private Sub ButCancel_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles ButCancel.Click
Call bersih()ButSearch.Enabled = TrueButSave.Enabled = False
End Sub
Private Sub TxtID_TextChanged(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles TxtID.TextChanged
End SubEnd Class
Lampiran 3: Surat Keterangan Kerja Praktek
Lampiran 3 Rekapitulasi Kehadiran Kerja Praktek
Lampiran 4 Jurnal Kerja Praktek
Lampiran 4 Jurnal Kerja Praktek (Lanjutan)
Lampiran 5 Jurnal Bimbingan Tugas Akhir
Lampiran 5 Jurnal Bimbingan Tugas Akhir (Lanjutan)