
Dim harga As Integer
Dim diskon As Single
Dim total As Single
Dim jumlah As Integer
Dim urut As Integer
Private Sub cclear_Click()
urut = Val(tno.Text) + 1
tno.Text = ""
tnama.Text = ""
Combo1.Text = ""
tjumlah.Text = ""
tharga.Text = ""
tbayar.Text = ""
tdiskon.Text = ""
ltotal.Caption = ""
tno.Text = urut
tnama.SetFocus
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
tjumlah.SetFocus
End If
End Sub
Private Sub Command1_Click()
If MsgBox("Apakah anda ingin menghapus ricod ini", vbInformation + vbOKCancel, "Perhatian") = vbOK Then
Adodc1.Recordset.Delete
Else
tnama.SetFocus
End If
End Sub
Private Sub csimpan_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset!no = tno
Adodc1.Recordset!Tanggal = DTPicker1
Adodc1.Recordset!Nama = tnama
Adodc1.Recordset!Barang = Combo1
Adodc1.Recordset!jumlah = tjumlah
Adodc1.Recordset!harga = tharga
Adodc1.Recordset!bayar = tbayar
Adodc1.Recordset!diskon = tdiskon
Adodc1.Recordset!total = ltotal
Adodc1.Recordset.Update
End Sub
Private Sub Form_Activate()
tno.SetFocus
End Sub
Private Sub Form_Load()
Combo1.AddItem "Beras"
Combo1.AddItem "Tepung"
Combo1.AddItem "Minyak Goreng"
Combo1.AddItem "Gula"
Combo1.AddItem "Susu"
End Sub
Private Sub Timer1_Timer()
Label11 = Right(Label11, Len(Label11) - 1) + Left(Label11, 1)
End Sub
Private Sub tjumlah_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If tno.Text = "" Then
MsgBox "Kolom 'no' belum anda isi!!!"
tno.SetFocus
Exit Sub
End If
If tnama.Text = "" Then
MsgBox "Kolom 'nama' belum anda is!!!"
tnama.SetFocus
Exit Sub
End If
If Combo1.Text = "" Then
MsgBox "Kolom 'barang' belum anda isi!!!"
Combo1.SetFocus
Exit Sub
End If
If tjumlah.Text = "" Then
MsgBox "kolol 'jumlah' belum anda isi!!!"
tjumlah.SetFocus
Exit Sub
End If
If Combo1.Text = "Beras" Then
harga = 5000
Else
If Combo1.Text = "Tepung" Then
harga = 4000
Else
If Combo1.Text = "Minyak Goreng" Then
harga = 8000
Else
If Combo1.Text = "Susu" Then
harga = 6500
Else
If Combo1.Text = "Gula" Then
harga = 5500
Else
MsgBox "Silahkan pilih nama barang yang sudah tersedia!!!"
End If
End If
End If
End If
End If
tharga.Text = Format(harga, "currency")
jumlah = Val(tjumlah.Text)
bayar = Val(harga) * jumlah
If bayar >= 50000 Then
diskon = 0.03
Else
If (bayar >= 25000) And (bayar < diskon =" 0.02"> 5000) And (bayar < 25000) Then
diskon = 0.01
Else
diskon = 0.1
End If
End If
End If
tbayar.Text = Format(bayar, "currency")
tdiskon.Text = Format(diskon, " 0%")
total = bayar * (1 - diskon)
ltotal.Caption = Format(total, "currency")
End If
End Sub
Private Sub tnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo1.SetFocus
End If
End Sub
Private Sub tno_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
tnama.SetFocus
End If
End Sub




0 komentar:
Poskan Komentar