Академический Документы
Профессиональный Документы
Культура Документы
Module Module1
CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
End Sub
End Module
Imports System.Data.OleDb
Me.Visible = False
MNUtama.Show()
MNUtama.PanelKode.Text = dr.Item("id_petugas")
MNUtama.PanelNama.Text = dr.Item("nama_petugas")
MNUtama.PanelHakAkses.Text = UCase(dr.Item("hak_akses"))
Hitung = Hitung + 1
If Hitung > 2 Then
End
End If
End If
End Sub
End Class
Imports System.Data.OleDb
Public Class Petugas
Sub IDPetugasOtomatis()
cmd = New OleDbCommand("select id_Petugas from Petugas order by
id_Petugas desc", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
TextBox1.Text = "P0001"
Else
TextBox1.Text = "P" +
Format(Microsoft.VisualBasic.Right(dr.Item("id_Petugas"), 4) + 1, "0000")
End If
TextBox1.Enabled = False
End Sub
Sub Kosongkan()
On Error Resume Next
'TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
ComboBox1.Text = ""
TextBox6.Clear()
TextBox2.Focus()
End Sub
Sub DataBaru()
On Error Resume Next
TextBox2.Clear()
TextBox3.Clear()
ComboBox1.Text = ""
TextBox6.Clear()
TextBox2.Focus()
End Sub
Sub Ketemu()
On Error Resume Next
TextBox2.Text = dr.Item(1)
TextBox3.Text = dr.Item(2)
ComboBox1.Text = dr.Item(3)
TextBox6.Clear()
TextBox2.Focus()
End Sub
Sub TampilHakAkses()
cmd = New OleDbCommand("select distinct Hak_Akses from Petugas",
conn)
dr = cmd.ExecuteReader
ComboBox1.Items.Clear()
Do While dr.Read
ComboBox1.Items.Add(dr.Item("Hak_Akses"))
Loop
End Sub
Sub TampilGrid()
da = New OleDbDataAdapter("select * from Petugas", conn)
ds = New DataSet
da.Fill(ds)
DGV.DataSource = ds.Tables(0)
DGV.ReadOnly = True
End Sub
Sub CariIdPetugas()
cmd = New OleDbCommand("select * from Petugas where id_Petugas='" &
TextBox1.Text & "'", conn)
dr = cmd.ExecuteReader
dr.Read()
End Sub
Sub Awal()
Call IDPetugasOtomatis()
Call Kosongkan()
Call TampilGrid()
Call TampilHakAkses()
End Sub
Try
Call CariIdPetugas()
If Not dr.HasRows Then
Dim simpan As String = "insert into Petugas values('" &
TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" &
ComboBox1.Text & "')"
cmd = New OleDbCommand(simpan, conn)
cmd.ExecuteNonQuery()
Else
Dim edit As String = "update Petugas set nama_petugas='" &
TextBox2.Text & "',pwd='" & TextBox3.Text & "',Hak_Akses='" &
ComboBox1.Text & "' where id_Petugas='" & TextBox1.Text & "'"
cmd = New OleDbCommand(edit, conn)
cmd.ExecuteNonQuery()
End If
Call Awal()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Sub IDBukuOtomatis()
cmd = New OleDbCommand("select id_buku from buku order by id_buku
desc", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
TextBox1.Text = "B0001"
Else
TextBox1.Text = "B" +
Format(Microsoft.VisualBasic.Right(dr.Item("id_Buku"), 4) + 1, "0000")
End If
TextBox1.Enabled = False
End Sub
Sub Kosongkan()
On Error Resume Next
'TextBox1.Clear()
TextBox2.Clear()
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
TextBox3.Clear()
ComboBox5.Text = ""
TextBox4.Clear()
TextBox5.Clear()
TextBox5.Enabled = False
PictureBox1.Load(TextBox5.Text)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
TextBox6.Clear()
TextBox2.Focus()
End Sub
Sub DataBaru()
On Error Resume Next
TextBox2.Clear()
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
TextBox3.Clear()
ComboBox5.Text = ""
TextBox4.Clear()
TextBox5.Clear()
PictureBox1.Load(TextBox5.Text)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
TextBox6.Clear()
TextBox2.Focus()
End Sub
Sub Ketemu()
On Error Resume Next
TextBox2.Text = dr.Item(1)
ComboBox1.Text = dr.Item(2)
ComboBox2.Text = dr.Item(3)
ComboBox3.Text = dr.Item(4)
ComboBox4.Text = dr.Item(5)
TextBox3.Text = dr.Item(6)
ComboBox5.Text = dr.Item(7)
DateTimePicker1.Text = dr.Item(8)
TextBox4.Text = dr.Item(9)
TextBox5.Text = dr.Item(10)
PictureBox1.Load(TextBox5.Text)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
TextBox6.Clear()
TextBox2.Focus()
End Sub
Sub TampilPengarang()
cmd = New OleDbCommand("select distinct pengarang from buku", conn)
dr = cmd.ExecuteReader
ComboBox1.Items.Clear()
Do While dr.Read
ComboBox1.Items.Add(dr.Item("pengarang"))
Loop
End Sub
Sub TampilPenerbit()
cmd = New OleDbCommand("select distinct penerbit from buku", conn)
dr = cmd.ExecuteReader
ComboBox2.Items.Clear()
Do While dr.Read
ComboBox2.Items.Add(dr.Item("penerbit"))
Loop
End Sub
Sub TampilKategori()
cmd = New OleDbCommand("select distinct kategori from buku", conn)
dr = cmd.ExecuteReader
ComboBox3.Items.Clear()
Do While dr.Read
ComboBox3.Items.Add(dr.Item("kategori"))
Loop
End Sub
Sub TampiltahunTerbit()
cmd = New OleDbCommand("select distinct tahun from buku", conn)
dr = cmd.ExecuteReader
ComboBox4.Items.Clear()
Do While dr.Read
ComboBox4.Items.Add(dr.Item("tahun"))
Loop
End Sub
Sub TampilLokasirak()
cmd = New OleDbCommand("select distinct lokasi from buku", conn)
dr = cmd.ExecuteReader
ComboBox5.Items.Clear()
Do While dr.Read
ComboBox5.Items.Add(dr.Item("lokasi"))
Loop
End Sub
Sub TampilGrid()
da = New OleDbDataAdapter("select * from buku", conn)
ds = New DataSet
da.Fill(ds)
DGV.DataSource = ds.Tables(0)
DGV.ReadOnly = True
End Sub
Sub CariIdBuku()
cmd = New OleDbCommand("select * from buku where id_buku='" &
TextBox1.Text & "'", conn)
dr = cmd.ExecuteReader
dr.Read()
End Sub
Sub Awal()
Call IDBukuOtomatis()
Call Kosongkan()
Call TampilGrid()
Call TampilKategori()
Call TampilLokasirak()
Call TampilPenerbit()
Call TampilPengarang()
Call TampiltahunTerbit()
End Sub
Try
Call CariIdBuku()
If Not dr.HasRows Then
Dim simpan As String = "insert into buku values('" &
TextBox1.Text & "','" & TextBox2.Text & "','" & ComboBox1.Text & "','" &
ComboBox2.Text & "','" & ComboBox3.Text & "','" & ComboBox4.Text & "','" &
TextBox3.Text & "','" & ComboBox5.Text & "','" & DateTimePicker1.Text
& "','" & TextBox4.Text & "','" & TextBox5.Text & "')"
cmd = New OleDbCommand(simpan, conn)
cmd.ExecuteNonQuery()
Else
Dim edit As String = "update buku set judul='" &
TextBox2.Text & "',pengarang='" & ComboBox1.Text & "',penerbit='" &
ComboBox2.Text & "',kategori='"& ComboBox3.Text & "',tahun='" &
ComboBox4.Text & "',stok='" & TextBox3.Text & "',lokasi='" & ComboBox5.Text
& "',Tanggal_masuk='" & DateTimePicker1.Text & "',harga_buku='" &
TextBox4.Text & "',gambar='" & TextBox5.Text & "' where id_buku='" &
TextBox1.Text & "'"
cmd = New OleDbCommand(edit, conn)
cmd.ExecuteNonQuery()
End If
Call Awal()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Imports System.Data.OleDb
Sub IDLembagaOtomatis()
cmd = New OleDbCommand("select id_Lembaga from Lembaga order by
id_Lembaga desc", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
ID.Text = "01"
Else
ID.Text = "01"
End If
ID.Enabled = False
End Sub
Sub Kosongkan()
On Error Resume Next
Nama.Clear()
Alamat.Clear()
Telepon.Clear()
Fax.Clear()
Email.Clear()
Website.Clear()
Nama.Focus()
End Sub
Sub Ketemu()
On Error Resume Next
Nama.Text = dr.Item(1)
Alamat.Text = dr.Item(2)
Telepon.Text = Microsoft.VisualBasic.Mid(dr.Item(3), 9, 30)
Fax.Text = Microsoft.VisualBasic.Mid(dr.Item(4), 5, 30)
Email.Text = Microsoft.VisualBasic.Mid(dr.Item(5), 7, 30)
Website.Text = Microsoft.VisualBasic.Mid(dr.Item(6), 9, 30)
Nama.Focus()
End Sub
Sub CariIdLembaga()
cmd = New OleDbCommand("select * from Lembaga where id_Lembaga='" &
ID.Text & "'", conn)
dr = cmd.ExecuteReader
dr.Read()
End Sub
Sub Awal()
Call IDLembagaOtomatis()
Call Kosongkan()
End Sub
Try
Call CariIdLembaga()
If Not dr.HasRows Then
Dim simpan As String = "insert into Lembaga values('" &
ID.Text & "','" & Nama.Text & "','" & Alamat.Text & "', '" & Label4.Text &
Space(1) & Telepon.Text & "', '" & Label5.Text & Space(1) & Fax.Text & " ',
'" & Label6.Text & Space(1) & Email.Text & "', '" & Label7.Text & Space(1)
& Website.Text & "')"
cmd = New OleDbCommand(simpan, conn)
cmd.ExecuteNonQuery()
Else
cmd = New OleDbCommand("delete * from lembaga", conn)
cmd.ExecuteNonQuery()
Dim simpan As String = "insert into Lembaga values('" &
ID.Text & "','" & Nama.Text & "','" & Alamat.Text & "', '" & Label4.Text &
Space(1) & Telepon.Text & "', '" & Label5.Text & Space(1) & Fax.Text & " ',
'" & Label6.Text & Space(1) & Email.Text & "', '" & Label7.Text & Space(1)
& Website.Text & "')"
cmd = New OleDbCommand(simpan, conn)
cmd.ExecuteNonQuery()
End If
'Call Awal()
MNUtama.IDLembaga.Text = ID.Text
MsgBox("Data berhasil disimpan")
Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Imports System.Data.OleDb
Sub IDPengaturanOtomatis()
cmd = New OleDbCommand("select id_Pengaturan from Pengaturan order
by id_Pengaturan desc", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
TextBox1.Text = "1"
Else
TextBox1.Text = "1"
End If
TextBox1.Enabled = False
End Sub
Sub Kosongkan()
On Error Resume Next
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox2.Focus()
End Sub
Sub DataBaru()
On Error Resume Next
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox2.Focus()
End Sub
Sub Ketemu()
On Error Resume Next
TextBox2.Text = dr.Item(1)
TextBox3.Text = dr.Item(2)
TextBox4.Text = dr.Item(3)
TextBox5.Text = dr.Item(4)
TextBox2.Focus()
End Sub
Sub CariIdPengaturan()
cmd = New OleDbCommand("select * from Pengaturan where
id_Pengaturan='" & TextBox1.Text & "'", conn)
dr = cmd.ExecuteReader
dr.Read()
End Sub
Sub Awal()
Call IDPengaturanOtomatis()
Call Kosongkan()
End Sub
Try
Call CariIdPengaturan()
If Not dr.HasRows Then
Dim simpan As String = "insert into Pengaturan values('" &
TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" &
TextBox4.Text & "','" & TextBox5.Text & "','" & MNUtama.PanelKode.Text
& "')"
cmd = New OleDbCommand(simpan, conn)
cmd.ExecuteNonQuery()
Else
Imports System.Data.OleDb
End Sub
End Class
Imports System.Data.OleDb
Sub Kosongkan()
On Error Resume Next
DGV3.Enabled = True
ComboBox1.Text = ""
LBLNama.Text = ""
LBLPinjamSekarang.Text = 0
LBLPernahPinjam.Text = 0
LBLTotalPinjam.Text = 0
DGV1.Rows.Clear()
DGV2.Columns.Clear()
TextBox1.Clear()
PictureBox2.Load(TextBox1.Text)
PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
End If
End Sub
'menampilkan data buku yang pernah dan sedang dipinjam oleh anggota
da = New OleDbDataAdapter("select
pinjamdetail.ID_Pinjam,pinjamdetail.ID_Buku,buku.Judul,Pengarang,Penerbit
from pinjamdetail,pinjam,buku where pinjamdetail.id_pinjam=pinjam.id_pinjam
and buku.id_buku=pinjamdetail.id_buku and pinjam.id_anggota='" &
ComboBox1.Text & "' and pinjamdetail.keterangan='Dipinjam'", conn)
ds = New DataSet
da.Fill(ds)
DGV2.DataSource = ds.Tables(0)
DGV2.ReadOnly = True
DGV2.Columns(0).HeaderText = "ID Pinjam"
DGV2.Columns(1).HeaderText = "ID Buku"
DGV2.Columns(2).HeaderText = "Judul"
LBLPernahPinjam.Text = DGV2.RowCount - 1
End Sub
Imports System.Data.OleDb
Sub Kosongkan()
On Error Resume Next
ComboBox1.Text = ""
LBLIDAnggota.Text = ""
LBLNama.Text = ""
LBLTotalPinjam.Text = 0
LBLTotalDenda.Text = 0
txtdibayar.Text = 0
LBLKembali.Text = 0
DGV1.Rows.Clear()
DGV2.Columns.Clear()
TextBox1.Clear()
PictureBox1.Load(TextBox1.Text)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
Sub IDKembaliOtomatis()
cmd = New OleDbCommand("select ID_kembali from kembali order by
id_kembali desc", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
LBLIDKembali.Text = "KB" + Format(Today, "yyMMdd") + "01"
Else
If Microsoft.VisualBasic.Mid(dr.Item("id_kembali"), 3, 6) =
Format(Today, "yyMMdd") Then
LBLIDKembali.Text = "KB" +
Format(Microsoft.VisualBasic.Right(dr.Item("id_kembali"), 8) + 1, "00")
Else
LBLIDKembali.Text = "KB" + Format(Today, "yyMMdd") + "01"
End If
End If
End Sub
DGV1.Columns(0).ReadOnly = True
DGV1.Columns(1).ReadOnly = True
DGV1.Columns(2).ReadOnly = True
DGV1.Columns(3).ReadOnly = True
DGV1.Columns(4).ReadOnly = True
DGV1.Columns(7).ReadOnly = True
End Sub
ds = New DataSet
da.Fill(ds)
DGV2.DataSource = ds.Tables(0)
DGV2.ReadOnly = True
DGV2.Columns(0).HeaderText = "ID Buku"
DGV2.Columns(1).HeaderText = "Judul"
LBLTotalPinjam.Text = DGV2.RowCount - 1
End Sub
Sub HitungDenda()
Dim hitung As Double
For baris As Integer = 0 To DGV1.RowCount - 1
hitung = hitung + DGV1.Rows(baris).Cells(7).Value
Next
LBLTotalDenda.Text = hitung
If LBLTotalDenda.Text = 0 Then
LBLTotalDenda.Text = 0
txtdibayar.Text = 0
LBLKembali.Text = 0
Else
End If
End Sub
Imports System.Data.OleDb
ds = New DataSet
da.Fill(ds)
DGVPinjam.DataSource = ds.Tables(0)
DGVPinjam.ReadOnly = True
ds = New DataSet
da.Fill(ds)
DGVPinjam.DataSource = ds.Tables(0)
DGVPinjam.ReadOnly = True