transaksi di vb
YAYAN NURYANA
43A87067100022
D3/KA/M/3
TUGAS VB
NB: maaf pak tugas baru di kirim, ternyata walaupun
referensi dari TA(TUGAS AKHIR ) di
perpustakaan tidak tentu langsung bisa jalan programnya. Saya belum puas
apabila program yang saya buat belum jalan.alhamdulilah walaupun telat tugasnya
yang penting saya mengerti akan program
transaksi yang ada di TA dan berhasil menyelesaikan tugas dengan sempurna
.terimakasih.wss
Yayan nuryana
Programnya ada di bawah ini:
Program vb
TRANSAKSI
APOTEK
VERSI YAYAN
NURYANA
TRANSAKSI APOTIK
terdiri dari form obat,form
kasir,form transaksi dan form log in dan
menu utama.
1.
FORM (MENU
UTAMA)
HASILNYA
CODINGAN NYA
Private Sub FKASIR_Click()
Form2.Show
End Sub
Private Sub FKELUAR_Click()
End
End Sub
Private Sub FOBAT_Click()
Form1.Show
End Sub
Private Sub L_Click()
End Sub
Private Sub MKELUAR_Click()
End
End Sub
Private Sub MOBAT_Click()
Form1.Show
End Sub
Private Sub MPENJUALAN_Click()
Form3.Show
End Sub
Private Sub Picture1_Click()
End Sub
Private Sub Timer1_Timer()
If L.FontSize <> 60 Then
L.FontSize = L.FontSize + 1
Else
L.FontSize = 1
End If
End Sub
2.FORM(MENU LOG IN )
HASILNYA:
CODINGANYA:
Option Explicit
Public LoginSucceeded As Boolean
Private Sub Command1_Click()
If Text2 = "yayan nuryana" And Text1 = "lupa lagi"
Then
LoginSucceeded = True
MsgBox "SELAMAT MENGGUNAKAN
APLIKASI INI!"
Me.Hide
MENU_UTAMA.Show
Else
MsgBox "Password Salah, Coba
lagi...!", , "Login"
Text2.SetFocus
SendKeys "{Home}+{End}"
End IF
End Sub
Private Sub Command2_Click()
'
LoginSucceeded = False
' Me.Hide
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
End Sub
2. FORM(MENU OBAT)
HASIL
NYA:
CODINGANYA:
Private Sub TXTKOSONG()
TXTKDOBAT.Text =
""
TXTNMOBAT.Text =
""
TXTHRG.Text = 0
CBOJNS.Text =
""
End Sub
Private Sub
CBOJNS_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTHRG.SetFocus
End If
End Sub
Private Sub CMDCANCEL_Click()
CMDAKTIF
CMDCANCEL.Enabled =
True
CMDEXIT.Enabled = True
CMDINPUT.Caption =
"&INPUT"
CMDEDIT.Caption =
"&EDIT"
CMDDELETE.Caption =
"&DELETE"
CMDCANCEL.Caption =
"&CANCEL"
CMDNEXT.Caption =
"&NEXT"
CMDPRE.Caption =
"&PREVIOUS"
CMDCARI.Caption =
"&SEARCH"
TXTTAKAKTIF
TXTKOSONG
CMDCANCEL.Enabled =
True
End Sub
Private Sub
CMDCARI_Click()
If CMDCARI.Caption =
"&SEARCH" Then
CMDCARI.Caption = "&START"
TXTAKTIF
TXTKOSONG
CMDTAKAKTIF
CMDCARI.Enabled = True
TXTKDOBAT.SetFocus
Else
If Data1.Recordset.RecordCount <> 0
Then
ketemu = False
Data1.Refresh
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
If TXTKDOBAT.Text =
Data1.Recordset!kdOBAT Then
ketemu = True
Exit Do
End If
Data1.Recordset.MoveNext
Loop
End If
If ketemu Then
TXTKDOBAT.Text =
Data1.Recordset("KDOBAT")
TXTNMOBAT.Text =
Data1.Recordset("NMOBAT")
TXTHRG.Text = Data1.Recordset("HRGOBAT")
CBOJNS.Text =
Data1.Recordset("JNSOBAT")
MsgBox "DATA ADA",
vbInformation + vbOKOnly, "PERHATIAN!"
CMDCARI.Caption =
"&SEARCH"
CMDAKTIF
Else
MsgBox "DATA TIDAK ADA",
vbInformation + vbOKOnly, "PERHATIAN!"
CMDAKTIF
TXTTAKAKTIF
Data1.Refresh
CMDCARI.Caption =
"&SEARCH"
End If
End If
End Sub
Private Sub
CMDEDIT_Click()
If CMDEDIT.Caption =
"&EDIT" Then
If Data1.Recordset.RecordCount = 0 Then
MsgBox "DATA KOSONG",
vbOKOnly + vbInformation, "PERHATIAN"
Else
CMDEDIT.Caption = "&SAVE"
CMDTAKAKTIF
CMDEDIT.Enabled = True
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
TXTAKTIF
TXTKDOBAT.Enabled = False
TXTNMOBAT.SetFocus
End If
Else
If (TXTKDOBAT.Text <> "")
And (TXTNMOBAT.Text <> "") And (CBOJNS.Text <>
"") And (TXTHRG.Text <> "") Then
Data1.Recordset.Edit
Data1.Recordset("KDOBAT") =
TXTKDOBAT.Text
Data1.Recordset("NMOBAT") =
TXTNMOBAT.Text
Data1.Recordset("HRGOBAT") =
TXTHRG.Text
Data1.Recordset("JNSOBAT") =
CBOJNS.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
CMDEDIT.Caption = "&EDIT"
CMDAKTIF
TXTTAKAKTIF
Else
MsgBox "DATA YANG ANDA ISI BELUM
LENGKAP !", vbInformation + vbOKOnly, "PERHATIAN"
TXTKDOBAT.Locked = False
TXTKDOBAT.SetFocus
End If
End If
End Sub
Private Sub
CMDEXIT_Click()
Unload Me
End Sub
Private Sub
CMDDELETE_Click()
If CMDDELETE.Caption =
"&DELETE" Then
CMDDELETE.Caption = "&OK"
CMDTAKAKTIF
CMDDELETE.Enabled = True
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
TXTAKTIF
TXTKOSONG
TXTKDOBAT.SetFocus
If Data1.Recordset.RecordCount = 0 Then
MsgBox "DATA KOSONG", vbOKOnly
+ vbInformation, "PERHATIAN"
Else
X = MsgBox("DATA INGIN DIHAPUS
?", vbYesNo + vbInformation, "PERHATIAN!")
If X = vbYes Then
Data1.Recordset.Delete
Data1.Refresh
DBGrid1.Refresh
End If
End If
CMDDELETE.Caption = "&DELETE"
CMDAKTIF
TXTTAKAKTIF
End If
End Sub
Private Sub
CMDINPUT_Click()
If CMDINPUT.Caption =
"&INPUT" Then
CMDINPUT.Caption = "&SAVE"
CMDTAKAKTIF
CMDINPUT.Enabled = True
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
TXTAKTIF
TXTKDOBAT.Enabled = True
TXTKOSONG
TXTKDOBAT.SetFocus
Else
If (TXTKDOBAT.Text <> "")
And (TXTNMOBAT.Text <> "") And (CBOJNS.Text <>
"") And (TXTHRG.Text <> "") Then
Data1.Recordset.AddNew
Data1.Recordset("KDOBAT") =
TXTKDOBAT.Text
Data1.Recordset("NMOBAT") =
TXTNMOBAT.Text
Data1.Recordset("HRGOBAT") =
TXTHRG.Text
Data1.Recordset("JNSOBAT") =
CBOJNS.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
CMDINPUT.Caption = "&INPUT"
CMDAKTIF
TXTTAKAKTIF
Else
MsgBox "DATA YANG ANDA ISI BELUM
LENGKAP !", vbInformation + vbOKOnly, "PERHATIAN"
TXTKDOBAT.SetFocus
End If
End If
End Sub
Private Sub
CMDNEXT_Click()
If
Data1.Recordset.RecordCount <> 0 Then
Data1.Recordset.MoveNext
If Data1.Recordset.EOF
Then
MsgBox "KEMBALI KE RECORD
PERTAMA", vbOKOnly + vbInformation, "PERHATIAN!"
Data1.Recordset.MoveFirst
End If
TXTKDOBAT.Text = Data1.Recordset("KDOBAT")
TXTNMOBAT.Text =
Data1.Recordset("NMOBAT")
TXTHRG.Text =
Data1.Recordset("HRGOBAT")
CBOJNS.Text =
Data1.Recordset("JNSOBAT")
Else
MsgBox "DATA KOSONG", vbOKOnly +
vbInformation, "PERHATIAN"
End If
End Sub
Private Sub
CMDPRE_Click()
If Data1.Recordset.RecordCount <> 0 Then
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
MsgBox "BERIKUTNYA RECORD
TERAKHIR", vbOKOnly + vbInformation, "PERHATIAN!"
Data1.Recordset.MoveLast
End If
TXTKDOBAT.Text =
Data1.Recordset("KDOBAT")
TXTNMOBAT.Text =
Data1.Recordset("NMOBAT")
TXTHRG.Text =
Data1.Recordset("HRGOBAT")
CBOJNS.Text =
Data1.Recordset("JNSOBAT")
Else
MsgBox "DATA KOSONG", vbOKOnly +
vbInformation, "PERHATIAN"
End If
End Sub
Private Sub
CMDTAKAKTIF()
CMDINPUT.Enabled =
False
CMDEDIT.Enabled = False
CMDDELETE.Enabled =
False
CMDNEXT.Enabled = False
CMDPRE.Enabled = False
CMDEXIT.Enabled = False
CMDCANCEL.Enabled = False
CMDCARI.Enabled = False
End Sub
Private Sub CMDAKTIF()
CMDINPUT.Enabled = True
CMDEDIT.Enabled = True
CMDDELETE.Enabled =
True
CMDNEXT.Enabled = True
CMDPRE.Enabled = True
CMDEXIT.Enabled = True
CMDCANCEL.Enabled =
True
CMDCARI.Enabled = True
End Sub
Private Sub
TXTTAKAKTIF()
TXTKDOBAT.Enabled =
False
TXTNMOBAT.Enabled =
False
TXTHRG.Enabled = False
CBOJNS.Enabled = False
End Sub
Private Sub TXTAKTIF()
TXTKDOBAT.Enabled =
True
TXTNMOBAT.Enabled =
True
TXTHRG.Enabled = True
CBOJNS.Enabled = True
End Sub
Private Sub Form_Load()
TXTTAKAKTIF
TXTKOSONG
CBOJNS.AddItem
"TABLET"
CBOJNS.AddItem
"KAPSUL"
CBOJNS.AddItem
"SIRUP"
CBOJNS.AddItem
"PUYER"
End Sub
Private Sub
TXTKDOBAT_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTNMOBAT.SetFocus
End If
If
Data1.Recordset.RecordCount <> 0 Then
ketemu = False
Data1.Refresh
Data1.Recordset.MoveFirst
Do While Not
Data1.Recordset.EOF
If TXTKDOBAT.Text =
Data1.Recordset("KDOBAT") Then
ketemu = True
Exit Do
End If
Data1.Recordset.MoveNext
Loop
End If
If ketemu Then
TXTKDOBAT.Text =
Data1.Recordset("KDOBAT")
TXTNMOBAT.Text =
Data1.Recordset("NMOBAT")
TXTHRG.Text =
Data1.Recordset("HRGOBAT")
CBOJNS.Text =
Data1.Recordset("JNSOBAT")
MsgBox "DATA SUDAH ADA", vbOKOnly
+ vbInformation, "PENGUMUMAN"
TXTKOSONG
TXTKDOBAT.Enabled = True
TXTKDOBAT.SetFocus
Data1.Refresh
End If
End Sub
Private Sub
TXTNMOBAT_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
CBOJNS.SetFocus
End If
End Sub
4.FORM (TRANSAKSI TRANSAKSI)
----LIST TRANSAKSI
HASILNYA:
---LIST TRANSAKSI
---LIST DATA OBAT
---LIST DATA KASIR
CODINGAN NYA:
Private Sub TXTKOSONG()
TXTKWIT.Text = ""
TXTJAM.Text = ""
DBKDKSR.Text = ""
TXTRESEP.Text = ""
DBKDOBAT.Text = ""
TXTHRG.Text = ""
TXTITEM.Text = 0
TXTNMDOK.Text = ""
TXTTOT.Text = 0
End Sub
Private Sub CBOTRAN_Click()
If CBOTRAN.Text = "BIASA" Then
CMDAKTIF
TXTNMDOK.Enabled = False
TXTRESEP.Enabled = False
CBOTRAN.Enabled = False
TXTTAKAKTIF
Else
CMDAKTIF
TXTNMDOK.Enabled = True
TXTRESEP.Enabled = True
CBOTRAN.Enabled = False
TXTTAKAKTIF
End If
End Sub
Private Sub CMDCANCEL_Click()
CMDTAKAKTIF
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
CMDINPUT.Caption = "&INPUT"
CMDEDIT.Caption = "&EDIT"
CMDDELETE.Caption = "&DELETE"
CMDCANCEL.Caption = "&CANCEL"
CMDNEXT.Caption = "&NEXT"
CMDPRE.Caption = "&PREVIOUS"
TXTTAKAKTIF
CBOTRAN.Enabled = True
TXTKOSONG
CMDCANCEL.Enabled = True
End Sub
Private Sub CMDCARI_Click()
If CMDCARI.Caption = "&SEARCH" Then
CMDCARI.Caption = "&START"
TXTAKTIF
TXTKOSONG
CMDTAKAKTIF
CMDCARI.Enabled = True
TXTKWIT.SetFocus
Else
If
Data1.Recordset.RecordCount <> 0 Then
ketemu =
False
Data1.Refresh
Data1.Recordset.MoveFirst
Do While
Not Data1.Recordset.EOF
If
TXTKWIT.Text = Data1.Recordset("NO KWITANSI") Then
ketemu = True
Exit Do
End If
Data1.Recordset.MoveNext
Loop
End If
If ketemu
Then
TXTKWIT.Text = Data1.Recordset("NO KWITANSI")
TXTJAM.Text = Data1.Recordset("JAM")
DBKDKSR.Text = Data1.Recordset("KODE KASIR")
CBOTRAN.Text = Data1.Recordset("JENIS TRANSAKSI")
TXTRESEP.Text = Data1.Recordset("NO RESEP")
DBKDOBAT.Text = Data1.Recordset("KODE OBAT")
TXTHRG.Text = Data1.Recordset("HARGA OBAT")
TXTITEM.Text = Data1.Recordset("ITEM")
TXTNMDOK.Text = Data1.Recordset("NAMA DOKTER")
TXTTOT.Text = Data1.Recordset("TOTAL HARGA")
MsgBox
"DATA ADA", vbInformation + vbOKOnly, "PERHATIAN!"
CMDCARI.Caption = "&SEARCH"
Else
MsgBox
"DATA TIDAK ADA", vbInformation + vbOKOnly, "PERHATIAN!"
TXTTAKAKTIF
CMDAKTIF
CBOTRAN.Enabled = True
CMDINPUT.Enabled = False
Data1.Refresh
CMDCARI.Caption = "&SEARCH"
End If
End If
End Sub
Private Sub CMDEDIT_Click()
If CMDEDIT.Caption = "&EDIT" Then
If
Data1.Recordset.RecordCount = 0 Then
MsgBox
"DATA KOSONG", vbOKOnly + vbInformation, "PERHATIAN"
Else
CMDEDIT.Caption = "&SAVE"
CMDTAKAKTIF
CMDEDIT.Enabled = True
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
TXTAKTIF
TXTKOSONG
TXTKWIT.Text = Data1.Recordset("NO KWITANSI")
TXTJAM.Text
= Data1.Recordset("JAM")
DBKDKSR.Text
= Data1.Recordset("KODE KASIR")
CBOTRAN.Text
= Data1.Recordset("JENIS TRANSAKSI")
TXTKWIT.Locked = True
End If
Else
If
(TXTKWIT.Text <> "") And (TXTJAM.Text <> "")
And (DBKDKSR.Text <> "") And (CBOTRAN.Text <>
"") And (TXTRESEP.Text <> "") And (DBKDOBAT.Text
<> "") And (TXTHRG.Text <> "") And
(TXTITEM.Text <> 0) And (TXTNMDOK.Text <> "") And
(TXTTOT.Text <> 0) Then
Data1.Refresh
Data1.Recordset.Edit
Data1.Recordset("NO KWITANSI") = TXTKWIT.Text
Data1.Recordset("JAM") = TXTJAM.Text
Data1.Recordset("KODE KASIR") = DBKDKSR.Text
Data1.Recordset("JENIS TRANSAKSI") = CBOTRAN.Text
Data1.Recordset("NO RESEP") = TXTRESEP.Text
Data1.Recordset("KODE OBAT") = DBKDOBAT.Text
Data1.Recordset("TGL") = DT1
Data1.Recordset("HARGA OBAT") = TXTHRG.Text
Data1.Recordset("ITEM") = TXTITEM.Text
Data1.Recordset("NAMA DOKTER") = TXTNMDOK.Text
Data1.Recordset("TOTAL HARGA") = TXTTOT.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
CMDEDIT.Caption = "&EDIT"
CMDAKTIF
TXTTAKAKTIF
Else
MsgBox
"DATA YANG ANDA ISI BELUM LENGKAP !", vbInformation + vbOKOnly,
"PERHATIAN"
TXTKWIT.SetFocus
End If
End If
End Sub
Private Sub CMDEXIT_Click()
Unload Me
End Sub
Private Sub CMDDELETE_Click()
If CMDDELETE.Caption = "&DELETE" Then
CMDDELETE.Caption = "&OK"
CMDTAKAKTIF
CMDDELETE.Enabled = True
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
TXTAKTIF
TXTKOSONG
TXTKWIT.SetFocus
If
Data1.Recordset.RecordCount = 0 Then
MsgBox
"DATA KOSONG", vbOKOnly + vbInformation, "PERHATIAN"
Else
X =
MsgBox("DATA INGIN DIHAPUS ?", vbYesNo + vbInformation,
"PERHATIAN!")
If X = vbYes
Then
Data1.Recordset.Delete
Data1.Refresh
DBGrid1.Refresh
End If
End If
TXTTAKAKTIF
CMDAKTIF
CBOTRAN.Enabled = True
CMDINPUT.Enabled = False
CMDDELETE.Caption = "&DELETE"
End If
End Sub
Private Sub CMDINPUT_Click()
If (CMDINPUT.Caption = "&INPUT") And
(CBOTRAN.Text = "BIASA") Then
CMDINPUT.Caption = "&SAVE"
TXTKOSONG
TXTJAM.Text
= JAM
CMDTAKAKTIF
CMDINPUT.Enabled = True
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
TXTAKTIF
CBOTRAN.Enabled = False
TXTKWIT.Enabled = True
TXTNMDOK.Enabled = False
TXTRESEP.Enabled = False
TXTTOT.Enabled = False
TXTNMDOK.Text = "-"
TXTRESEP.Text = "-"
TXTKWIT.SetFocus
Else
If
(CMDINPUT.Caption = "&INPUT") And (CBOTRAN.Text =
"RESEP") Then
CMDINPUT.Caption = "&SAVE"
CMDTAKAKTIF
CMDINPUT.Enabled = True
CMDCANCEL.Enabled = True
CMDEXIT.Enabled = True
TXTTOT.Enabled = False
TXTAKTIF
CBOTRAN.Enabled = False
TXTKWIT.Enabled = True
TXTKOSONG
TXTJAM.Text =
JAM
TXTKWIT.SetFocus
Else
If
(TXTKWIT.Text <> "") And (TXTJAM.Text <> "")
And (DBKDKSR.Text <> "") And (CBOTRAN.Text <>
"") And (TXTRESEP.Text <> "") And (DBKDOBAT.Text
<> "") And (TXTHRG.Text <> "") And
(TXTITEM.Text <> 0) And (TXTNMDOK.Text <> "") And
(TXTTOT.Text <> 0) Then
Data1.Recordset.AddNew
Data1.Recordset("NO
KWITANSI") = TXTKWIT.Text
Data1.Recordset("JAM") = TXTJAM.Text
Data1.Recordset("KODE KASIR") = DBKDKSR.Text
Data1.Recordset("JENIS TRANSAKSI") = CBOTRAN.Text
Data1.Recordset("NO RESEP") = TXTRESEP.Text
Data1.Recordset("KODE OBAT") = DBKDOBAT.Text
Data1.Recordset("HARGA OBAT") = TXTHRG.Text
Data1.Recordset("TGL") = DT1
Data1.Recordset("ITEM") = TXTITEM.Text
Data1.Recordset("NAMA DOKTER") = TXTNMDOK.Text
Data1.Recordset("TOTAL HARGA") = TXTTOT.Text
Data1.Recordset.Update
Data1.Refresh
DBGrid1.Refresh
CMDINPUT.Caption = "&INPUT"
CMDAKTIF
TXTTAKAKTIF
CBOTRAN.Enabled = True
CMDINPUT.Enabled = False
Else
MsgBox
"DATA YANG ANDA ISI BELUM LENGKAP !", vbInformation + vbOKOnly,
"PERHATIAN"
TXTKWIT.SetFocus
End If
End If
Komentar
Posting Komentar