Professional Documents
Culture Documents
com
Pusat Kursus VB.Net & Bimbingan Tugas Akhir
1. MEMBUAT PROJECT
2. MEMBUAT DATABASE
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Module Module1
Imports System.Data.OleDb
Public Class Login
End If
End Sub
Imports System.Data.OleDb
Sub Kosongkan()
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
ComboBox1.Text = ""
TextBox1.Focus()
End Sub
Sub DataBaru()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
ComboBox1.Text = ""
TextBox2.Focus()
End Sub
Sub TampilStatus()
CMD = New OleDbCommand("select status_user from users", CONN)
DR = CMD.ExecuteReader
ComboBox1.Items.Clear()
Do While DR.Read
ComboBox1.Items.Add(DR.Item("status_user"))
Loop
End Sub
Sub TampilGrid()
DA = New OleDbDataAdapter("select * from users", CONN)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
End Sub
Sub Ketemu()
On Error Resume Next
TextBox2.Text = DR.Item("nama_user")
TextBox3.Text = DR.Item("pwd_user")
ComboBox1.Text = DR.Item("status_user")
TextBox2.Focus()
End Sub
Sub CariData()
CMD = New OleDbCommand("select * from users where kode_user='" &
TextBox1.Text & "'", CONN)
DR = CMD.ExecuteReader
DR.Read()
End Sub
Call Kosongkan()
Call TampilGrid()
Call TampilStatus()
End Sub
Call CariData()
If Not DR.HasRows Then
MsgBox("kode tidak terdaftar")
TextBox1.Clear()
TextBox1.Focus()
www.konsultasivb.com
Pusat Kursus VB.Net & Bimbingan Tugas Akhir
Exit Sub
End If
Imports System.Data.OleDb
Sub Bersihkan()
TNopol.Clear()
TKeluhan.Text = "-"
TTLBiayaBarang.Text = 0
TTLBiayaService.Text = 0
TTotalharga.Text = 0
TDibayar.Text = 0
TKembali.Text = 0
TCariBarang.Clear()
TCariJasa.Clear()
DGVJasa.Rows.Clear()
DGVBarang.Rows.Clear()
End Sub
Sub Otomatis()
CMD = New OleDbCommand("select nomor from service order by nomor
desc", CONN)
DR = CMD.ExecuteReader
DR.Read()
If Not DR.HasRows Then
TNomor.Text = "00001"
Else
TNomor.Text =
Format(Microsoft.VisualBasic.Right(DR.Item("nomor"), 5) + 1, "00000")
End If
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net & Bimbingan Tugas Akhir
Sub tampilJasa()
DA = New OleDbDataAdapter("select * from jasa", CONN)
DS = New DataSet
DA.Fill(DS)
DGV1.DataSource = DS.Tables(0)
DGV1.ReadOnly = True
End Sub
Sub tampilBarang()
DA = New OleDbDataAdapter("select * from barang where stok>0",
CONN)
DS = New DataSet
DA.Fill(DS)
DGV2.DataSource = DS.Tables(0)
DGV2.ReadOnly = True
End Sub
Sub TotalBiayaJasa()
Dim hitung As Integer = 0
For baris As Integer = 0 To DGVJasa.RowCount - 1
hitung = hitung + DGVJasa.Rows(baris).Cells(2).Value
TTLBiayaService.Text = FormatNumber(hitung, 0)
Next
End Sub
Sub TotalBiayaBarang()
Dim hitung As Integer = 0
For baris As Integer = 0 To DGVBarang.RowCount - 1
hitung = hitung + DGVBarang.Rows(baris).Cells(4).Value
TTLBiayaBarang.Text = FormatNumber(hitung, 0)
Next
End Sub
Sub HitungTotal()
TTotalharga.Text =
Val(Microsoft.VisualBasic.Str(TTLBiayaService.Text)) +
Val(Microsoft.VisualBasic.Str(TTLBiayaBarang.Text))
TTotalharga.Text = FormatNumber(TTotalharga.Text, 0)
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net & Bimbingan Tugas Akhir
End Sub
End If
End Sub
End Sub
Call SetingLaporan()
CRV.ReportSource = laporan
CRV.RefreshReport()
End Sub
Imports System.Data.OleDb
Sub Kosongkan()
ComboBox1.Text = ""
TTanggal.Text = ""
TNopol.Text = ""
TKeluhan.Text = ""
TBiayaService.Text = ""
TBiayaBarang.Text = ""
TTotalharga.Text = ""
TDibayar.Text = ""
TKembali.Text = ""
End Sub
Sub TampilData()
TTanggal.Text = DR.Item("tanggal")
TNopol.Text = DR.Item("nomor_polisi")
TKeluhan.Text = DR.Item("keluhan")
TBiayaService.Text = DR.Item("biaya_jasa")
www.konsultasivb.com
Pusat Kursus VB.Net & Bimbingan Tugas Akhir
TBiayaBarang.Text = DR.Item("biaya_barang")
TTotalharga.Text = DR.Item("total_harga")
TDibayar.Text = DR.Item("dibayar")
TKembali.Text = DR.Item("kembali")
End Sub
Sub DetailJasa()
DA = New OleDbDataAdapter("select Nama_jasa,harga_jasa from
jasa,detailjasa where jasa.kode_jasa=detailjasa.kode_jasa and nomor='" &
ComboBox1.Text & "'", CONN)
DS = New DataSet
DA.Fill(DS)
DGVJasa.DataSource = DS.Tables(0)
DGVJasa.ReadOnly = True
DGVJasa.Columns(0).HeaderText = "Nama Jasa"
DGVJasa.Columns(1).HeaderText = "Harga"
DGVJasa.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
End Sub
Sub DetailBarang()
DA = New OleDbDataAdapter("select
barang.nama_barang,harga_barang,detailbarang.Jumlah,Total from
barang,detailbarang where barang.kode_barang=detailbarang.kode_barang and
nomor='" & ComboBox1.Text & "'", CONN)
DS = New DataSet
DA.Fill(DS)
DGVBarang.DataSource = DS.Tables(0)
DGVBarang.ReadOnly = True
End Sub
Sub BersihkanDuaGrid()
DGVJasa.Columns.Clear()
DGVBarang.Columns.Clear()
End Sub