Lampiran

LAMPIRAN

FLOWCHART

Menu Utama Menu Entri Data

Supplier Sub Menu Tambah

Supplier

Sub Menu Perbaiki Sub Menu Hapus

Supplier Supplier

Sub Menu Cari

Supplier

Pegawai Sub Menu Tambah

Pegawai

Sub Menu Perbaiki Sub Menu Hapus

Pegawai Pegawai

Sub Menu Cari

Pegawai

Barang Sub Menu Tambah

Barang

Sub Menu Perbaiki Sub Menu Hapus

Barang Barang

Sub Menu Cari

Barang

Menu Proses

Pembelian Barang Sub Menu Tambah

Pembelian Barang

Sub Menu Perbaiki Sub Menu Hapus

Pembelian Pembelian

Permintaan Sub Menu Tambah

Permintaan

Sub Menu Perbaiki Sub Menu Hapus

Permintaan Permintaan

Menu Laporan

Sub Menu Tanggal

Laporan

Sub Menu Bulan

Laporan

LISTING PROGRAM

Form Login

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{TAB}”

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

End Sub

Private Sub Command1_Click()

If Text1.Text = “VERA” And Text2.Text = “ADMINISTRATOR” Then

MdiMenuUtama.Show

Else

MsgBox “Isi Nama User dan Password yang benar..????”, vbCritical, “Wrong Password”

Text1.Text = “”

Text2.Text = “”

Text1.SetFocus

End If

End Sub

Private Sub Command2_Click()

End

End Sub

Menu

Private Sub MDIForm_Load()

Label1.Top = 1800

Label2.Top = 3840

End Sub

Private Sub MnEntryData_Detail_Click(Index As Integer)

Select Case Index

Case 1

FormSupplier.Show

Case 2

FormPegawai.Show

Case 3

FormBarang.Show

End Select

End Sub

Private Sub MnProses_Detail_Click(Index As Integer)

Select Case Index

Case 1

FormPembelian.Show

Case 2

FormPermintaan.Show

End Select

End Sub

Private Sub MnLaporanDetail_Click(Index As Integer)

Select Case Index

Case 1

FormLapStokBarang.Show

Case 2

nModul = lap_1

FormLapPembelianPertanggal.Show

Case 3

nModul = lap_1

FormLapPembelianPerbulan.Show

Case 4

nModul = lap_2

FormLapPembelianPertanggal.Show

Case 5

nModul = lap_2

FormLapPembelianPerbulan.Show

End Select

End Sub

Private Sub Timer1_Timer()

100 If Label1.Top < (Picture1.ScaleHeight / 3) Then

Label1.Top = Label1.Top +

Label2.Top = Label2.Top – 100

Else

Timer1.Enabled = False

End If

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Index

Case 1: MnEntryData_Detail_Click (1)

Case 2: MnEntryData_Detail_Click (2)

Case 3: MnEntryData_Detail_Click (3)

Case 4: MnProses_Detail_Click (1)

Case 5: MnProses_Detail_Click (2)

Case 7: End

End Select

End Sub

Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)

Select Case ButtonMenu.Index

Case 1: MnLaporanDetail_Click (1)

Case 2: MnLaporanDetail_Click (2)

Case 3: MnLaporanDetail_Click (3)

Case 4: MnLaporanDetail_Click (4)

Case 5: MnLaporanDetail_Click (5)

End Select

End Sub

Form Barang

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

With CboSatuan_Barang

.AddItem “Buah”

.AddItem “Botol”

.AddItem “Unit”

End With

Bersih

Hidup False, True

RefreshData

End Sub

Private Sub Bersih()

TxtKode_Barang.Text = “”

TxtNama_Barang.Text = “”

CboSatuan_Barang.Text = “”

TxtCari.Text = “”

End Sub

Private Sub Hidup(X As Boolean, Y As Boolean)

TxtKode_Barang.Enabled = X

TxtNama_Barang.Enabled = X

CboSatuan_Barang.Enabled = X

CmdSimpan.Enabled = X

CmdBatal.Enabled = X

CmdCari.Enabled = Y

TxtCari.Enabled = Y

CmdTambah.Enabled = Y

CmdPerbaiki.Enabled = Y

CmdHapus.Enabled = Y

End Sub

Private Sub RefreshData()

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select kode_barang as [Kode],Nama_Barang as [Nama Barang], Satuan_Barang as [Satuan] From Barang Order By Kode_Barang”

.Refresh

End With

End Sub

Private Sub CmdCari_Click()

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select kode_barang as [Kode],Nama_Barang as [Nama Barang], Satuan_Barang as [Satuan] From Barang Where Kode_Barang like ‘%” & TxtCari.Text & “%’ Order By Kode_Barang”

.Refresh

End With

TxtCari.SetFocus

End Sub

Private Sub CmdTambah_Click()

Bersih

Hidup True, False

TxtKode_Barang.SetFocus

nModul = k_Save

End Sub

Private Sub CmdSimpan_Click()

With RecBarang

If nModul = k_Save Then

.AddNew

Else

.Edit

End If

!kode_barang = TxtKode_Barang.Text

!Nama_Barang = TxtNama_Barang.Text

!Satuan_Barang = CboSatuan_Barang.Text

.Update

End With

Grid1.Refresh

Adodc1.Refresh

RefreshData

Bersih

Hidup False, True

TxtCari.SetFocus

End Sub

Private Sub CmdBatal_Click()

Bersih

Hidup False, True

RefreshData

Grid1.Refresh

Adodc1.Refresh

TxtCari.SetFocus

End Sub

Private Sub CmdPerbaiki_Click()

Hidup True, False

TxtKode_Barang.Text = Grid1.Columns(0).Text

With RecBarang

.Index = “idxbarang”

.Seek “=”, TxtKode_Barang.Text

If Not .NoMatch Then

TxtNama_Barang.Text = !Nama_Barang

CboSatuan_Barang.Text = !Satuan_Barang

End If

End With

TxtKode_Barang.Enabled = False

TxtNama_Barang.SetFocus

nModul = k_Cancel

End Sub

Private Sub CmdHapus_Click()

Adodc1.Recordset.Delete

End Sub

Private Sub CmdKeluar_Click()

Unload Me

End Sub

Private Sub TxtKode_Barang_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

End Sub

Private Sub TxtKode_Barang_LostFocus()

With RecBarang

.Index = “idxbarang”

.Seek “=”, TxtKode_Barang.Text

If Not .NoMatch Or TxtKode_Barang.Text = “” Then

MsgBox “Data sudah ada/Isian Kosong”, vbCritical, “Error Message”

TxtKode_Barang.SetFocus

End If

End With

End Sub

Form Pegawai

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

Bersih

Hidup False, True

RefreshData

End Sub

Private Sub Bersih()

TxtKode_Pegawai.Text = “”

TxtNama_Pegawai.Text = “”

TxtAlamat_Pegawai.Text = “”

TxtJabatan_Pegawai.Text = “”

TxtTelepon_Pegawai.Text = “”

TxtCari.Text = “”

End Sub

Private Sub Hidup(X As Boolean, Y As Boolean)

TxtKode_Pegawai.Enabled = X

TxtNama_Pegawai.Enabled = X

TxtAlamat_Pegawai.Enabled = X

TxtJabatan_Pegawai.Enabled = X

TxtTelepon_Pegawai.Enabled = X

CmdSimpan.Enabled = X

CmdBatal.Enabled = X

CmdCari.Enabled = Y

TxtCari.Enabled = Y

CmdTambah.Enabled = Y

CmdPerbaiki.Enabled = Y

CmdHapus.Enabled = Y

End Sub

Private Sub RefreshData()

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select kode_pegawai as [Kode],Nama_Pegawai as [Nama Pegawai], Alamat_Pegawai as [Alamat],Jabatan_Pegawai as [Jabatan],Telepon_Pegawai as [Telepon] From Pegawai Order By Kode_Pegawai”

.Refresh

End With

End Sub

Private Sub CmdCari_Click()

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select kode_pegawai as [Kode],Nama_Pegawai as [Nama Pegawai], Alamat_Pegawai as [Alamat],Jabatan_Pegawai as [Jabatan],Telepon_Pegawai as [Telepon] From Pegawai where kode_pegawai like ‘%” & TxtCari.Text & “%’ Order By Kode_Pegawai”

.Refresh

End With

TxtCari.SetFocus

End Sub

Private Sub CmdTambah_Click()

Bersih

Hidup True, False

TxtKode_Pegawai.SetFocus

nModul = k_Save

End Sub

Private Sub CmdSimpan_Click()

With RecPegawai

If nModul = k_Save Then

.AddNew

Else

.Edit

End If

!kode_pegawai = TxtKode_Pegawai.Text

!Nama_Pegawai = TxtNama_Pegawai.Text

!alamat_pegawai = TxtAlamat_Pegawai.Text

!Jabatan_Pegawai = TxtJabatan_Pegawai.Text

!telepon_pegawai = TxtTelepon_Pegawai.Text

.Update

End With

Grid1.Refresh

Adodc1.Refresh

RefreshData

Bersih

Hidup False, True

TxtCari.SetFocus

End Sub

Private Sub CmdBatal_Click()

Bersih

Hidup False, True

RefreshData

Grid1.Refresh

Adodc1.Refresh

TxtCari.SetFocus

End Sub

Private Sub CmdPerbaiki_Click()

Hidup True, False

TxtKode_Pegawai.Text = Grid1.Columns(0).Text

With RecPegawai

.Index = “idxpegawai”

.Seek “=”, TxtKode_Pegawai.Text

If Not .NoMatch Then

TxtNama_Pegawai.Text = !Nama_Pegawai

TxtAlamat_Pegawai.Text = !alamat_pegawai

TxtJabatan_Pegawai.Text = !Jabatan_Pegawai

TxtTelepon_Pegawai.Text = !telepon_pegawai

End If

End With

TxtKode_Pegawai.Enabled = False

TxtNama_Pegawai.SetFocus

nModul = k_Cancel

End Sub

Private Sub CmdHapus_Click()

Adodc1.Recordset.Delete

End Sub

Private Sub CmdKeluar_Click()

Unload Me

End Sub

Private Sub TxtKode_Pegawai_LostFocus()

With RecPegawai

.Index = “idxPegawai”

.Seek “=”, TxtKode_Pegawai.Text

If Not .NoMatch Or TxtKode_Pegawai.Text = “” Then

MsgBox “Data sudah ada/Isian Kosong”, vbCritical, “Error Message”

TxtKode_Pegawai.SetFocus

End If

End With

End Sub

Private Sub TxtKode_Pegawai_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

End Sub

Private Sub TxtTelepon_Pegawai_KeyPress(KeyAscii As Integer)

If KeyAscii = vbKeyBack Then Exit Sub

If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45 Then KeyAscii = 0

End Sub

Form Supplier

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

Bersih

Hidup False, True

RefreshData

End Sub

Private Sub Bersih()

TxtKode_Supplier.Text = “”

TxtNama_Supplier.Text = “”

TxtAlamat_Supplier.Text = “”

TxtPerusahaan_Supplier.Text = “”

TxtTelepon_Supplier.Text = “”

TxtCari.Text = “”

End Sub

Private Sub Hidup(X As Boolean, Y As Boolean)

TxtKode_Supplier.Enabled = X

TxtNama_Supplier.Enabled = X

TxtAlamat_Supplier.Enabled = X

TxtPerusahaan_Supplier.Enabled = X

TxtTelepon_Supplier.Enabled = X

CmdSimpan.Enabled = X

CmdBatal.Enabled = X

CmdCari.Enabled = Y

TxtCari.Enabled = Y

CmdTambah.Enabled = Y

CmdPerbaiki.Enabled = Y

CmdHapus.Enabled = Y

End Sub

Private Sub RefreshData()

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select kode_Supplier as [Kode],Nama_Supplier as [Nama Supplier], Alamat_Supplier as [Alamat],Perusahaan_Supplier as [Nama Perusahaan],Telepon_Supplier as [Telepon] From Supplier Order By Kode_Supplier”

.Refresh

End With

End Sub

Private Sub CmdCari_Click()

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select kode_Supplier as [Kode],Nama_Supplier as [Nama Supplier], Alamat_Supplier as [Alamat],Perusahaan_Supplier as [Nama Perusahaan],Telepon_Supplier as [Telepon] From Supplier where kode_Supplier like ‘%” & TxtCari.Text & “%’ Order By Kode_Supplier”

.Refresh

End With

TxtCari.SetFocus

End Sub

Private Sub CmdTambah_Click()

Bersih

Hidup True, False

TxtKode_Supplier.SetFocus

nModul = k_Save

End Sub

Private Sub CmdSimpan_Click()

With RecSupplier

If nModul = k_Save Then

.AddNew

Else

.Edit

End If

!kode_Supplier = TxtKode_Supplier.Text

!Nama_Supplier = TxtNama_Supplier.Text

!Alamat_Supplier = TxtAlamat_Supplier.Text

!Perusahaan_Supplier = TxtPerusahaan_Supplier.Text

!Telepon_Supplier = TxtTelepon_Supplier.Text

.Update

End With

Grid1.Refresh

Adodc1.Refresh

RefreshData

Bersih

Hidup False, True

TxtCari.SetFocus

End Sub

Private Sub CmdBatal_Click()

Bersih

Hidup False, True

RefreshData

Grid1.Refresh

Adodc1.Refresh

TxtCari.SetFocus

End Sub

Private Sub CmdPerbaiki_Click()

Hidup True, False

TxtKode_Supplier.Text = Grid1.Columns(0).Text

With RecSupplier

.Index = “idxSupplier”

.Seek “=”, TxtKode_Supplier.Text

If Not .NoMatch Then

TxtNama_Supplier.Text = !Nama_Supplier

TxtAlamat_Supplier.Text = !Alamat_Supplier

TxtPerusahaan_Supplier.Text = !Perusahaan_Supplier

TxtTelepon_Supplier.Text = !Telepon_Supplier

End If

End With

TxtKode_Supplier.Enabled = False

TxtNama_Supplier.SetFocus

nModul = k_Cancel

End Sub

Private Sub CmdHapus_Click()

Adodc1.Recordset.Delete

End Sub

Private Sub CmdKeluar_Click()

Unload Me

End Sub

Private Sub TxtKode_Supplier_LostFocus()

With RecSupplier

.Index = “idxSupplier”

.Seek “=”, TxtKode_Supplier.Text

If Not .NoMatch Or TxtKode_Supplier.Text = “” Then

MsgBox “Data sudah ada/Isian Kosong”, vbCritical, “Error Message”

TxtKode_Supplier.SetFocus

End If

End With

End Sub

Private Sub TxtKode_Supplier_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

End Sub

Private Sub TxtTelepon_Supplier_KeyPress(KeyAscii As Integer)

If KeyAscii = vbKeyBack Then Exit Sub

If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45 Then KeyAscii = 0

End Sub

Form Pembelian

Private Sub Form_Load()

With Combo1

.AddItem “NoFak_Pembelian”

.AddItem “Tanggal_Pembelian”

End With

Combo1.ListIndex = 0

RefreshData

End Sub

Public Sub RefreshData()

With AdoPembelian

.ConnectionString = Conn

.RecordSource = “Select Pembelian.NoFak_Pembelian as [No Faktur],Pembelian.Tanggal_Pembelian as [Tanggal],Pembelian.Kode_Pegawai as [Kode Pegawai],Pembelian.Kode_Supplier as [Kode Supplier],Pembelian.Total_Pembelian as [Total Pembelian] From Pembelian Where ” + Combo1.Text + ” Like ‘%” + Text1.Text + “%’ Order By Pembelian.NoFak_Pembelian”

.Refresh

End With

End Sub

Private Sub Form_Resize()

With GridPembelian

.Top = Toolbar1.Height

.Left = 50

.Height = Me.ScaleHeight – 100

.Width = Me.ScaleWidth – .Left – 50

End With

End Sub

Private Sub PindahData()

With FormTransaksiPembelian

.TxtNoFak_Pembelian.Text = GridPembelian.Columns(0).Text

.TxtNoFak_Pembelian.Enabled = False

.DtpTanggal_Pembelian.Value = GridPembelian.Columns(1).Text

.TxtKode_Pegawai.Text = GridPembelian.Columns(2).Text

.TxtKode_Supplier.Text = GridPembelian.Columns(3).Text

.TxtTotal_Pembelian.Text = Val(GridPembelian.Columns(4).Text)

.CmdSupplier.Enabled = False

.CmdPegawai.Enabled = False

End With

End Sub

Private Sub Text1_Change()

RefreshData

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case “Add”

nModul = k_Appe

FormTransaksiPembelian.Show

Case “Edit”

nModul = k_Edit

PindahData

FormTransaksiPembelian.Show

Case “Del”

hapus = MsgBox(“Yakin data ini dihapus ? “, vbInformation + vbYesNo, “Hapus Data”)

If hapus = vbYes Then AdoPembelian.Recordset.Delete

Case “Fresh”

RefreshData

End Select

End Sub

Form Transaksi Pembelian Barang Umum

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

If nModul = k_Appe Then Bersih

RefreshData

End Sub

Private Sub Bersih()

TxtNofak_Pembelian.Text = “B-“

DtpTanggal_Pembelian.Value = DateValue(Now)

TxtKode_Pegawai.Text = “”

TxtNama_Pegawai.Text = “”

TxtJabatan_Pegawai.Text = “”

TxtKode_Supplier.Text = “”

TxtNama_Supplier.Text = “”

TxtAlamat_Supplier.Text = “”

TxtTelepon_Supplier.Text = “”

TxtPerusahaan_Supplier.Text = “”

End Sub

Public Sub RefreshData()

Dim tPembelian As Currency

With AdoPembelianBarang

.ConnectionString = Conn

.RecordSource = “Select PembelianBarang.Kode_Barang as [Kode Barang],PembelianBarang.Jumlah_Beli as [Jumlah Beli],PembelianBarang.Harga_Beli as [Harga],(PembelianBarang.jumlah_beli * PembelianBarang.harga_beli) as [Total] From Barang,Pembelian,PembelianBarang Where (PembelianBarang.NoFak_Pembelian= Pembelian.NoFak_Pembelian) And (PembelianBarang.Kode_Barang= Barang.Kode_Barang) And PembelianBarang.NoFak_Pembelian='” + TxtNofak_Pembelian.Text + “‘”

.Refresh

End With

AdoPembelianBarang.Refresh

Do While Not AdoPembelianBarang.Recordset.EOF

tPembelian = tPembelian + AdoPembelianBarang.Recordset.Fields(3)

AdoPembelianBarang.Recordset.MoveNext

Loop

TxtTotal_Pembelian.Text = tPembelian

End Sub

Private Sub TxtNoFak_Pembelian_Change()

RefreshData

End Sub

Private Sub TxtNoFak_Pembelian_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

If KeyAscii = vbKeyBack Then Exit Sub

If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45 And KeyAscii <> 66 Then KeyAscii = 0

End Sub

Private Sub CmdSupplier_Click()

GridSupplier.Visible = True

With AdoSupplier

.ConnectionString = Conn

.RecordSource = “select * from supplier order by kode_supplier”

.Refresh

End With

End Sub

Private Sub GridSupplier_DblClick()

TxtKode_Supplier.Text = GridSupplier.Columns(0).Text

GridSupplier.Visible = False

End Sub

Private Sub TxtKode_Supplier_Change()

With RecSupplier

.Index = “IdxSupplier”

.Seek “=”, TxtKode_Supplier.Text

If Not .NoMatch Then

TxtNama_Supplier.Text = !Nama_Supplier

TxtAlamat_Supplier.Text = !Alamat_Supplier

TxtTelepon_Supplier.Text = !Telepon_Supplier

TxtPerusahaan_Supplier.Text = !Perusahaan_Supplier

End If

End With

End Sub

Private Sub CmdPegawai_Click()

GridPegawai.Visible = True

With AdoPegawai

.ConnectionString = Conn

.RecordSource = “select * from pegawai order by kode_pegawai”

.Refresh

End With

End Sub

Private Sub GridPegawai_DblClick()

TxtKode_Pegawai.Text = GridPegawai.Columns(0).Text

GridPegawai.Visible = False

End Sub

Private Sub TxtKode_Pegawai_Change()

With RecPegawai

.Index = “IdxPegawai”

.Seek “=”, TxtKode_Pegawai.Text

If Not .NoMatch Then

TxtNama_Pegawai.Text = !Nama_Pegawai

TxtJabatan_Pegawai.Text = !Jabatan_Pegawai

End If

End With

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case “New”

If CekPembelian Then

SimpanPembelian “Edit”

Else

SimpanPembelian “Add”

End If

MsgBox “Data Pembelian di Update”, vbInformation, “Update Pembelian”

FormPembelian.AdoPembelian.Refresh

nnModul = k_Appe

FormInputPembelian.Show

Case “Edit”

nnModul = k_Edit

PindahData

FormInputPembelian.Show

Case “Del”

hapus = MsgBox(“Benar data ini dihapus ?”, vbInformation + vbYesNo, “Hapus Data”)

If hapus = vbYes Then

Dim X As Integer

X = GridPembelianBarang.Columns(1).Text

With RecBarang

.Index = “IdxBarang”

.Seek “=”, GridPembelianBarang.Columns(0).Text

If Not .NoMatch Then

.Edit

.Fields(“Stok_Barang”) = .Fields(“Stok_Barang”) – X

.Update

End If

End With

With RecStok_Barang

.Index = “idxpengecekan”

.Seek “=”, TxtNofak_Pembelian.Text, GridPembelianBarang.Columns(0).Text

If Not .NoMatch Then

RecStok_Barang.Delete

End If

End With

AdoPembelianBarang.Recordset.Delete

RefreshData

With RecPembelian

.Edit

.Fields(“Total_Pembelian”) = Val(TxtTotal_Pembelian.Text)

.Update

End With

MsgBox “Data direfresh”, vbInformation, “RefreshData”

AdoPembelianBarang.Refresh

FormPembelian.AdoPembelian.Refresh

End If

End Select

End Sub

Private Function CekPembelian() As Boolean

BacaPembelian

If Not RecPembelian.NoMatch Then

CekPembelian = True

Else

CekPembelian = False

End If

End Function

Private Sub BacaPembelian()

With RecPembelian

.Index = “IdxPembelian”

.Seek “=”, TxtNofak_Pembelian.Text

End With

End Sub

Private Sub SimpanPembelian(p As String)

With RecPembelian

If p = “Add” Then

.AddNew

Else

.Edit

End If

.Fields(“NoFak_Pembelian”) = TxtNofak_Pembelian.Text

.Fields(“Tanggal_Pembelian”) = DtpTanggal_Pembelian.Value

.Fields(“Kode_Supplier”) = TxtKode_Supplier.Text

.Fields(“Kode_Pegawai”) = TxtKode_Pegawai.Text

.Fields(“Total_Pembelian”) = Val(TxtTotal_Pembelian.Text)

.Update

End With

End Sub

Private Sub PindahData()

With FormInputPembelian

.TxtNofak_Pembelian.Text = TxtNofak_Pembelian.Text

.TxtKode_Barang.Text = GridPembelianBarang.Columns(0).Text

.TxtJumlah_Beli.Text = Val(GridPembelianBarang.Columns(1).Text)

.Text1.Text = Val(GridPembelianBarang.Columns(1).Text)

.TxtHarga_Beli.Text = Val(GridPembelianBarang.Columns(2).Text)

.TxtTotal_Beli.Text = Val(GridPembelianBarang.Columns(3).Text)

.Text2.Text = Val(GridPembelianBarang.Columns(3).Text)

.CmdBarang.Enabled = False

End With

End Sub

Form Input Pembelian

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

If nnModul = k_Appe Then Bersih

End Sub

Private Sub Bersih()

TxtNoFak_Pembelian.Text = FormTransaksiPembelian.TxtNoFak_Pembelian.Text

TxtKode_Barang.Text = “”

TxtNama_Barang.Text = “”

TxtJumlah_Beli.Text = “”

txtSatuan_Barang.Text = “”

TxtHarga_Beli.Text = “”

TxtTotal_Beli.Text = “”

TxtStok_Barang.Text = “”

End Sub

Private Sub CmdBarang_Click()

Grid1.Visible = True

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select * from barang order by kode_barang”

.Refresh

End With

End Sub

Private Sub Grid1_DblClick()

TxtKode_Barang.Text = Grid1.Columns(0).Text

Grid1.Visible = False

End Sub

Private Sub Grid1_LostFocus()

With RecPembelianBarang

.Index = “idxpembelianbarang”

.Seek “=”, TxtNoFak_Pembelian.Text, Grid1.Columns(0).Text

If Not .NoMatch Then

MsgBox “kode barang tsb. sudah dibeli…”, vbCritical, “Duplikasi Data”

Exit Sub

End If

End With

End Sub

Private Sub TxtKode_Barang_Change()

With RecBarang

.Index = “IdxBarang”

.Seek “=”, TxtKode_Barang.Text

If Not .NoMatch Then

TxtNama_Barang.Text = !Nama_Barang

txtSatuan_Barang.Text = !Satuan_Barang

TxtStok_Barang.Text = !Stok_Barang

End If

End With

End Sub

Private Sub TxtJumlah_Beli_Change()

TxtTotal_Beli.Text = Val(TxtJumlah_Beli.Text) * Val(TxtHarga_Beli.Text)

End Sub

Private Sub TxtHarga_Beli_Change()

TxtTotal_Beli.Text = Val(TxtJumlah_Beli.Text) * Val(TxtHarga_Beli.Text)

End Sub

Private Sub Baca()

With RecPembelianBarang

.Index = “idxPembelianBarang”

.Seek “=”, TxtNoFak_Pembelian.Text, TxtKode_Barang.Text

End With

End Sub

Private Sub Simpan(p As String)

With RecPembelianBarang

If p = “Add” Then

.AddNew

Else

.Edit

End If

.Fields(“NoFak_Pembelian”) = TxtNoFak_Pembelian.Text

.Fields(“Kode_Barang”) = TxtKode_Barang.Text

.Fields(“Jumlah_Beli”) = Val(TxtJumlah_Beli.Text)

.Fields(“Harga_Beli”) = Val(TxtHarga_Beli.Text)

.Fields(“Stok_Beli”) = Val(TxtJumlah_Beli.Text)

.Update

End With

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case “Save”

Select Case nnModul

Case k_Appe

Simpan “Add”

BacaPembelian

SimpanPembelian “Add”

BacaBarang

SimpanBarang “Add”

Bersih

CmdBarang.SetFocus

Case k_Edit

Baca

Simpan “Edit”

BacaPembelian

SimpanPembelian “Edit”

BacaBarang

SimpanBarang “Edit”

End Select

MsgBox “Data sudah disimpan..”, vbInformation, “Informasi”

FormTransaksiPembelian.RefreshData

FormTransaksiPembelian.AdoPembelianBarang.Refresh

FormPembelian.AdoPembelian.Refresh

If nnModul = k_Edit Then Unload Me

Case “Cancel”

Unload Me

End Select

End Sub

Private Sub BacaBarang()

With RecBarang

.Index = “IdxBarang”

.Seek “=”, TxtKode_Barang.Text

End With

End Sub

Private Sub SimpanBarang(p As String)

With RecBarang

.Edit

If p = “Add” Then

.Fields(“Stok_Barang”) = .Fields(“Stok_Barang”) + Val(TxtJumlah_Beli.Text)

Else

.Fields(“Stok_Barang”) = .Fields(“Stok_Barang”) – Val(Text1.Text) + Val(TxtJumlah_Beli.Text)

End If

.Update

End With

End Sub

Private Sub BacaPembelian()

With RecPembelian

.Index = “IdxPembelian”

.Seek “=”, TxtNoFak_Pembelian.Text

End With

End Sub

Private Sub SimpanPembelian(p As String)

With RecPembelian

.Edit

If p = “Add” Then

.Fields(“Total_Pembelian”) = .Fields(“Total_Pembelian”) + Val(TxtTotal_Beli.Text)

Else

.Fields(“Total_Pembelian”) = .Fields(“Total_Pembelian”) – Val(Text2.Text) + Val(TxtTotal_Beli.Text)

End If

.Update

End With

End Sub

Form Permintaan Barang

Private Sub Form_Load()

With Combo1

.AddItem “Nomor_Permintaan”

.AddItem “Tanggal_Permintaan”

End With

Combo1.ListIndex = 0

RefreshData

End Sub

Public Sub RefreshData()

With AdoPermintaan

.ConnectionString = Conn

.RecordSource = “Select Permintaan.Nomor_Permintaan as [No Permintaan],Permintaan.Tanggal_Permintaan as [Tanggal],Permintaan.Kode_Pegawai as [Kode Pegawai]From Permintaan Where ” + Combo1.Text + ” Like ‘%” + Text1.Text + “%’ Order By Permintaan.Nomor_Permintaan”

.Refresh

End With

End Sub

Private Sub Form_Resize()

With GridPermintaan

.Top = Toolbar1.Height

.Left = 50

.Height = Me.ScaleHeight – 100

.Width = Me.ScaleWidth – .Left – 50

End With

End Sub

Private Sub PindahData()

With FormTransaksiPermintaan

.TxtNomor_Permintaan.Text = GridPermintaan.Columns(0).Text

.TxtNomor_Permintaan.Enabled = False

.DtpTanggal_Permintaan.Value = GridPermintaan.Columns(1).Text

.TxtKode_Pegawai.Text = GridPermintaan.Columns(2).Text

.CmdPegawai.Enabled = False

End With

End Sub

Private Sub Text1_Change()

RefreshData

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case “Add”

nModul = k_Appe

FormTransaksiPermintaan.Show

Case “Edit”

nModul = k_Edit

PindahData

FormTransaksiPermintaan.Show

Case “Del”

hapus = MsgBox(“Yakin data ini dihapus ? “, vbInformation + vbYesNo, “Hapus Data”)

If hapus = vbYes Then AdoPermintaan.Recordset.Delete

Case “Fresh”

RefreshData

End Select

End Sub

Form Transaksi Permintaan Barang

‘Dim aa As String * 8

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

If nModul = k_Appe Then Bersih

RefreshData

End Sub

Private Sub Bersih()

TxtNomor_Permintaan.Text = “M-” ‘& aa

DtpTanggal_Permintaan.Value = DateValue(Now)

TxtKode_Pegawai.Text = “”

TxtNama_Pegawai.Text = “”

TxtJabatan_Pegawai.Text = “”

End Sub

Public Sub RefreshData()

With AdoPermintaanBarang

.ConnectionString = Conn

.RecordSource = “Select PermintaanBarang.Kode_Barang as [Kode Barang],PermintaanBarang.Jumlah_Minta as [Jumlah],PermintaanBarang.Harga_minta as [Harga],(PermintaanBarang.jumlah_minta * permintaanbarang.harga_minta) as [Total Permintaan],PermintaanBarang.Nofak_Pembelian From Barang,Permintaan,PermintaanBarang Where (PermintaanBarang.Nomor_Permintaan= Permintaan.Nomor_Permintaan) And (PermintaanBarang.Kode_Barang= Barang.Kode_Barang) And PermintaanBarang.Nomor_Permintaan='” + TxtNomor_Permintaan.Text + “‘”

.Refresh

End With

AdoPermintaanBarang.Refresh

End Sub

Private Sub TxtNomor_Permintaan_Change()

RefreshData

GridPermintaanBarang.Columns(4).Visible = False

GridPermintaanBarang.Refresh

End Sub

Private Sub CmdPegawai_Click()

GridPegawai.Visible = True

With AdoPegawai

.ConnectionString = Conn

.RecordSource = “select * from pegawai order by kode_pegawai”

.Refresh

End With

End Sub

Private Sub GridPegawai_DblClick()

TxtKode_Pegawai.Text = GridPegawai.Columns(0).Text

GridPegawai.Visible = False

End Sub

Private Sub TxtKode_Pegawai_Change()

With RecPegawai

.Index = “IdxPegawai”

.Seek “=”, TxtKode_Pegawai.Text

If Not .NoMatch Then

TxtNama_Pegawai.Text = !Nama_Pegawai

TxtJabatan_Pegawai.Text = !Jabatan_Pegawai

End If

End With

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case “New”

If CekPermintaan Then

SimpanPermintaan “Edit”

Else

SimpanPermintaan “Add”

End If

MsgBox “Data Permintaan di Update”, vbInformation, “Update Permintaan”

FormPermintaan.AdoPermintaan.Refresh

nnModul = k_Appe

FormInputPermintaan.Show

Case “Edit”

nnModul = k_Edit

PindahData

FormInputPermintaan.Show

Case “Del”

hapus = MsgBox(“Benar data ini dihapus ?”, vbInformation + vbYesNo, “Hapus Data”)

If hapus = vbYes Then

Dim X As Integer

X = GridPermintaanBarang.Columns(1).Text

With RecPembelianBarang

.Index = “Idxpembelianbarang”

.Seek “=”, GridPermintaanBarang.Columns(4).Text, GridPermintaanBarang.Columns(0).Text

If Not .NoMatch Then

.Edit

.Fields(“Stok_Beli”) = .Fields(“Stok_Beli”) + X

.Update

End If

End With

With RecBarang

.Index = “IdxBarang”

.Seek “=”, GridPermintaanBarang.Columns(0).Text

If Not .NoMatch Then

.Edit

.Fields(“Stok_Barang”) = .Fields(“Stok_Barang”) + X

.Update

End If

End With

AdoPermintaanBarang.Recordset.Delete

RefreshData

MsgBox “Data direfresh”, vbInformation, “RefreshData”

AdoPermintaanBarang.Refresh

FormPermintaan.AdoPermintaan.Refresh

End If

End Select

End Sub

Private Function CekPermintaan() As Boolean

BacaPermintaan

If Not RecPermintaan.NoMatch Then

CekPermintaan = True

Else

CekPermintaan = False

End If

End Function

Private Sub BacaPermintaan()

With RecPermintaan

.Index = “IdxPermintaan”

.Seek “=”, TxtNomor_Permintaan.Text

End With

End Sub

Private Sub SimpanPermintaan(p As String)

With RecPermintaan

If p = “Add” Then

.AddNew

Else

.Edit

End If

.Fields(“Nomor_Permintaan”) = TxtNomor_Permintaan.Text

.Fields(“Tanggal_Permintaan”) = DtpTanggal_Permintaan.Value

.Fields(“Kode_Pegawai”) = TxtKode_Pegawai.Text

.Update

End With

End Sub

Private Sub PindahData()

With FormInputPermintaan

.TxtNomor_Permintaan.Text = TxtNomor_Permintaan.Text

.TxtKode_Barang.Text = GridPermintaanBarang.Columns(0).Text

.TxtJumlah_Minta.Text = Val(GridPermintaanBarang.Columns(1).Text)

.Text1.Text = Val(GridPermintaanBarang.Columns(1).Text)

.TxtHarga_Beli.Text = Val(GridPermintaanBarang.Columns(2).Text)

.CboPembelian.Text = GridPermintaanBarang.Columns(4).Text

.CboPembelian.Enabled = False

.CmdBarang.Enabled = False

End With

End Sub

Private Sub TxtNomor_Permintaan_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

If KeyAscii = vbKeyBack Then Exit Sub

If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45 And KeyAscii <> 77 Then KeyAscii = 0

End Sub

Form Input Permintaan Barang

Dim stok, stokmin, belistok, sisa, SB As Long

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

If nnModul = k_Appe Then Bersih

End Sub

Private Sub Bersih()

TxtNomor_Permintaan.Text = FormTransaksiPermintaan.TxtNomor_Permintaan.Text

TxtKode_Barang.Text = “”

TxtNama_Barang.Text = “”

TxtJumlah_Minta.Text = “”

TxtSatuan_Barang.Text = “”

TxtHarga_Beli.Text = “”

TxtStok_Beli.Text = “”

TxtStok_Barang.Text = “”

End Sub

Private Sub CmdBarang_Click()

Grid1.Visible = True

With Adodc1

.ConnectionString = Conn

.RecordSource = “Select * from barang order by kode_barang”

.Refresh

End With

End Sub

Private Sub Grid1_DblClick()

TxtKode_Barang.Text = Grid1.Columns(0).Text

Grid1.Visible = False

End Sub

Private Sub Grid1_LostFocus()

With RecPermintaanBarang

.Index = “idxpermintaanbarang”

.Seek “=”, TxtNomor_Permintaan.Text, Grid1.Columns(0).Text

If Not .NoMatch Then

MsgBox “kode barang tsb. sudah diminta…”, vbCritical, “Duplikasi Data”

Exit Sub

End If

End With

End Sub

Private Sub TxtKode_Barang_Change()

With RecBarang

.Index = “IdxBarang”

.Seek “=”, TxtKode_Barang.Text

If Not .NoMatch Then

TxtNama_Barang.Text = !Nama_Barang

TxtSatuan_Barang.Text = !Satuan_Barang

TxtStok_Barang.Text = !Stok_Barang

stok = !Stok_Barang

End If

End With

CboPembelian.Clear

Call FakturPembelian

End Sub

Private Sub FakturPembelian()

Set RecPembelianBarang = db.OpenRecordset(“Select Distinct nofak_pembelian From pembelianbarang Where Kode_Barang='” & TxtKode_Barang.Text & “‘ Order By Nofak_Pembelian”)

If RecPembelianBarang.RecordCount <> 0 Then

RecPembelianBarang.MoveFirst

While Not RecPembelianBarang.EOF

CboPembelian.AddItem RecPembelianBarang.Fields(“Nofak_pembelian”)

RecPembelianBarang.MoveNext

Wend

End If

Set RecPembelianBarang = db.OpenRecordset(“PembelianBarang”)

End Sub

Private Sub CboPembelian_change()

With RecPembelianBarang

.Index = “idxpembelianbarang”

.Seek “=”, CboPembelian.Text, TxtKode_Barang.Text

If Not .NoMatch Then

TxtHarga_Beli.Text = !harga_beli

TxtStok_Beli.Text = !stok_beli

belistok = !stok_beli

End If

End With

End Sub

Private Sub CboPembelian_Click()

With RecPembelianBarang

.Index = “idxpembelianbarang”

.Seek “=”, CboPembelian.Text, TxtKode_Barang.Text

If Not .NoMatch Then

TxtHarga_Beli.Text = !harga_beli

TxtStok_Beli.Text = !stok_beli

belistok = !stok_beli

End If

End With

End Sub

Private Sub TxtJumlah_Minta_LostFocus()

If Val(TxtJumlah_Minta.Text) > Val(TxtStok_Beli.Text) Then

MsgBox “jumlah Permintaan harus lebih kecil dari stok barang ..!!”, vbCritical, “Error Input”

TxtJumlah_Minta.SetFocus

Else

sisa = stok – Val(TxtJumlah_Minta.Text)

If sisa < 0 Then

MsgBox “Pembelian Barang Atas Kode barang ini tidak mencukupi”, vbCritical, “Permintaan Melebihi stok minimal”

TxtJumlah_Minta.SetFocus

‘Me.Hide

End If

End If

End Sub

Private Sub Baca()

With RecPermintaanBarang

.Index = “idxPermintaanBarang”

.Seek “=”, TxtNomor_Permintaan.Text, TxtKode_Barang.Text

End With

End Sub

Private Sub Simpan(p As String)

With RecPermintaanBarang

If p = “Add” Then

.AddNew

Else

.Edit

End If

.Fields(“Nomor_Permintaan”) = TxtNomor_Permintaan.Text

.Fields(“Kode_Barang”) = TxtKode_Barang.Text

.Fields(“Jumlah_Minta”) = Val(TxtJumlah_Minta.Text)

.Fields(“Harga_Minta”) = Val(TxtHarga_Beli.Text)

.Fields(“Nofak_Pembelian”) = CboPembelian.Text

.Update

End With

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case “Save”

Select Case nnModul

Case k_Appe

Simpan “Add”

BacaBeli

SimpanBeli “Add”

BacaBarang

SimpanBarang “Add”

Bersih

CmdBarang.SetFocus

Case k_Edit

Baca

Simpan “Edit”

BacaBeli

SimpanBeli “Edit”

BacaBarang

SimpanBarang “Edit”

End Select

MsgBox “Data sudah disimpan..”, vbInformation, “Informasi”

FormTransaksiPermintaan.RefreshData

FormTransaksiPermintaan.AdoPermintaanBarang.Refresh

FormPermintaan.AdoPermintaan.Refresh

If nnModul = k_Edit Then Unload Me

Case “Cancel”

Unload Me

End Select

End Sub

Private Sub BacaBeli()

With RecPembelianBarang

.Index = “IdxPembelianBarang”

.Seek “=”, CboPembelian.Text, TxtKode_Barang.Text

End With

End Sub

Private Sub SimpanBeli(p As String)

With RecPembelianBarang

.Edit

If p = “Add” Then

.Fields(“Stok_Beli”) = .Fields(“Stok_Beli”) – Val(TxtJumlah_Minta.Text)

Else

.Fields(“Stok_Beli”) = .Fields(“Stok_Beli”) + Val(Text1.Text) – Val(TxtJumlah_Minta.Text)

End If

.Update

End With

End Sub

Private Sub BacaBarang()

With RecBarang

.Index = “IdxBarang”

.Seek “=”, TxtKode_Barang.Text

End With

End Sub

Private Sub SimpanBarang(p As String)

With RecBarang

.Edit

If p = “Add” Then

.Fields(“Stok_Barang”) = .Fields(“Stok_Barang”) – Val(TxtJumlah_Minta.Text)

Else

.Fields(“Stok_Barang”) = .Fields(“Stok_Barang”) + Val(Text1.Text) – Val(TxtJumlah_Minta.Text)

End If

.Update

End With

End Sub

Laporan Persediaan Barang

Private Sub Command1_Click()

CrystalReport1.ReportFileName = App.Path & “\report3.rpt”

CrystalReport1.Formulas(0) = “Pimpinan='” & Text1.Text & “‘”

CrystalReport1.Formulas(1) = “Bagian_Administrasi='” & Text2.Text & “‘”

CrystalReport1.PrintReport

CrystalReport1.WindowShowZoomCtl = 100

If CrystalReport1.LastErrorNumber <> 0 Then

MsgBox CrystalReport1.LastErrorString & vbCrLf & _

“Diproses pembuatan laporan ada kesalahan…!?”

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

Text1.Text = “”

Text2.Text = “”

End Sub

Form Laporan Pembelian Pertanggal

Private Sub Command1_Click()

Select Case nModul

Case lap_1

CrystalReport1.ReportFileName = App.Path & “\report1.rpt”

CrystalReport1.ReplaceSelectionFormula “{q_laporan_pembelian.tanggal_pembelian}>=datevalue(‘” & DTPicker1.Value & “‘) And {q_laporan_pembelian.tanggal_pembelian}<=datevalue(‘” & DTPicker2.Value & “‘) “

CrystalReport1.Formulas(0) = “Tanggal_Awal='” & Format(DTPicker1.Value, “dd mmmm yyyy”) & “‘”

CrystalReport1.Formulas(1) = “Tanggal_Akhir='” & Format(DTPicker2.Value, “dd mmmm yyyy”) & “‘”

CrystalReport1.Formulas(2) = “Pimpinan='” & Text1.Text & “‘”

CrystalReport1.Formulas(3) = “Bagian_Administrasi='” & Text2.Text & “‘”

CrystalReport1.PrintReport

CrystalReport1.WindowShowZoomCtl = 100

If CrystalReport1.LastErrorNumber <> 0 Then

MsgBox CrystalReport1.LastErrorString & vbCrLf & _

“Diproses pembuatan laporan ada kesalahan…!?”

End If

Case lap_2

CrystalReport1.ReportFileName = App.Path & “\report4.rpt”

CrystalReport1.ReplaceSelectionFormula “{q_laporan_permintaan.tanggal_permintaan}>=datevalue(‘” & DTPicker1.Value & “‘) And {q_laporan_permintaan.tanggal_permintaan}<=datevalue(‘” & DTPicker2.Value & “‘) “

CrystalReport1.Formulas(0) = “Tanggal_Awal='” & Format(DTPicker1.Value, “dd mmmm yyyy”) & “‘”

CrystalReport1.Formulas(1) = “Tanggal_Akhir='” & Format(DTPicker2.Value, “dd mmmm yyyy”) & “‘”

CrystalReport1.Formulas(2) = “Pimpinan='” & Text1.Text & “‘”

CrystalReport1.Formulas(3) = “Bagian_Administrasi='” & Text2.Text & “‘”

CrystalReport1.PrintReport

CrystalReport1.WindowShowZoomCtl = 100

If CrystalReport1.LastErrorNumber <> 0 Then

MsgBox CrystalReport1.LastErrorString & vbCrLf & _

“Diproses pembuatan laporan ada kesalahan…!?”

End If

End Select

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

DTPicker1.Value = Format(Date, “dd/mm/yyyy”)

DTPicker2.Value = Format(Date, “dd/mm/yyyy”)

Text1.Text = “”

Text2.Text = “”

End Sub

Form Laporan Pembelian PerBulan

Private Sub Command1_Click()

Select Case nModul

Case lap_1

CrystalReport1.ReportFileName = App.Path & “\report2.rpt”

CrystalReport1.SelectionFormula = “Month({q_laporan_pembelian_bulan.Tanggal_Pembelian})=” & Month(DTPicker1.Value) & ” And Year({q_laporan_pembelian_bulan.Tanggal_Pembelian})=” & Year(DTPicker1.Value)

CrystalReport1.Formulas(0) = “Pimpinan='” & Text1.Text & “‘”

CrystalReport1.Formulas(1) = “Bagian_Administrasi='” & Text2.Text & “‘”

CrystalReport1.PrintReport

CrystalReport1.WindowShowZoomCtl = 100

If CrystalReport1.LastErrorNumber <> 0 Then

MsgBox CrystalReport1.LastErrorString & vbCrLf & _

“Diproses pembuatan laporan ada kesalahan…!?”

End If

Case lap_2

CrystalReport1.ReportFileName = App.Path & “\report5.rpt”

CrystalReport1.SelectionFormula = “Month({q_laporan_permintaan.Tanggal_Permintaan})=” & Month(DTPicker1.Value) & ” And Year({q_laporan_permintaan.Tanggal_Permintaan})=” & Year(DTPicker1.Value)

CrystalReport1.Formulas(0) = “Pimpinan='” & Text1.Text & “‘”

CrystalReport1.Formulas(1) = “Bagian_Administrasi='” & Text2.Text & “‘”

CrystalReport1.PrintReport

CrystalReport1.WindowShowZoomCtl = 100

If CrystalReport1.LastErrorNumber <> 0 Then

MsgBox CrystalReport1.LastErrorString & vbCrLf & _

“Diproses pembuatan laporan ada kesalahan…!?”

End If

End Select

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

DTPicker1.Value = Format(Date, “MMMM yyyy”)

Text1.Text = “”

Text2.Text = “”

End Sub

Form Laporan Rincian Persediaan Detail

Private Sub Command1_Click()

CrystalReport1.ReportFileName = App.Path & “\report6.rpt”

CrystalReport1.ReplaceSelectionFormula “{q_laporan_persediaan.tgl_transaksi}>=datevalue(‘” & DTPicker1.Value & “‘) And {q_laporan_persediaan.tgl_transaksi}<=datevalue(‘” & DTPicker2.Value & “‘) “

CrystalReport1.Formulas(0) = “Tanggal_Awal='” & Format(DTPicker1.Value, “dd mmmm yyyy”) & “‘”

CrystalReport1.Formulas(1) = “Tanggal_Akhir='” & Format(DTPicker2.Value, “dd mmmm yyyy”) & “‘”

CrystalReport1.Formulas(2) = “Pimpinan='” & Text1.Text & “‘”

CrystalReport1.Formulas(3) = “Bagian_Administrasi='” & Text2.Text & “‘”

CrystalReport1.PrintReport

CrystalReport1.WindowShowZoomCtl = 100

If CrystalReport1.LastErrorNumber <> 0 Then

MsgBox CrystalReport1.LastErrorString & vbCrLf & _

“Diproses pembuatan laporan ada kesalahan…!?”

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys “{Tab}”

End Sub

Private Sub Form_Load()

DTPicker1.Value = Format(Date, “dd/mm/yyyy”)

DTPicker2.Value = Format(Date, “dd/mm/yyyy”)

Text1.Text = “”

Text2.Text = “”

End Sub

Modules

Global Ws As DAO.Workspace

Global db As DAO.Database

Global Conn As String

Global nModul As Integer

Global nnModul As Integer

Global Tunjuk As Integer

Global RecBarang As DAO.Recordset

Global RecPegawai As DAO.Recordset

Global RecSupplier As DAO.Recordset

Global RecPembelian As DAO.Recordset

Global RecPembelianBarang As DAO.Recordset

Global RecPermintaan As DAO.Recordset

Global RecPermintaanBarang As DAO.Recordset

Global Const k_Save = 100

Global Const k_Cancel = 200

Global Const k_Appe = 300

Global Const k_Edit = 400

Global Const lap_1 = 1000

Global Const lap_2 = 1100

Sub main()

Conn = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + App.Path + “\db_peralatan.Mdb”

Set Ws = DBEngine.Workspaces(0)

Set db = Ws.OpenDatabase(App.Path + “\db_peralatan.Mdb”)

Set RecBarang = db.OpenRecordset(“Barang”)

Set RecPegawai = db.OpenRecordset(“Pegawai”)

Set RecSupplier = db.OpenRecordset(“Supplier”)

Set RecPembelian = db.OpenRecordset(“Pembelian”)

Set RecPembelianBarang = db.OpenRecordset(“PembelianBarang”)

Set RecPermintaan = db.OpenRecordset(“Permintaan”)

Set RecPermintaanBarang = db.OpenRecordset(“PermintaanBarang”)

FormLogin.Show

‘MdiMenuUtama.Show

End Sub

Tag:

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s


%d blogger menyukai ini: