Kamis, 12 November 2009

Menghitung Lagu....? bagaimana...?

hm....
mendengar lagu dari Ipod, Mp3 Player ato dari Handphone itu memang sering sekali
dilakukan oleh kamu, kamu yang disana, dan kamu yang diujung sono...
hehehe....
ada yang pernah kepikiran tidak bagaimana cara menghitung lagu dengna format "*.MP3"
nah penulis sebenarnya mendapat pertanyaan ini dari teman yang bernama Kebin Kuwoku....
dia mendapat pertanyaan ini pada saat di jalan pulang dari kampus ke rumah sambil dengerin Ipod Nano kesayangannya....
"bagaimana yah cara menghitung lagu dengna format *.MP3 sedangakan file word
dalam 1 karakter adalah 1 bit& jika lagu bagaimana?"
nah peunis juga belum pernah mendapatkan pertanyaan seperti berikut maka penulis berusaha mencari jawaban nya melalui Paman Google....
"google menjawab segalanya...."
jadi langsung ke intinya saja....

lagu form mp3 ini paling banyak dan umum dijumpai pada setiap pemutar musik. Ukuran bitrate tertingginya adalah 320 kbps.
jika di hitung dengan bitrate itu maka besar file bisa mencapai sekitar 9 MB/ 3 min lagu. jadi, bagaiman cara menghitungnya?
lagu itu tersusun atas karakter yang dinamakan byte atau bit, 1byte = 8 bit.

misalkan lagu itu lamanya 3 menit dalam 128 kbps (bitrate) maka satuan bit itu di ubah ke byte dgn cara d bagi 8. jadi, tiap detik lagu itu memakai 16 Kb memori. So, besar file total lagu itu adalah 180x16-2880, kemudian dikurangi 100 sebagai konstanta sehingga hasilnya jadi 2780 Kb.
128 kbps merupakan bit standard pada file mp3. jika di perbesar, kualitasnya semakin meningkat, begitu pula sebaliknya.

penyebab file yang dihitung tidak tepat tak lain adalah komputer yang terlalu teliti dan menghitungnya sampai satuan milidetik. itulah sebabnya komputer masih dipercayakan untuk menghitung nilai UN, biar g korup nilai gitu loh.... tapi ya itu tadi, kita kan hanya mau tahu kira-kira berapa besar filenya saja bukan cari tahu sampai yang sebenar-benarnya.

mengenai konstantanya, bisa di atur besarnya lewat kelipatan misalnya 64kbit=50, 32kbit=25, 192kbit=150.


ini penulis kutip dari
http://417d1.multiply.com/journal/item/1/Math_4_Fun
maklum..... (^^)"

Selasa, 21 Juli 2009

Membuat Databse dengan VB.NET 2005

Pertama-tama buat dulu rancang databsenya :
1. ambil data mentah
2. olah menjadi table normal 1 (1NF) ampe ngk dipecah pecah tabelnya seperti ini

TABEL TOKO HANDPHONE

KDSUPP

NAMASUPP

ALAMAT

KOTA

TELP

TGLMASUK

NAMABRANG

QTY

HARGA

TOTAL

K205

KUSUMA

GANDHI

MEDAN

0611234567

21/04/2009

NOKIAE71BLACK

5

4500000

22500000

S205

SELULAR

MANTRI

MEDAN

0612345678

21/04/2009

BBJAVELINE

3

4000000

12000000

H205

SELSEL

HMYAMIN

MEDAN

0618989898

22/04/2009

NOKIAN73BLACK

5

2500000

12500000

22/04/2009

SONERW900I

5

1500000

75000000

TABEL NORMAL PERTAMA 1NF

KDSUPP

NAMASUPP

ALAMAT

KOTA

TELP

TGLMASUK

NAMABRANG

QTY

HARGA

TOTAL

K205

KUSUMA

GANDHI

MEDAN

0611234567

21/04/2009

NOKIAE71BLACK

5

4500000

22500000

S205

SELULAR

MANTRI

MEDAN

0612345678

21/04/2009

BBJAVELINE

3

4000000

12000000

H205

SELSEL

HMYAMIN

MEDAN

0618989898

22/04/2009

NOKIAN73BLACK

5

2500000

12500000

H205

SELSEL

HMYAMIN

MEDAN

0618989898

22/04/2009

SONERW900I

5

1500000

75000000

TABEL NORMAL KE DUA 2 NF

KDSUPP

TGLMASUK

NMBARANG

QTY

HARGA

TOTAL

K205

21/04/2009

NOKIAE71BLACK

5

4500000

22500000

S205

21/04/2009

BBJAVELINE

3

4000000

12000000

H205

22/04/2009

NOKIAN73BLACK

5

2500000

12500000

H205

22/04/2009

SONERW900I

5

1500000

75000000

KDSUPP

NMSUPP

ALAMATSUPP

TELPSUPP

KOTASUPP

K205

KUSUMA

GANDHI

0611234567

MEDAN

S205

SELULAR

MANTRI

0612345678

MEDAN

H205

SELSEL

HMYAMIN

0618989898

MEDAN

TABEL PENJUALAN

TGLTRNASAKSI

NOFAKTUR

TELP

KDCUSS

NMCUSS

ALAMAT

NMBARANG

HARGA

QTY

23/09/200

10478

0618888888

C111

FELIX

GABUS 15E

NOKIAE71BLACK

4500000

1

10479

0619999999

C112

KEVIN

MANTRI 2A

NOKIAN73

2500000

1

10480

0611111111

C113

STEFFI

KMPKELING

SONERW900I

1500000

1

24/09/2009

10481

0615555555

C114

SHERLY

MARELAN

BBJAVELINE

4000000

1

TABEL NORMAL PERTAMA 1NF

TGLTRNASAKSI

NOFAKTUR

TELP

KDCUSS

NMCUSS

ALAMAT

NMBARANG

HARGA

QTY

23/09/200

10478

0618888888

C111

FELIX

GABUS 15E

NOKIAE71BLACK

4500000

1

23/09/200

10479

0619999999

C112

KEVIN

MANTRI 2A

NOKIAN73

2500000

1

23/09/200

10480

0611111111

C113

STEFFI

KMPKELING

SONERW900I

1500000

1

24/09/2009

10481

0615555555

C114

SHERLY

MARELAN

BBJAVELINE

4000000

1

TABEL NORMAL KE 2 2NF

NOFAKCUSS

TGLTRANSAKSI

KDCUSS

NAMABARANG

HARGATRANSAKSI

QTYTRANSAKSI

10478

23/09/2009

C111

NOKIAE71BLACK

4500000

1

10479

23/09/2009

C112

NOKIAN73

2500000

1

10480

23/09/2009

C113

SONERW900I

1500000

1

10481

24/09/2009

C114

BBJAVELINE

4000000

1

NOFAKCUSS

KDCUSS

NMCUSS

ALAMATCUSS

TELPCUSS

KOTACUSS

10478

C111

FELIX

GABUS 15E

0618888888

MEDAN

10479

C112

KEVIN

MANTRI 2A

0619999999

MEDAN

10480

C113

STEFFI

KMPKELING

0611111111

MEDAN

10481

C114

SHERLY

MARELAN

0615555555

MEDAN






























Programmer membuat databse menggunakan Microsoft Access 2005


Nb : Database tidak diisi secara manual dari Microsoft access melainkan dari program

RELASI ANTAR TABEL

TAMPILAN PROGRAM

LISTNING PROGRAM

Imports ADOX

Imports System.Data.OleDb

Public Class TabelBarang

Dim KNS As New OleDbConnection

Dim DA, DA2, DA3, DA4 As New OleDbDataAdapter

Dim DT1, DT2, DT3, DT4, DT5, DT6, DT7, DT8 As New DataTable

Dim BS1, BS2, BS3, BS4, BS5, BS6, BS7, BS8 As New BindingSource

Dim SQL, SQL2, SQL3, SQL4 As String

Dim A, B, D, F, G As String

Dim Z As New ADOX.Catalog

Private Sub kosongtabelbarang()

kdsupp.Text = ""

tglmasuk.Text = ""

nmbarang.Text = ""

qty.Text = ""

harga.Text = ""

total.Text = ""

End Sub

Private Sub kosongtabelsupplier()

kdsupp.Text = ""

nmsupp.Text = ""

alamatsupp.Text = ""

telpsupp.Text = ""

kotasupp.Text = ""

End Sub

Private Sub KOSONGTABELCUSTOMER()

NOFAK.Text = ""

NMCUSS.Text = ""

ALAMATCUSS.Text = ""

TELPCUSS.Text = ""

KOTACUSS.Text = ""

End Sub

Private Sub KOSONGTABELTRANSAKSI()

NOFAK2.Text = ""

TGLTRANSAKSI.Value = Now

KDCUSS2.Text = ""

NMBARANG2.Text = ""

HARGATRANSAKSI.Text = ""

QTYTRANSAKSI.Text = ""

End Sub

Private Sub semuatabelbarang()

SQL = "SELECT * FROM BARANG"

DA.SelectCommand = New OleDbCommand(SQL, KNS)

DA.Fill(DT1)

BS1.DataSource = DT1

DG.DataSource = BS1

End Sub

Private Sub semuatabelsupplier()

SQL2 = "SELECT * FROM HPSUPP"

DA2.SelectCommand = New OleDbCommand(SQL2, KNS)

DA2.Fill(DT3)

BS3.DataSource = DT3

dgsupp.DataSource = BS3

End Sub

Private Sub SEMUATABELCUSTOMER()

SQL3 = "SELECT * FROM CUSTOM"

DA3.SelectCommand = New OleDbCommand(SQL3, KNS)

DA3.Fill(DT5)

BS5.DataSource = DT5

DGCUSS.DataSource = BS5

End Sub

Private Sub SEMUATABELTRANSAKSI()

SQL4 = "SELECT * FROM TRANSAKSI"

DA4.SelectCommand = New OleDbCommand(SQL4, KNS)

DA4.Fill(DT7)

BS7.DataSource = DT7

DGTRANSAKSI.DataSource = BS7

End Sub

Private Sub CARItabelbarang()

DT1.Clear()

SQL = "SELECT * FROM BARANG WHERE KDSUPP='" & kdsupp.Text & "'"

DA.SelectCommand = New OleDbCommand(SQL, KNS)

DA.Fill(DT1)

End Sub

Private Sub CARItabelsupplier()

DT3.Clear()

SQL2 = "SELECT * FROM HPSUPP WHERE KDSUPP='" & kdsupp.Text & "'"

DA2.SelectCommand = New OleDbCommand(SQL2, KNS)

DA2.Fill(DT3)

End Sub

Private Sub CARITABELCUSTOMER()

DT5.Clear()

SQL3 = "SELECT * FROM CUSTOM WHERE NOFAKCUSS='" & NOFAK.Text & "'"

DA3.SelectCommand = New OleDbCommand(SQL3, KNS)

DA3.Fill(DT5)

End Sub

Private Sub CARITABELTRANSAKSI()

DT7.Clear()

SQL4 = "SELECT * FROM TRANSAKSI WHERE NOFAKCUSS='" & NOFAK.Text & "'"

DA4.SelectCommand = New OleDbCommand(SQL4, KNS)

DA4.Fill(DT7)

End Sub

Private Sub tampiltabelbarang()

kdsupp.Text = DT1.Rows(0)("KDSUPP")

tglmasuk.Text = DT1.Rows(0)("TGLMASUK")

nmbarang.Text = DT1.Rows(0)("NMBARANG")

qty.Text = DT1.Rows(0)("QTY")

harga.Text = DT1.Rows(0)("HARGA")

total.Text = DT1.Rows(0)("TOTAL")

End Sub

Private Sub tampiltabelsupplier()

kdsupp.Text = DT3.Rows(0)("KDSUPP")

nmsupp.Text = DT3.Rows(0)("NMSUPP")

alamatsupp.Text = DT3.Rows(0)("ALAMATSUPP")

telpsupp.Text = DT3.Rows(0)("TELPSUPP")

kotasupp.Text = DT3.Rows(0)("KOTASUPP")

End Sub

Private Sub TAMPILTABELCUSTOMER()

NOFAK.Text = DT5.Rows(0)("NOFAKCUSS")

NMCUSS.Text = DT5.Rows(0)("NMCUSS")

ALAMATCUSS.Text = DT5.Rows(0)("ALAMATCUSS")

TELPCUSS.Text = DT5.Rows(0)("TELPCUSS")

KOTACUSS.Text = DT5.Rows(0)("KOTACUSS")

End Sub

Private Sub TAMPILTABELTRANSAKSI()

NOFAK.Text = DT7.Rows(0)("NOFAKCUSS")

TGLTRANSAKSI.Text = DT7.Rows(0)("TGLTRANSAKSI")

KDCUSS2.Text = DT7.Rows(0)("KDCUSS")

NMBARANG2.Text = DT7.Rows(0)("NAMABARANG")

HARGATRANSAKSI.Text = DT7.Rows(0)("HARGATRANSAKSI")

QTYTRANSAKSI.Text = DT7.Rows(0)("QTYTRANSAKSI")

End Sub

Private Sub isitabelbarang()

DT1.Clear()

SQL = "SELECT * FROM [BARANG] ORDER BY KDSUPP"

DA.SelectCommand = New OleDbCommand(SQL, KNS)

DA.Fill(DT2)

BS2.DataSource = DT2

kdsupp.DataSource = BS2

kdsupp.DisplayMember = "KDSUPP"

End Sub

Private Sub isitabelsupplier()

DT3.Clear()

SQL2 = "SELECT * FROM [HPSUPP] ORDER BY KDSUPP"

DA2.SelectCommand = New OleDbCommand(SQL2, KNS)

DA2.Fill(DT4)

BS4.DataSource = DT4

kdsupp.DataSource = BS4

kdsupp.DisplayMember = "KDSUPP"

End Sub

Private Sub ISITABELCUSTOMER()

DT5.Clear()

SQL3 = "SELECT * FROM [CUSTOM] ORDER BY NOFAKCUSS"

DA3.SelectCommand = New OleDbCommand(SQL3, KNS)

DA3.Fill(DT6)

BS6.DataSource = DT6

NOFAK.DataSource = BS6

NOFAK.DisplayMember = "NOFAKCUSS"

End Sub

Private Sub ISITABELTRANSAKSI()

DT7.Clear()

SQL4 = "SELECT * FROM [TRANSAKSI] ORDER BY NOFAK"

DA4.Fill(DT8)

BS7.DataSource = DT8

NOFAK.DataSource = BS7

NOFAK.DisplayMember = "NOFAKCUSS"

End Sub

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

kdsupp.Focus()

'MENCIPTAKAN DATABASE DENGAN MICROSOFT ACCESS 2007

If IO.File.Exists(Application.StartupPath & "\HANDPHONE.ACCDB") = False Then

'MENCIPTAKAN DATABSE DENGAN NAMA HANDPHONE DAN FORMAT ACCDB

A = "PROVIDER=MICROSOFT.ACE.OLEDB.12.0;DATA SOURCE=" & Application.StartupPath & "\HANDPHONE.ACCDB"

Z.Create(A)

'MENCIPTAKAN TABEL BARANG,HPSUPP,CUSTOM, DAN TRANSAKSI

B = "CREATE TABLE [BARANG]([KDSUPP] CHAR(10),[TGLMASUK] date,[NMBARANG] CHAR(30),[QTY] CHAR(3),[HARGA] CHAR(30),[TOTAL] CHAR(30))"

D = "CREATE TABLE [HPSUPP]([KDSUPP] CHAR(10),[NMSUPP] CHAR(20),[ALAMATSUPP] CHAR(30),[TELPSUPP] CHAR(20),[KOTASUPP] CHAR(30))"

F = "CREATE TABLE [CUSTOM]([NOFAKCUSS] CHAR(10),[KDCUSS] CHAR(10),[NMCUSS] CHAR(30),[ALAMATCUSS] CHAR(30),[TELPCUSS] CHAR(14),[KOTACUSS] CHAR(30))"

G = "CREATE TABLE [TRANSAKSI]([NOFAKCUSS] CHAR(10),[TGLTRANSAKSI] date,[KDCUSS] CHAR(10),[NAMABARANG] CHAR(30),[HARGATRANSAKSI] CHAR(20),[QTYTRANSAKSI] CHAR(10))"

KNS.ConnectionString = A

DA.SelectCommand = New OleDbCommand(B, KNS)

DA2.SelectCommand = New OleDbCommand(D, KNS)

DA3.SelectCommand = New OleDbCommand(F, KNS)

DA4.SelectCommand = New OleDbCommand(G, KNS)

DA.Fill(DT1)

DA2.Fill(DT3)

DA3.Fill(DT5)

DA4.Fill(DT7)

End If

KNS.ConnectionString = "PROVIDER=MICROSOFT.ACE.OLEDB.12.0;DATA SOURCE=" & Application.StartupPath & "\HANDPHONE.ACCDB"

semuatabelbarang()

semuatabelsupplier()

SEMUATABELCUSTOMER()

SEMUATABELTRANSAKSI()

End Sub

Private Sub vsim_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles vsim.Click

If kdsupp.Text.Trim = "" Then

MsgBox("Isi data dengan lengkap")

Exit Sub

End If

KNS.Open()

CARItabelbarang()

CARItabelsupplier()

If DT1.Rows.Count = 0 Then

SQL = "INSERT INTO BARANG VALUES('" & kdsupp.Text & "','" & tglmasuk.Value.Date & "','" & nmbarang.Text & "','" & qty.Text & "','" & harga.Text & "','" & total.Text & "')"

SQL2 = "INSERT INTO HPSUPP VALUES('" & kdsupp.Text & "','" & nmsupp.Text & "','" & alamatsupp.Text & "','" & telpsupp.Text & "','" & kotasupp.Text & "')"

Else

SQL = "UPDATE BARANG SET KDSUPP='" & kdsupp.Text & "',[TGLMASUK]=#" & tglmasuk.Value.Date & "#,[NMBARANG]='" & nmbarang.Text & "',[QTY]='" & qty.Text & "',[HARGA]='" & harga.Text & "',[TOTAL]='" & total.Text & "'"

SQL2 = "UPDATEHPSUPP SET HPSUPP='" & kdsupp.Text & "',[NMSUPP]='" & nmsupp.Text & "',[ALAMATSUPP]='" & alamatsupp.Text & "',[TELPSUPP]='" & telpsupp.Text & "',[KOTASUPP]='" & kotasupp.Text & "'"

End If

Using CMD As New OleDbCommand(SQL, KNS)

CMD.ExecuteNonQuery()

End Using

Using CMD As New OleDbCommand(SQL2, KNS)

CMD.ExecuteNonQuery()

End Using

KNS.Close()

isitabelbarang()

isitabelsupplier()

semuatabelbarang()

semuatabelsupplier()

kdsupp.Text = ""

kdsupp.Focus()

kosongtabelbarang()

kosongtabelsupplier()

Me.Refresh()

End Sub

Private Sub VSIMCUSS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VSIMCUSS.Click

If KDCUSS.Text.Trim = "" Then

MsgBox("Isi data dengan lengkap")

Exit Sub

End If

KNS.Open()

CARITABELCUSTOMER()

If DT5.Rows.Count = 0 Then

SQL3 = "INSERT INTO CUSTOM VALUES('" & NOFAK.Text & "','" & KDCUSS.Text & "','" & NMCUSS.Text & "','" & ALAMATCUSS.Text & "','" & TELPCUSS.Text & "','" & KOTACUSS.Text & "')"

Else

SQL3 = "UPDATE CUSTOM SET NOFAKCUSS='" & NOFAK.Text & "',[KDCUSS]='" & KDCUSS.Text & "',[NMCUSS]='" & NMCUSS.Text & "',[ALAMATCUSS]='" & ALAMATCUSS.Text & "',[TELPCUSS]='" & TELPCUSS.Text & "',[KOTACUSS]='" & KOTACUSS.Text & "'"

End If

Using CMD As New OleDbCommand(SQL3, KNS)

CMD.ExecuteNonQuery()

End Using

If DT7.Rows.Count = 0 Then

SQL4 = "INSERT INTO TRANSAKSI VALUES('" & NOFAK.Text & "','" & TGLTRANSAKSI.Value.Date & "','" & KDCUSS.Text & "','" & NMBARANG2.Text & "','" & HARGATRANSAKSI.Text & "','" & QTYTRANSAKSI.Text & "')"

Else

SQL4 = "UPDATE TRANSAKSI SET NOFAKCUSS='" & NOFAK.Text & "',[TGLTRANSAKSI]='" & TGLTRANSAKSI.Value.Date & "',[KDCUSS]='" & KDCUSS.Text & "',[NAMABARANG]='" & NMBARANG2.Text & "',[HARGATRANSAKSI]='" & HARGATRANSAKSI.Text & "',[QTYTRANSAKSI]='" & QTYTRANSAKSI.Text & "'"

End If

Using CMD As New OleDbCommand(SQL4, KNS)

CMD.ExecuteNonQuery()

End Using

ISITABELCUSTOMER()

ISITABELTRANSAKSI()

SEMUATABELCUSTOMER()

SEMUATABELTRANSAKSI()

KOSONGTABELCUSTOMER()

KOSONGTABELTRANSAKSI()

DGCUSS.Refresh()

DGTRANSAKSI.Refresh()

Me.Refresh()

End Sub

Private Sub kdsupp_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles kdsupp.TextChanged

DT1.Clear()

DT3.Clear()

'DT5.Clear()

SQL = "SELECT * FROM BARANG WHERE KDSUPP='" & kdsupp.Text & "'"

SQL2 = "SELECT * FROM HPSUPP WHERE KDSUPP='" & kdsupp.Text & "'"

DA.SelectCommand = New OleDbCommand(SQL, KNS)

DA2.SelectCommand = New OleDbCommand(SQL2, KNS)

DA.Fill(DT1)

DA2.Fill(DT3)

If DT1.Rows.Count = 0 Then

semuatabelbarang()

Else

tampiltabelbarang()

End If

If DT3.Rows.Count = 0 Then

semuatabelsupplier()

Else

tampiltabelsupplier()

End If

KDSUPP2.Text = kdsupp.Text

End Sub

Private Sub NOFAK_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles NOFAK.TextChanged

DT5.Clear()

SQL3 = "SELECT * FROM CUSTOM WHERE NOFAKCUSS='" & NOFAK.Text & "'"

DA3.SelectCommand = New OleDbCommand(SQL3, KNS)

DA3.Fill(DT5)

If DT5.Rows.Count = 0 Then

SEMUATABELCUSTOMER()

Else

TAMPILTABELCUSTOMER()

End If

NOFAK2.Text = NOFAK.Text

End Sub

Private Sub vhap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles vhap.Click

CARItabelbarang()

CARItabelsupplier()

If DT1.Rows.Count = 0 Then

MessageBox.Show("DATA GAK KETEMU", "INFO", MessageBoxButtons.OK)

Else

MessageBox.Show("Yakin Data Dihapus", "INFORMATION", MessageBoxButtons.YesNo)

If vbYes Then

SQL = "DELETE FROM BARANG WHERE [KDSUPP]='" & kdsupp.Text & "'"

SQL2 = "DELETE FROM HPSUPP WHERE [KDSUPP]='" & kdsupp.Text & "'"

KNS.Open()

DA.DeleteCommand = New OleDbCommand(SQL, KNS)

DA2.DeleteCommand = New OleDbCommand(SQL2, KNS)

DA.DeleteCommand.ExecuteNonQuery()

DA2.DeleteCommand.ExecuteNonQuery()

semuatabelbarang()

semuatabelsupplier()

dgsupp.Refresh()

DGCUSS.Refresh()

isitabelbarang()

isitabelsupplier()

kosongtabelbarang()

kosongtabelsupplier()

Me.Refresh()

DG.Refresh()

dgsupp.Refresh()

kdsupp.Text = ""

kdsupp.Focus()

Else

kosongtabelbarang()

kosongtabelsupplier()

End If

End If

KNS.Close()

dgsupp.Refresh()

End Sub

Private Sub VHAPCUSS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VHAPCUSS.Click

CARITABELCUSTOMER()

CARITABELTRANSAKSI()

If DT5.Rows.Count = 0 And DT7.Rows.Count = 0 Then

MessageBox.Show("DATA GAK KETEMU", "INFO", MessageBoxButtons.OK)

Else

MessageBox.Show("Yakin Data Dihapus", "INFORMATION", MessageBoxButtons.YesNo)

If vbYes Then

SQL3 = "DELETE FROM CUSTOM WHERE [NOFAKCUSS]='" & NOFAK.Text & "'"

SQL4 = "DELETE FROM TRANSAKSI WHERE [NOFAKCUSS]='" & NOFAK.Text & "'"

KNS.Open()

DA3.DeleteCommand = New OleDbCommand(SQL3, KNS)

DA4.DeleteCommand = New OleDbCommand(SQL4, KNS)

DA3.DeleteCommand.ExecuteNonQuery()

DA4.DeleteCommand.ExecuteNonQuery()

SEMUATABELCUSTOMER()

SEMUATABELCUSTOMER()

DGCUSS.Refresh()

DGTRANSAKSI.Refresh()

ISITABELCUSTOMER()

ISITABELTRANSAKSI()

KOSONGTABELCUSTOMER()

KOSONGTABELTRANSAKSI()

Me.Refresh()

DGCUSS.Refresh()

kdsupp.Text = ""

kdsupp.Focus()

Else

KOSONGTABELCUSTOMER()

DGTRANSAKSI.Refresh()

End If

End If

KNS.Close()

dgsupp.Refresh()

DGTRANSAKSI.Refresh()

End Sub

Private Sub TabelBarang_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown

kdsupp.Focus()

kdsupp.Text = ""

End Sub

Private Sub vubah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles vubah.Click

If kdsupp.Text.Trim = "" Then

MsgBox("ISI DATA DENGAN LENGKAP")

Exit Sub

End If

KNS.Open()

CARItabelbarang()

If MsgBox("perbaiki data", MsgBoxStyle.OkCancel) <> MsgBoxResult.Ok Then Exit Sub

SQL = "UPDATE BARANG SET KDSUPP='" & kdsupp.Text & "',[TGLMASUK]=#" & tglmasuk.Value.Date & "#,[NMBARANG]='" & nmbarang.Text & "',[QTY]='" & qty.Text & "',[HARGA]='" & harga.Text & "',[TOTAL]='" & total.Text & "'"

SQL2 = "UPDATE HPSUPP SET KDSUPP='" & kdsupp.Text & "',[NMSUPP]='" & nmsupp.Text & "',[ALAMATSUPP]='" & alamatsupp.Text & "',[TELPSUPP]='" & telpsupp.Text & "',[KOTASUPP]='" & kotasupp.Text & "'"

Using CMD As New OleDbCommand(SQL, KNS)

CMD.ExecuteNonQuery()

End Using

Using CMD As New OleDbCommand(SQL2, KNS)

CMD.ExecuteNonQuery()

End Using

KNS.Close()

isitabelbarang()

isitabelsupplier()

semuatabelbarang()

semuatabelsupplier()

kosongtabelbarang()

kosongtabelsupplier()

kdsupp.Text = ""

kdsupp.Focus()

End Sub

Private Sub VUBAHCUSS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VUBAHCUSS.Click

If NOFAK.Text.Trim = "" Then

MsgBox("ISI DATA DENGAN LENGKAP")

Exit Sub

End If

KNS.Open()

CARITABELCUSTOMER()

CARITABELTRANSAKSI()

If MsgBox("perbaiki data", MsgBoxStyle.OkCancel) <> MsgBoxResult.Ok Then Exit Sub

SQL3 = "UPDATE CUSTOM SET NOFAK='" & NOFAK.Text & "',[KDSCUSS]='" & KDCUSS.Text & "',[NMCUSS]='" & NMCUSS.Text & "',[ALAMATCUSS]='" & ALAMATCUSS.Text & "',[TELPCUSS]='" & TELPCUSS.Text & "',[KOTACUSS]='" & KOTACUSS.Text & "'"

SQL4 = "UPDATE TRANSAKSI SET NOFAKCUSS='" & NOFAK.Text & "',[TGLTRANSAKSI]='" & TGLTRANSAKSI.Value.Date & "',[KDCUSS]='" & KDCUSS.Text & "',[NAMABARANG]='" & NMBARANG2.Text & "',[HARGATRANSAKSI]='" & HARGATRANSAKSI.Text & "',[QTYTRANSAKSI]='" & QTYTRANSAKSI.Text & "'"

Using CMD As New OleDbCommand(SQL3, KNS)

CMD.ExecuteNonQuery()

End Using

Using CMD As New OleDbCommand(SQL4, KNS)

CMD.ExecuteNonQuery()

End Using

KNS.Close()

ISITABELCUSTOMER()

ISITABELTRANSAKSI()

SEMUATABELCUSTOMER()

SEMUATABELTRANSAKSI()

KOSONGTABELCUSTOMER()

KOSONGTABELTRANSAKSI()

kdsupp.Text = ""

kdsupp.Focus()

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Me.Refresh()

kosongtabelsupplier()

kosongtabelbarang()

KOSONGTABELCUSTOMER()

KOSONGTABELTRANSAKSI()

End Sub

Private Sub KDCUSS_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KDCUSS.TextChanged

KDCUSS2.Text = KDCUSS.Text

End Sub

End Class