L A M P I R A N. Universitas Sumatera Utara

Similar documents
LAMPIRAN. Universitas Sumatera Utara

LAMPIRAN A-2 : LAPORAN PENJUALAN DOKUMEN KELUARAN

Kartu Bimbingan Tugas Akhir Mahasiswa

Private Sub MenuUtamaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.ShowDialog() End Sub

LISTING PROGRAM. 1. Form Menu Utama. Universitas Sumatera Utara

To enter the number in decimals Label 1 To show total. Text:...

LISTING PROGRAM. 1. Tampilan Awal. 2. Menu Login. Public Class Awal

LISTING PROGRAM. PrivateSub KeluarToolStripMenuItem_Click(sender AsObject, e AsEventArgs) Handles KeluarToolStripMenuItem.Click Close() EndSub

Member Management System

DO NOT COPY AMIT PHOTOSTUDIO

LAMPIRAN A: Listing Program

Tutorial, Source code, Request Program Visual Basic

โปรแกรมช วยทดสอบหม อแปลงกระแส

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Label1.

"!#... )*! "!# )+, -./ 01 $

Mr.Khaled Anwar ( )

WEEK 1. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled.

Else. End If End Sub End Class. PDF created with pdffactory trial version

LAMPIRAN LIST PROGRAM

VB.NET Programs. ADO.NET (insert, update, view records)

Sub clear() lblidver.text = Nothing lblstatus.text = Nothing

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

LAMPIRAN. Universitas Sumatera Utara

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result.

DAFTAR PUSTAKA. Bojic, Paul, 2008, Business Information System. Pearson Education Ltd., England

LISTING PROGRAM. frmmenu.vb. frmlogin.vb. Universitas Sumatera Utara. Public Class frmmenu

LAMPIRAN A : LISTING PROGRAM

'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("8b a5-46bb-a6a9-87b4949d1f4c")>

Lampiran 1 Kode Program

ภาคผนวก ก. Source Code

A-1 LISTING PROGRAM. Halaman Koneksi. Universitas Sumatera Utara

Unit 4 Advanced Features of VB.Net

Form Connection. Imports System Imports System.Threading Imports System.IO.Ports Imports System.ComponentModel

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

LAMPIRAN A: Listing Program

DAFTAR PUSTAKA. Munawar, Pemodelan Visual dengan UML edl. Graha Ilmu : Jakarta.

LISTING PROGRAM. 1. Form Login. Private Sub BATAL_Click() End End Sub

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3)

Revision for Final Examination (Second Semester) Grade 9

Learning VB.Net. Tutorial 10 Collections

LISTING PROGRAM. Form Splash

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

Software for Auto-Generating Electrode Block Order Sheet: Study Case in Mold Machining Workshop

Learning VB.Net. Tutorial 19 Classes and Inheritance

LAMPIRAN A : LISTING PROGRAM

LISTING PROGRAM. mainform.vb A-1. Universitas Sumatera Utara

Visual Basic: Opdracht Structuur

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions

超音波モータ制御プログラムの作成 (v1.2.1)

Private Sub Cours_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

LAMPIRAN FORM 1 Universitas Sumatera Universitas Utara

LAMPIRAN. 1. Kode Program

End Sub. Sub Kunci() Dim i As Integer For i = 0 To 4 Txtfield(i).Locked = True Next i grddatagrid.enabled = False End Sub

Computing Science Unit 1

Learning VB.Net. Tutorial 17 Classes

VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS

Learning VB.Net. Tutorial 15 Structures

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date :

LAMPIRAN A. LISTING PROGRAM

LISTING PROGRAM. 1. Menu Utama

ก Microsoft Visual Studio 2008

Panduan Menggunakan Autoresponder FreeAutobot.com

Final Exam 7:00-10:00pm, April 14, 2008

Code: Week 13. Write a Program to perform Money Conversion. Public Class Form1

Tutorial 5 Database. Adam Sek Keb Wira 12 A123 6 Amanah Tmn Mahkota

Interacting with External Applications

Programming with Visual Studio Higher (v. 2013)

REGISTRATION GUIDE MCIS CUSTOMER PORTAL. Page 1

A-1 LISTING PROGRAM. 1. Module1

S.2 Computer Literacy Question-Answer Book

A Complete Tutorial for Beginners LIEW VOON KIONG

Code: Write a Program for perform Money Conversion. Public Class Form1

Senior Software Engineering Project CSSP Project CEN April 5, Adam Cox Tass Oscar

Serial-out Color Sensor. Overview. Features

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

Darshan Institute of Engineering & Technology for Diploma Studies

System Analysis and Design

Unit 7. Lesson 7.1. Loop. For Next Statements. Introduction. Loop

PANDUAN PENGGUNA (SUPPLIER) MAINTAIN CERTIFICATES/SUPPLIER DETAILS SUPPLIER RELATIONSHIP MANAGEMENT SUPPLY CHAIN MANAGEMENT SYSTEM (SCMS)

Déclaration du module

LAMPIRAN. Private Sub FrmSkinDetect_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load IndikatorHandle(False) End Sub

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

Learning VB.Net. Tutorial 16 Modules

VISUAL BASIC PROGRAMMING (44) Technical Task KEY. Regional 2013 TOTAL POINTS (485)

IT3101 -Rapid Application Development Second Year- First Semester. Practical 01. Visual Basic.NET Environment.

Universitas Sumatera Utara

Herefordshire College of Technology Centre Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3)

Visitor Management System

DEVELOPING OBJECT ORIENTED APPLICATIONS

Unit 3. Lesson Designing User Interface-2. TreeView Control. TreeView Contol

LAMPIRAN LISTING PROGRAM

Visual Basic 2008 The programming part

Ingegneria del Software T. Interfaccia utente

MATFOR In Visual Basic

1. Create your First VB.Net Program Hello World

LAMPIRAN Lampiran Utama. a. Struktur Organisasi

L A M P I R A N. Universitas Sumatera Utara

Apéndice E Código de software de ayuda en Visual Basic 2005 Public Class Form1

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Transcription:

L A M P I R A N

1 Listing Program 1. Form Menu Public Class frm_menu Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click frm_login.show() Me.Hide() End Class 2. Form Login Imports System.Data.OleDb Public Class frm_login Dim exp As OleDbCommand Dim dr As OleDbDataReader Private Sub frm_login_load(byval sender As MyBase.Load cekkoneksi() Private Sub btn_login_click(byval sender As btn_login.click exp = New OleDbCommand("SELECT * FROM tbl_user WHERE [username]='" & TextBox1.Text & "' AND [password]='" & TextBox2.Text & "'", koneksi) dr = exp.executereader If dr.hasrows Then 'jika data yang diinput benar, maka proses dibawah dikerjakan,utk memanggil dr.read() Me.Hide() Dim F_Utama As New MDIParent1 F_Utama.Show() Else MsgBox("Pastikan data anda benar", MsgBoxStyle.Information, "Pesan") TextBox1.Text = "" TextBox2.Text = "" TextBox1.Select() dr.close() 'memunculkan pesan kesalahan jika step 1 ada kesalahan tetapi program tetap berjalan

2 End End Class 3. Form MDI Parent Imports System.Windows.Forms Public Class MDIParent1 Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) ' Create a new instance of the child form. Dim ChildForm As New System.Windows.Forms.Form ' Make it a child of this MDI form before showing it. ChildForm.MdiParent = Me m_childformnumber += 1 ChildForm.Text = "Window " & m_childformnumber ChildForm.Show() Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs) Dim OpenFileDialog As New OpenFileDialog OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments OpenFileDialog.Filter = "Text Files (*.txt) *.txt All Files (*.*) *.*" If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then Dim FileName As String = OpenFileDialog.FileName ' TODO: Add code here to open the file. Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Dim SaveFileDialog As New SaveFileDialog SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments SaveFileDialog.Filter = "Text Files (*.txt) *.txt All Files (*.*) *.*" If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then Dim FileName As String = SaveFileDialog.FileName ' TODO: Add code here to save the current contents of the form to a file. Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) End

3 Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) 'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to retrieve information from the clipboard. Private Sub ToolBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) 'Me.ToolStrip.Visible = Me.ToolBarToolStripMenuItem.Checked Private Sub StatusBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) 'Me.StatusStrip.Visible = Me.StatusBarToolStripMenuItem.Checked Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Me.LayoutMdi(MdiLayout.Cascade) Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Me.LayoutMdi(MdiLayout.TileVertical) Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Me.LayoutMdi(MdiLayout.TileHorizontal) Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Me.LayoutMdi(MdiLayout.ArrangeIcons) Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) ' Close all child forms of the parent. For Each ChildForm As Form In Me.MdiChildren ChildForm.Close() Next

4 Private m_childformnumber As Integer Private Sub UserToolStripMenuItem_Click(ByVal sender As UserToolStripMenuItem.Click Dim F_User As New frm_user F_User.MdiParent = Me F_User.Show() Private Sub DataBarangToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataBarangToolStripMenuItem.Click Dim F_Barang As New frm_barang F_Barang.MdiParent = Me F_Barang.Show() Private Sub DataSupplierToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataSupplierToolStripMenuItem.Click Dim F_Supplier As New frm_supplier F_Supplier.MdiParent = Me F_Supplier.Show() Private Sub DataCustomerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataCustomerToolStripMenuItem.Click Dim F_Customer As New frm_customer F_Customer.MdiParent = Me F_Customer.Show() Private Sub FakturPembelianToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FakturPembelianToolStripMenuItem.Click Dim F_Pembelian As New frm_pembelian F_Pembelian.MdiParent = Me F_Pembelian.Show() Private Sub DetailHutangPiutangPembelianToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DetailHutangPiutangPembelianToolStripMenuItem.Click Dim F_Detail_Credit As New frm_detail_credit F_Detail_Credit.MdiParent = Me F_Detail_Credit.Show() Private Sub FakturPenjualanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FakturPenjualanToolStripMenuItem.Click Dim F_Penjualan As New frm_penjualan F_Penjualan.MdiParent = Me F_Penjualan.Show()

5 Private Sub DetailHutangPiutangPenjualanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DetailHutangPiutangPenjualanToolStripMenuItem.Click Dim F_Detail_Hutang As New frm_detail_hutang F_Detail_Hutang.MdiParent = Me F_Detail_Hutang.Show() Private Sub MDIParent1_Load(ByVal sender As MyBase.Load Dim F_Cek_Gudang As New frm_cek_gudang F_Cek_Gudang.MdiParent = Me F_Cek_Gudang.Show() Timer1.Enabled = True 'LaporanToolStripMenuItem.Enabled = False Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ToolTime.Text = Format(Now, "HH:mm:ss") ToolDate.Text = Format(Now, "ddd dd-mmm-yyyy") Private Sub LaporanPembelianToolStripMenuItem_Click(ByVal sender As LaporanPembelianToolStripMenuItem.Click Dim F_Laporan_Pembelian As New Laporan F_Laporan_Pembelian.MdiParent = Me F_Laporan_Pembelian.Show() Private Sub LaporanPenjualanToolStripMenuItem_Click(ByVal sender As LaporanPenjualanToolStripMenuItem.Click Dim F_Laporan_Penjualan As New Laporan1 F_Laporan_Penjualan.MdiParent = Me F_Laporan_Penjualan.Show() Private Sub BantuanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BantuanToolStripMenuItem.Click Dim F_help As New frm_help F_help.MdiParent = Me F_help.Show() Private Sub TentangToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TentangToolStripMenuItem.Click Dim F_about As New frm_about F_about.MdiParent = Me

6 F_about.Show() Private Sub LogoutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogoutToolStripMenuItem.Click End End Class 4. Form Cek_Gudang Imports System.Data.OleDb Public Class frm_cek_gudang Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub da = New OleDbDataAdapter("Select * from tbl_barang WHERE jumlah < 5", conn) ds = New DataSet ds.clear() da.fill(ds, "tbl_barang") DGV1.DataSource = (ds.tables("tbl_barang")) With DGV1.Columns(0).Width = 200.Columns(1).Width = 350.Columns(2).Width = 100.Columns(3).Width = 150.Columns(4).Width = 150.Columns(5).Width = 150.Columns(0).HeaderText = "Kode Barang".Columns(1).HeaderText = "Nama Barang".Columns(2).HeaderText = "Satuan".Columns(3).HeaderText = "Harga Beli".Columns(4).HeaderText = "Harga Jual".Columns(5).HeaderText = "Stok".ForeColor = Color.Red End With Private Sub frm_cek_gudang_activated(byval sender As Object, ByVal e As System.EventArgs) Handles Me.Activated 'gunanya pada saat dia aktip maka form akan terus terrefresh Private Sub frm_cek_gudang_load(byval sender As MyBase.Load cekkoneksi() End Class

7 5. Form User Imports System.Data.OleDb Public Class frm_user Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub frm_user_load(byval sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cekkoneksi() Private Sub bersih() da = New OleDbDataAdapter("Select username, password, kategori from tbl_user", conn) ds = New DataSet ds.clear() da.fill(ds, "tbl_user") DGV1.DataSource = (ds.tables("tbl_user")) With DGV1.Columns(0).Width = 250.Columns(1).Width = 100.Columns(2).Width = 120.Columns(0).HeaderText = "Username".Columns(1).HeaderText = "Password".Columns(2).HeaderText = "Kategori" End With Private Sub bersih() txtuname.text = "" txtpass.text = "" cbokategori.text = "" txtuname.select() Private Sub txtuname_lostfocus(byval sender As Object, ByVal e As System.EventArgs) Handles txtuname.lostfocus If txtuname.text = String.Empty Then Exit Sub Dim perintah As String = "select * from tbl_user where username = '" & txtuname.text & "'" If data.hasrows Then data.read() txtuname.text = data(1) txtpass.text = data(2) cbokategori.text = data(3)

8 Private Sub btn_simpan_click(byval sender As btn_simpan.click Dim perintah As String = "INSERT INTO &_ tbl_user([username], [password], kategori VALUES ('" & txtuname.text & "','" & txtpass.text & "','" & cbokategori.text & "')" MsgBox("Data Berhasil Disimpan", End Private Sub btn_hapus_click(byval sender As btn_hapus.click Dim perintah As String = "Delete from tbl_user where username = '" & txtuname.text & "'" MsgBox("Data Berhasil Dihapus", End Private Sub btn_batal_click(byval sender As btn_batal.click bersih() Private Sub btn_keluar_click(byval sender As btn_keluar.click Me.Close() End Class 6. Form Barang Imports System.Data.OleDb Public Class frm_barang

9 Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub frm_barang_load(byval sender As Object, ByVal e As System.EventArgs) Handles Me.Load cekkoneksi() tampil_satuan() txtkode.select() Private Sub bersih() da = New OleDbDataAdapter("Select * from tbl_barang", conn) ds = New DataSet ds.clear() da.fill(ds, "tbl_barang") DGV1.DataSource = (ds.tables("tbl_barang")) With DGV1.Columns(0).Width = 100.Columns(1).Width = 250.Columns(2).Width = 100.Columns(3).Width = 120.Columns(4).Width = 120.Columns(5).Width = 100.Columns(0).HeaderText = "Kode Barang".Columns(1).HeaderText = "Nama Barang".Columns(2).HeaderText = "Satuan".Columns(3).HeaderText = "Harga Beli".Columns(4).HeaderText = "Harga Jual".Columns(5).HeaderText = "Stok yang Tersedia" End With Private Sub bersih() txtkode.text = "" txtnama.text = "" cbosatuan.text = "" txthargabeli.text = "" txthargajual.text = "" txtjumlah.text = "" txtkode.focus() Private Sub btn_satuan_click(byval sender As btn_satuan.click frm_satuan.show() Private Sub txtkode_lostfocus(byval sender As Object, ByVal e As System.EventArgs) Handles txtkode.lostfocus If txtkode.text = String.Empty Then 'jika textkode kosong maka tidak ada proses yang dijalankan. Exit Sub

10 'jika txtkode ada isi dan isi tersebut tertera di tabel db maka data yang ada di tabel db dimunculkan pada komponen dibwh ini Dim perintah As String = "select * from tbl_barang where kode = '" & txtkode.text & "'" If data.hasrows Then data.read() txtkode.text = data(0) txtnama.text = data(1) cbosatuan.text = data(2) txthargabeli.text = data(3) txthargajual.text = data(4) txtjumlah.text = data(5) Public Sub tampil_satuan() cbosatuan.items.clear() Dim perintah As String = "Select satuan from satuan" While data.read() cbosatuan.items.add(data("satuan")) End While End Private Sub btn_hapus_click_1(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_hapus.click Dim perintah As String = "Delete from tbl_barang where kode = '" & txtkode.text & "'" MsgBox("Data Berhasil Dihapus", End Private Sub btn_simpan_click_1(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_simpan.click Dim perintah As String = "Insert into tbl_barang (kode, nama, satuan, harga_beli, harga_jual, jumlah) values ('" & txtkode.text & "','" & txtnama.text & "','" & cbosatuan.text & "','" & txthargabeli.text & "','" & txthargajual.text & "','" &

11 txtjumlah.text & "')" MsgBox("Data Berhasil Disimpan", End Private Sub btn_update_click_1(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_update.click Dim perintah As String = "update tbl_barang set nama='" & txtnama.text & "', satuan ='" & cbosatuan.text & "', harga_beli='" & txthargabeli.text & "', harga_jual='" & txthargajual.text & "', jumlah='" & txtjumlah.text & "' WHERE kode='" & txtkode.text & "'" MsgBox("Data Berhasil Diupdate", End Private Sub btn_batal_click_1(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_batal.click bersih() Private Sub btn_keluar_click_1(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close() Private Sub cbosatuan_click(byval sender As Object, ByVal e As System.EventArgs) Handles cbosatuan.click tampil_satuan() End Class 7. Form Satuan Imports System.Data.OleDb Public Class frm_satuan Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub bersih() txtsatuan.text = ""

12 txtsatuan.select() Private Sub frm_satuan_load(byval sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cekkoneksi() bersih() Private Sub btn_simpan_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_simpan.click Dim perintah As String = "insert into satuan (satuan) values ('" & txtsatuan.text & "')" MsgBox("Data berhasil ditambah", MsgBoxStyle.Information, "Pesan") bersih() End frm_barang.tampil_satuan() Me.Close() Private Sub txtsatuan_lostfocus(byval sender As Object, ByVal e As System.EventArgs) Handles txtsatuan.lostfocus If txtsatuan.text = String.Empty Then Exit Sub Dim perintah As String = "select * from satuan where satuan like '" & txtsatuan.text & "'" data = eksekusi.executereader If data.hasrows Then data.read() txtsatuan.text = data(1) Private Sub btn_hapus_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_hapus.click Dim perintah As String = "delete from satuan where satuan='" & txtsatuan.text & "'" MsgBox("Data berhasil dihapus", MsgBoxStyle.Information, "Pesan") bersih() End

13 frm_barang.tampil_satuan() Me.Close() End Class 8. Form Supplier Imports System.Data.OleDb Public Class frm_supplier Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub frm_supplier_load(byval sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cekkoneksi() Private Sub bersih() da = New OleDbDataAdapter("Select * from tbl_supplier", conn) ds = New DataSet ds.clear() da.fill(ds, "tbl_supplier") DGV1.DataSource = (ds.tables("tbl_supplier")) With DGV1.Columns(0).Width = 100.Columns(1).Width = 250.Columns(2).Width = 100.Columns(3).Width = 120.Columns(4).Width = 120.Columns(5).Width = 100.Columns(0).HeaderText = "Kode Supplier".Columns(1).HeaderText = "Nama Supplier".Columns(2).HeaderText = "Alamat".Columns(3).HeaderText = "Nomor Telp".Columns(4).HeaderText = "Nomor Hp".Columns(5).HeaderText = "Email" End With Private Sub bersih() txtkode.text = "" txtnama.text = "" txtalamat.text = "" txttelp.text = "" txthp.text = "" txtemail.text = "" txtkode.select() Private Sub txtkode_lostfocus(byval sender As Object, ByVal e As System.EventArgs) Handles txtkode.lostfocus If txtkode.text = String.Empty Then Exit Sub

14 Dim perintah As String = "select * from tbl_supplier where kode = '" & txtkode.text & "'" If data.hasrows Then data.read() txtkode.text = data(0) txtnama.text = data(1) txtalamat.text = data(2) txttelp.text = data(3) txthp.text = data(4) txtemail.text = data(5) Private Sub btn_simpan_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_simpan.click Dim perintah As String = "Insert into tbl_supplier values ('" & txtkode.text & "','" & txtnama.text & "','" & txtalamat.text & "','" & txttelp.text & "','" & txthp.text & "','" & txtemail.text & "')" MsgBox("Data Berhasil Disimpan", End Private Sub btn_update_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_update.click Dim perintah As String = "update tbl_supplier set nama='" & txtnama.text & "', alamat ='" & txtalamat.text & "', telp='" & txttelp.text & "', hp='" & txthp.text & "', email='" & txtemail.text & "' WHERE kode='" & txtkode.text & "'" MsgBox("Data Berhasil Diupdate", End Private Sub btn_hapus_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_hapus.click

15 Dim perintah As String = "Delete from tbl_supplier where kode = '" & txtkode.text & "'" MsgBox("Data Berhasil Dihapus", End Private Sub btn_batal_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_batal.click bersih() Private Sub btn_keluar_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close() End Class 9. Form Customer Imports System.Data.OleDb Public Class frm_customer Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub frm_customer_load(byval sender As Object, ByVal e As System.EventArgs) Handles Me.Load cekkoneksi() Private Sub bersih() da = New OleDbDataAdapter("Select * from tbl_customer", conn) ds = New DataSet ds.clear() da.fill(ds, "tbl_customer") DGV1.DataSource = (ds.tables("tbl_customer")) With DGV1.Columns(0).Width = 100.Columns(1).Width = 250.Columns(2).Width = 100.Columns(3).Width = 120.Columns(4).Width = 120.Columns(5).Width = 100.Columns(0).HeaderText = "Kode Customer".Columns(1).HeaderText = "Nama Customer".Columns(2).HeaderText = "Alamat".Columns(3).HeaderText = "Nomor Telp".Columns(4).HeaderText = "Nomor Hp"

16.Columns(5).HeaderText = "Email" End With Private Sub bersih() txtkode.text = "" txtnama.text = "" txtalamat.text = "" txttelp.text = "" txthp.text = "" txtemail.text = "" txtkode.select() Private Sub txtkode_lostfocus(byval sender As Object, ByVal e As System.EventArgs) Handles txtkode.lostfocus If txtkode.text = String.Empty Then Exit Sub Dim perintah As String = "select * from tbl_customer where kode = '" & txtkode.text & "'" If data.hasrows Then data.read() txtkode.text = data(0) txtnama.text = data(1) txtalamat.text = data(2) txttelp.text = data(3) txthp.text = data(4) txtemail.text = data(5) Private Sub btn_simpan_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_simpan.click Dim perintah As String = "Insert into tbl_customer values ('" & txtkode.text & "','" & txtnama.text & "','" & txtalamat.text & "','" & txttelp.text & "','" & txthp.text & "','" & txtemail.text & "')" MsgBox("Data Berhasil Disimpan", End

17 Private Sub btn_update_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_update.click Dim perintah As String = "update tbl_customer set nama='" & txtnama.text & "', alamat ='" & txtalamat.text & "', telp='" & txttelp.text & "', hp='" & txthp.text & "', email='" & txtemail.text & "' WHERE kode='" & txtkode.text & "'" MsgBox("Data Berhasil Diupdate", End Private Sub btn_hapus_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_hapus.click Dim perintah As String = "Delete from tbl_customer where kode = '" & txtkode.text & "'" MsgBox("Data Berhasil Dihapus", End Private Sub btn_batal_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_batal.click bersih() Private Sub btn_keluar_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close() End Class 10. Form Pembelian Imports System.Data.OleDb Public Class frm_pembelian Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub bersih1() da = New OleDbDataAdapter("Select tgl_pembelian, kode_brg, qty, satuan, harga_beli, jumlah_bayar from tbl_pembelian WHERE no_faktur = '" & txtfaktur.text &

18 "'", conn) ds = New DataSet ds.clear() da.fill(ds, "tbl_pembelian") DGV1.DataSource = (ds.tables("tbl_pembelian")) With DGV1.Columns(0).Width = 100.Columns(1).Width = 250.Columns(2).Width = 100.Columns(3).Width = 120.Columns(4).Width = 120.Columns(5).Width = 100.Columns(0).HeaderText = "Tanggal Pembelian".Columns(1).HeaderText = "Kode Barang".Columns(2).HeaderText = "Banyaknya".Columns(3).HeaderText = "Satuan".Columns(4).HeaderText = "Harga Beli".Columns(5).HeaderText = "Jumlah Yang Dibayar" End With Private Sub tampil_supplier() Dim perintah As String = "Select nama from tbl_supplier" While data.read() cbosupplier.items.add(data("nama")) End While End Private Sub tampil_kode_barang() Dim perintah As String = "Select kode from tbl_barang" While data.read() cbobarang.items.add(data("kode")) End While End Private Sub bersih1() cbobarang.text = "" txtbarang.text = "" txtsatuan.text = "" txtqty.text = "" txtharga.text = "" txtjum.text = ""

19 cbobarang.select() Private Sub bersih2() txtfaktur.text = "" cbosupplier.text = "" cbobarang.text = "" txtbarang.text = "" txtsatuan.text = "" txtqty.text = "" txtharga.text = "" txtjum.text = "" txttotbayar.text = "" cbojenisbayar.text = "" txtsudahbayar.text = "" txtsisabayar.text = "" cbostatus.text = "" 'DGV1.Rows.Clear() txtfaktur.select() Private Sub frm_pembelian_load(byval sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cekkoneksi() tampil_supplier() tampil_kode_barang() txtfaktur.select() Private Sub cbobarang_selectedindexchanged(byval sender As cbobarang.selectedindexchanged Dim perintah As String = "select nama, satuan from tbl_barang where kode = '" & cbobarang.text & "'" If data.hasrows Then data.read() txtbarang.text = data(0) txtsatuan.text = data(1) Private Sub txtharga_textchanged(byval sender As txtharga.textchanged txtjum.text = Val(txtqty.Text) * Val(txtharga.Text) Private Sub btn_tambah_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_tambah.click Dim perintah As String = "Insert into tbl_pembelian (no_faktur, tgl_pembelian, supplier, kode_brg, qty, satuan, harga_beli, jumlah_bayar) values

20 ('" & txtfaktur.text & "','" & tgl_beli.text & "','" & cbosupplier.text & "','" & cbobarang.text & "','" & txtqty.text & "','" & txtsatuan.text & "','" & txtharga.text & "','" & txtjum.text & "')" Dim perintah1 As String = "update tbl_barang set harga_beli='" & txtharga.text & "', jumlah=jumlah + '" & txtqty.text & "' where kode='" & cbobarang.text & "'" Dim eksekusi1 As New OleDbCommand(perintah1, koneksi) eksekusi1.executenonquery() MsgBox("Data Berhasil Disimpan", End Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim perintah As String = "Select Sum(jumlah_bayar) as total_bayar From tbl_pembelian WHERE no_faktur = '" & txtfaktur.text & "'" If data.hasrows Then data.read() txttotbayar.text = data(0) Private Sub txtsudahbayar_textchanged(byval sender As txtsudahbayar.textchanged txtsisabayar.text = Val(txttotbayar.Text) Val(txtsudahbayar.Text) Private Sub btn_simpan_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_simpan.click Dim perintah As String = "Insert into tbl_detail_pembelian values ('" & txtfaktur.text & "','" & tgl_beli.text & "','" & txttotbayar.text & "','" & cbojenisbayar.text & "','" & txtsudahbayar.text & "','" & txtsisabayar.text & "','" & cbostatus.text & "')"

21 MsgBox("Data Berhasil Disimpan", bersih2() End Private Sub pilih_jenis_bayar() If cbojenisbayar.text = "Cash" Then txtsudahbayar.text = txttotbayar.text txtsisabayar.enabled = False cbostatus.text = "Lunas" ElseIf cbojenisbayar.text = "Credit" Then txtsudahbayar.text = "" cbostatus.text = "Belum Lunas" Private Sub cbojenisbayar_selectedindexchanged(byval sender As cbojenisbayar.selectedindexchanged pilih_jenis_bayar() Private Sub btn_batal_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_batal.click bersih2() Private Sub btn_keluar_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close() Private Sub btn_hapus_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_hapus.click Dim perintah As String = "Delete from tbl_detail_pembelian where no_faktur = '" & txtfaktur.text & "'" MsgBox("Data Berhasil Dihapus", End End Class

22 11. Form Penjualan Imports System.Data.OleDb Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class frm_penjualan Dim da As OleDbDataAdapter Dim ds As DataSet Private Sub bersih1() da = New OleDbDataAdapter("Select tgl_penjualan, kode_brg, qty, satuan, harga_jual, jumlah_bayar from tbl_penjualan WHERE no_faktur = '" & txtfaktur.text & "'", conn) ds = New DataSet ds.clear() da.fill(ds, "tbl_penjualan") DGV1.DataSource = (ds.tables("tbl_penjualan")) With DGV1.Columns(0).Width = 100.Columns(1).Width = 250.Columns(2).Width = 100.Columns(3).Width = 120.Columns(4).Width = 120.Columns(5).Width = 100.Columns(0).HeaderText = "Tanggal Penjualan".Columns(1).HeaderText = "Kode Barang".Columns(2).HeaderText = "Banyaknya".Columns(3).HeaderText = "Satuan".Columns(4).HeaderText = "Harga Jual".Columns(5).HeaderText = "Jumlah Yang Dibayar" End With Private Sub tampil_customer() cbocustomer.items.clear() Dim perintah As String = "Select nama from tbl_customer" While data.read() cbocustomer.items.add(data("nama")) End While End Private Sub tampil_kode_barang() Dim perintah As String = "Select kode from tbl_barang"

23 While data.read() cbobarang.items.add(data("kode")) End While End Private Sub bersih1() cbobarang.text = "" txtbarang.text = "" txtsatuan.text = "" txtqty.text = "" txtharga.text = "" txtjum.text = "" cbostatusbeli.select() Private Sub bersih2() cbostatusbeli.text = "" txtfaktur.text = "" cbocustomer.text = "" cbobarang.text = "" txtbarang.text = "" txtsatuan.text = "" txtqty.text = "" txtharga.text = "" txtjum.text = "" txttotbayar.text = "" cbojenisbayar.text = "" txtsudahbayar.text = "" txtsisabayar.text = "" cbostatus.text = "" 'DGV1.Rows.Clear() cbostatusbeli.select() Private Sub cbostatusbeli_selectedindexchanged(byval sender As cbostatusbeli.selectedindexchanged If cbostatusbeli.text = "Non-Member" Then cbocustomer.enabled = False Else tampil_customer() cbocustomer.enabled = True Private Sub frm_penjualan_load(byval sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cekkoneksi() tampil_kode_barang() Private Sub cbobarang_lostfocus(byval sender As Object, ByVal e As System.EventArgs) Handles cbobarang.lostfocus If txtfaktur.text = String.Empty Then

24 MsgBox("Nomor Faktur mohon Diisi", MsgBoxStyle.Information, "Pesan") Else Exit Sub Private Sub cbobarang_selectedindexchanged(byval sender As cbobarang.selectedindexchanged Dim perintah As String = "select nama, satuan, harga_jual from tbl_barang where kode = '" & cbobarang.text & "'" If data.hasrows Then data.read() txtbarang.text = data(0) txtsatuan.text = data(1) txtharga.text = data(2) Private Sub txtqty_textchanged(byval sender As System.Object, ByVal e As System.EventArgs) Handles txtqty.textchanged txtjum.text = Val(txtharga.Text) * Val(txtqty.Text) Private Sub btn_tambah_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_tambah.click Dim temp As Integer Dim perintah2 As String = "Select jumlah from tbl_barang where kode = '" & cbobarang.text & "'" Dim eksekusi2 As New OleDbCommand(perintah2, koneksi) data = eksekusi2.executereader() While data.read() temp = data("jumlah") End While If temp < txtqty.text Then MsgBox("Stok Tidak Mencukupi, Mohon Periksa Kembali Data di Gudang", MsgBoxStyle.Information, "Alert") Exit Sub Else Dim perintah As String = "Insert into tbl_penjualan (no_faktur, tgl_penjualan, status_pembeli, customer, kode_brg, qty, satuan, harga_jual, jumlah_bayar) values ('" & txtfaktur.text & "','" & tgl_beli.text & "','" & cbojenisbayar.text & "','" & cbocustomer.text & "','" &

25 cbobarang.text & "','" & txtqty.text & "','" & txtsatuan.text & "','" & txtharga.text & "','" & txtjum.text & "')" Dim eksekusi As New OleDbCommand(perintah,koneksi) Dim perintah1 As String = "update tbl_barang set jumlah=jumlah - '" & txtqty.text & "' where kode='" & cbobarang.text &"'" Dim eksekusi1 As New OleDbCommand(perintah1,koneksi) eksekusi1.executenonquery() MsgBox("Data Berhasil Disimpan", End End Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim perintah As String = "Select Sum(jumlah_bayar) as total_bayar From tbl_penjualan WHERE no_faktur = '" & txtfaktur.text & "'" If data.hasrows Then data.read() txttotbayar.text = data(0) Private Sub txtsudahbayar_textchanged(byval sender As txtsudahbayar.textchanged txtsisabayar.text = Val(txttotbayar.Text) Val(txtsudahbayar.Text) Private Sub btn_simpan_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_simpan.click Dim perintah As String = "Insert into tbl_detail_penjualan values ('" & txtfaktur.text & "','" & tgl_beli.text & "','" & txttotbayar.text & "','" & cbojenisbayar.text & "','" & txtsudahbayar.text & "','" &

26 txtsisabayar.text & "','" & cbostatus.text & "')" MsgBox("Data Berhasil Disimpan", End Dim str1 As String = "Select * From view_cetak_penjualan Where no_faktur='" & txtfaktur.text & "'" Dim CRP1 As New ReportDocument Dim dset1 As New DataSet Dim DA1 As New OleDbDataAdapter(str1, koneksi) DA1.Fill(dSet1) CRP1.Load(Application.StartupPath & "\CetakPenjualan.rpt") CRP1.SetDataSource(dSet1.Tables(0)) CRP1.Refresh() Dim F_Cetak_Penjualan As New frm_cetak_penjualan With F_Cetak_Penjualan.CRV1.Refresh().CRV1.ReportSource = CRP1.Show() End With bersih2() Private Sub pilih_jenis_bayar() If cbojenisbayar.text = "Cash" Then txtsudahbayar.text = txttotbayar.text txtsisabayar.enabled = False cbostatus.text = "Lunas" ElseIf cbojenisbayar.text = "Credit" Then txtsudahbayar.text = "" cbostatus.text = "Belum Lunas" txtsisabayar.enabled = True Private Sub btn_batal_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_batal.click bersih2() Private Sub btn_keluar_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close()

27 Private Sub btn_hapus_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_hapus.click Dim perintah As String = "Delete from tbl_detail_penjualan where no_faktur = '" & txtfaktur.text & "'" MsgBox("Data Berhasil Dihapus", End Private Sub cbojenisbayar_selectedvaluechanged(byval sender As Object, ByVal e As System.EventArgs) Handles cbojenisbayar.selectedvaluechanged pilih_jenis_bayar() End Class 12. Form Detail Hutang Pembelian Imports System.Data.OleDb Public Class frm_detail_credit Private Sub bersih() cbofaktur.text = "" tglpembelian.text = "" txtsupplier.text = "" txttotbayar.text = "" txtsudahbayar.text = "" txtsisabayar.text = "" cbostatus.text = "" tampil_credit() Private Sub tampil_credit() cbofaktur.items.clear() Dim perintah As String = "Select no_faktur from tbl_detail_pembelian where status='belum Lunas'" While data.read() cbofaktur.items.add(data("no_faktur")) End While End

28 Private Sub frm_detail_credit_load(byval sender As MyBase.Load cekkoneksi() bersih() Private Sub cbofaktur_selectedindexchanged(byval sender As cbofaktur.selectedindexchanged Dim perintah As String = "select tbl_detail_pembelian.tgl_pembelian, tbl_pembelian.supplier, tbl_detail_pembelian.total_bayar, tbl_detail_pembelian.sudah_bayar, tbl_detail_pembelian.sisa_bayar, tbl_detail_pembelian.status from tbl_detail_pembelian, tbl_pembelian where tbl_detail_pembelian.no_faktur = '" & cbofaktur.text & "' and tbl_pembelian.no_faktur = '" & cbofaktur.text & "'" If data.hasrows Then data.read() tglpembelian.text = data(0) txtsupplier.text = data(1) txttotbayar.text = data(2) txtsudahbayar.text = data(3) txtsisabayar.text = data(4) cbostatus.text = data(5) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click txtsudahbayar.text = Val(txttotbayar.Text) txtsisabayar.text = 0 cbostatus.text = "Lunas" Private Sub btn_update_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_update.click Dim perintah As String = "update tbl_detail_pembelian set sudah_bayar='" & txtsudahbayar.text & "', sisa_bayar ='" & txtsisabayar.text & "', status='" & cbostatus.text & "' WHERE no_faktur='" & cbofaktur.text & "'" MsgBox("Data Berhasil Diupdate", bersih()

29 End Private Sub btn_batal_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_batal.click bersih() Private Sub btn_keluar_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close() End Class 13. Form Detail Hutang Penjualan Imports System.Data.OleDb Public Class frm_detail_hutang Private Sub bersih() cbofaktur.text = "" tglpembelian.text = "" txtsupplier.text = "" txttotbayar.text = "" txtsudahbayar.text = "" txtsisabayar.text = "" cbostatus.text = "" tampil_credit() Private Sub tampil_credit() cbofaktur.items.clear() Dim perintah As String = "Select no_faktur from tbl_detail_penjualan where status='belum Lunas'" While data.read() cbofaktur.items.add(data("no_faktur")) End While End Private Sub frm_detail_hutang_load(byval sender As MyBase.Load cekkoneksi() bersih()

30 Private Sub cbofaktur_selectedindexchanged(byval sender As cbofaktur.selectedindexchanged Dim perintah As String = "select tbl_detail_penjualan.tgl_penjualan, tbl_penjualan.customer, tbl_detail_penjualan.total_bayar, tbl_detail_penjualan.sudah_bayar, tbl_detail_penjualan.sisa_bayar, tbl_detail_penjualan.status from tbl_detail_penjualan, tbl_penjualan where tbl_detail_penjualan.no_faktur = '" & cbofaktur.text & "' and tbl_penjualan.no_faktur = '" & cbofaktur.text & "'" If data.hasrows Then data.read() tglpembelian.text = data(0) txtsupplier.text = data(1) txttotbayar.text = data(2) txtsudahbayar.text = data(3) txtsisabayar.text = data(4) cbostatus.text = data(5) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click txtsudahbayar.text = Val(txttotbayar.Text) txtsisabayar.text = 0 cbostatus.text = "Lunas" Private Sub btn_update_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_update.click Dim perintah As String = "update tbl_detail_penjualan set sudah_bayar='" & txtsudahbayar.text & "', sisa_bayar ='" & txtsisabayar.text & "', status='" & cbostatus.text & "' WHERE no_faktur='" & cbofaktur.text & "'" MsgBox("Data Berhasil Diupdate", bersih() End Private Sub btn_batal_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_batal.click

31 bersih() Private Sub btn_keluar_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close() End Class 14. Form Laporan Pembelian Imports System.Data.OleDb Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class Laporan Dim teks As String Dim da As OleDbDataAdapter Dim perintah As String Dim perintah1 As String Private Sub RadioButton2_CheckedChanged(ByVal sender As RadioButton2.CheckedChanged DTtanggal.Enabled = False cbohari.enabled = True cboitem.enabled = False cbohari.items.clear() Dim i As Integer For i = 1 To 12 cbohari.items.add(i) Next Private Sub RadioButton3_CheckedChanged(ByVal sender As RadioButton3.CheckedChanged DTtanggal.Enabled = False cbohari.enabled = True cboitem.enabled = False cbohari.items.clear() Dim i As Integer For i = 2009 To 2050 cbohari.items.add(i) Next Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If RadioButton1.Checked = True Then teks = DTtanggal.Value.Date.ToString("MM/dd/yyyy") perintah = "Select * From view_pembelian where tgl_pembelian=cdate('" & teks & "')"

32 ElseIf RadioButton2.Checked = True Then teks = cbohari.text perintah = "Select * From view_pembelian where MONTH(tgl_pembelian)='" & teks & "'" ElseIf RadioButton3.Checked = True Then teks = cbohari.text perintah = "Select * From view_pembelian where YEAR(tgl_pembelian)='" & teks & "'" ElseIf RadioButton4.Checked = True Then teks = cboitem.text perintah1 = "Select * From tbl_pembelian where kode_brg='" & teks & "'" 'Dim CRP1 As New ReportDocument 'Dim dset1 As New DataSet 'Dim DA1 As New OleDbDataAdapter(perintah, koneksi) 'DA1.Fill(dSet1) 'CRP1.Load(Application.StartupPath & "\CRPembelian.rpt") 'CRP1.SetDataSource(dSet1.Tables(0)) 'CRP1.Refresh() 'CrystalReportViewer1.ReportSource = CRP1 'CrystalReportViewer1.Refresh() Dim CRP1 As New ReportDocument Dim CRP2 As New ReportDocument Dim dset1 As New DataSet Dim dset2 As New DataSet Dim DA1 As New OleDbDataAdapter(perintah, koneksi) Dim DA2 As New OleDbDataAdapter(perintah1, koneksi) If RadioButton4.Checked = True Then DA2.Fill(dSet2) CRP2.Load(Application.StartupPath & "\CRPembelian1.rpt") CRP2.SetDataSource(dSet2.Tables(0)) CRP2.Refresh() Else DA1.Fill(dSet1) CRP1.Load(Application.StartupPath & "\CRPembelian.rpt") CRP1.SetDataSource(dSet1.Tables(0)) CRP1.Refresh() If RadioButton4.Checked = True Then CrystalReportViewer1.ReportSource = CRP2 CrystalReportViewer1.Refresh() Else CrystalReportViewer1.ReportSource = CRP1 CrystalReportViewer1.Refresh() End

33 Private Sub RadioButton1_CheckedChanged(ByVal sender As RadioButton1.CheckedChanged DTtanggal.Enabled = True cbohari.enabled = False cboitem.enabled = False Private Sub RadioButton4_CheckedChanged(ByVal sender As RadioButton4.CheckedChanged DTtanggal.Enabled = False cbohari.enabled = False cboitem.enabled = True Private Sub Laporan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cekkoneksi() tampil_kode_barang() Private Sub tampil_kode_barang() Dim perintah As String = "Select kode from tbl_barang" While data.read() cboitem.items.add(data("kode")) End While End End Class 15. Form Laporan Penjualan Imports System.Data.OleDb Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class Laporan1 Dim teks As String Dim da As OleDbDataAdapter Dim perintah As String Dim perintah1 As String Private Sub Laporan1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cekkoneksi() tampil_kode_barang()

34 Private Sub RadioButton2_CheckedChanged(ByVal sender As RadioButton2.CheckedChanged DTtanggal.Enabled = False cbohari.enabled = True cboitem.enabled = False cbohari.items.clear() Dim i As Integer For i = 1 To 12 cbohari.items.add(i) Next Private Sub RadioButton3_CheckedChanged(ByVal sender As RadioButton3.CheckedChanged DTtanggal.Enabled = False cbohari.enabled = True cboitem.enabled = False cbohari.items.clear() Dim i As Integer For i = 2009 To 2050 cbohari.items.add(i) Next Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If RadioButton1.Checked = True Then teks = DTtanggal.Value.Date.ToString("MM/dd/yyyy") perintah = "Select * From view_penjualan where tgl_penjualan=cdate('" & teks & "')" ElseIf RadioButton2.Checked = True Then teks = cbohari.text perintah = "Select * From view_penjualan where MONTH(tgl_penjualan)='" & teks & "'" ElseIf RadioButton3.Checked = True Then teks = cbohari.text perintah = "Select * From view_penjualan where YEAR(tgl_penjualan)='" & teks & "'" ElseIf RadioButton4.Checked = True Then teks = cboitem.text perintah1 = "Select * From tbl_penjualan where kode_brg = '" & teks & "'" Dim CRP1 As New ReportDocument Dim CRP2 As New ReportDocument Dim dset1 As New DataSet Dim dset2 As New DataSet Dim DA1 As New OleDbDataAdapter(perintah, koneksi) Dim DA2 As New OleDbDataAdapter(perintah1, koneksi)

35 If RadioButton4.Checked = True Then DA2.Fill(dSet2) CRP2.Load(Application.StartupPath & "\CRPenjualan1.rpt") CRP2.SetDataSource(dSet2.Tables(0)) CRP2.Refresh() Else DA1.Fill(dSet1) CRP1.Load(Application.StartupPath & "\CRPenjualan.rpt") CRP1.SetDataSource(dSet1.Tables(0)) CRP1.Refresh() If RadioButton4.Checked = True Then CrystalReportViewer1.ReportSource = CRP2 CrystalReportViewer1.Refresh() Else CrystalReportViewer1.ReportSource = CRP1 CrystalReportViewer1.Refresh() End Private Sub RadioButton1_CheckedChanged(ByVal sender As RadioButton1.CheckedChanged DTtanggal.Enabled = True cbohari.enabled = False cboitem.enabled = False Private Sub RadioButton4_CheckedChanged(ByVal sender As RadioButton4.CheckedChanged DTtanggal.Enabled = False cbohari.enabled = False cboitem.enabled = True Private Sub tampil_kode_barang() Dim perintah As String = "Select kode from tbl_barang" While data.read() cboitem.items.add(data("kode")) End While End End Class

36 16. Form About Public Class frm_about Private Sub btn_keluar_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btn_keluar.click Me.Close() End Class 17. Form Help Public Class frm_help Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Process.Start(Application.StartupPath & "/tutorial.pdf") 'posisi dimana file exe(executable) berada End Class 18. Module Imports System.Data.OleDb Module Module1 Public conn As String = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=db_inventory.mdb" 'syntax utk koneksi db ke access Public koneksi As New OleDbConnection(conn) Public Sub cekkoneksi() koneksi.close() koneksi.open() 'MsgBox("Periksa Kembali Database", MsgBoxStyle.Information, "Error") End End Module