Visual 1 Kode
Visual 1 Kode
tkode.Text = Adodc1.Recordset!kdbrg
tnama.Text = Adodc1.Recordset!nmbrg
tharga.Text = Adodc1.Recordset!harga
tsatuan.Text = Adodc1.Recordset!satuan
cmdsimpan.Caption = "&Update"
cmdkeluar.Caption = "&Batal"
On Error GoTo 0
End Sub
tkode.Text = ""
tnama.Text = ""
tharga.Text = ""
tsatuan.Text = ""
Call kodebrg
cmdkeluar.Caption = "&Exit"
cmdsimpan.Caption = "&Save"
End Sub
If Adodc1.Recordset.RecordCount = 0 Then
tkode.Text = "B000"
Else
Adodc1.Recordset.MoveLast
kdbrg = Right(Adodc1.Recordset![kdbrg], 3) + 1
tkode.Text = Format(kdbrg, "B000")
End If
End Sub
Call kosong
Me.tkode.SetFocus
End Sub
Call tampil
End Sub
tnama.SetFocus
Else
Adodc1.Recordset.Delete
Call kosong
tnama.SetFocus
End If
End If
End Sub
Adodc1.Recordset.Cancel
Call kosong
cmdbaru.SetFocus
Else
FormBarang.Hide
MenuUtama.Show
Else
cmdbaru.SetFocus
End If
End If
End Sub
With Adodc1.Recordset
tnama.SetFocus
Else
MsgBox "Kode barang yang anda inputkan sudah ada", vbCritical, "Dobel Input"
.Requery
Call kosong
tnama.SetFocus
Else
.AddNew
.Fields(0) = tkode.Text
.Fields(1) = tnama.Text
.Fields(2) = tharga.Text
.Fields(3) = tsatuan.Text
.Save
Call kosong
tnama.SetFocus
End If
Else
.Fields(0) = tkode.Text
.Fields(1) = tnama.Text
.Fields(2) = tharga.Text
.Fields(3) = tsatuan.Text
.Update
Call kosong
tnama.SetFocus
End If
End If
End With
End Sub
Private Sub Form_Load()
Call kodebrg
End Sub
Adodc1.Recordset.MoveFirst
Call tampil
End Sub
Adodc1.Recordset.MoveLast
Call tampil
End Sub
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If
Call tampil
End Sub
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.MoveLast
End If
Call tampil
End Sub
FORM CUSTOMER
Call kosong
fcari.Visible = False
gridcust.Visible = False
End Sub
tkode.Text = Addcus.Recordset!kscust
tnama.Text = Addcus.Recordset!nmcust
ttelepeon = Addcus.Recordset!tlpn
talamat = Addcus.Recordset!alamat
cmdsimpan.Caption = "&Update"
cmdkeluar.Caption = "&Exit"
On Error GoTo 0
End Sub
tkode.Text = ""
tnama.Text = ""
ttelepon.Text = ""
talamat.Text = ""
Call kodecust
cmdkeluar.Caption = "&Exit"
cmdsimpan.Caption = "&Save"
End Sub
If Addcus.Recordset.RecordCount = 0 Then
tkode.Text = "K001"
Else
Addcus.Recordset.MoveLast
kdcst = Right(Addcus.Recordset![kdcust], 3) + 1
End If
End Sub
Call kosong
tnama.SetFocus
End Sub
With Addcus
.CommandType = adCmdText
.RecordSource = "select*from pembeli where nmcust like'%" & tpencarian.Text & "%'"
.Refresh
End With
End Sub
Private Sub cmdedit_Click()
Call tampil
End Sub
fcari.Visible = True
gridcust.Visible = True
finput.Visible = False
End Sub
fcari.Visible = False
gridcust.Visible = False
finput.Visible = True
End Sub
tnama.SetFocus
Else
Addcus.Recordset.Delete
Call kosong
MsgBox "Data berhasil dihapus", vbInformation, "Info hapus data"
tnama.SetFocus
Addcus.Refresh
Else
tnama.SetFocus
End If
End If
End Sub
Addcus.Recordset.Cancel
Call kosong
cmdbaru.SetFocus
Else
FormCustomer.Hide
MenuUtama.Show
Else
cmdbaru.SetFocus
End If
End If
End Sub
With Addcus.Recordset
.Find "Kdcust='" & tkode.Text & "'", , adSearchForward
tnama.SetFocus
Else
MsgBox "Kode customer yang anda inputkan sudah ada", vbCritical, "Dobel Input"
.Requery
Call kosong
tnama.SetFocus
Else
.AddNew
.Fields(0) = tkode.Text
.Fields(1) = tnama.Text
.Fields(2) = ttelepon.Text
.Fields(3) = talamat.Text
.Save
Call kosong
tnama.SetFocus
End If
Else
.AddNew
.Fields(0) = tkode.Text
.Fields(1) = tnama.Text
.Fields(2) = ttelepon.Text
.Fields(3) = talamat.Text
.Update
Call kosong
tnama.SetFocus
End If
End If
End With
End Sub
Addcus.Recordset.MoveFirst
Call tampil
End Sub
Addcus.Recordset.MoveLast
Call tampil
End Sub
Addcus.Recordset.MoveNext
If Addcus.Recordset.EOF Then
Addcus.Recordset.MoveLast
End If
Call tampil
End Sub
Addcus.Recordset.MovePrevious
If Addcus.Recordset.BOF Then
Addcus.Recordset.MoveFirst
End If
Call tampil
End Sub
End Sub
FORM TRANSAKSI
cmbkdcust.Text = "Pili--"
tnama.Text = ""
talamat.Text = ""
ttelepon.Text = ""
cmbkdbarang.Text = "Pilih--"
tbarang.Text = ""
tharga.Text = ""
tjumlah.Text = ""
ttotal.Text = ""
tbayar.Text = ""
tkembali.Text = ""
Call nomortrans
cmbkdcust.Enabled = True
cmbkdbarang.Enabled = True
End Sub
If Addtransaksi.Recordset.RecordCount = 0 Then
tnotrans.Text = "TR001"
Else
Addtransaksi.Recordset.MoveLast
trans = Right(Addtransaksi.Recordset![notrans], 3) + 1
End If
End Sub
With Addcus
.CommandType = adCmdText
.Refresh
Do Until .Recordset.EOF
cmbkdcust.AddItem .Recordset!kdcust
.Recordset.MoveNext
Loop
End With
End Sub
With Addbarang
.CommandType = adCmdText
.Refresh
Do Until .Recordset.EOF
cmbkdbarang.AddItem .Recordset!kdbarang
.Recordset.MoveNext
Loop
End With
End Sub
With Addcus
.CommandType = adCmdText
.Refresh
cmbkdbarang.Tex = ""
Me.cmbkdbarang.SetFocus
Else
cmbkdbarang.Text = .Recordset!kdbarang
tbarang.Text = .Recordset!nmbarang
hargasat = .Recordset!harga
Me.tjumlah.SetFocus
End If
End With
End Sub
With Addcus
.CommandType = adCmdText
.Refresh
cmbkdcust.Text = ""
Me.cmbkdcust.SetFocus
Else
cmbkdcust.Text = .Recordset!kdcust
tnama.Text = .Recordset!nmcust
talamat.Text = .Recordset!alamat
ttelepon.Text = .Recordset!telpon
End If
End With
End Sub
Call kosong
cmdkeluar.Caption = "&Batal"
End Sub
Addtransaksi.Recordset.Cancel
Call kosong
Call disable
cmdkeluar.Caption = "&Exit"
cmdbaru.SetFocus
Else
End Sub
With Addtransaksi.Recordset
If tnotrans.Text = "" Or ttanggal = "" Or cmbkdcust = "" Or cmbkdbarang = "" Or tayar = "" Then
cmdbaru.SetFocus
Else
.AddNew
.Fields(0) = Me.tnotrans.Text
.Fields(1) = Me.ttanggal.Text
.Fields(2) = Me.cmbkdcust.Text
.Fields(3) = Me.cmbkdbarang.Text
.Fields(4) = Me.tjumlah.Text
.Fields(5) = Me.totalbrg
.Save
Call kosong
Call disable
End If
End With
End Sub
Call kosong
Call listcust
Call listbarang
cmdkeluar.Caption = "&Batal"
End Sub
If keyascii = 13 Then
Me.cmdsimpan.SetFocus
End If
End Sub
If keyascii = 13 Then
Me.tbayar.Enabled = True
Me.tbayar.SetFocus
End If
End Sub
Timer1.Enabled = True
Timer1.Interval = 300
End Sub