SURAT KETERANGAN
Hasil Uji Program Tugas Akhir
Yang bertanda tangan dibawah ini, menerangkan bahwa Mahasiswa Tugas Akhir
Program Diploma III Teknik Informatika/Statistika :
Nama
:
KHAIRUL TAMIMI
NIM
:
082406195
Prog. Studi
:
Teknik Informatika
Judul TA
:
PERANCANGAN APLIKASI PENDATAAN DI KLINIK
MURNI
Telah melaksanakan test program Tugas Akhir Mahasiswa tersebut di atas pada
tanggal……….
Dengan Hasil : Sukses / Gagal
Demikian diterangkan untuk digunakan melengkapi syarat pendaftaran Ujian Meja
Hijau Tugas Akhir Mahasiswa bersangkutan di Departemen Matematika FMIPA USU
Medan.
Medan, Mei 2011
Dosen Pembimbing
Program Studi D3 Teknik Informatika
Dr. Sutarman, M.Sc
NIP. 196310261991031001
KARTU BIMBINGAN TUGAS AKHIR MAHASISWA
Nama Mahasiswa
: KHAIRUL TAMIMI
NIM
: 082406195
Judul Tugas Akhir
: Perancangan Aplikasi Sistem Informasi Pendataan Di
Klinik Murni
Dosen Pembimbing
: Dr. Sutarman, M.Sc
Tanggal Mulai Bimbingan :
Tanggal Selesai Bimbingan :
No. Tanggal Asisten Bimbingan
Pembahasan Pada Asisten Mengenai Pada BAB
Paraf Dosen Pembimbing Keterangan 1. 2. 3. 4. 5. 6. 7.
Kartu ini dikembalikan ke Departemen Matematika bila Bimbingan Mahasiswa telah selesai
Diketahui,
Disetujui,
Departemen Matematika FMIPA USU
Pembimbing Utama/
Ketua
Penanggung Jawab
Prof. Dr. Tulus, M.Si
Dr. Sutarman, M.Sc
NIP. 196209011988031002
NIP.196310261991031001
KEMENTERIAN PENDIDIKAN NASIONAL
UNIVERSITAS SUMATERA UTARA
FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM
PROGRAM STUDI D.III TEKNIK INFORMATIKA
Lampiran
1.
Menu Utama
Dim text As String
Private Sub MDIForm_Load()
text = " Sistem Informasi Pasien (Klinik Murni)"
CheckSoftware frmUtama End Sub
Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode <> vbFormCode Then Cancel = True
End If End Sub
Private Sub mnuClose_Click() End
End Sub
Private Sub mnudaftarpas_Click() Me.MousePointer = 11
StatusBar1.Panels(1).text = "Tunggu,...." frmLapPasien.Show
Me.MousePointer = 1 End Sub
Private Sub mnuDokter_Click() Me.MousePointer = 11
StatusBar1.Panels(1).text = "Tunggu,...." frmDokter.Show
StatusBar1.Panels(1).text = "Entry Data Dokter,...." Me.MousePointer = 1
End Sub
Private Sub mnuDokterlap_Click() Me.MousePointer = 11
frmLapDokter.Show Me.MousePointer = 1 End Sub
Private Sub mnukartu_Click() Me.MousePointer = 11
StatusBar1.Panels(1).text = "Tunggu,...." frmLapKartu.Show
StatusBar1.Panels(1).text = "Entry Data Obat,...." Me.MousePointer = 1
End Sub
Private Sub Mnukeluar_Click() Tutup
Set TMedis = Nothing End
Private Sub mnuObat_Click() Me.MousePointer = 11
StatusBar1.Panels(1).text = "Tunggu,...." frmObat.Show
StatusBar1.Panels(1).text = "Entry Data Obat,...." Me.MousePointer = 1
End Sub
Private Sub mnuObatlap_Click() Me.MousePointer = 11
With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap Obat.rpt" .Password = Chr(10) & "irul"
.DataFiles(0) = App.Path & "\Medis.mdb" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With Me.MousePointer = 1 End Sub
Private Sub mnuPasien_Click() Me.MousePointer = 11
StatusBar1.Panels(1).text = "Tunggu,...." frmPasien.Show
StatusBar1.Panels(1).text = "Entry Data Pasien,...." Me.MousePointer = 1
End Sub
Private Sub mnuPeriksa_Click() Me.MousePointer = 11
StatusBar1.Panels(1).text = "Tunggu,...." frmPemeriksaan.Show
StatusBar1.Panels(1).text = "Proses Pemeriksaa Pasien,...." Me.MousePointer = 1
End Sub
Private Sub mnuPeriksaLap_Click() Me.MousePointer = 11
StatusBar1.Panels(1).text = "Tunggu,...." frmLapMedis.Show
StatusBar1.Panels(1).text = "Proses Pemeriksaa Pasien,...." Me.MousePointer = 1
End Sub
Private Sub Timer1_Timer() a = Left(text, 1)
b = Len(text)
c = Right(text, b - 1) text = c + a
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.Index
Case 1 frmPasien.Show Case 2 frmDokter.Show Case 3 frmObat.Show Case 4 frmPemeriksaan.Show End Select End Sub
2.
Menu Input Pasien
Private Sub cmbKelamin_Click() If CmbKelamin.text <> "" Then Fokus txtAlamat
Exit Sub End If
End Sub
Private Sub cmbKelamin_KeyPress(KeyAscii As Integer) KeyAscii = AutoComplete(CmbKelamin, KeyAscii, True, Ubah) End Sub
Private Sub cmdBaru_Click() Me.MousePointer = 11
If cmdBaru.Caption = "&Baru" Then cmdBaru.Caption = "&Batal" Fokus txtKode vEdit = False cmdCari.Enabled = False Else Semula End If Me.MousePointer = 1 End Sub
Private Sub cmdCari_Click() Dim cari
ulang:
cari = InputBox("Masukkan Kode Pasien yang akan di cari...", "Cari Kode Pasien")
If cari = "" Then Exit Sub Me.MousePointer = 11
Set TCari = New ADODB.Recordset
Kata = "Select * from Pasien where [Kode Pasien]='" & cari & "'"
If TCari.EOF Then TCari.Close
Set TCari = Nothing Me.MousePointer = 1
MsgBox "Kode Pasien = " & cari & " tidak ditemukan..", vbInformation, ""
Exit Sub End If
DaftarCari TCari.Close
Set TCari = Nothing Me.MousePointer = 1 cmdEdit.Enabled = True cmdHapus.Enabled = True cmdBaru.Caption = "&Batal" Me.MousePointer = 1 End Sub
Private Sub cmdEdit_Click() Me.MousePointer = 11 vEdit = True vTrans = True Fokus txtNama cmdHapus.Enabled = False cmdSimpan.Enabled = True cmdBaru.Caption = "&Batal" cmdCari.Enabled = False Me.MousePointer = 1 End Sub
Private Sub cmdHapus_Click() On Error GoTo salah
If MsgBox("Data Pasien " & txtNama.text & " Akan di hapus..", vbCritical + vbYesNo, "Informasi System") = vbYes Then
Me.MousePointer = 11 TMedis.BeginTrans
Kata = "Delete From [Pasien] Where [Kode Pasien]='" & txtKode.text & "'" TMedis.Execute Kata TMedis.CommitTrans Me.MousePointer = 1 Semula Exit Sub End If Me.MousePointer = 1 Exit Sub salah:
MsgBox "Data tidak dapat di hapus..., coba periksa kembali..", vbInformation
Me.MousePointer = 1 End Sub
Private Sub cmdSimpan_Click() Me.MousePointer = 11
If Not vEdit Then Simpan
Else Edit
End If Semula End Sub
Private Sub cmdTutup_Click() Unload Me End Sub Sub Semula() Bersih vEdit = False vTrans = False cmdSimpan.Enabled = False cmdHapus.Enabled = False cmdEdit.Enabled = False cmdBaru.Caption = "&Baru" NotAktif DaftarPasien cmdBaru.SetFocus cmdCari.Enabled = True End Sub Sub Bersih() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.text = ""
End If
If TypeOf Control Is ComboBox Then Control.text = "" End If Next Control End Sub Sub NotAktif() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.Enabled = False
End If
If TypeOf Control Is ComboBox Then Control.Enabled = False
End If Next Control End Sub Sub Simpan()
On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
TMedis.Execute "Insert Into Pasien values ('" & txtKode.text & "'," & _
"'" & txtNama.text & "','" & txtUmur.text & "','" & CmbKelamin.text & "'," & _
"'" & txtAlamat.text & "','" & txtKota.text & "','" & txtNomor.text & "','" & txtPekerjaan.text & "')"
TMedis.CommitTrans Me.MousePointer = 1
MsgBox "Data Pasien sudah disimpan..", vbInformation, "Sukses" Exit Sub
MsgBox "Data Pasien tidak sukses di simpan...", vbInformation, "Periksa"
End Sub Sub Edit()
On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
TMedis.Execute "Update Pasien set [Nama Pasien]='" & txtNama.text & "',[Umur]='" & _
txtUmur.text & "',[JK]='" & CmbKelamin.text & "',alamat='" & txtAlamat.text & "', [Asal KOta]='" & txtKota.text & "', [No telp]='" & txtNomor.text & "',Pekerjaan='" & _
txtPekerjaan.text & "' where [Kode Pasien]='" & txtKode.text & "'"
TMedis.CommitTrans Me.MousePointer = 1
MsgBox "Data Pasien sudah di edit..", vbInformation, "Sukses Edit"
Exit Sub salah:
MsgBox "Data Pasien tidak bisa di edit..", , "Periksa" End Sub
Private Sub Form_Activate() cmdBaru.Enabled = True cmdBaru.SetFocus
End Sub
Private Sub Form_Load() Ketengah Me DaftarPasien If Tab1.Tab = 1 Then Tab1.Tab = 0 Exit Sub End If End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Not vTrans Then Unload Me
Set TPasien = Nothing Set frmPasien = Nothing Else
Kata = MsgBox("Data Pasien belum di simpan...." & vbCrLf & _ "Data Pasien mau di simpan...", vbInformation + vbYesNo, "Pasien Belum di Simpan")
If Kata = vbYes Then
cmdSimpan.Enabled = True cmdSimpan_Click
Set TPasien = Nothing Set frmPasien = Nothing Unload Me
Exit Sub End If
Set TPasien = Nothing Set frmPasien = Nothing Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer) On Error Resume Next
Do Until Me.Top <= -5000 DoEvents
Me.Move Me.Left, Me.Top - 10 DoEvents
Loop Unload Me
End Sub
Private Sub Lv1_DblClick() With frmPasien .txtKode = Lv1.SelectedItem.SubItems(1) .txtNama = Lv1.SelectedItem.SubItems(2) .txtUmur = Lv1.SelectedItem.SubItems(3) .CmbKelamin.text = Lv1.SelectedItem.SubItems(4) .txtAlamat = Lv1.SelectedItem.SubItems(5) .txtKota = Lv1.SelectedItem.SubItems(6) .txtNomor = Lv1.SelectedItem.SubItems(7) .txtPekerjaan = Lv1.SelectedItem.SubItems(8) .cmdHapus.Enabled = True .cmdEdit.Enabled = True .cmdBaru.Caption = "&Batal" .Tab1.Tab = 0 End With End Sub
Private Sub Tab1_Click(PreviousTab As Integer) If Tab1.Tab = 1 Then
If Lv1.ListItems.Count = 0 Then
MsgBox "Daftar Pasien masih kosong.." & vbCrLf & _ "Entry Data Pasien...."
Tab1.Tab = 0 End If Else DaftarPasien End If End Sub Sub DaftarPasien() On Error GoTo salah
Me.MousePointer = 11
Kata = "Select * From [Pasien] Order By [kode Pasien]" Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenStatic, adLockReadOnly Lv1.ListItems.Clear
If Not TPasien.EOF Then TPasien.MoveFirst i = 1
While Not TPasien.EOF
Set Vbutir = Lv1.ListItems.Add(, , i & ".") Vbutir.SubItems(1) = TPasien![Kode Pasien] Vbutir.SubItems(2) = TPasien![Nama pasien] Vbutir.SubItems(3) = TPasien![Umur]
Vbutir.SubItems(5) = TPasien![Alamat] Vbutir.SubItems(6) = TPasien![asal Kota] Vbutir.SubItems(7) = TPasien![No telp] Vbutir.SubItems(8) = TPasien![Pekerjaan] TPasien.MoveNext i = i + 1 Wend End If TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1 Exit Sub
salah:
MsgBox Err.Description End Sub
Private Sub txtKode_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If txtKode <> "" Then
If Len(txtKode) <> 5 Then
MsgBox "Kode Pasien harus di isi sebayak 5 digit..", vbCritical, "System error"
Fokus txtKode Exit Sub End If
Me.MousePointer = 11
Kata = "select * from Pasien where [koDe Pasien]='" & txtKode.text & "'"
Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenDynamic, adLockPessimistic
If TPasien.EOF Then Fokus txtNama TPasien.Close
' Set TPasien = norhing Me.MousePointer = 1 Exit Sub
End If
With TPasien
txtNama = ![Nama pasien] txtAlamat = ![Alamat] txtUmur = ![Umur]
CmbKelamin.text = ![JK] txtNomor = ![No telp]
txtPekerjaan = ![Pekerjaan] End With cmdEdit.Enabled = True cmdCari.Enabled = False cmdHapus.Enabled = True cmdBaru.Caption = "&Batal" TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1 End If
End If End Sub
If KeyAscii = 13 Then If txtKota <> "" Then Fokus txtNomor Exit Sub End If End If End Sub
Private Sub txtNama_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtNama <> "" Then Fokus txtUmur Exit Sub End If End If End Sub
Private Sub txtNama_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("a") & Chr(13) _
And KeyAscii <= Asc("z") & Chr(13) _ Or (KeyAscii >= Asc("A") & Chr(13) _ And KeyAscii <= Asc("Z") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace)) Then Beep
KeyAscii = 0 End If
End Sub
Private Sub txtAlamat_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtAlamat <> "" Then Fokus txtKota Exit Sub End If End If End Sub
Private Sub txtNomor_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtNomor <> "" Then Fokus txtPekerjaan Exit Sub End If End If End Sub
Private Sub txtNomor_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("0") & Chr(13) _
And KeyAscii <= Asc("9") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace) Then Beep
KeyAscii = 0 End If
Private Sub txtPekerjaan_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtPekerjaan <> "" Then cmdSimpan.Enabled = True cmdSimpan.SetFocus Exit Sub End If End If End Sub
Private Sub txtPekerjaan_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("a") & Chr(13) _
And KeyAscii <= Asc("z") & Chr(13) _ Or (KeyAscii >= Asc("A") & Chr(13) _ And KeyAscii <= Asc("Z") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace)) Then Beep
KeyAscii = 0 End If
End Sub
Private Sub txtUmur_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
If txtUmur <> "" Then
CmbKelamin.Enabled = True CmbKelamin.SetFocus
r = SendMessageLong(CmbKelamin.hwnd, CB_SHOWDROPDOWN, True, 0)
Exit Sub End If
End If End Sub
Private Sub txtUmur_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("0") & Chr(13) _
And KeyAscii <= Asc("9") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace) Then Beep KeyAscii = 0 End If End Sub Sub DaftarCari() With TCari
txtKode = ![Kode Pasien] txtNama = ![Nama pasien] txtUmur = ![Umur]
CmbKelamin = ![JK] txtAlamat = ![Alamat] txtKota = ![asal Kota] txtNomor = ![No telp]
txtPekerjaan = ![Pekerjaan] End With
End Sub
3.
Menu Input Dokter
Private Sub cmbKelamin_Click() If cmbKelamin.text <> "" Then Fokus txtNomor
Exit Sub End If
End Sub
Private Sub cmbKelamin_KeyPress(KeyAscii As Integer) KeyAscii = AutoComplete(cmbKelamin, KeyAscii, True, Ubah) End Sub
Private Sub cmdBaru_Click() Me.MousePointer = 11
If cmdBaru.Caption = "&Baru" Then cmdBaru.Caption = "&Batal" Fokus txtKode vEdit = False cmdCari.Enabled = False Else Semula End If Me.MousePointer = 1 End Sub
Private Sub cmdCari_Click() Dim cari
ulang:
cari = InputBox("Masukkan Kode Dokter yang akan di cari...", "Cari Kode Dokter")
If cari = "" Then Exit Sub Me.MousePointer = 11
Set TCari = New ADODB.Recordset
Kata = "Select * from Dokter where [Kode Dokter]='" & cari & "'"
TCari.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TCari.EOF Then
TCari.Close
Set TCari = Nothing Me.MousePointer = 1
If MsgBox("Kode Dokter = " & cari & " tidak ditemukan.." & vbCrLf & _
"Apakah masih ada kode Dokter yang akan dicari...", vbInformation + vbYesNo) = vbYes Then
GoTo ulang Else
' TCari.Close
Set TCari = Nothing Me.MousePointer = 1 End If
Else
DaftarCari
Set TCari = Nothing cmdEdit.Enabled = True
cmdHapus.Enabled = True Me.MousePointer = 1 End If
End Sub
Private Sub cmdEdit_Click() Me.MousePointer = 11 vEdit = True vTrans = True Fokus txtNama cmdHapus.Enabled = False cmdSimpan.Enabled = True cmdBaru.Caption = "&Batal" cmdCari.Enabled = False Me.MousePointer = 1 End Sub
Private Sub cmdHapus_Click() On Error GoTo salah
If MsgBox("Data Dokter " & Lv1.SelectedItem.SubItems(2) & " Akan di hapus..", vbCritical + vbYesNo, "Informasi System") = vbYes Then Me.MousePointer = 11
TMedis.BeginTrans
Kata = "Delete From [Dokter] Where [Kode Dokter]='" & txtKode.text & "'" TMedis.Execute Kata TMedis.CommitTrans Me.MousePointer = 1 Semula Exit Sub End If Me.MousePointer = 1 Exit Sub salah:
MsgBox "Data tidak dapat di hapus..., coba periksa kembali..", vbInformation
Me.MousePointer = 1 End Sub
Private Sub cmdSimpan_Click() Me.MousePointer = 11
If Not vEdit Then Simpan Else Edit End If Semula End Sub
Private Sub cmdTutup_Click() Unload Me End Sub Sub Semula() Bersih vEdit = False vTrans = False cmdSimpan.Enabled = False cmdHapus.Enabled = False
cmdEdit.Enabled = False cmdBaru.Caption = "&Baru" NotAktif DaftarDokter cmdCari.Enabled = True cmdBaru.SetFocus End Sub Sub Bersih() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.text = ""
End If
If TypeOf Control Is ComboBox Then Control.text = "" End If Next Control End Sub Sub NotAktif() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.Enabled = False
End If
If TypeOf Control Is ComboBox Then Control.Enabled = False
End If Next Control End Sub Sub Simpan()
On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
TMedis.Execute "Insert Into Dokter values ('" & txtKode.text & "'," & _
"'" & txtNama.text & "','" & txtAlamat.text & "','" & txtKota.text & "','" & cmbKelamin.text & "'," & _
"'" & txtNomor.text & "','" & txtSpesialis.text & "')" TMedis.CommitTrans
Me.MousePointer = 1
MsgBox "Data Dokter sudah disimpan..", vbInformation, "Sukses" Exit Sub
salah:
MsgBox "Data Dokter tidak sukses di simpan...", vbInformation, "Periksa"
End Sub Sub Edit()
On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
TMedis.Execute "Update Dokter set [Nama Dokter]='" & txtNama.text & "',[Alamat]='" & _
txtAlamat.text & "',Kota='" & txtKota.text & "', [JK]='" &
cmbKelamin.text & "',[No telp]='" & txtNomor.text & "',Spesialis='" & _
txtSpesialis.text & "' where [Kode Dokter]='" & txtKode.text & "'"
TMedis.CommitTrans Me.MousePointer = 1
MsgBox "Data Dokter sudah di edit..", vbInformation, "Sukses Edit"
Exit Sub salah:
MsgBox "Data Dokter tidak bisa di edit..", , "Periksa" End Sub
Private Sub Form_Activate() cmdBaru.Enabled = True cmdBaru.SetFocus
End Sub
Private Sub Form_Load() Ketengah Me DaftarDokter If Tab1.Tab = 1 Then Tab1.Tab = 0 Exit Sub End If End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next Do Until Me.Top <= -5000 DoEvents
Me.Move Me.Left, Me.Top - 10 DoEvents
Loop Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer) If Not vTrans Then
Unload Me
Set TDokter = Nothing Set frmDokter = Nothing Else
Kata = MsgBox("Data Dokter belum di simpan...." & vbCrLf & _ "Data Dokter mau di simpan...", vbInformation + vbYesNo, "Dokter Belum di Simpan")
If Kata = vbYes Then
cmdSimpan.Enabled = True cmdSimpan_Click
Set TDokter = Nothing Set frmDokter = Nothing Unload Me
Exit Sub End If
Set TDokter = Nothing Set frmDokter = Nothing Unload Me
End If
End Sub
Private Sub Lv1_DblClick() With frmDokter .txtKode = Lv1.SelectedItem.SubItems(1) .txtNama = Lv1.SelectedItem.SubItems(2) .txtAlamat = Lv1.SelectedItem.SubItems(3) .txtKota = Lv1.SelectedItem.SubItems(4) .cmbKelamin.text = Lv1.SelectedItem.SubItems(5) .txtNomor = Lv1.SelectedItem.SubItems(6) .txtSpesialis = Lv1.SelectedItem.SubItems(7) .cmdHapus.Enabled = True .cmdEdit.Enabled = True .cmdBaru.Caption = "&Batal" .Tab1.Tab = 0 End With End Sub
Private Sub Tab1_Click(PreviousTab As Integer) If Tab1.Tab = 1 Then
If Lv1.ListItems.Count = 0 Then
MsgBox "Daftar Dokter masih kosong.." & vbCrLf & _ "Entry Data Dokter...."
Tab1.Tab = 0 End If Else DaftarDokter End If End Sub Sub DaftarDokter() On Error GoTo salah
Me.MousePointer = 11
Kata = "Select * From [Dokter] Order By [kode Dokter]" Set TDokter = New ADODB.Recordset
TDokter.Open Kata, TMedis, adOpenStatic, adLockReadOnly Lv1.ListItems.Clear
If Not TDokter.EOF Then TDokter.MoveFirst i = 1
While Not TDokter.EOF
Set Vbutir = Lv1.ListItems.Add(, , i & ".") Vbutir.SubItems(1) = TDokter![Kode Dokter] Vbutir.SubItems(2) = TDokter![Nama dokter] Vbutir.SubItems(3) = TDokter![Alamat] Vbutir.SubItems(4) = TDokter![Kota] Vbutir.SubItems(5) = TDokter![JK] Vbutir.SubItems(6) = TDokter![No telp] Vbutir.SubItems(7) = TDokter![Spesialis] TDokter.MoveNext i = i + 1 Wend End If TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1 Exit Sub
salah:
End Sub
Private Sub txtKode_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If txtKode <> "" Then
If Len(txtKode) <> 5 Then
MsgBox "Kode Dokter harus di isi sebayak 5 digit..", vbCritical, "System error"
Fokus txtKode Exit Sub End If
Me.MousePointer = 11
Kata = "select * from Dokter where [koDe Dokter]='" & txtKode.text & "'"
Set TDokter = New ADODB.Recordset
TDokter.Open Kata, TMedis, adOpenDynamic, adLockPessimistic
If TDokter.EOF Then Fokus txtNama TDokter.Close
' Set TDokter = norhing Me.MousePointer = 1 Exit Sub
End If
With TDokter
txtNama = ![Nama dokter] txtAlamat = ![Alamat] cmbKelamin.text = ![JK] txtNomor = ![No telp]
txtSpesialis = ![Spesialis] End With cmdEdit.Enabled = True cmdCari.Enabled = False cmdHapus.Enabled = True cmdBaru.Caption = "&Batal" TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1 End If
End If End Sub
Private Sub txtKota_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If txtKota <> "" Then
cmbKelamin.Enabled = True cmbKelamin.SetFocus
r = SendMessageLong(cmbKelamin.hwnd, CB_SHOWDROPDOWN, True, 0)
Exit Sub End If
End If End Sub
Private Sub txtNama_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
If txtNama <> "" Then Fokus txtAlamat
Exit Sub End If
End If End Sub
Private Sub txtNama_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("a") & Chr(13) _
And KeyAscii <= Asc("z") & Chr(13) _ Or (KeyAscii >= Asc("A") & Chr(13) _ And KeyAscii <= Asc("Z") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace)) Then Beep
KeyAscii = 0 End If
End Sub
Private Sub txtAlamat_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtAlamat <> "" Then Fokus txtKota Exit Sub End If End If End Sub
Private Sub txtNomor_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtNomor <> "" Then Fokus txtSpesialis Exit Sub End If End If End Sub
Private Sub txtNomor_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("0") & Chr(13) _
And KeyAscii <= Asc("9") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace) Then Beep
KeyAscii = 0 End If
End Sub
Private Sub txtSpesialis_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtSpesialis <> "" Then cmdSimpan.Enabled = True cmdSimpan.SetFocus Exit Sub End If End If End Sub
Private Sub txtSpesialis_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("a") & Chr(13) _
And KeyAscii <= Asc("z") & Chr(13) _ Or (KeyAscii >= Asc("A") & Chr(13) _ And KeyAscii <= Asc("Z") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace)) Then Beep KeyAscii = 0 End If End Sub Sub DaftarCari() With TCari
txtKode = ![Kode Dokter] txtNama = ![Nama dokter] cmbKelamin = ![JK]
txtAlamat = ![Alamat] txtKota = !Kota
txtNomor = ![No telp]
txtSpesialis = ![Spesialis] End With
End Sub
4.
Menu Input Obat
Private Sub cmdBaru_Click() Me.MousePointer = 11
If cmdBaru.Caption = "&Baru" Then cmdBaru.Caption = "&Batal" Fokus txtKode vEdit = False cmdCari.Enabled = False Else Semula End If Me.MousePointer = 1 End Sub
Private Sub cmdCari_Click() Dim cari
ulang:
cari = InputBox("Masukkan Kode Obat yang akan di cari...", "Cari Kode Obat")
If cari = "" Then Exit Sub Me.MousePointer = 11
Set TCari = New ADODB.Recordset
Kata = "Select * from Obat where [Kode Obat]='" & cari & "'" TCari.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TCari.EOF Then
TCari.Close
Set TCari = Nothing Me.MousePointer = 1
If MsgBox("Kode Obat = " & cari & " tidak ditemukan.." & vbCrLf & _
"Apakah masih ada kode obat yang akan dicari...", vbInformation + vbYesNo) = vbYes Then
GoTo ulang Else
' TCari.Close
Set TCari = Nothing Me.MousePointer = 1 End If
Else
DaftarCari
Set TCari = Nothing cmdEdit.Enabled = True cmdHapus.Enabled = True Me.MousePointer = 1 End If End Sub
Private Sub cmdEdit_Click() Me.MousePointer = 11 vEdit = True vTrans = True Fokus txtNama cmdHapus.Enabled = False cmdSimpan.Enabled = True cmdBaru.Caption = "&Batal" cmdCari.Enabled = False Me.MousePointer = 1 End Sub
Private Sub cmdHapus_Click() On Error GoTo salah
If MsgBox("Data Obat " & Lv1.SelectedItem.SubItems(2) & " Akan di hapus..", vbCritical + vbYesNo, "Informasi System") = vbYes Then Me.MousePointer = 11
TMedis.BeginTrans
Kata = "Delete From [Obat] Where [Kode Obat]='" & txtKode.text & "'" TMedis.Execute Kata TMedis.CommitTrans Me.MousePointer = 1 Semula Exit Sub End If Me.MousePointer = 1 Exit Sub salah:
MsgBox "Data tidak dapat di hapus..., coba periksa kembali..", vbInformation
Me.MousePointer = 1 End Sub
Private Sub cmdSimpan_Click() Me.MousePointer = 11
If Not vEdit Then Simpan
Else Edit End If
Semula End Sub
Private Sub cmdTutup_Click() Unload Me End Sub Sub Semula() Bersih vEdit = False vTrans = False cmdSimpan.Enabled = False cmdHapus.Enabled = False cmdEdit.Enabled = False cmdBaru.Caption = "&Baru" NotAktif DaftarObat cmdBaru.SetFocus cmdCari.Enabled = True End Sub Sub Bersih() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.text = ""
End If
If TypeOf Control Is ComboBox Then Control.text = "" End If Next Control End Sub Sub NotAktif() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.Enabled = False
End If
If TypeOf Control Is ComboBox Then Control.Enabled = False
End If Next Control End Sub Sub Simpan()
On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
TMedis.Execute "Insert Into Obat values ('" & txtKode.text & "'," & _
"'" & txtNama.text & "','" & txtJenis.text & "')" TMedis.CommitTrans
Me.MousePointer = 1
MsgBox "Data Obat sudah disimpan..", vbInformation, "Sukses" Exit Sub
salah:
MsgBox "Data obat tidak sukses di simpan...", vbInformation, "Periksa"
Sub Edit()
On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
TMedis.Execute "Update obat set [Nama obat]='" & txtNama.text & "',[Jenis]='" & _
txtJenis.text & "' where [Kode Obat]='" & txtKode.text & "'" TMedis.CommitTrans
Me.MousePointer = 1
MsgBox "Data Obat sudah di edit..", vbInformation, "Sukses Edit" Exit Sub
salah:
MsgBox "Data Obat tidak bisa di edit..", , "Periksa" End Sub
Private Sub Form_Activate() cmdBaru.Enabled = True cmdBaru.SetFocus
End Sub
Private Sub Form_Load() Ketengah Me DaftarObat If Tab1.Tab = 1 Then Tab1.Tab = 0 Exit Sub End If End Sub
Private Sub Form_OLESetData(Data As DataObject, DataFormat As Integer)
On Error Resume Next Do Until Me.Top <= -5000 DoEvents
Me.Move Me.Left, Me.Top - 10 DoEvents
Loop Unload Me End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next Do Until Me.Top <= -5000 DoEvents
Me.Move Me.Left, Me.Top - 10 DoEvents
Loop Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer) If Not vTrans Then
Unload Me
Set TObat = Nothing Set frmObat = Nothing Else
"Data obat mau di simpan...", vbInformation + vbYesNo, "Obat Belum di Simpan")
If Kata = vbYes Then
cmdSimpan.Enabled = True cmdSimpan_Click
Set TObat = Nothing Set frmObat = Nothing Unload Me
Exit Sub End If
Set TObat = Nothing Set frmObat = Nothing Unload Me
End If
End Sub
Private Sub Lv1_DblClick() With frmObat .txtKode = Lv1.SelectedItem.SubItems(1) .txtNama = Lv1.SelectedItem.SubItems(2) .txtJenis = Lv1.SelectedItem.SubItems(3) .cmdHapus.Enabled = True .cmdEdit.Enabled = True .cmdBaru.Caption = "&Batal" .Tab1.Tab = 0 End With End Sub
Private Sub Tab1_Click(PreviousTab As Integer) If Tab1.Tab = 1 Then
If Lv1.ListItems.Count = 0 Then
MsgBox "DaftarObat masih kosong.." & vbCrLf & _ "Entry Data obat...."
Tab1.Tab = 0 End If Else DaftarObat End If End Sub Sub DaftarObat() On Error GoTo salah
Me.MousePointer = 11
Kata = "Select * From [obat] Order By [kode Obat]" Set TObat = New ADODB.Recordset
TObat.Open Kata, TMedis, adOpenStatic, adLockReadOnly Lv1.ListItems.Clear
If Not TObat.EOF Then TObat.MoveFirst i = 1
While Not TObat.EOF
Set Vbutir = Lv1.ListItems.Add(, , i & ".") Vbutir.SubItems(1) = TObat![Kode Obat]
Vbutir.SubItems(2) = TObat![Nama Obat] Vbutir.SubItems(3) = TObat![jenis] TObat.MoveNext i = i + 1 Wend End If TObat.Close
Set TObat = Nothing Me.MousePointer = 1 Exit Sub
salah:
MsgBox Err.Description End Sub
Private Sub txtKode_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If txtKode <> "" Then
If Len(txtKode) <> 6 Then
MsgBox "Kode Obat harus di isi sebayak 6 digit..", vbCritical, "System error"
Fokus txtKode Exit Sub End If
Me.MousePointer = 11
Kata = "select * from obat where [koDe Obat]='" & txtKode.text & "'"
Set TObat = New ADODB.Recordset
TObat.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TObat.EOF Then Fokus txtNama TObat.Close Me.MousePointer = 1 Exit Sub End If With TObat
txtNama = ![Nama Obat] txtJenis = ![jenis] End With NotAktif Me.MousePointer = 1 cmdEdit.Enabled = True cmdCari.Enabled = False cmdHapus.Enabled = True cmdBaru.Caption = "&Batal" TObat.Close
Set TObat = Nothing End If
End If End Sub
Private Sub txtNama_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtNama <> "" Then Fokus txtJenis Exit Sub End If End If End Sub
Private Sub txtNama_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("a") & Chr(13) _
And KeyAscii <= Asc("z") & Chr(13) _ Or (KeyAscii >= Asc("A") & Chr(13) _ And KeyAscii <= Asc("Z") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace)) Then Beep
KeyAscii = 0 End If
End Sub
Private Sub txtJenis_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then If txtJenis <> "" Then cmdSimpan.Enabled = True cmdSimpan.SetFocus vTrans = True Exit Sub End If End If End Sub
Private Sub txtJenis_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("a") & Chr(13) _
And KeyAscii <= Asc("z") & Chr(13) _ Or (KeyAscii >= Asc("A") & Chr(13) _ And KeyAscii <= Asc("Z") & Chr(13) _ Or KeyAscii = vbKeyBack _
Or KeyAscii = vbKeyDelete _ Or KeyAscii = vbKeySpace)) Then Beep KeyAscii = 0 End If End Sub Sub DaftarCari() With TCari
txtKode = ![Kode Obat] txtNama = ![Nama Obat] txtJenis = ![jenis] End With
End Sub
5.
Menu Input Pemeriksaan
Private Sub Auto() Dim Hitung As Byte
Dim tanggal, Tahun As Date tanggal = Format(Now, "mmyy") Set TRawat = New ADODB.Recordset
TRawat.Open "Select * From medis ", TMedis, adOpenStatic, adLockReadOnly
With TRawat
If .RecordCount = 0 Then Urutan = "000" & "001" Else
.MoveLast
If Val(Left(.Fields("No Medis"), 5)) <> "000" Then Urutan = "00" & "001"
Else
Hitung = Val(Right(.Fields("No Medis"), 6)) + 1 Urutan = "00" & Right("000" & Hitung, 6)
End If End If
txtNomor.text = Urutan End With
End Sub
Private Sub cmbDokter_Click() If cmbDokter.text <> "" Then Me.MousePointer = 11
Kata = "Select * from dokter where [Kode dokter]='" & cmbDokter.text & "'"
Set TDokter = New ADODB.Recordset
TDokter.Open Kata, TMedis, adOpenDynamic, adLockPessimistic
If TDokter.EOF Then TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1
MsgBox "Kode dokter = & " & cmbDokter.text & " tidak terdaftar...", vbInformation
cmbDokter.SetFocus Exit Sub
End If
With TDokter
txtNamaDokter = ![Nama dokter] End With
TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1 Fokus txtDiagnosa End If
End Sub
Private Sub cmbDokter_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If cmbDokter.text <> "" Then Me.MousePointer = 11
Kata = "Select * from dokter where [Kode dokter]='" & cmbDokter.text & "'"
Set TDokter = New ADODB.Recordset
TDokter.Open Kata, TMedis, adOpenDynamic, adLockPessimistic
If TDokter.EOF Then TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1
MsgBox "Kode dokter = & " & cmbDokter.text & " tidak terdaftar...", vbInformation
cmbDokter.SetFocus Exit Sub
With TDokter
txtNamaDokter = ![Nama dokter] End With
TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1 Fokus txtkdoe
End If End If
End Sub
Private Sub cmbPasien_Click() If cmbPasien.text <> "" Then Me.MousePointer = 11
Kata = "Select * from Pasien where [Kode pasien]='" & cmbPasien.text & "'"
Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenDynamic, adLockPessimistic
If TPasien.EOF Then TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1
MsgBox "Kode pasien = & " & cmbPasien.text & " tidak terdaftar...", vbInformation
cmbPasien.SetFocus Exit Sub
End If
With TPasien
txtNamaPasien = ![Nama pasien] End With
TPasien.Close
Set TPasien = Nothing DaftarDokter
Me.MousePointer = 1
If cmbPasien.ListCount = 0 Then
MsgBox "Data Dokter masih kosong..,," & vbCrLf & _ "Coba periksa kembali...", vbCritical Unload Me
Exit Sub End If
r = SendMessageLong(cmbDokter.hwnd, CB_SHOWDROPDOWN, True, 0) cmbDokter.Enabled = True
Frame1.Enabled = False Frame2.Enabled = True End If
End Sub
Private Sub cmbPasien_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If cmbPasien.text <> "" Then Me.MousePointer = 11
Kata = "Select * from Pasien where [Kode pasien]='" & cmbPasien.text & "'"
Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenDynamic, adLockPessimistic
If TPasien.EOF Then TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1
MsgBox "Kode pasien = & " & cmbPasien.text & " tidak terdaftar...", vbInformation
cmbPasien.SetFocus Exit Sub
End If
With TPasien
txtNamaPasien = ![Nama pasien] End With
TPasien.Close
Set TPasien = Nothing DaftarDokter
If cmbPasien.ListCount = 0 Then
MsgBox "Data Dokter masih kosong..,," & vbCrLf & _ "Coba periksa kembali...", vbCritical Unload Me
Exit Sub End If
r = SendMessageLong(cmbDokter.hwnd, CB_SHOWDROPDOWN, True, 0) cmbDokter.Enabled = True
End If End If End Sub
Private Sub cmdHapusDaftar_Click() If Lv1.ListItems.Count > 0 Then Lv1.ListItems.Remove Lv1.SelectedItem.Index For i = 1 To Lv1.ListItems.Count Lv1.ListItems(i).text = i & "." Next i End If End Sub
Private Sub Form_Load() Ketengah Me
End Sub
Private Sub cmdBaru_Click() Me.MousePointer = 11
If cmdBaru.Caption = "&Baru" Then cmdBaru.Caption = "&Batal" Auto txtTanggal.Enabled = True txtTanggal.SetFocus vEdit = False Else Semula End If Me.MousePointer = 1 End Sub
Private Sub cmdSimpan_Click() Me.MousePointer = 11
If Not vEdit Then Simpan
Else Edit End If
Semula End Sub
Private Sub cmdTutup_Click() Unload Me End Sub Sub Semula() Bersih vEdit = False vTrans = False cmdSimpan.Enabled = False cmdBaru.Caption = "&Baru" NotAktif cmdBaru.SetFocus Lv1.ListItems.Clear End Sub Sub Bersih() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.text = ""
End If
If TypeOf Control Is ComboBox Then Control.text = "" End If Next Control End Sub Sub NotAktif() Dim Control
For Each Control In Me.Controls
If TypeOf Control Is TextBox Then Control.Enabled = False
End If
If TypeOf Control Is ComboBox Then Control.Enabled = False
End If Next Control End Sub
Private Sub Form_Activate() cmdBaru.Enabled = True cmdBaru.SetFocus Timer1.Enabled = True End Sub Sub DaftarDokter() Me.MousePointer = 11
Kata = "Select * from Dokter Order By [Kode Dokter]" Set TDokter = New ADODB.Recordset
TDokter.Open Kata, TMedis, adOpenDynamic cmbDokter.Clear
If Not TDokter.EOF Then TDokter.MoveFirst While Not TDokter.EOF
cmbDokter.AddItem TDokter![Kode Dokter] TDokter.MoveNext
Wend End If
TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1 End Sub
Sub DaftarPasien() Me.MousePointer = 11
Kata = "Select * from Pasien Order By [Kode Pasien]" Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenDynamic cmbPasien.Clear
If Not TPasien.EOF Then TPasien.MoveFirst While Not TPasien.EOF
cmbPasien.AddItem TPasien![Kode Pasien] TPasien.MoveNext
Wend End If
TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1 End Sub
Private Sub Form_Unload(Cancel As Integer) On Error Resume Next
Do Until Me.Top <= -5000 DoEvents
Me.Move Me.Left, Me.Top - 10 DoEvents
Loop Unload Me
End Sub
Private Sub lstObat_Click() On Error GoTo salah
Set TCari = New ADODB.Recordset
Kata = "Select * from obat where [Kode Obat]='" & Left(lstObat, 5) & "'"
TCari.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TCari.RecordCount = 0 Then
TCari.Close
Set TCari = Nothing Exit Sub
End If With TCari
txtKode = ![Kode Obat] txtNamaObat = ![Nama Obat] txtJenis = ![jenis]
End With
For i = 1 To Lv1.ListItems.Count
If txtKode.text = Lv1.ListItems(i).SubItems(5) Then Me.MousePointer = 1
MsgBox "Data Obat Sudah Ada....", vbExclamation, "Ooops..." txtKode = "" Fokus txtKode txtNamaObat = "" txtJenis = "" txtJumlah = ""
Exit Sub End If
Next
Fokus txtJumlah TCari.Close
Set TCari = Nothing Exit Sub
salah:
MsgBox "System Error, Please cek data obat", vbInformation, "data error"
End Sub
Private Sub Lv1_Click()
If Not Lv1.ListItems.Count = 0 Then cmdHapusDaftar.Enabled = True
Exit Sub End If End Sub
Private Sub Timer1_Timer() DataObat
End Sub
Private Sub txtDiagnosa_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If txtDiagnosa <> "" Then Fokus txtKeterangan Exit Sub End If End If End Sub
Private Sub txtJumlah_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then
If txtJumlah <> "" Then If vEdit = False Then Me.MousePointer = 11
Set Vbutir = Lv1.ListItems.Add(, , Lv1.ListItems.Count + 1 & ".") Vbutir.SubItems(1) = cmbDokter.text Vbutir.SubItems(2) = txtNamaDokter.text Vbutir.SubItems(3) = txtDiagnosa.text Vbutir.SubItems(4) = txtKeterangan.text Vbutir.SubItems(5) = txtKode.text Vbutir.SubItems(6) = txtNamaObat Vbutir.SubItems(7) = txtJenis Vbutir.SubItems(8) = txtJumlah vTrans = True Me.MousePointer = 1
Pesan = MsgBox("Masih Ada data Obat Yang Mau Di Input...", vbQuestion + vbYesNo, "Informasi..")
If Pesan = vbYes Then txtKode = "" Fokus txtKode txtNamaObat = "" txtJenis = "" txtJumlah = "" Exit Sub End If Me.MousePointer = 1
cmdSimpan.Enabled = True cmdSimpan.SetFocus Else vTrans = True If Lv1.ListItems.Count > 0 Then Lv1.ListItems.Remove Lv1.SelectedItem.Index For i = 1 To Lv1.ListItems.Count Lv1.ListItems(i).text = i & "." Next i End If txtSubTotal.text = Val(Int(txtHarga)) * Val(Int(txtJumlah))
Set Vbutir = Lv1.ListItems.Add(, , Lv1.ListItems.Count + 1 & ".") Vbutir.SubItems(1) = cmbDokter.text Vbutir.SubItems(2) = txtNamaDokter.text Vbutir.SubItems(3) = txtDiagnosa.text Vbutir.SubItems(4) = txtKeterangan.text Vbutir.SubItems(5) = txtKode.text Vbutir.SubItems(6) = txtNamaObat Vbutir.SubItems(7) = txtJenis Vbutir.SubItems(8) = txtJumlah cmdSimpan.Enabled = True cmdSimpan.SetFocus End If End If End If End Sub
Private Sub txtKeterangan_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If txtKeterangan <> "" Then If Not vEdit Then
Fokus txtKode lstObat.Enabled = True Frame2.Enabled = False Exit Sub End If Fokus txtJumlah lstObat.Enabled = True Frame2.Enabled = False End If End If End Sub
Private Sub txtTanggal_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
DaftarPasien
If cmbPasien.ListCount = 0 Then
MsgBox "Data Pasien masih kosong..,," & vbCrLf & _ "Coba periksa kembali...", vbCritical Unload Me
Exit Sub End If
r = SendMessageLong(cmbPasien.hwnd, CB_SHOWDROPDOWN, True, 0)
cmbPasien.Enabled = True Frame1.Enabled = True End If
End Sub
Sub DataObat()
On Error GoTo Obatkosong
Set TObat = New ADODB.Recordset
TObat.Open "Select * from Obat", TMedis, adOpenDynamic, adLockPessimistic
If TObat.RecordCount = 0 Then TObat.Close
Set TObat = Nothing
MsgBox "data Obat masih kosong...", vbInformation Timer1.Enabled = False Unload Me Exit Sub End If lstObat.Clear Timer1.Enabled = False Do Until TObat.EOF
lstObat.AddItem TObat![Kode Obat] & vbTab & TObat![Nama Obat] TObat.MoveNext
Loop
TObat.Close
Set TObat = Nothing Exit Sub
Obatkosong:
MsgBox Err.Description End Sub
Sub Simpan()
'On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
' For i = 1 To Lv1.ListItems.Count
TMedis.Execute "Insert Into Master values ('" & txtNomor.text & "'," & _
"'" & txtTanggal.text & "','" & cmbPasien.text & "','" & cmbDokter.text & "'," & _
"'" & txtDiagnosa.text & "','" & txtKeterangan.text & "')" 'Next i
TMedis.CommitTrans
TMedis.BeginTrans
For i = 1 To Lv1.ListItems.Count
TMedis.Execute "Insert Into Medis values ('" & txtNomor.text & "'," & _
"'" & Lv1.ListItems(i).SubItems(5) & "','" & Val(Lv1.ListItems(i).SubItems(8)) & "')" Next i TMedis.CommitTrans Me.MousePointer = 1 End Sub Sub Edit()
On Error GoTo salah Me.MousePointer = 11 TMedis.BeginTrans
For i = 1 To Lv1.ListItems.Count
TMedis.Execute "Update Medis Set Diagnosa='" & Lv1.ListItems(i).SubItems(3) & "',Keterangan='" & _
Lv1.ListItems(i).SubItems(4) & "' Where [No Medis]='" & txtNomor.text & "'"
Next i
TMedis.BeginTrans
For i = 1 To Lv1.ListItems.Count
TMedis.Execute "Update Dosis set resep ='" &
Lv1.ListItems(i).SubItems(8) & "' Where [No medis]='" & txtNomor.text & "'" Next i TMedis.CommitTrans Me.MousePointer = 1 Exit Sub salah:
MsgBox "Data tidak bisa di edit, ada kesalahan..", vbInformation End Sub
6.
Menu Laporan Pasien
Private Sub cmbLaporan_Click() If Len(cmbLaporan) Then
Select Case cmbLaporan.text Case "Kode Pasien"
LblStatus.Caption = "Kode Pasien:" Fokus txtLaporan
cmdTutup.Caption = "&Batal" Case "Nama Pasien"
LblStatus.Caption = "Nama Pasien:" Fokus txtLaporan
cmdTutup.Caption = "&Batal" Case "Kota"
LblStatus.Caption = "Kota Pasien:" Fokus txtLaporan
cmdTutup.Caption = "&Batal" Case "All"
LblStatus.Caption = "All Laporan:" cmdCetak.Enabled = True cmdCetak.SetFocus txtLaporan.Enabled = False cmdTutup.Caption = "&Batal" End Select End If End Sub
Private Sub cmbLaporan_KeyPress(KeyAscii As Integer) KeyAscii = AutoComplete(cmbLaporan, KeyAscii, True, Ubah) End Sub
Private Sub cmdCetak_Click() 'On Error GoTo Cetak
Me.MousePointer = 11
Select Case cmbLaporan.text Case "Kode Pasien" With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap All Pasien.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "irul"
.SelectionFormula = "{Pasien.Kode Pasien}='" & txtLaporan.text & "'"
.Formulas(0) = "Ket='" & cmbLaporan.text & vbTab & txtLaporan.text & " '" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With '==================================================================== =======
Case "Nama Pasien"
With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap All Pasien.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "irul"
.SelectionFormula = "{Pasien.Nama Pasien}='" & txtLaporan.text & "'"
.Formulas(0) = "Ket='" & cmbLaporan.text & vbTab & txtLaporan.text & " '" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With '==================================================================== =================== Case "Kota" With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap All Pasien.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "irul"
.SelectionFormula = "{Pasien.Asal Kota}='" & txtLaporan.text & "'"
.Formulas(0) = "Ket='" & cmbLaporan.text & vbTab & txtLaporan.text & " '" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True
.WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With '==================================================================== =============== Case "All" With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap Pasien.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "irul"
.WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With End Select cmdCetak.Enabled = False Me.MousePointer = 1 '=================================================================== 'Exit Sub 'Cetak:
' MsgBox Err.Description & Err.Number End Sub
Private Sub cmdTutup_Click() Select Case cmdTutup.Caption Case "&Tutup"
Set frmLapPasien = Nothing Unload Me Case "&Batal" txtLaporan = "" cmbLaporan.text = "" LblStatus.Caption = "" cmdTutup.Caption = "&Tutup" cmdCetak.Enabled = False End Select End Sub
Private Sub Form_Load() Ketengah Me
End Sub
Private Sub txtLaporan_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If txtLaporan <> "" Then
Select Case cmbLaporan.text Case "Kode Pasien" DataKode
Case "Nama Pasien" DataNama Case "Kota" DataKota End Select End If End If End Sub Sub DataKode() On Error GoTo salah Me.MousePointer = 11
Kata = "Select * from pasien Where [Kode Pasien]='" & txtLaporan.text & "'"
Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TPasien.EOF Then
TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1
MsgBox "Kode pasien = " & txtLaporan & " tidak terdaftar....", vbInformation Fokus txtLaporan Exit Sub End If cmdCetak.Enabled = True cmdCetak.SetFocus TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1 Exit Sub
salah:
Me.MousePointer = 1
MsgBox Err.Description & Err.Number End Sub
Sub DataNama() On Error GoTo salah Me.MousePointer = 11
Kata = "Select * from pasien Where [Nama Pasien] like '%" & txtLaporan.text & "%'"
Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TPasien.EOF Then
TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1
MsgBox "Nama pasien = " & txtLaporan & " tidak terdaftar....", vbInformation Fokus txtLaporan Exit Sub End If cmdCetak.Enabled = True cmdCetak.SetFocus TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1 Exit Sub
salah:
Me.MousePointer = 1
MsgBox Err.Description & Err.Number End Sub
Sub DataKota() On Error GoTo salah Me.MousePointer = 11
Kata = "Select * from pasien Where [asal KOta] like '%" & txtLaporan.text & "%'"
Set TPasien = New ADODB.Recordset
TPasien.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TPasien.EOF Then
TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1
MsgBox "Kota pasien = " & txtLaporan & " tidak terdaftar....", vbInformation Fokus txtLaporan Exit Sub End If cmdCetak.Enabled = True cmdCetak.SetFocus TPasien.Close
Set TPasien = Nothing Me.MousePointer = 1 Exit Sub
salah:
Me.MousePointer = 1
MsgBox Err.Description & Err.Number End Sub
7.
Menu Laporan Dokter
Private Sub cmbLaporan_Click() If Len(cmbLaporan) Then
Select Case cmbLaporan.text Case "Kode Dokter"
LblStatus.Caption = "Kode Dokter:" Fokus txtLaporan
cmdTutup.Caption = "&Batal" Case "Nama Dokter"
LblStatus.Caption = "Nama Dokter:" Fokus txtLaporan
cmdTutup.Caption = "&Batal" Case "Kota"
LblStatus.Caption = "Kota Dokter:" Fokus txtLaporan cmdTutup.Caption = "&Batal" Case "Spesialis" LblStatus.Caption = "Spesialis:" Fokus txtLaporan cmdTutup.Caption = "&Batal"
Case "All"
LblStatus.Caption = "All Laporan:" cmdCetak.Enabled = True cmdCetak.SetFocus txtLaporan.Enabled = False cmdTutup.Caption = "&Batal" End Select End If End Sub
Private Sub cmbLaporan_KeyPress(KeyAscii As Integer) KeyAscii = AutoComplete(cmbLaporan, KeyAscii, True, Ubah) End Sub
Private Sub cmdCetak_Click() 'On Error GoTo Cetak
Me.MousePointer = 11
Select Case cmbLaporan.text Case "Kode Dokter" With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap All Dokter.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "irul"
.SelectionFormula = "{Dokter.Kode Dokter}='" & txtLaporan.text & "'"
.Formulas(0) = "Ket='" & cmbLaporan.text & vbTab & txtLaporan.text & " '" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With '==================================================================== =====================
Case "Nama Dokter"
With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap All Dokter.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "candra"
.SelectionFormula = "{Dokter.Nama Dokter}='" & txtLaporan.text & "'"
.Formulas(0) = "Ket='" & cmbLaporan.text & vbTab & txtLaporan.text & " '" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True
.WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With '==================================================================== =================== Case "Kota" With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap All Dokter.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "candra"
.SelectionFormula = "{Dokter.Kota}='" & txtLaporan.text & "'"
.Formulas(0) = "Ket='" & cmbLaporan.text & vbTab & txtLaporan.text & " '" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With '==================================================================== =============== Case "Spesialis" With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap All Dokter.rpt"
.DataFiles(0) = App.Path & "\medis.mdb" .Password = Chr(10) & "candra"
.SelectionFormula = "{Dokter.Spesialis}='" & txtLaporan.text & "'"
.Formulas(0) = "Ket='" & cmbLaporan.text & vbTab & txtLaporan.text & " '" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With '==================================================================== =============== Case "All" With CrtLaporan .Reset
.ReportFileName = App.Path & "\Laporan\Lap Dokter.rpt"
.Password = Chr(10) & "candra"
.DataFiles(0) = App.Path & "\Medis.mdb" .WindowMinButton = False .WindowShowCancelBtn = True .WindowShowCloseBtn = True .WindowShowPrintBtn = True .WindowShowPrintSetupBtn = True .WindowParentHandle = frmUtama.hwnd .WindowState = crptMaximized .Action = 1 End With End Select cmdCetak.Enabled = False Me.MousePointer = 1 '=================================================================== 'Exit Sub 'Cetak:
' MsgBox Err.Description & Err.Number End Sub
Private Sub cmdTutup_Click() Select Case cmdTutup.Caption Case "&Tutup"
Set frmLapDokter = Nothing Unload Me Case "&Batal" txtLaporan = "" cmbLaporan.text = "" LblStatus.Caption = "" cmdTutup.Caption = "&Tutup" cmdCetak.Enabled = False End Select End Sub
Private Sub Form_Load() Ketengah Me
End Sub
Private Sub txtLaporan_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If txtLaporan <> "" Then
Select Case cmbLaporan.text Case "Kode Dokter" DataKode
Case "Nama Dokter" DataNama Case "Kota" DataKota Case "Spesialis" DataSpesialis End Select End If End If End Sub Sub DataKode()
On Error GoTo salah Me.MousePointer = 11
Kata = "Select * from Dokter Where [Kode Dokter]='" & txtLaporan.text & "'"
Set TDokter = New ADODB.Recordset
TDokter.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TDokter.EOF Then
TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1
MsgBox "Kode Dokter = " & txtLaporan & " tidak terdaftar....", vbInformation Fokus txtLaporan Exit Sub End If cmdCetak.Enabled = True cmdCetak.SetFocus TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1 Exit Sub
salah:
Me.MousePointer = 1
MsgBox Err.Description & Err.Number End Sub
Sub DataNama() On Error GoTo salah Me.MousePointer = 11
Kata = "Select * from Dokter Where [Nama Dokter] like '%" & txtLaporan.text & "%'"
Set TDokter = New ADODB.Recordset
TDokter.Open Kata, TMedis, adOpenDynamic, adLockPessimistic If TDokter.EOF Then
TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1
MsgBox "Nama Dokter = " & txtLaporan & " tidak terdaftar....", vbInformation Fokus txtLaporan Exit Sub End If cmdCetak.Enabled = True cmdCetak.SetFocus TDokter.Close
Set TDokter = Nothing Me.MousePointer = 1 Exit Sub
salah:
Me.MousePointer = 1
MsgBox Err.Description & Err.Number End Sub