Академический Документы
Профессиональный Документы
Культура Документы
UUSRUSMAWAN.C
PANDUAN MEMBUAT APLIKASI SERVICE KENDARAAN
DENGAN VB.NET
Tahapan pembuatan aplikasi service kendaraan adalah sebagai berikut :
1. MEMBUAT PROJECT
2. MEMBUAT DATABASE
1
M
UUSRUSMAWAN.C
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Module Module1
Imports System.Data.OleDb
Public Class Login
2
M
UUSRUSMAWAN.C
End If
End Sub
3
M
UUSRUSMAWAN.C
6. MEMBUAT FORM MENU UTAMA
Imports System.Data.OleDb
4
M
UUSRUSMAWAN.C
Public Class User
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
5
M
UUSRUSMAWAN.C
Call CariData()
If Not DR.HasRows Then
MsgBox("kode tidak terdaftar")
TextBox1.Clear()
TextBox1.Focus()
Exit Sub
End If
6
M
UUSRUSMAWAN.C
Dim hapus As String = "delete * from users where kode_user='" &
TextBox1.Text & "'"
CMD = New OleDbCommand(hapus, CONN)
CMD.ExecuteNonQuery()
Call Kosongkan()
Call TampilGrid()
Call TampilStatus()
Else
Call Kosongkan()
End If
End Sub
7
M
UUSRUSMAWAN.C
8. MEMBUAT FORM BARANG
8
M
UUSRUSMAWAN.C
Imports System.Data.OleDb
Sub Bersihkan()
TNopol.Clear()
TKeluhan.Text = "-"
9
M
UUSRUSMAWAN.C
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
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
10
M
UUSRUSMAWAN.C
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
End Sub
11
M
UUSRUSMAWAN.C
TKembali.Text =
Val(Microsoft.VisualBasic.Str(TDibayar.Text)) -
Val(Microsoft.VisualBasic.Str(TTotalharga.Text))
TKembali.Text = FormatNumber(TKembali.Text, 0)
'Button1.Enabled = True
End If
Button1.Focus()
End If
12
M
UUSRUSMAWAN.C
Next
Next
End Sub
13
M
UUSRUSMAWAN.C
TCariBarang.Clear()
End Sub
End Class
14
M
UUSRUSMAWAN.C
15
M
UUSRUSMAWAN.C
16
M
UUSRUSMAWAN.C
End Sub
17
M
UUSRUSMAWAN.C
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")
TBiayaBarang.Text = DR.Item("biaya_barang")
TTotalharga.Text = DR.Item("total_harga")
18
M
UUSRUSMAWAN.C
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
19
M
UUSRUSMAWAN.C
End Sub
20