Form Transaksi - Sistem Informasi Penjualan (VB6)
Program berikut merupakan form untuk mendata transaksi sistem informasi penjualan (VB6). Silahkan mendesain form seperti pada gambar diatas.
Berikut merupakan program form transaksi sistem informasi penjualan (VB6)
Dim lst As ListItem
Dim ckdbarang As String
Dim njumlah As Double
Dim i As Byte
Dim nT As Double
Private Sub cmdHapus_Click()
If LV.ListItems.Count = 0 Then
MsgBox "Record Belum ada Dalam Tabel ! ", vbOKOnly + vbInformation, "Pilih..."
Else
LV.ListItems.Remove LV.SelectedItem.Index
CekTotal
End If
End Sub
Private Sub CmdTrans_Click(Index As Integer)
Select Case Index
Case 0
Call Hapus
RUBAH False, True, False, True
Case 1
If CmdTrans(1).Caption = "SIMPAN" Then SimpanJUAL Else EditJUAL
Call Hapus
Case 2
X = MsgBox("YAKIN ! Data akan dihapus ?", vbCritical + vbYesNo, "Hapus Record")
If X = vbYes Then
HapusJual
End If
Call Hapus
Case 3
Call Hapus
Call HapusBarang
Case 4
Unload Me
End Select
End Sub
Private Sub Form_Activate()
Hapus
HapusBarang
Tabel
End Sub
Private Sub PA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Sisa.Text = Val(CCur(txtTotal.Text)) - Val(PA.Text)
Sisa.Text = Format(Sisa.Text, "###,###,###")
End If
End Sub
Private Sub txtJualB_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If txtJualB.Text = "" Then Exit Sub
Call Proses
HapusBarang
txtKodeB.SetFocus
End If
End Sub
Private Sub txtKd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If txtKd.Text = "" Then Exit Sub
If Found(Data2, "KdPelanggan", txtKd, 0) Then
With Data2.Recordset
txtNama.Text = !Nama
End With
Else
MsgBox "Ma'af ! Data Konsumen ini tidak ada...", vbInformation + vbOKOnly, "Not Found"
txtKd.SetFocus
End If
End If
End Sub
Private Sub txtNO_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If txtNO.Text = "" Then Exit Sub
With Data3.Recordset
.Index = "NoBukti"
.Seek "=", txtNO.Text
If Not .NoMatch Then
txtTanggal.Value = !Tanggal
txtKd.Text = !KdPelanggan
Sisa.Text = Format(!Sisa, "###,###,###")
PA.Text = Format(!PA, "###,###,###")
Found Data2, "KdPelanggan", txtKd.Text, 0
txtNama.Text = Data2.Recordset!Nama
CmdTrans(1).Caption = "EDIT"
RUBAH False, True, True, True
ShowJual
CekTotal
Else
X = txtNO.Text
Call Hapus
txtNO.Text = X
RUBAH False, True, False, True
End If
txtTanggal.SetFocus
End With
End If
End Sub
Private Sub txtKodeB_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If txtKodeB.Text = "" Then Exit Sub
If Found(Data1, "KdBarang", txtKodeB, 0) Then
With Data1.Recordset
txtNamaB.Text = !Nama
txtSatuanB.Text = !Penerbit
txtHargaB.Text = !harga
txtJualB.Text = !Stock
txtJualB.SetFocus
End With
Else
MsgBox "Ma'af ! Data barang ini tidak ada...", vbInformation + vbOKOnly, "Not Found"
txtKode.SetFocus
End If
End If
End Sub
Sub Tabel()
LV.ColumnHeaders.Add , , "Kode", 850
LV.ColumnHeaders.Add , , "Nama", 3250
LV.ColumnHeaders.Add , , "Penerbit", 2000
LV.ColumnHeaders.Add , , "Harga", 830, 1
LV.ColumnHeaders.Add , , "Qty", 530, 1
LV.ColumnHeaders.Add , , "Nilai", 900, 1
LV.View = lvwReport
LV.GridLines = True
End Sub
Sub Proses()
Set lst = LV.ListItems.Add(, , txtKodeB.Text)
lst.SubItems(1) = txtNamaB.Text
lst.SubItems(2) = txtSatuanB.Text
lst.SubItems(3) = txtHargaB.Text
lst.SubItems(4) = txtJualB.Text
lst.SubItems(5) = txtHargaB.Text * txtJualB.Text
CekTotal
End Sub
Sub CekTotal()
nT = 0
For i = 1 To LV.ListItems.Count
nT = nT + CCur(LV.ListItems(i).ListSubItems(5).Text)
Next i
txtTotal.Text = Format(nT, "###,###,#")
End Sub
Sub RUBAH(L0 As Boolean, L1 As Boolean, L2 As Boolean, L3 As Boolean)
CmdTrans(0).Enabled = L0
CmdTrans(1).Enabled = L1
CmdTrans(2).Enabled = L2
CmdTrans(3).Enabled = L3
End Sub
Sub Hapus()
txtNO.Text = ""
txtKd.Text = ""
txtNama.Text = ""
txtTanggal.Value = Now
LV.ListItems.Clear
txtTotal.Text = ""
PA.Text = ""
Sisa.Text = ""
CmdTrans(1).Caption = "SIMPAN"
RUBAH True, False, False, False
txtNO.SetFocus
End Sub
Sub HapusBarang()
txtKodeB.Text = ""
'txtNama.Text = ""
txtNamaB.Text = ""
txtSatuanB.Text = ""
txtHargaB.Text = ""
txtJualB.Text = ""
End Sub
Sub SimpanJUAL()
With Data3.Recordset
For i = 1 To LV.ListItems.Count
njumlah = Val(LV.ListItems(i).ListSubItems(4).Text)
.AddNew
!Nobukti = txtNO.Text
!Tanggal = txtTanggal.Value
!KdPelanggan = txtKd.Text
!KdBarang = LV.ListItems(i).Text
!Jumlah = njumlah
!Total = CCur(txtTotal.Text)
!Sisa = CCur(Sisa.Text)
!PA = CCur(PA.Text)
.Update
If Found(Data1, "KdBarang", LV.ListItems(i).Text, 0) Then
Data1.Recordset.edit
Data1.Recordset!Stock = Data1.Recordset!Stock - njumlah
Data1.Recordset.Update
End If
If Found(Data2, "KdPelanggan", txtKd.Text, 0) Then
Data2.Recordset.edit
Data2.Recordset!TAGIHAN = CCur(Data2.Recordset!TAGIHAN) + CCur(Sisa.Text)
Data2.Recordset.Update
End If
Next i
End With
Call Hapus
End Sub
Sub HapusJual()
With Data3.Recordset
If Data3.Recordset.RecordCount = 0 Then Exit Sub
.MoveFirst
Do While Not .EOF
ckdbarang = Data3.Recordset!KdBarang
njumlah = Data3.Recordset!Jumlah
If Data3.Recordset!Nobukti = txtNO.Text Then
Found Data1, "KdBarang", ckdbarang, 0
Data1.Recordset.edit
Data1.Recordset!Stock = Data1.Recordset!Stock + njumlah
Data1.Recordset.Update
Data3.Recordset.Delete
End If
.MoveNext
Loop
End With
End Sub
Sub EditJUAL()
HapusJual
SimpanJUAL
End Sub
Sub ShowJual()
With Data3.Recordset
If Data3.Recordset.RecordCount = 0 Then Exit Sub
.MoveFirst
Do While Not .EOF
If Data3.Recordset!Nobukti = txtNO.Text Then
ckdbarang = Data3.Recordset!KdBarang
njumlah = Data3.Recordset!Jumlah
Found Data1, "KdBarang", ckdbarang, 0
Set lst = LV.ListItems.Add(, , ckdbarang)
lst.SubItems(1) = Data1.Recordset!Nama
lst.SubItems(2) = Data1.Recordset!Penerbit
lst.SubItems(3) = Format(Data1.Recordset!harga, "###,###")
lst.SubItems(4) = njumlah
lst.SubItems(5) = Format(Data1.Recordset!harga * njumlah, "###,###,#")
End If
.MoveNext
Loop
End With
End Sub
Demikianlah program form transaksi sistem informasi penjualan (VB6)
Labels:
Sistem Informasi Penjualan (VB6)
2 komentar untuk "Form Transaksi - Sistem Informasi Penjualan (VB6)"
Terima kasih sudah memberikan komentar anda dengan baik.Konversi KodeEmoticonFolllow
Subscribe to:
Post Comments (Atom)
Terimakasih sis, membantu untuk latihan sebelum saya uas, visit back yah.
ReplyDeletehttp://opraywinter.blogspot.com/
Mantabs Tutornya gan, bisa dijadikan referensi nih
ReplyDeletejangan lupa mampir juga gan
http://carakuvb6.blogspot.co.id