Professional Documents
Culture Documents
Tugas Kelompok Sister - Kelas P
Tugas Kelompok Sister - Kelas P
Aditya (18041018)
2. M. Auliani Assauri (18042102)
3. Tomi Rimpun Sirait (18042184)
4. Justin Andres Pangestu (18042115)
5. Louis Sunariyadi (18042109)
6. Miko Novandi Tama (18042107)
7. Zaini Gani (18042072)
8. Fahruzzaman (18042092)
9. M. Sugianoor (18041064)
10. Vincent Handi Surya (18041068)
11. Juan Felix Guynadi (18041074)
12. M. Rizky Sya’bani (15041242)
Kelas : P (Malam)
Mata Kuliah : Sistem Terdistribusi
Dosen : Yeffriansyah Salim, S.Kom, M.Kom
Hari/Tanggal : Rabu, 29 Desember 2021
___________________________________________________________________________
Database Access
Berikut Tabel Barang
Tabel User
Login
Berikut tampilan design Form Login
Berikut Code :
Imports System.Data.OleDb
Public Class Form_login
Else
MessageBox.Show("Password dan Usename Salah")
End If
End If
End Sub
Code :
Form Barang
Design Form Barang
Code :
Imports System.Data.OleDb
Public Class Form_Barang
Sub tampil_barang()
cmd = New OleDbCommand("select * from tbl_barang", conn)
rd = cmd.ExecuteReader
DataGridView1.Rows.Clear()
Do While rd.Read = True
DataGridView1.Rows.Add(rd(0), rd(1), rd(2), rd(3), rd(4), rd(5), rd(6))
Loop
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellContentClick
End Sub
End Sub
Imports System.Data.OleDb
End Sub
End Sub
cmd = New OleDbCommand("insert into tbl_barang values ('" & TextBox1.Text &
_
"','" & TextBox2.Text & _
"','" & ComboBox1.Text & _
"','" & ComboBox2.Text & _
"','" & TextBox5.Text & _
"','" & TextBox6.Text & _
"','" & TextBox7.Text & _
"')", conn)
cmd.ExecuteNonQuery()
MessageBox.Show("Data Berhasil di Tambahkan")
Call Clear()
Call Form_Barang.tampil_barang()
Else
'---Melakuakan edit data berdasarkan kode barang yang di panggil
Call koneksi()
End If
End Sub
End Class
Code :
Imports System.Data.OleDb
Public Class Form_Penjualan
Sub no_faktur()
cmd = New OleDbCommand("select * from tbl_jual where faktur_jual in(select
max(faktur_jual)from tbl_jual )order by faktur_jual DESC ", conn)
rd = cmd.ExecuteReader
rd.Read()
If Not rd.HasRows Then
tbnofaktur.Text = Format(Now, "yyMMdd") + "0001"
Else
If Microsoft.VisualBasic.Left(rd.GetString(0), 6) >= Format(Now, "yyMMdd") Then
tbnofaktur.Text = Format(Now, "yyMMdd") + "0001"
Else
tbnofaktur.Text = rd.Item("faktur_jual") + 1
End If
End If
End Sub
Sub grand_total()
Dim jumlah As Decimal = 0
For i As Integer = 0 To DataGridView1.Rows.Count - 1
jumlah = jumlah + DataGridView1.Rows(i).Cells(6).Value
tbgrandtoal.Text = jumlah
Next
If tbgrandtoal.Text = "" Then
tbgrandtoal.Text = "0"
End If
End Sub
End Sub
End Sub
End If
End If
End Sub
Sub bersih_barang()
tbkodebarang.Text = ""
tbnamabarang.Text = ""
tbsatuan.Text = ""
tbjenisbarang.Text = ""
tbharga.Text = ""
tbqty.Text = ""
tbtotalharga.Text = ""
tbkodebarang.Focus()
End Sub
Catch ex As Exception
tbtotalharga.Text = ""
End Try
End Sub
'===pengurangan stok==='
cmd = New OleDbCommand("select * from tbl_barang where kode_barang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'", conn)
rd = cmd.ExecuteReader
rd.Read()
If rd.HasRows = True Then
cmd = New OleDbCommand("update tbl_barang set stok='" & rd.Item("stok") -
Val(DataGridView1.Rows(baris).Cells(5).Value) & "' where kode_barang='" &
DataGridView1.Rows(baris).Cells(0).Value & "'", conn)
cmd.ExecuteNonQuery()
End If
Next
'====Membersihkan Data===='
MessageBox.Show("Transaksi Penjualan Berhasil Disimpan !!!")
DataGridView1.Rows.Clear()
tbgrandtoal.Text = "0"
tbdibayar.Text = "0"
tbkembalian.Text = "0"
Call no_faktur()
Call bersih_barang()
End If
End Sub
End Try
End If
End Sub
End Sub
End Sub
End Class
Hasil setelah di input :
Laporan Barang
Code :
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
End Sub
End Sub
End Sub
cryrpt = laporan
With crconnectioninfo
.ServerName = Application.StartupPath & "\db_penjualan.mdb"
.DatabaseName = Application.StartupPath & "\db_penjualan.mdb"
.UserID = ""
.Password = ""
crtables = cryrpt.Database.Tables
For Each crtable In crtables
crtablelogoninfo = crtable.LogOnInfo
crtablelogoninfo.ConnectionInfo = crconnectioninfo
crtable.ApplyLogOnInfo(crtablelogoninfo)
Next
CrystalReportViewer1.ReportSource = cryrpt
CrystalReportViewer1.Refresh()
CrystalReportViewer1.RefreshReport()
End With
Catch ex As Exception
End Try
End Sub
End Sub
cryrpt = laporan
With crconnectioninfo
.ServerName = Application.StartupPath & "\db_penjualan.mdb"
.DatabaseName = Application.StartupPath & "\db_penjualan.mdb"
.UserID = ""
.Password = ""
crtables = cryrpt.Database.Tables
For Each crtable In crtables
crtablelogoninfo = crtable.LogOnInfo
crtablelogoninfo.ConnectionInfo = crconnectioninfo
crtable.ApplyLogOnInfo(crtablelogoninfo)
Next
CrystalReportViewer1.SelectionFormula = "({tbl_jual.tgl_jual})=#" &
DateTimePicker1.Text & "#"
CrystalReportViewer1.ReportSource = cryrpt
CrystalReportViewer1.Refresh()
CrystalReportViewer1.RefreshReport()
End With
Catch ex As Exception
End Try
End Sub
End Sub
End Sub
End Class
Hasil :
Tampilan Laporan Crystal Report bagian jual harian :
cryrpt = laporan
With crconnectioninfo
.ServerName = Application.StartupPath & "\db_penjualan.mdb"
.DatabaseName = Application.StartupPath & "\db_penjualan.mdb"
.UserID = ""
.Password = ""
crtables = cryrpt.Database.Tables
For Each crtable In crtables
crtablelogoninfo = crtable.LogOnInfo
crtablelogoninfo.ConnectionInfo = crconnectioninfo
crtable.ApplyLogOnInfo(crtablelogoninfo)
Next
CrystalReportViewer1.SelectionFormula = "Month({tbl_jual.tgl_jual})=" &
Val(ComboBox1.Text) & "and Year ({tbl_jual.tgl_jual} )=" & Val(ComboBox2.Text)
CrystalReportViewer1.ReportSource = cryrpt
CrystalReportViewer1.Refresh()
CrystalReportViewer1.RefreshReport()
End With
Catch ex As Exception
End Try
End Sub
End Class
Hasil:
Tampilan Laporan Crystal Report bagian jual bulanan :
Sub tampil_user()
cmd = New OleDbCommand("select * from tbl_user", conn)
rd = cmd.ExecuteReader
DataGridView1.Rows.Clear()
Do While rd.Read = True
DataGridView1.Rows.Add(rd(0), rd(1), rd(2), rd(3), rd(4))
Loop
End Sub
Sub bersih()
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
ComboBox1.Text = ""
TextBox1.Focus()
End Sub
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label4.Click
End Sub
End Sub
End Sub
cmd = New OleDbCommand("insert into tbl_user values ('" & TextBox1.Text & _
"','" & TextBox2.Text & _
"','" & TextBox3.Text & _
"','" & TextBox4.Text & _
"','" & ComboBox1.Text & _
"')", conn)
cmd.ExecuteNonQuery()
MessageBox.Show("Data Berhasil di Tambahkan")
Call bersih()
Call tampil_user()
Else
'---Melakuakan edit data berdasarkan kode barang yang di panggil
Call koneksi()
End If
End If
End Sub
End Sub
Else
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
ComboBox1.Text = ""
End If
End Sub
End Class
Berikut tampilan input user :