manual book penggunaan aplikasi sistem administrasi …
TRANSCRIPT
Manual Book Penggunaan Aplikasi
Sistem Administrasi Pasien Rawat Jalan (SIAPRAJA)
Manual Penggunaan Program Dan Source Code
Use Case Diagram Sistem Administrasi Pasien
Gambar
Use Case Diagram Sistem Administrasi Pasien
Use Case Diagram Mengelola Data User
Gambar Use Case Diagram Mengelola Data User
Tabel
Deskripsi Use Case Mengelola Data User
Use Case Name Mengelola data user
Goal Admin dapat mencari, menambah, mengubah, dan menghapus data user.
Pre-conditions
1. Menjalankan aplikasi. 2. Admin melakukan login. 3. Memilih menu data user pada menu utama.
Post-conditions Data user tersimpan, terupdate, atau terhapus.
Failed end
conditions
Gagal menyimpan, mengupdate, atau menghapus.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data user
Step 2. Menampilkan form data user
Step 3. Input data user Step 4. Sistem akan melakukan penyimpanan data user
Step 5. Mencari data user Step 6. Menampilkan data user
Step 7. Mengubah data user
Step 8. Sistem akan melakukan pengupdatean data user dan menampilkannya
Step 9. Menghapus data user
Step 10. Sistem akan menghapus data user
Alternate Flows
1. Admin belum melengkapi semua data user yang diperlukan. Maka ketika data disimpan, sistem akan menampilkan pesan bahwa data belum lengkap dan admin harus melengkapinya terlebih dahulu.
2. Admin salah mengetik ulang password user (retype
password). Maka ketika data disimpan, sistem akan menampilkan pesan bahwa password tidak cocok dan admin harus mengetik ulang password yang sama dengan password yang diberikan sebelumnya.
3. Admin salah memasukkan id user atau nama user saat melakukan pencarian data, maka sistem akan menampilkan pesan bahwa data tidak ditemukan dan admin memasukkan kembali id atau nama user tersebut.
4. Admin batal mengelola data user, maka admin dapat mengklik tombol close untuk keluar dari form data user.
Use Case Diagram Mengelola Backup Data
Gambar Use Case Diagram Mengelola Backup Data
Tabel
Deskripsi Use Case Mengelola Backup Data
Use Case Name Backup data
Goal Admin dapatmenyalin/backupsuatu data ke lokasi penyimpanan tertentu.
Pre-conditions
1. Menjalankan aplikasi. 2. Admin melakukan login. 3. Memilih menu backup data pada menu utama.
Post-conditions Data dapatdisalin ke direktori tertentu.
Failed end
condition
Gagal menyalin data.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu backup data
Step 2. Menampilkan form
backup data
Step 3. Memilih sumber file
dan direktori tujuan Step 4. Melakukan penyalinan data
Alternate Flows
1. Admin belum memilih sumber file yang akan disalin, maka sistem akan menampilkan pesan bahwa harus memilih sumber filenya terlebih dahulu.
2. Admin batal melakukan backup data, maka admin dapat mengklik tombol close untuk keluar dari form
backup data.
Use Case Diagram Mengelola Data Pasien
Gambar Use Case Diagram Mengelola Data Pasien
Tabel
Deskripsi Use Case Mengelola Data Pasien
Use Case Name Mengelola data pasien
Goal Pengguna dapat mencari, menambah, mengubah, dan menghapus data pasien.
Pre-conditions 1. Menjalankan aplikasi 2. User melakukan login 3. Memilih menu data pasien pada menu utama
Post-conditions Data pasien tersimpan, terupdate, atau terhapus.
Failed end
condition
Gagal menyimpan, mengupdate, atau menghapus.
Actors 1. Administrator 2. Kasir
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data pasien
Step 2. Menampilkan form data pasien
Step 3. Input data pasien Step 4. Sistem akan melakukan penyimpanan data pasien
Step 5. Mencari data pasien Step 6. Menampilkan data pasien
Step 7. Mengubah data pasien
Step 8. Sistem akan melakukan pengupdatean data pasien dan menampilkannya
Step 9. Menghapus data pasien
Step 10. Sistem akan menghapus data pasien
Alternate Flows 1. Pengguna belum melengkapi semua data pasien yang diperlukan. Maka ketika data disimpan, sistem akan menampilkan pesan bahwa data belum lengkap dan pengguna harus melengkapinya terlebih dahulu.
2. Pengguna salah memasukkan nomor pasien atau nama pasien saat melakukan pencarian data, maka sistem akan menampilkan pesan bahwa data tidak ditemukan
dan pengguna memasukkan kembali nomor atau nama pasien tersebut.
3. Pengguna batal mengelola data pasien, maka pengguna dapat mengklik tombol close untuk keluar dari form data pasien.
Use Case Diagram Input Data Kunjungan
Gambar Use Case Diagram Input Data Kunjungan
Tabel
Deskripsi Use Case Input Data Kunjungan
Use Case Name Input data kunjungan
Goal Pengguna dapat menambah data kunjung pasien dan mencetak nomor antrian.
Pre-conditions 1. Menjalankan aplikasi 2. User melakukan login 3. Memilih menu data pasien pada menu utama 4. Klik tombol Kunjungan pada data pasien
Post-conditions Data kunjungan tersimpan, dan nomor antrian tercetak.
Failed end
condition
Gagal menyimpan datadan mencetak nomor antrian.
Actors 1. Administrator 2. Kasir
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data pasien
Step 2. Menampilkan form data pasien
Step 3. Input nomor pasien pada data kunjungan
Step 4. Sistem akan menampilkan data pasien
Step 5. Mencetak nomor antrian
Step 6. Sistem akan menyimpan data kunjungan dan menampilkan preview nomor antrian pasien
Alternate Flows 1. Pengguna salah memasukkan nomor pasien. Maka sistem akan menampilkan pesan bahwa data tidak ditemukan dan pengguna memasukkan kembali nomor pasien tersebut.
2. Pengguna batal mencetak nomor kunjungan. Maka pengguna dapat menekan tombol ESC pada keyboard untuk membatalkannya.
Use Case Diagram Pencarian Data Rekam Medis
Gambar Use Case Diagram Pencarian Data Rekam Medis
Tabel
Deskripsi Use Case Pencarian Data Rekam Medis
Use Case Name Pencarian data rekam medis
Goal Pengguna dapat melihat riwayat rekam medis pasien.
Pre-conditions 1. Menjalankan aplikasi 2. User melakukan login 3. Memilih menu data rekam medis pada menu utama
Post-conditions Data rekam medis tampil.
Failed end
condition
Gagal mencari data rekam medis pasien.
Actors 1. Dokter 2. Perawat
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data rekam medis
Step 2. Menampilkan form data rekam medis
Step 3. Input nomor pasien atau nama pasien
Step 4. Sistem akan menampilkan data rekam medis pasien tersebut
Alternate Flows 1. Pengguna salah memasukkan nomor pasien atau nama pasien saat melakukan pencarian data, maka sistem akan menampilkan pesan bahwa data tidak ditemukan dan pengguna memasukkan kembali nomor atau nama pasien tersebut.
2. Pengguna batal mencari data rekam medis, maka pengguna dapat mengklik tombol close untuk keluar dari form data rekam medis.
4. Use Case Diagram Input Data Diagnosa
Gambar Use Case Diagram Input Data Diagnosa
Tabel
Deskripsi Use Case Input Data Diagnosa
Use Case Name Input data diagnosa
Goal Pengguna dapat menambah data diagnosa pasien dan mencetak resep obat.
Pre-conditions 1. Menjalankan aplikasi 2. User melakukan login 3. Memilih menu data rekam medis pada menu utama
dan mengkilk tombol New pada form rekam medis
Post-conditions Data diagnosa tersimpan dan resep obat tercetak.
Failed end
condition
Gagal menyimpan data diagnosa pasien dan mencetak resep obat.
Actors 1. Dokter 2. Perawat
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data rekam medis
Step 2. Menampilkan form data rekam medis
Step 3. Mengklik tombol New
Step 4. Menampilkan formdiagnose
Step 5. Input data hasil diagnosa dan resep obat
Step 6. Sistem akan menyimpan data diagnosa dan menampilkan preview resep obat
Alternate Flows 1. Pengguna belum melengkapi semua data diagnosa yang diperlukan. Maka ketika data disimpan, sistem akan menampilkan pesan bahwa data belum lengkap dan pengguna harus melengkapinya terlebih dahulu.
2. Pengguna batal menginput data diagnosa, maka pengguna dapat mengklik tombol close untuk keluar
dari form diagnosa. 3. Pengguna batal mencetak resep obat, maka pengguna
dapat menekan tombol ESC pada keyboard untuk membatalkannya.
Use Case Diagram Input Data Transaksi
Gambar Use Case Diagram Input Data Transaksi
Tabel
Deskripsi Use Case Input Data Transaksi
Use Case Name Input data transaksi
Goal Pengguna dapat menginput data transaksi dan mencetak kuitansi pembayaran.
Pre-conditions 1. Menjalankan aplikasi 2. User melakukan login 3. Memilih menu data transaksi pada menu utama
Post-conditions Data transaksi tersimpan dan kuitansi pembayaran tercetak.
Failed end
condition
Gagal menyimpan data transaksi dan mencetak kuitansi pembayaran.
Actors 1. Administrator 2. Kasir
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data transaksi
Step 2. Menampilkan form data transaksi
Step 3. Mengisi semua data transaksi pembayaran
Step4. Sistem akan menyimpan data transaksi dan menampilkan preview kuitansi pembayaran
Alternate Flows 1. Pengguna belum melengkapi semua data transaksi yang diperlukan. Maka ketika data disimpan, sistem akan menampilkan pesan bahwa data belum lengkap dan pengguna harus melengkapinya terlebih dahulu.
2. Pengguna batal menginput data transaksi, maka pengguna dapat mengklik tombol close untuk keluar
dari form transaksi. 3. Pengguna batal mencetak kuitansi, maka pengguna
dapat menekan tombol ESC pada keyboard untuk membatalkannya.
Use Case Diagram Mengelola Data Obat
Gambar Use Case Diagram Mengelola Data Obat
Tabel
Deskripsi Use Case Mengelola Data Obat
Use Case Name Mengelola data obat
Goal Admin dapat mencari, menambah, mengubah, dan menghapus data obat.
Pre-conditions 1. Menjalankan aplikasi 2. Admin melakukan login 3. Memilih menu data obat pada menu utama
Post-conditions Data obat tersimpan, terupdate, atau terhapus.
Failed end
condition
Gagal menyimpan, mengupdate, atau menghapus.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data obat
Step 2. Menampilkan form data obat
Step 3. Input data obat Step 4. Sistem akan melakukan penyimpanan data obat
Step 5. Mencari data obat Step 6. Menampilkan data obat
Step 7. Mengubah data obat
Step 8. Sistem akan melakukan pengupdatean data obat
Step 9. Menghapus data obat
Step 10. Sistem akan menghapus data obat
Alternate Flows 1. Admin belum melengkapi semua data obat yang diperlukan. Maka ketika data disimpan, sistem akan menampilkan pesan bahwa data belum lengkap dan pengguna harus melengkapinya terlebih dahulu.
2. Admin salah memasukkan kode obat atau nama obat saat melakukan pencarian data, maka sistem akan menampilkan pesan bahwa data tidak ditemukan dan pengguna memasukkan kembali kode atau nama obat tersebut.
3. Admin batal mengelola data obat, maka pengguna dapat mengklik tombol close untuk keluar dari form data obat.
Use Case Diagram Mengelola Data Dokter
Gambar Use Case Diagram Mengelola Data Dokter
Tabel
Deskripsi Use Case Mengelola Data Dokter
Use Case Name Mengelola data dokter
Goal Admin dapat mencari, menambah, mengubah, dan menghapus data dokter.
Pre-conditions 1. Menjalankan aplikasi 2. Admin melakukan login 3. Memilih menu data dokter pada menu utama
Post-conditions Data dokter tersimpan, terupdate, atau terhapus.
Failed end
condition
Gagal menyimpan, mengupdate, atau menghapus.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data dokter
Step 2. Menampilkan form data dokter
Step 3. Input data dokter Step 4. Sistem akan melakukan penyimpanan data dokter
Step 5. Mencari data dokter Step 6. Menampilkan data dokter
Step 7. Mengubah data dokter
Step 8. Sistem akan melakukan pengupdatean data dokter
Step 9. Menghapus data Step 10. Sistem akan
dokter menghapus data dokter
Alternate Flows 1. Admin belum melengkapi semua data dokter yang diperlukan. Maka ketika data disimpan, sistem akan menampilkan pesan bahwa data belum lengkap dan pengguna harus melengkapinya terlebih dahulu.
2. Admin salah memasukkan kode dokter atau nama dokter saat melakukan pencarian data, maka sistem akan menampilkan pesan bahwa data tidak ditemukan dan pengguna memasukkan kembali kode atau nama dokter tersebut.
3. Admin batal mengelola data obat, maka pengguna dapat mengklik tombol close untuk keluar dari form data dokter.
Use Case Diagram Mengelola Jadwal Dokter
Gambar Use Case Diagram Mengelola Jadwal Dokter
Tabel
Deskripsi Use Case Mengelola Jadwal Dokter
Use Case Name Mengelola jadwal dokter
Goal Admin dapat mencari, menambah, mengubah, dan menghapus jadwal dokter.
Pre-conditions 1. Menjalankan aplikasi 2. Admin melakukan login 3. Memilih menu data dokter pada menu utama 4. Klik tombol Jadwal pada data dokter
Post-conditions Jadwal dokter tersimpan, terupdate, atau terhapus.
Failed end
condition
Gagal menyimpan, mengupdate, atau menghapus.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu data dokter
Step 2. Menampilkan form data dokter
Step 3. Input jadwal pada data jadwal dokter
Step 4. Sistem akan melakukan penyimpanan jadwal dokter
Step 5. Mencari jadwal dokter
Step 6. Menampilkan jadwal dokter
Step 7. Mengubah jadwal dokter
Step 8. Sistem akan melakukan pengupdatean jadwal dokter
Step 9. Menghapus jadwal dokter
Step 10. Sistem akan menghapus jadwal dokter
Alternate Flows 1. Admin belum melengkapi semua data jadwal dokter yang diperlukan. Maka ketika data disimpan, sistem akan menampilkan pesan bahwa data belum lengkap dan pengguna harus melengkapinya terlebih dahulu.
2. Admin batal mengelola jadwal dokter, maka admin dapat mengklik tombol close untuk keluar dari form data dokter.
Use Case Diagram Mencetak Laporan
Gambar Use Case Diagram Mencetak Laporan
Tabel
Deskripsi Use Case Mencetak Laporan Data Pasien
Use Case Name Mengelola laporan data pasien
Goal Admin dapat mencetak laporan data pasien per hari, per minggu, dan perbulan.
Pre-conditions 1. Menjalankan aplikasi 2. Admin melakukan login 3. Memilih menu laporan data pasien pada menu utama
Post-conditions Laporan data pasien tercetak.
Failed end
condition
Gagal mencetak laporan data pasien.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu laporan data pasien
Step 2. Menampilkan form laporan data pasien
Step 3. Pilih periode pencetakan laporan
Step 4. Sistem akan menampilkan preview laporan
Alternate Flows 1. Admin belum memilih periode laporan yang akan dicetak. Maka ketika data ingin ditampilkan, sistem tidak dapat menemukan laporan tersebut dan admin harus memilih periodenya terlebih dulu.
Tabel
Deskripsi Use Case Mencetak Laporan Data Obat
Use Case Name Mengelola laporan data obat
Goal Admin dapat mencetak laporan data obat per kategori obat.
Pre-conditions 1. Menjalankan aplikasi 2. Admin melakukan login 3. Memilih menu laporan data obat pada menu utama
Post-conditions Laporan data obat tercetak.
Failed end
condition
Gagal mencetak laporan data obat.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu laporan data obat
Step 2. Menampilkan form laporan data obat
Step 3. Pilih kategori pencetakan laporan
Step 4. Sistem akan menampilkan preview laporan
Alternate Flows 1. Admin belum memilih kategori laporan obat yang akan dicetak. Maka ketika data ingin ditampilkan, sistem tidak dapat menemukan laporan tersebut dan admin harus memilih kategorinya terlebih dulu.
Tabel
Deskripsi Use Case Mencetak Laporan Data Rekam Medis
Use Case Name Mengelola laporan data rekam medis
Goal Admin dapat mencetak laporan data rekam medis per hari, per minggu, per bulan, dan per pasien.
Pre-conditions 1. Menjalankan aplikasi 2. Admin melakukan login 3. Memilih menu laporan data rekam medis pada menu
utama
Post-conditions Laporan data rekam medis tercetak.
Failed end
condition
Gagal mencetak laporan data rekam medis.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu Step 2. Menampilkan form
laporan data rekam medis laporan data rekam medis
Step 3. Pilih kategori pencetakan laporan
Step 4. Sistem akan menampilkan preview laporan
Alternate Flows 1. Admin belum memilih periode laporan yang akan dicetak. Maka ketika data ingin ditampilkan, sistem tidak dapat menemukan laporan tersebut dan admin harus memilih periodenya terlebih dulu.
Tabel
Deskripsi Use Case Mencetak Laporan Data Transaksi
Use Case Name Mengelola laporan data transaksi
Goal Admin dapat mencetak laporan data transaksi per hari, per minggu, dan per bulan.
Pre-conditions 1. Menjalankan aplikasi 2. Admin melakukan login 3. Memilih menu laporan data transaksi pada menu
utama
Post-conditions Laporan data transaksi tercetak.
Failed end
condition
Gagal mencetak laporan data transaksi.
Actor Administrator
Main Flows / Basic
Path
Actor Action System Response
Step 1. Memilih menu laporan data transaksi
Step 2. Menampilkan form laporan data transaksi
Step 3. Pilih periode pencetakan laporan
Step 4. Sistem akan menampilkan preview laporan
Alternate Flows 1. Admin belum memilih periode laporan yang akan dicetak. Maka ketika data ingin ditampilkan, sistem tidak dapat menemukan laporan tersebut dan admin harus memilih periodenya terlebih dulu.
Logical Recore Structure (LRS)
Gambar
LRS Sistem Administrasi Pasien
User Interface
Adapun tampilan desain antar muka form-form yang terdapat pada sistem
informasi administrasi pasien.
A. Form Login
Gambar
Tampilan Form Login
B. Form Menu Utama
Gambar
Tampilan Menu Utama
C. Form Data Pasien
Gambar
Tampilan Form Data Pasien
D. Form Data Obat
Gambar
Tampilan Form Data Obat
E. Form Data Dokter
Gambar
Tampilan Form Data Dokter
F. Form Data User
Gambar
Tampilan Form Data User
G. Form Data Rekam Medis
Gambar
Tampilan Form Data Rekam Medis
H. Form Data Diagnosa
Gambar
Tampilan Form Data Diagnosa
I. Form Data Transaksi
Gambar
Tampilan Form Data Transaksi
J. Form Laporan Data Pasien
Gambar
Tampilan Form Laporan Data Pasien
K. Form Laporan Data Obat
Gambar
Tampilan Form Laporan Data Obat
L. Form Laporan Data Rekam Medis
Gambar
Tampilan Form Laporan Data Rekam Medis
M. Form Laporan Data Transaksi
Gambar
Tampilan Form Laporan Data Transaksi
N. Form Backup Data
Gambar
Tampilan Form Backup Data
Code Generation
Berikut listing program pada form-form yang dibuat.
A. Form Login
Dim perintah As String Dim X As Byte Dim y As Byte Dim roll As Integer Sub progresbar() ProgressBar1.Visible = True ProgressBar1.Min = 0 ProgressBar1.Max = 3000 ProgressBar1.Value = ProgressBar1.Min For roll = ProgressBar1.Min To ProgressBar1.Max ProgressBar1.Value = roll Next roll ProgressBar1.Value = ProgressBar1.Min End Sub Private Sub Form_Activate()
ProgressBar1.Visible = False tid.SetFocus End Sub Private Sub Form_Load() Call OpenConn Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 ActConn.CursorLocation = adUseClient tid.MaxLength = 7 tpas.PasswordChar = "*" tpas.Enabled = False tuser.Visible = False tsta.Visible = False End Sub Private Sub tid_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) If (KeyAscii = vbKeySpace) Then KeyAscii = 0 perintah = "select*from user where id_user='" & tid.Text & "'" Set RSUser = ActConn.Execute(perintah, , adCmdText) If KeyAscii = 13 Then If Not RSUser.EOF Then tid.Enabled = False tuser.Text = RSUser!nm_user tsta.Text = RSUser!Status tpas.Enabled = True tpas.SetFocus End If End If If KeyAscii = 27 Then Unload Me End If End Sub Private Sub Timer1_Timer() Label4.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) End Sub Private Sub tpas_KeyPress(KeyAscii As Integer) If (KeyAscii = vbKeySpace) Then KeyAscii = 0 perintah = "Select * from user where id_user ='" & tid.Text & "' and password='" & tpas.Text & "'" Set RSUser = ActConn.Execute(perintah, , adCmdText) If KeyAscii = 13 Then If RSUser.EOF Then y = y + 1 If 1 - y = 0 Then MsgBox "Kesempatan ke " & y & " Salah", 64, "Login" tpas.Text = "" tpas.SetFocus
ElseIf 2 - y = 0 Then MsgBox "Kesempatan ke " & y & " Salah", 64, "Login" tpas.Text = "" tpas.SetFocus ElseIf 3 - y = 0 Then MsgBox "Kesempatan ke " & y & " Salah", 64, "Login" MsgBox "Maaf, kesempatan Login Anda habis", 64, "Login" Unload Me End If Else Call progresbar menu.Show If tsta.Text = "Dokter" Or tsta.Text = "Perawat" Then menu.mnmaster.Enabled = False menu.mnlap.Enabled = False menu.mnuti.Enabled = False menu.byr.Enabled = False ElseIf tsta.Text = "Kasir" Then menu.Command1.Enabled = True menu.Command2.Enabled = False menu.Command3.Enabled = False menu.Command4.Enabled = False menu.rm.Enabled = False menu.mnlap.Enabled = False menu.mnuti.Enabled = False ElseIf tsta.Text = "Admin" Then menu.mnmaster.Enabled = True menu.rm.Enabled = False menu.mnlap.Enabled = True menu.mnuti.Enabled = True End If transaksi.tid.Text = login.tid.Text transaksi.tnakas.Text = login.tuser.Text diagnosa.tkode.Text = login.tid.Text diagnosa.lkode.Caption = login.tuser.Text ubah_password.tid.Text = login.tid.Text ubah_password.tnama.Text = login.tuser.Text menu.StatusBar1.Panels(4) = tuser.Text menu.StatusBar1.Panels(5) = tsta.Text Unload Me End If End If If KeyAscii = 27 Then Unload Me End If End Sub
B. Menu Utama
Private Sub bd_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False backup.Show vbModal End Sub Private Sub byr_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False transaksi.Show End Sub Private Sub Command1_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False pasien.Show End Sub Private Sub Command10_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False lap_pasien.Show vbModal End Sub Private Sub Command13_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False backup.Show vbModal End Sub Private Sub Command12_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False tentang.Show vbModal End Sub
Private Sub Command14_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False ubah_password.Show vbModal End Sub Private Sub Command2_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False dtobat.Show vbModal End Sub Private Sub Command3_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False dokter.Show vbModal End Sub Private Sub Command4_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False user.Show vbModal End Sub Private Sub Command5_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False lap_trans.Show vbModal End Sub Private Sub Command6_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False lap_rm.Show vbModal End Sub Private Sub Command9_Click()
master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False lap_obat.Show vbModal End Sub Private Sub Form_Load() Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False End Sub Private Sub mnexit_Click() X = MsgBox("Keluar Dari Menu Utama...?", vbYesNo + vbInformation, "Konfirmasi") If X = vbYes Then Unload Me login.Show End If End Sub Private Sub mnlap_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = True End Sub Private Sub mnmaster_Click() master.Visible = True trans.Visible = False uti.Visible = False lap.Visible = False End Sub Private Sub mntrans_Click() master.Visible = False trans.Visible = True uti.Visible = False lap.Visible = False End Sub Private Sub mnuti_Click() master.Visible = False trans.Visible = False uti.Visible = True
lap.Visible = False End Sub Private Sub rm_Click() master.Visible = False trans.Visible = False uti.Visible = False lap.Visible = False rmd.Show vbModal End Sub
C. Form Data Pasien
Dim ModeSave As Boolean Dim perintah As String Dim strTemp, LenTemp, n Sub jml() perintah = "select*from pasien" Set RSpasien = ActConn.Execute(perintah, , adCmdText) litem.Caption = RSpasien.RecordCount End Sub Sub non() tnama.Enabled = False cbjenis.Enabled = False tlahir.Enabled = False cbstatus.Enabled = False ttelp.Enabled = False cbkerja.Enabled = False talamat.Enabled = False End Sub Sub grid() DataGrid1.HeadFont = "Times New Roman" DataGrid1.Columns(0).Width = 1300 DataGrid1.Columns(0).Caption = "No. Pasien" DataGrid1.Columns(0).Alignment = dbgCenter DataGrid1.Columns(1).Width = 1300 DataGrid1.Columns(1).Caption = "Tgl. Daftar" DataGrid1.Columns(1).Alignment = dbgLeft DataGrid1.Columns(2).Width = 1800 DataGrid1.Columns(2).Caption = "Nama Pasien" DataGrid1.Columns(2).Alignment = dbgLeft DataGrid1.Columns(3).Width = 1300 DataGrid1.Columns(3).Caption = "Tgl. Lahir" DataGrid1.Columns(3).Alignment = dbgCenter DataGrid1.Columns(4).Width = 1500 DataGrid1.Columns(4).Caption = "Genre" DataGrid1.Columns(4).Alignment = dbgLeft
DataGrid1.Columns(5).Width = 2000 DataGrid1.Columns(5).Caption = "Alamat" DataGrid1.Columns(5).Alignment = dbgLeft DataGrid1.Columns(6).Width = 1000 DataGrid1.Columns(6).Caption = "Status" DataGrid1.Columns(6).Alignment = dbgLeft DataGrid1.Columns(7).Width = 1500 DataGrid1.Columns(7).Caption = "Pekerjaan" DataGrid1.Columns(7).Alignment = dbgLeft DataGrid1.Columns(8).Width = 1000 DataGrid1.Columns(8).Caption = "No. Telp" DataGrid1.Columns(8).Alignment = dbgLeft DataGrid1.Font = "Times New Roman" End Sub Sub antri() frm_kunjung.Show Call OpenConn perintah = "select*from kunjungan where no_pasien='" & tnopas.Text & "'" Set RSKunjung = ActConn.Execute(perintah, , adCmdText) frm_kunjung.FontName = "Comic Sans MS" frm_kunjung.FontSize = 8 frm_kunjung.Print Tab(30); "Klinik Keluarga" grs = String$(35, "*") frm_kunjung.Print Tab(16); grs frm_kunjung.Print Tab frm_kunjung.Print Tab(20); "Hari"; Space(1); ":"; Space(1); (hari.Caption) frm_kunjung.Print Tab(20); "Tgl."; Space(1); ":"; Space(1); (tgl.Caption) frm_kunjung.Print Tab(20); "Waktu"; Space(1); ":"; Space(1); (wkt.Caption) frm_kunjung.Print Tab(20); "No. Pasien"; Space(1); ":"; Space(1); (RSKunjung!no_pasien) frm_kunjung.FontSize = 30 frm_kunjung.Print Tab(8); (lkunjung.Caption) frm_kunjung.FontSize = 8 frm_kunjung.Print Tab(19); "Silahkan Menunggu Nomor Anda" End Sub Sub cetak() frm_kbp.Show Call OpenConn perintah = "select*from cetak_kbp where no_pasien='" & tno.Text & "'" Set cetak_KBP = ActConn.Execute(perintah, , adCmdText) frm_kbp.FontName = "Comic Sans MS" frm_kbp.FontSize = 8 frm_kbp.Print Tab(30); "Klinik Keluarga" frm_kbp.Print Tab(16); "Jl.Raya Jakarta-Bogor KM.34 Cimanggis-Depok" frm_kbp.Print Tab(28); "Telp. (021)8746361" grs = String$(41, "*") grs2 = String$(68, "-") grs3 = String$(35, "-")
frm_kbp.Print Tab(16); grs frm_kbp.Print Tab(24); "KARTU BEROBAT PASIEN" frm_kbp.Print Tab(24); grs3 frm_kbp.Print Tab frm_kbp.Print Tab(20); "No. Pasien"; Space(1); ":"; Space(1); (cetak_KBP!no_pasien) frm_kbp.Print Tab(20); "Nama"; Space(9); ":"; Space(1); (cetak_KBP!nm_pasien) frm_kbp.Print Tab(20); "Tgl. Lahir"; Space(2); ":"; Space(1); (cetak_KBP!tgl_lahir) frm_kbp.Print Tab(20); "Alamat"; Space(7); ":"; Space(1); (cetak_KBP!alamat) frm_kbp.Print Tab(20); "Telp."; Space(10); ":"; Space(1); (cetak_KBP!no_telp) End Sub Sub tampil() perintah = "select*from pasien order by no_pasien" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If RSpasien.RecordCount <> 0 Then tno.Text = RSpasien!no_pasien ttgl.Text = RSpasien!tgl_daftar tnama.Text = RSpasien!nm_pasien cbjenis.Text = RSpasien!jkel tlahir.Mask = RSpasien!tgl_lahir talamat.Text = RSpasien!alamat cbstatus.Text = RSpasien!Status cbkerja.Text = RSpasien!pekerjaan ttelp.Text = RSpasien!no_telp End If End Sub Sub setgrid() perintah = "select*from pasien order by no_pasien" Set RSpasien = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSpasien.DataSource DataGrid1.Refresh End Sub Sub semula() Bersih Me nonaktif Me tlahir.Mask = "" ttgl.Text = Format(Date, "dd mmmm yyyy") ttgl.Enabled = False cadd.Enabled = True cedit.Enabled = False ccancel.Enabled = False cdel.Enabled = False csave1.Visible = True csave1.Enabled = False
csave2.Visible = False cclose.Enabled = True optno.Enabled = True optnama.Enabled = True cprint.Enabled = False End Sub Sub AutoNomor() perintah = "select*from pasien order by no_pasien" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If RSpasien.RecordCount = 0 Then tno.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & "001" Else RSpasien.MoveLast If Format(Date, "yymm") <> Mid(RSpasien!no_pasien, 2, 4) Then tno.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & "001" Else RSpasien.MoveLast tno.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & Right(Val(Right(RSpasien!no_pasien, 3) + 1001), 3) End If End If End Sub
Private Sub bantri_Click() perintah = "insert into kunjungan values('" & lkunjung.Caption & "','" & Format(tgl.Caption, "yyyy-mm-dd") & "','" & tnopas.Text & "')" Set RSKunjung = ActConn.Execute(perintah, , adCmdText) antri End Sub Private Sub bkunjung_Click() Call OpenConn frkunjungan.Visible = True frkunjungan.Enabled = True Aktif Me tnopas.SetFocus bantri.Enabled = False hari.Caption = Format(Date, "dddd") tgl.Caption = Format(Date, "dd-mm-yyyy") wkt.Caption = Time perintah = "select * from kunjungan" Set RSKunjung = ActConn.Execute(perintah, , 1) If RSKunjung.RecordCount = 0 Then a = 1 lkunjung.Caption = a 'Else 'RSKunjung.MoveFirst 'If Format(Date, "yyyy-mm-dd") <> RSKunjung!tgl_kunjung Then
'lkunjung.Caption = 1 Else RSKunjung.MoveFirst a = RSKunjung!no_antri + 1 lkunjung.Caption = a 'End If End If End Sub Private Sub cadd_Click() Aktif Me Bersih Me tlahir.Mask = "####-##-##" ttgl.Text = Format(Date, "dd mmmm yyyy") ttgl.Enabled = False AutoNomor tno.Locked = True tno.Enabled = False tnama.SetFocus tcno.Enabled = False tcnama.Enabled = False cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = False cedit.Enabled = False csave2.Visible = False csave1.Visible = True csave1.Enabled = True cclose.Enabled = False ModeSave = True End Sub Private Sub cbjenis_Click() tlahir.SetFocus End Sub Private Sub cbkerja_Click() talamat.SetFocus End Sub Private Sub cbstatus_Click() ttelp.SetFocus End Sub Private Sub ccancel_Click() semula End Sub Private Sub cclose_Click() Dim cepat As Long
cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend While Top - Height < Screen.Height DoEvents Top = Top + cepat Wend Unload Me End If End Sub Private Sub cdel_Click() del = MsgBox("Yakin Data Akan Dihapus??..", vbQuestion + vbYesNo, "Konfirmasi") If del = vbYes Then perintah = "delete from pasien where no_pasien='" & tno.Text & "'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) perintah = "delete from cetak_kbp where no_pasien='" & tno.Text & "'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) End If tampil setgrid grid jml semula End Sub Private Sub cedit_Click() If tnama.Text <> "" Then ModeSave = False Aktif Me tno.Enabled = False ttgl.Enabled = False tno.Locked = True ttgl.Locked = True cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = True cedit.Enabled = False csave2.Visible = True csave1.Visible = False csave2.Enabled = True cclose.Enabled = False cprint.Enabled = False End If
End Sub Private Sub cprint_Click() cetak End Sub Private Sub csave1_Click() If tnama = "" Or ttgl = "" Or cbjenis = "" Or cbjenis = "--PILIH--" Or tlahir.Text = "" Or talamat = "" Or cbstatus.Text = "" Or cbstatus.Text = "--PILIH--" Or cbkerja.Text = "" Or cbkerja.Text = "--PILIH--" Or ttelp = "" Then MsgBox "Data Belum Lengkap!..." Else perintah = "insert into pasien values('" & tno.Text & "','" & Format(ttgl.Text, "yyyy-mm-dd") & "','" & tnama.Text & "','" & Format(tlahir.Text, "yyyy-mm-dd") & "','" & cbjenis.Text & "','" & talamat.Text & "','" & cbstatus.Text & "','" & cbkerja.Text & "','" & ttelp.Text & "')" Set RSpasien = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Disimpan", vbInformation, "Info" perintah = "insert into cetak_KBP values('" & tno.Text & "','" & tnama.Text & "','" & Format(tlahir.Text, "yyyy-mm-dd") & "','" & talamat.Text & "','" & ttelp.Text & "')" Set cetak_KBP = ActConn.Execute(perintah, , adCmdText) non setgrid grid jml cprint.Enabled = True End If End Sub Private Sub csave2_Click() If tnama = "" Or ttgl = "" Or cbjenis = "" Or cbjenis = "--PILIH--" Or tlahir.Text = "" Or talamat = "" Or cbstatus.Text = "" Or cbstatus.Text = "--PILIH--" Or cbkerja.Text = "" Or cbkerja.Text = "--PILIH--" Or ttelp = "" Then MsgBox "Data Belum Lengkap!..." Else ModeSave = False ActConn.Execute "update pasien set nm_pasien='" & tnama.Text & "',tgl_lahir='" & Format(tlahir.Text, "yyyy-mm-dd") & "',jkel='" & cbjenis.Text & "',alamat='" & talamat.Text & "',status='" & cbstatus.Text & "',pekerjaan='" & cbkerja.Text & "',no_telp='" & ttelp.Text & "' where no_pasien='" & tno.Text & "'" MsgBox "Data Berhasil Disimpan..", vbInformation, "Info" ActConn.Execute "update cetak_KBP set nm_pasien='" & tnama.Text & "',tgl_lahir='" & Format(tlahir.Text, "yyyy-mm-dd") & "',alamat='" & talamat.Text & "',no_telp='" & ttelp.Text & "'" non
setgrid grid jml cprint.Enabled = True End If End Sub Private Sub Form_Activate() ccancel.Enabled = False csave2.Visible = False csave1.Visible = True cprint.Enabled = False csave1.Enabled = False jml frkunjungan.Visible = False End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 nonaktif Me Call OpenConn ActConn.CursorLocation = adUseClient cbjenis.AddItem "Laki-Laki" cbjenis.AddItem "Perempuan" cbstatus.AddItem "Single" cbstatus.AddItem "Menikah" cbkerja.AddItem "Pegawai Negeri" cbkerja.AddItem "Karyawan Swasta" cbkerja.AddItem "Mahasiswa" cbkerja.AddItem "Pelajar" cbkerja.AddItem "Wiraswasta" cbkerja.AddItem "Tidak Bekerja" semula setgrid grid End Sub Private Sub optnama_Click() tcnama.Enabled = True tcnama.Locked = False tcnama.SetFocus tcno.Enabled = False End Sub Private Sub optno_Click() tcno.Enabled = True tcno.Locked = False tcno.SetFocus tcnama.Enabled = False
End Sub Private Sub talamat_Change() Dim i As Integer i = talamat.SelStart talamat.Text = StrConv(talamat.Text, vbProperCase) talamat.SelStart = i End Sub Private Sub tcnama_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from pasien where nm_pasien like '%" & tcnama.Text & "%'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSpasien.DataSource If KeyAscii = 13 Then If Not RSpasien.EOF Then tno.Text = RSpasien!no_pasien ttgl.Text = RSpasien!tgl_daftar tnama.Text = RSpasien!nm_pasien cbjenis.Text = RSpasien!jkel tlahir.Mask = RSpasien!tgl_lahir talamat.Text = RSpasien!alamat cbstatus.Text = RSpasien!Status cbkerja.Text = RSpasien!pekerjaan ttelp.Text = RSpasien!no_telp non cadd.Enabled = True ccancel.Enabled = False cdel.Enabled = True cedit.Enabled = True csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True cprint.Enabled = True Else MsgBox "Nama Pasien Tidak Ditemukan", vbInformation, "Info" tcnama.Text = "" tcnama.SetFocus End If End If If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub Private Sub tcno_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from pasien where no_pasien like '%" & tcno.Text & "%'"
Set RSpasien = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSpasien.DataSource If KeyAscii = 13 Then If Not RSpasien.EOF Then tno.Text = RSpasien!no_pasien ttgl.Text = RSpasien!tgl_daftar tnama.Text = RSpasien!nm_pasien cbjenis.Text = RSpasien!jkel tlahir.Mask = RSpasien!tgl_lahir talamat.Text = RSpasien!alamat cbstatus.Text = RSpasien!Status cbkerja.Text = RSpasien!pekerjaan ttelp.Text = RSpasien!no_telp non cadd.Enabled = True ccancel.Enabled = False cdel.Enabled = True cedit.Enabled = True csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True cprint.Enabled = True Else MsgBox "Nomor Pasien Tidak Ditemukan", vbInformation, "Info" tcno.Text = "" tcno.SetFocus End If End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub Private Sub tnama_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub
Private Sub tnopas_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from pasien where no_pasien like '%" & tnopas.Text & "%'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If KeyAscii = 13 Then If Not RSpasien.EOF Then tnapas.Text = RSpasien!nm_pasien talmt.Text = RSpasien!alamat bantri.Enabled = True Else MsgBox "Nomor Pasien Tidak Ditemukan", vbInformation, "Info" tnopas.Text = "" tnopas.SetFocus End If End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub Private Sub ttelp_KeyPress(KeyAscii As Integer) If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End Sub
D. Form Data Obat
Dim ModeSave As Boolean Dim perintah As String Dim strTemp, LenTemp, n Sub jml() perintah = "select*from obat" Set RSObat = ActConn.Execute(perintah, , adCmdText) litem.Caption = RSObat.RecordCount End Sub Sub grid() DataGrid1.HeadFont = "Times New Roman" DataGrid1.Columns(0).Width = 1300 DataGrid1.Columns(0).Caption = "Kode Obat" DataGrid1.Columns(0).Alignment = dbgCenter DataGrid1.Columns(1).Width = 1500 DataGrid1.Columns(1).Caption = "Kategori" DataGrid1.Columns(1).Alignment = dbgCenter DataGrid1.Columns(2).Width = 1300 DataGrid1.Columns(2).Caption = "Jenis Obat" DataGrid1.Columns(2).Alignment = dbgCenter DataGrid1.Columns(3).Width = 2000
DataGrid1.Columns(3).Caption = "Nama Obat" DataGrid1.Columns(3).Alignment = dbgLeft DataGrid1.Columns(4).Width = 1000 DataGrid1.Columns(4).Caption = "Harga" DataGrid1.Columns(4).Alignment = dbgCenter DataGrid1.Columns(5).Width = 1000 DataGrid1.Columns(5).Caption = "Kemasan" DataGrid1.Columns(5).Alignment = dbgCenter DataGrid1.Columns(6).Width = 800 DataGrid1.Columns(6).Caption = "Stok" DataGrid1.Columns(6).Alignment = dbgCenter DataGrid1.Font = "Times New Roman" End Sub Sub setgrid() perintah = "select*from obat order by kd_obat" Set RSObat = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSObat.DataSource DataGrid1.Refresh End Sub Sub tampil() perintah = "select*from obat order by kd_obat" Set RSObat = ActConn.Execute(perintah, , adCmdText) If RSObat.RecordCount > 0 Then cbkat.Text = RSObat!kategori tkode.Text = RSObat!kd_obat cbjenis.Text = RSObat!jns_obat tnama.Text = RSObat!nm_obat tstok.Text = RSObat!stok tharga.Text = RSObat!harga cbkem.Text = RSObat!bentuk_kemasan End If End Sub Sub semula() Bersih Me nonaktif Me cadd.Enabled = True cedit.Enabled = False ccancel.Enabled = False cdel.Enabled = False csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True optkode.Enabled = True optnama.Enabled = True End Sub
Private Sub cadd_Click() Aktif Me tkode.Enabled = False cbkat.SetFocus cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = False cedit.Enabled = False csave2.Visible = False csave1.Visible = True csave1.Enabled = True cclose.Enabled = False ModeSave = True End Sub Private Sub cbjenis_Click() tharga.SetFocus End Sub Private Sub cbkat_Click() perintah = "select*from obat where kategori='" & cbkat.Text & "' order by kd_obat" Set RSObat = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSObat.DataSource DataGrid1.Refresh grid If cbkat.Text = "Antibiotik" Then If RSObat.EOF Then tkode.Text = "BIO" & "0001" Else RSObat.MoveLast tambah = Right(RSObat!kd_obat, 4) + 1 tkode.Text = "BIO" + Right("000" & tambah, 4) End If ElseIf cbkat.Text = "Penyembuh" Then If RSObat.EOF Then tkode.Text = "SMB" & "0001" Else RSObat.MoveLast tambah = Right(RSObat!kd_obat, 4) + 1 tkode.Text = "SMB" + Right("000" & tambah, 4) End If Else If RSObat.EOF Then tkode.Text = "VIT" & "0001" Else RSObat.MoveLast
tambah = Right(RSObat!kd_obat, 4) + 1 tkode.Text = "VIT" + Right("000" & tambah, 4) End If End If tnama.SetFocus End Sub Private Sub ccancel_Click() semula End Sub Private Sub cclose_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend While Top - Height < Screen.Height DoEvents Top = Top + cepat Wend Unload Me End If End Sub Private Sub cdel_Click() del = MsgBox("Yakin Data Akan Dihapus??..", vbQuestion + vbYesNo, "Konfirmasi") If del = vbYes Then perintah = "delete from obat where kd_obat='" & tkode.Text & "'" Set RSObat = ActConn.Execute(perintah, , adCmdText) 'RSObat.MoveFirst End If tampil setgrid grid jml semula End Sub Private Sub cedit_Click() If tnama.Text <> "" Then ModeSave = False Aktif Me cbkat.Enabled = False
tkode.Enabled = False cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = True cedit.Enabled = False csave2.Visible = True csave1.Visible = False csave2.Enabled = True cclose.Enabled = False End If End Sub Private Sub csave1_Click() If cbkat = "" Or cbkat = "--PILIH--" Or cbjenis.Text = "" Or cbjenis = "--PILIH--" Or tnama = "" Or tstok = "" Or tharga = "" Or cbkem.Text = "" Or cbkem.Text = "--PILIH--" Then MsgBox "Data Belum Lengkap!..." Else perintah = "insert into obat values('" & tkode.Text & "','" & cbkat.Text & "','" & cbjenis.Text & "','" & tnama.Text & "','" & tharga.Text & "','" & cbkem.Text & "','" & tstok.Text & "')" Set RSObat = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Disimpan", vbInformation, "Info" semula setgrid grid jml End If End Sub Private Sub csave2_Click() If cbjenis.Text = "" Or cbjenis = "--PILIH--" Or tnama = "" Or tstok = "" Or tharga = "" Or cbkem.Text = "" Or cbkem.Text = "--PILIH--" Then MsgBox "Data Belum Lengkap!..." Else ModeSave = False ActConn.Execute "update obat set jns_obat='" & cbjenis.Text & "',nm_obat='" & tnama.Text & "',stok='" & tstok.Text & "',harga='" & tharga.Text & "',bentuk_kemasan='" & cbkem.Text & "' where kd_obat='" & tkode.Text & "'" MsgBox "Data Berhasil Disimpan..", vbInformation, "Info" semula setgrid grid jml End If End Sub Private Sub Form_Activate() ccancel.Enabled = False csave2.Visible = False
csave1.Visible = True csave1.Enabled = False jml Bersih Me End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 nonaktif Me Call OpenConn ActConn.CursorLocation = adUseClient cbkat.AddItem "Antibiotik" cbkat.AddItem "Penyembuh" cbkat.AddItem "Vitamin" cbkem.AddItem "Pack" cbkem.AddItem "Botol" cbkem.AddItem "Lembar" cbjenis.AddItem "Tablet" cbjenis.AddItem "Kaplet" cbjenis.AddItem "Kapsul" cbjenis.AddItem "Tetes" cbjenis.AddItem "Sirup" semula setgrid grid End Sub Private Sub optkode_Click() tckode.Enabled = True tckode.Locked = False tckode.SetFocus tcnama.Enabled = False End Sub Private Sub optnama_Click() tcnama.Enabled = True tcnama.Locked = False tcnama.SetFocus tckode.Enabled = False End Sub Private Sub tckode_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from obat where kd_obat like '%" & tckode.Text & "%'" Set RSObat = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSObat.DataSource
DataGrid1.Refresh grid If KeyAscii = 13 Then If Not RSObat.EOF Then cbkat.Text = RSObat!kategori tkode.Text = RSObat!kd_obat tnama.Text = RSObat!nm_obat cbjenis.Text = RSObat!jns_obat tharga.Text = RSObat!harga tstok.Text = RSObat!stok cbkem.Text = RSObat!bentuk_kemasan cadd.Enabled = True ccancel.Enabled = False cdel.Enabled = True cedit.Enabled = True csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True Else MsgBox "Kode Obat Tidak Ditemukan", vbInformation, "Info" tckode.Text = "" tckode.SetFocus End If End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub Private Sub tcnama_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from obat where nm_obat like '%" & tcnama.Text & "%'" DataGrid1.Refresh Set RSObat = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSObat.DataSource DataGrid1.Refresh grid If KeyAscii = 13 Then If Not RSObat.EOF Then cbkat.Text = RSObat!kategori tkode.Text = RSObat!kd_obat tnama.Text = RSObat!nm_obat cbjenis.Text = RSObat!jns_obat tharga.Text = RSObat!harga tstok.Text = RSObat!stok cbkem.Text = RSObat!bentuk_kemasan cadd.Enabled = True ccancel.Enabled = False cdel.Enabled = True cedit.Enabled = True
csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True Else MsgBox "Nama Obat Tidak Ditemukan", vbInformation, "Info" tcnama.Text = "" tcnama.SetFocus End If End If End Sub Private Sub tharga_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then tstok.SetFocus End If If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub Private Sub tnama_Change() Dim i As Integer i = tnama.SelStart tnama.Text = StrConv(tnama.Text, vbProperCase) tnama.SelStart = i End Sub Private Sub tnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cbjenis.SetFocus End If End Sub Private Sub tstok_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cbkem.SetFocus End If
If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End Sub
E. Form Data Dokter
Dim ModeSave As Boolean Dim perintah As String Dim strTemp, LenTemp, n Sub jml() perintah = "select*from dokter" Set RSDokter = ActConn.Execute(perintah, , adCmdText) litem.Caption = RSDokter.RecordCount End Sub Sub grid() DataGrid1.HeadFont = "Times New Roman" DataGrid1.Columns(0).Width = 1300 DataGrid1.Columns(0).Caption = "Kode Dokter" DataGrid1.Columns(0).Alignment = dbgCenter DataGrid1.Columns(1).Width = 2000 DataGrid1.Columns(1).Caption = "Nama Dokter" DataGrid1.Columns(1).Alignment = dbgLeft DataGrid1.Columns(2).Width = 2000 DataGrid1.Columns(2).Caption = "Alamat" DataGrid1.Columns(2).Alignment = dbgLeft DataGrid1.Columns(3).Width = 1500 DataGrid1.Columns(3).Caption = "No. Telp" DataGrid1.Columns(3).Alignment = dbgLeft DataGrid1.Font = "Times New Roman" End Sub Sub grid2() DGjadwal.HeadFont = "Times New Roman" DGjadwal.Columns(0).Width = 900 DGjadwal.Columns(0).Caption = "Hari" DGjadwal.Columns(0).Alignment = dbgLeft DGjadwal.Columns(1).Width = 600 DGjadwal.Columns(1).Caption = "Mulai" DGjadwal.Columns(1).Alignment = dbgCenter DGjadwal.Columns(2).Width = 600 DGjadwal.Columns(2).Caption = "Selesai" DGjadwal.Columns(2).Alignment = dbgCenter DGjadwal.Columns(3).Width = 2500 DGjadwal.Columns(3).Caption = "Keterangan" DGjadwal.Columns(3).Alignment = dbgLeft DGjadwal.Columns(4).Width = 900 DGjadwal.Columns(4).Caption = "Kd. Dokter"
DGjadwal.Columns(4).Alignment = dbgCenter DGjadwal.Font = "Times New Roman" End Sub Private Sub badd1_Click() Aktif Me Bersih Me tnamadok.Locked = True badd1.Enabled = False bcancel1.Enabled = True bsave1.Enabled = False bdel1.Enabled = False bedit1.Enabled = False ModeSave = True perintah = "select*from dokter" Set RSDokter = ActConn.Execute(perintah, , 1) ckode.Clear Do While Not RSDokter.EOF ckode.AddItem RSDokter!kd_dokter RSDokter.MoveNext Loop End Sub Private Sub bcancel1_Click() nonaktif Me Bersih Me badd1.Enabled = True bcancel1.Enabled = False bsave1.Enabled = False bsave2.Visible = False bedit1.Enabled = False bdel1.Enabled = False bclose1.Enabled = True cbfilter.Enabled = True cbfilter.Locked = False setgrid2 grid2 End Sub Private Sub bclose1_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend While Top - Height < Screen.Height DoEvents
Top = Top + cepat Wend Unload Me End If End Sub Private Sub bdel1_Click() X = MsgBox("Hapus Data", vbYesNo + vbQuestion, "Konfirmasi") If X = vbYes Then perintah = "delete from jadwal_dokter where hari='" & DGjadwal.Columns(0) & "'" Set RSDokter = ActConn.Execute(perintah, , 1) MsgBox "Data Berhasil Dihapus" setgrid2 grid2 nonaktif Me Bersih Me badd1.Enabled = True bcancel1.Enabled = False bsave1.Visible = True bsave2.Visible = False bedit1.Enabled = False bdel1.Enabled = False bclose1.Enabled = True cbfilter.Enabled = True cbfilter.Locked = False End If End Sub Private Sub bedit1_Click() Aktif Me ModeSave = False ckode.Enabled = False tnamadok.Enabled = False bsave1.Visible = False bsave2.Visible = True bsave2.Enabled = True bdel1.Enabled = False End Sub Private Sub bjadwal_Click() fjadwal.Visible = True fjadwal.Enabled = True nonaktif Me badd1.Enabled = True bcancel1.Enabled = False bsave1.Enabled = False bsave2.Visible = False bedit1.Enabled = False bdel1.Enabled = False bclose1.Enabled = True
cbfilter.Enabled = True cbfilter.Locked = False setgrid2 grid2 cbfilter.AddItem "Hari" cbfilter.AddItem "Jadwal Shift" cbfilter.AddItem "Kode Dokter" lhari.Visible = False cbhari.Visible = False lshift.Visible = False cbshift.Visible = False lkode.Visible = False cbkode.Visible = False End Sub Private Sub bsave1_Click() If ckode = "" Or ckode = "-PILIH-" Or tmulai.Text = "" Or tselesai = "" Then MsgBox "Data Belum Lengkap!..." Else For i = 0 To c1.Count - 1 If c1(i).Value = 1 Then perintah = "insert into jadwal_dokter values('" & c1(i).Caption & "','" & tmulai.Text & "','" & tselesai.Text & "','" & ket.Text & "','" & ckode.Text & "')" Set RSDokter = ActConn.Execute(perintah, , 1) End If Next i MsgBox "Data Berhasil Disimpan", vbInformation, "Info" setgrid2 grid2 nonaktif Me Bersih Me badd1.Enabled = True bcancel1.Enabled = False bsave1.Enabled = False bsave2.Visible = False bedit1.Enabled = False bdel1.Enabled = False bclose1.Enabled = True cbfilter.Enabled = True cbfilter.Locked = False End If End Sub
Private Sub bsave2_Click() If tmulai.Text = "" Or tselesai = "" Then MsgBox "Data Belum Lengkap!..." Else ModeSave = False
For i = 0 To c1.Count - 1 If c1(i).Value = 1 Then perintah = "update jadwal_dokter set hari='" & c1(i).Caption & "',mulai='" & tmulai.Text & "',selesai='" & tselesai.Text & "' where hari='" & DGjadwal.Columns(0) & "'" Set RSDokter = ActConn.Execute(perintah, , 1) End If Next i MsgBox "Data Berhasil Disimpan", vbInformation, "Info" setgrid2 grid2 nonaktif Me Bersih Me badd1.Enabled = True bcancel1.Enabled = False bsave1.Enabled = False bsave2.Visible = False bedit1.Enabled = False bdel1.Enabled = False bclose1.Enabled = True cbfilter.Enabled = True cbfilter.Locked = False End If End Sub Private Sub cadd_Click() Bersih Me AutoNomor Aktif Me tnama.SetFocus tkode.Enabled = False cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = False cedit.Enabled = False csave2.Visible = False csave1.Visible = True csave1.Enabled = True cclose.Enabled = False ModeSave = True End Sub Sub AutoNomor() perintah = "select*from dokter order by kd_dokter" Set RSDokter = ActConn.Execute(perintah, , adCmdText) If RSDokter.RecordCount = 0 Then tkode.Text = "D" + Format(Date, "yy") & Format(Date, "mm") & "01" Else RSDokter.MoveLast If Format(Date, "yymm") <> Mid(RSDokter!kd_dokter, 2, 4) Then
tkode.Text = "D" + Format(Date, "yy") & Format(Date, "mm") & "01" Else RSDokter.MoveLast tkode.Text = "D" + Format(Date, "yy") & Format(Date, "mm") & Right(Val(Right(RSDokter!kd_dokter, 2) + 101), 2) End If End If End Sub
Private Sub cbfilter_Click() If cbfilter.Text = "Hari" Then lhari.Visible = True cbhari.Visible = True cbhari.Enabled = True cbhari.Locked = False lshift.Visible = False cbshift.Visible = False lkode.Visible = False cbkode.Visible = False cbhari.AddItem "Senin" cbhari.AddItem "Selasa" cbhari.AddItem "Rabu" cbhari.AddItem "Kamis" cbhari.AddItem "Jumat" cbhari.AddItem "Sabtu" cbhari.AddItem "Minggu" ElseIf cbfilter.Text = "Jadwal Shift" Then lhari.Visible = False cbhari.Visible = False lshift.Visible = True cbshift.Visible = True lkode.Visible = False cbkode.Visible = False cbshift.Enabled = True cbshift.Locked = False perintah = "select distinct ket from jadwal_dokter" Set RSDokter = ActConn.Execute(perintah, , 1) RSDokter.Requery Do Until RSDokter.EOF cbshift.AddItem RSDokter!ket RSDokter.MoveNext Loop ElseIf cbfilter.Text = "Kode Dokter" Then lhari.Visible = False cbhari.Visible = False lshift.Visible = False cbshift.Visible = False lkode.Visible = True cbkode.Visible = True cbkode.Enabled = True
cbkode.Locked = False perintah = "select*from dokter" Set RSDokter = ActConn.Execute(perintah, , 1) cbkode.Clear Do While Not RSDokter.EOF cbkode.AddItem RSDokter!kd_dokter RSDokter.MoveNext Loop End If End Sub Private Sub cbhari_Click() perintah = "select*from jadwal_dokter where hari ='" & cbhari.Text & "'" Set RSDokter = ActConn.Execute(perintah, , 1) Set DGjadwal.DataSource = RSDokter.DataSource DGjadwal.Refresh grid2 'If KeyAscii = 13 Then 'If Not RSDokter.EOF Then ' ckode.Text = RSDokter!kd_dokter ' tmulai.Text = RSDokter!Mulai ' tselesai.Text = RSDokter!selesai 'ket.Text = RSDokter!ket 'perintah = "select*from dokter where kd_dokter like '%" & cbkode.Text & "%'" 'Set RSDokter = ActConn.Execute(perintah, , 1) ' tnamadok.Text = RSDokter!nm_dokter 'badd1.Enabled = True 'bcancel1.Enabled = False 'bsave1.Enabled = False 'bedit1.Enabled = True 'bdel1.Enabled = True 'bclose1.Enabled = True 'End If 'End If End Sub Private Sub cbkode_Click() perintah = "select*from jadwal_dokter where kd_dokter like '%" & cbkode.Text & "%'" Set RSDokter = ActConn.Execute(perintah, , 1) Set DGjadwal.DataSource = RSDokter.DataSource DGjadwal.Refresh grid2 If KeyAscii = 13 Then If Not RSDokter.EOF Then ckode.Text = RSDokter!kd_dokter tmulai.Text = RSDokter!Mulai tselesai.Text = RSDokter!selesai ket.Text = RSDokter!ket perintah = "select*from dokter where kd_dokter like '%" & cbkode.Text & "%'"
Set RSDokter = ActConn.Execute(perintah, , 1) tnamadok.Text = RSDokter!nm_dokter badd1.Enabled = True bcancel1.Enabled = False bsave1.Enabled = False bedit1.Enabled = True bdel1.Enabled = True bclose1.Enabled = True End If End If End Sub Private Sub cbshift_Click() perintah = "select*from jadwal_dokter where ket ='" & cbshift.Text & "'" Set RSDokter = ActConn.Execute(perintah, , 1) Set DGjadwal.DataSource = RSDokter.DataSource DGjadwal.Refresh grid2 If KeyAscii = 13 Then If Not RSDokter.EOF Then ckode.Text = RSDokter!kd_dokter tmulai.Text = RSDokter!Mulai tselesai.Text = RSDokter!selesai ket.Text = RSDokter!ket perintah = "select*from dokter where kd_dokter like '%" & cbkode.Text & "%'" Set RSDokter = ActConn.Execute(perintah, , 1) tnamadok.Text = RSDokter!nm_dokter badd1.Enabled = True bcancel1.Enabled = False bsave1.Enabled = False bedit1.Enabled = True bdel1.Enabled = True bclose1.Enabled = True End If End If End Sub Private Sub ccancel_Click() semula End Sub Private Sub cclose_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend
While Top - Height < Screen.Height DoEvents Top = Top + cepat Wend Unload Me End If End Sub Private Sub cdel_Click() del = MsgBox("Yakin Data Akan Dihapus??..", vbQuestion + vbYesNo, "Konfirmasi") If del = vbYes Then perintah = "delete from dokter where kd_dokter='" & tkode.Text & "'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Dihapus" End If setgrid grid semula End Sub Private Sub cedit_Click() If tnama.Text <> "" Then ModeSave = False Aktif Me cbspe.Enabled = False tkode.Locked = True cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = True cedit.Enabled = False csave2.Visible = True csave1.Visible = False csave2.Enabled = True cclose.Enabled = False End If End Sub Private Sub ckode_Click() perintah = "select * from dokter where kd_dokter='" & ckode.Text & "'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) If Not RSDokter.EOF Then tnamadok.Text = RSDokter!nm_dokter End If End Sub Private Sub csave1_Click() If tnama = "" Or talamat.Text = "" Or ttelp = "" Then MsgBox "Data Belum Lengkap!..." Else
perintah = "insert into dokter values('" & tkode.Text & "','" & tnama.Text & "','" & talamat.Text & "','" & ttelp.Text & "')" Set RSDokter = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Disimpan", vbInformation, "Info" semula setgrid grid jml End If End Sub Private Sub csave2_Click() If tnama = "" Or talamat.Text = "" Or ttelp.Text = "" Then MsgBox "Data Belum Lengkap!..." Else ModeSave = False ActConn.Execute "update dokter set nm_dokter='" & tnama.Text & "',alamat='" & talamat.Text & "',no_telp='" & ttelp.Text & "' where kd_dokter='" & tkode.Text & "'" MsgBox "Data Berhasil Disimpan..", vbInformation, "Info" semula setgrid grid jml End If End Sub
Private Sub DGjadwal_Click() perintah = "select*from jadwal_dokter where kd_dokter='" & DGjadwal.Columns(4) & "'" Set RSDokter = ActConn.Execute(perintah, , 1) ckode.Text = RSDokter!kd_dokter tmulai.Text = RSDokter!Mulai tselesai.Text = RSDokter!selesai ket.Text = RSDokter!ket perintah = "select*from dokter where kd_dokter like '%" & ckode.Text & "%'" Set RSDokter = ActConn.Execute(perintah, , 1) tnamadok.Text = RSDokter!nm_dokter bdel1.Enabled = True bedit1.Enabled = True End Sub
Private Sub Form_Activate() ccancel.Enabled = False csave2.Visible = False csave1.Visible = True csave1.Enabled = False jml Bersih Me fjadwal.Visible = False
End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 nonaktif Me Call OpenConn ActConn.CursorLocation = adUseClient semula setgrid grid End Sub Sub semula() nonaktif Me cadd.Enabled = True cedit.Enabled = False ccancel.Enabled = False cdel.Enabled = False csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True optnama.Enabled = True optkode.Enabled = True jml End Sub Sub setgrid() perintah = "select*from dokter order by kd_dokter" Set RSDokter = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSDokter.DataSource DataGrid1.Refresh End Sub Sub setgrid2() perintah = "select*from jadwal_dokter order by kd_dokter" Set RSDokter = ActConn.Execute(perintah, , adCmdText) Set DGjadwal.DataSource = RSDokter.DataSource DGjadwal.Refresh End Sub Private Sub optkode_Click() tckode.Enabled = True tckode.Locked = False tckode.SetFocus tcnama.Enabled = False End Sub
Private Sub optnama_Click() tcnama.Enabled = True tcnama.Locked = False tcnama.SetFocus tckode.Enabled = False End Sub Private Sub talamat_Change() Dim i As Integer i = talamat.SelStart talamat.Text = StrConv(talamat.Text, vbProperCase) talamat.SelStart = i End Sub
Private Sub tckode_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from dokter where kd_dokter like '%" & tckode.Text & "%'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSDokter.DataSource DataGrid1.Refresh If KeyAscii = 13 Then If Not RSDokter.EOF Then tkode.Text = RSDokter!kd_dokter tnama.Text = RSDokter!nm_dokter ttelp.Text = RSDokter!no_telp talamat.Text = RSDokter!alamat cadd.Enabled = True ccancel.Enabled = False cdel.Enabled = True cedit.Enabled = True csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True Else MsgBox "Kode Dokter Tidak Ditemukan", vbInformation, "Info" tckode.Text = "" tckode.SetFocus End If End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub Private Sub tcnama_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from dokter where nm_dokter like '%" & tcnama.Text & "%'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSDokter.DataSource DataGrid1.Refresh If KeyAscii = 13 Then
If Not RSDokter.EOF Then tkode.Text = RSDokter!kd_dokter tnama.Text = RSDokter!nm_dokter ttelp.Text = RSDokter!no_telp talamat.Text = RSDokter!alamat cadd.Enabled = True ccancel.Enabled = False cdel.Enabled = True cedit.Enabled = True csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True Else MsgBox "Nama Dokter Tidak Ditemukan", vbInformation, "Info" tcnama.Text = "" tcnama.SetFocus End If End If If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub Private Sub tmulai_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then tselesai.SetFocus End If End Sub Private Sub tnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then ttelp.Enabled = True ttelp.Locked = False ttelp.SetFocus End If KeyAscii = Asc(UCase(Chr(KeyAscii)))
If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub Private Sub tselesai_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Val(tmulai.Text) <= 12 Then ket.Text = " PRAKTEK DOKTER PAGI" ElseIf Val(tmulai.Text) <= 17 Then ket.Text = " PRAKTEK DOKTER SIANG" ElseIf Val(tmulai.Text) >= 17 Then ket.Text = " PRAKTEK DOKTER MALAM" ElseIf Val(tmulai.Text) <= 7 Then ket.Text = " PRAKTEK DOKTER MALAM" End If End If bsave1.Enabled = True End Sub Private Sub ttelp_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then talamat.Enabled = True talamat.Locked = False talamat.SetFocus End If If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End Sub
F. Form Data User
Dim ModeSave As Boolean Dim perintah As String Dim strTemp, LenTemp, n Sub grid() DataGrid1.HeadFont = "Times New Roman" DataGrid1.Columns(0).Width = 1000 DataGrid1.Columns(0).Caption = "ID User" DataGrid1.Columns(0).Alignment = dbgCenter DataGrid1.Columns(1).Width = 2000 DataGrid1.Columns(1).Caption = "Nama User" DataGrid1.Columns(1).Alignment = dbgLeft DataGrid1.Columns(2).Width = 1000 DataGrid1.Columns(2).Caption = "Status" DataGrid1.Columns(2).Alignment = dbgCenter DataGrid1.Columns(3).Width = 1000
DataGrid1.Columns(3).Caption = "Password" DataGrid1.Columns(3).Alignment = dbgCenter DataGrid1.Font = "Times New Roman" End Sub Sub tampil() perintah = "select*from user order by id_user" Set RSUser = ActConn.Execute(perintah, , adCmdText) If RSUser.RecordCount > 0 Then cbhak.Text = RSUser!Status tid.Text = RSUser!id_user tnama.Text = RSUser!nm_user tpas.Text = RSUser!Password End If End Sub Sub jml() perintah = "select*from user" Set RSUser = ActConn.Execute(perintah, , adCmdText) litem.Caption = RSUser.RecordCount End Sub Sub setgrid() perintah = "select*from user order by id_user" Set RSUser = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSUser.DataSource DataGrid1.Refresh End Sub Sub semula() Bersih Me nonaktif Me cadd.Enabled = True cedit.Enabled = False ccancel.Enabled = False cdel.Enabled = False csave1.Visible = True csave1.Enabled = False csave2.Visible = False cdok.Visible = False udok.Visible = False sdok.Visible = False cclose.Enabled = True optid.Enabled = True optnama.Enabled = True optid.Value = False optnama.Value = False jml tid.Visible = True cdok.Visible = False
End Sub Private Sub cadd_Click() cbhak.Enabled = True cbhak.Locked = False Bersih Me cbhak.SetFocus cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = False cedit.Enabled = False csave2.Visible = False csave1.Visible = True csave1.Enabled = True cclose.Enabled = True ModeSave = True End Sub Private Sub cbhak_Click() If cbhak.Text = "Dokter" Then cdok.Visible = True cdok.Enabled = True cdok.Locked = False tid.Visible = False sdok.Visible = True udok.Visible = False csave1.Visible = False ElseIf cbhak.Text = "Admin" Or cbhak.Text = "Kasir" Or cbhak.Text = "Perawat" Then tid.Visible = True cdok.Visible = False tid.Enabled = False AutoNomor tnama.Locked = False tnama.Enabled = True tnama.SetFocus End If End Sub Sub AutoNomor() perintah = "select*from user order by id_user" Set RSUser = ActConn.Execute(perintah, , adCmdText) If cbhak.Text = "Admin" Then If RSUser.EOF Then tid.Text = "A" + Format(Date, "yy") & Format(Date, "mm") & "01" Else RSUser.MoveLast If Format(Date, "yymm") <> Mid(RSUser!id_user, 2, 4) Then tid.Text = "A" + Format(Date, "yy") & Format(Date, "mm") & "01" Else
RSUser.MoveLast tid.Text = "A" + Format(Date, "yy") & Format(Date, "mm") & Right(Val(Right(RSUser!id_user, 2) + 101), 2) End If End If ElseIf cbhak.Text = "Kasir" Then If RSUser.EOF Then tid.Text = "K" + Format(Date, "yy") & Format(Date, "mm") & "01" Else RSUser.MoveLast If Format(Date, "yymm") <> Mid(RSUser!id_user, 2, 4) Then tid.Text = "K" + Format(Date, "yy") & Format(Date, "mm") & "01" Else RSUser.MoveLast tid.Text = "K" + Format(Date, "yy") & Format(Date, "mm") & Right(Val(Right(RSUser!id_user, 2) + 101), 2) End If End If ElseIf cbhak.Text = "Perawat" Then If RSUser.EOF Then tid.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & "01" Else RSUser.MoveLast If Format(Date, "yymm") <> Mid(RSUser!id_user, 2, 4) Then tid.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & "01" Else RSUser.MoveLast tid.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & Right(Val(Right(RSUser!id_user, 2) + 101), 2) End If End If End If End Sub Private Sub ccancel_Click() semula End Sub Private Sub cclose_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend While Top - Height < Screen.Height DoEvents
Top = Top + cepat Wend Unload Me End If End Sub Private Sub cdel_Click() del = MsgBox("Yakin Data Akan Dihapus??..", vbQuestion + vbYesNo, "Konfirmasi") If del = vbYes Then perintah = "delete from user where id_user='" & tid.Text & "'" Set RSUser = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Dihapus" End If tampil setgrid grid semula jml End Sub Private Sub cdok_Click() perintah = "select * from dokter where kd_dokter='" & cdok.Text & "'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) If Not RSDokter.EOF Then tnama.Text = RSDokter!nm_dokter End If tpas.Enabled = True tpas.Locked = False tpas.SetFocus End Sub Private Sub cedit_Click() If cbhak.Text = "Dokter" Then Aktif Me tnama.Enabled = False Else ModeSave = False Aktif Me End If cadd.Enabled = False ccancel.Enabled = True cdel.Enabled = True cedit.Enabled = False csave2.Visible = True csave1.Visible = False
csave2.Enabled = True cclose.Enabled = False End Sub Private Sub csave1_Click() If cbhak = "" Or cbhak = "--PILIH--" Or tid = "" Or tnama = "" Or tpas = "" Or tre = "" Then MsgBox "Data Belum Lengkap!..." ElseIf tpas.Text <> tre.Text Then MsgBox "Password Tidak Cocok, Ulangi.." tpas.Text = "" tre.Text = "" tpas.SetFocus Else perintah = "insert into user values('" & tid.Text & "','" & tnama.Text & "','" & cbhak.Text & "','" & tpas.Text & "')" Set RSUser = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Disimpan", vbInformation, "Info" semula setgrid grid jml End If End Sub Private Sub csave2_Click() If tid = "" Or cbhak = "--PILIH--" Or cbhak = "" Or tnama = "" Or tpas = "" Then MsgBox "Data Belum Lengkap!..." ElseIf tpas.Text <> tre.Text Then MsgBox "Password Tidak Cocok, Ulangi.." tpas.Text = "" tre.Text = "" tpas.SetFocus Else ModeSave = False ActConn.Execute "update user set status='" & cbhak.Text & "',id_user='" & tid.Text & "',nama='" & tnama.Text & "',password='" & tpas.Text & "' where id_user='" & tid.Text & "'" MsgBox "Data Berhasil Disimpan..", vbInformation, "Info" semula setgrid grid End If End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
nonaktif Me Call OpenConn ActConn.CursorLocation = adUseClient a = "select*from dokter" Set RSDokter = ActConn.Execute(a, , 1) cbhak.AddItem "Admin" cbhak.AddItem "Kasir" cbhak.AddItem "Dokter" cbhak.AddItem "Perawat" cdok.Clear Do While Not RSDokter.EOF cdok.AddItem RSDokter!kd_dokter RSDokter.MoveNext Loop semula setgrid grid End Sub
Private Sub optid_Click() tcid.Enabled = True tcid.Locked = False tcid.SetFocus tcnama.Enabled = False End Sub Private Sub optnama_Click() tcnama.Enabled = True tcnama.Locked = False tcnama.SetFocus tcid.Enabled = False End Sub Private Sub sdok_Click() If cbhak = "" Or cbhak = "--PILIH--" Or cdok = "" Or cdok = "--PILIH--" Or tnama = "" Or tpas = "" Or tre = "" Then MsgBox "Data Belum Lengkap!..." ElseIf tpas.Text <> tre.Text Then MsgBox "Password Tidak Cocok, Ulangi.." tpas.Text = "" tre.Text = "" tpas.SetFocus Else perintah = "insert into user values('" & cdok.Text & "','" & tnama.Text & "','" & cbhak.Text & "','" & tpas.Text & "')" Set RSUser = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Disimpan", vbInformation, "Info" semula setgrid grid
jml End If End Sub Private Sub tcid_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from user where id_user like '%" & tcid.Text & "%'" Set RSUser = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSUser.DataSource DataGrid1.Refresh If KeyAscii = 13 Then If Not RSUser.EOF Then cbhak.Enabled = False cbhak.Text = RSUser!Status tid.Text = RSUser!id_user tnama.Text = RSUser!nm_user tpas.Text = RSUser!Password cadd.Enabled = True ccancel.Enabled = False cdel.Enabled = True cedit.Enabled = True csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True Else MsgBox "ID User Tidak Ditemukan", vbInformation, "Info" tcid.Text = "" tcid.SetFocus End If End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub Private Sub tcnama_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from user where nm_user like '%" & tcnama.Text & "%'" Set RSUser = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSUser.DataSource DataGrid1.Refresh If KeyAscii = 13 Then If Not RSUser.EOF Then cbhak.Text = RSUser!Status tid.Text = RSUser!id_user tnama.Text = RSUser!nm_user tpas.Text = RSUser!Password cbhak.Enabled = False cadd.Enabled = True ccancel.Enabled = False
cdel.Enabled = True cedit.Enabled = True csave1.Visible = True csave1.Enabled = False csave2.Visible = False cclose.Enabled = True Else MsgBox "Nama User Tidak Ditemukan", vbInformation, "Info" tcnama.Text = "" tcnama.SetFocus End If End If If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub Private Sub tid_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) If (KeyAscii = vbKeySpace) Then KeyAscii = 0 If KeyAscii = 13 Then perintah = "select*from user where id_user='" & tid.Text & "'" Set RSUser = ActConn.Execute(perintah, , adCmdText) If Not RSUser.EOF Then MsgBox "Kode User Sudah Ada", vbInformation, "Info" tid.Text = "" tid.SetFocus ElseIf Len(tid.Text) <> 5 Then MsgBox "ID User Harus 5 Digit" tid.SetFocus Else tnama.Enabled = True tnama.Locked = False tnama.SetFocus End If End If End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub
Private Sub tnama_Change() Dim i As Integer i = tnama.SelStart tnama.Text = StrConv(tnama.Text, vbProperCase) tnama.SelStart = i End Sub Private Sub tnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then tpas.Enabled = True tpas.Locked = False tpas.SetFocus End If If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub Private Sub tpas_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Len(tpas.Text) > 8 Then MsgBox "Maksimal Password 8 Karakter" tpas.Text = "" Else tre.Enabled = True tre.Locked = False tre.SetFocus End If End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub Private Sub tre_KeyPress(KeyAscii As Integer) If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub Private Sub udok_Click() If cbhak = "" Or cbhak = "--PILIH--" Or cdok = "" Or cdok = "--PILIH--" Or tnama = "" Or tpas = "" Or tre = "" Then MsgBox "Data Belum Lengkap!..." ElseIf tpas.Text <> tre.Text Then MsgBox "Password Tidak Cocok, Ulangi.." tpas.Text = "" tre.Text = "" tpas.SetFocus Else ModeSave = False
ActConn.Execute "update user set status='" & cbhak.Text & "',id_user='" & cdok.Text & "',nama='" & tnama.Text & "',password='" & tpas.Text & "' where id_user='" & tid.Text & "'" MsgBox "Data Berhasil Disimpan..", vbInformation, "Info" semula setgrid End If End Sub
G. Form Data Rekam Medis Dim perintah As String Dim strTemp, LenTemp, n Function item() perintah = "select*from detail_resep where no_resep='" & tresep.Text & "'" Set RSResep = ActConn.Execute(perintah, , adCmdText) litem.Caption = RSResep.RecordCount End Function Sub tampil() perintah = "select*from rm" Set RSRM = ActConn.Execute(perintah, , adCmdText) If RSRM.RecordCount > 0 Then tnorm.Text = RSRM!no_rm tnopas.Text = RSRM!no_pasien tkode.Text = RSRM!kd_dokter ttgl.Text = RSRM!tgl_rm tdarah.Text = RSRM!tekanan_darah tanam.Text = RSRM!anamnesa tdiag.Text = RSRM!diagnosa tmedis.Text = RSRM!tindakan_medis tresep.Text = RSRM!no_resep setgrid2 grid2 item perintah = "select*from pasien where no_pasien='" & tnopas.Text & "'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If Not RSpasien.EOF Then tnama.Text = RSpasien!nm_pasien talamat.Text = RSpasien!alamat End If
perintah = "select*from user where id_user='" & tkode.Text & "'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) If Not RSDokter.EOF Then tdok.Text = RSDokter!nm_user End If End If End Sub Sub kunjung() perintah = "select*from kunjungan where no_pasien='" & tnopas.Text & "'" Set RSRM = ActConn.Execute(perintah, , 1) If Not RSRM.EOF Then tkunjung.Text = RSRM.RecordCount End If End Sub Sub setgrid() perintah = "select*from rm order by no_rm" Set RSRM = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSRM.DataSource DataGrid1.Refresh End Sub Sub setgrid2() perintah = "select detail_resep.kd_obat,obat.nm_obat,obat.jns_obat,detail_resep.dosis from obat,detail_resep where detail_resep.no_resep='" & tresep.Text & "' and detail_resep.kd_obat= obat.kd_obat" Set RSResep = ActConn.Execute(perintah, , adCmdText) Set DataGrid2.DataSource = RSResep.DataSource DataGrid2.Refresh End Sub Private Sub cmdref_Click() setgrid End Sub Private Sub cclose_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend While Top - Height < Screen.Height DoEvents Top = Top + cepat Wend
Unload Me End If End Sub Private Sub cnew_Click() rmd.Visible = False diagnosa.Visible = True End Sub Private Sub cref_Click() setgrid grid End Sub Private Sub Form_Activate() tampil kunjung optno.Enabled = True optnama.Enabled = True End Sub Sub grid() DataGrid1.HeadFont = "Times New Roman" DataGrid1.Columns(0).Width = 1300 DataGrid1.Columns(0).Caption = "No. RM" DataGrid1.Columns(0).Alignment = dbgCenter DataGrid1.Columns(1).Width = 1000 DataGrid1.Columns(1).Caption = "Tgl. RM" DataGrid1.Columns(1).Alignment = dbgCenter DataGrid1.Columns(2).Width = 1000 DataGrid1.Columns(2).Caption = "Tek. Darah" DataGrid1.Columns(2).Alignment = dbgCenter DataGrid1.Columns(3).Width = 1500 DataGrid1.Columns(3).Caption = "Anamnesa" DataGrid1.Columns(3).Alignment = dbgLeft DataGrid1.Columns(4).Width = 1500 DataGrid1.Columns(4).Caption = "Diagnosa" DataGrid1.Columns(4).Alignment = dbgLeft DataGrid1.Columns(5).Width = 2000 DataGrid1.Columns(5).Caption = "Tindakan Medis" DataGrid1.Columns(5).Alignment = dbgLeft DataGrid1.Columns(6).Width = 1000 DataGrid1.Columns(6).Caption = "No. Pasien" DataGrid1.Columns(6).Alignment = dbgCenter DataGrid1.Columns(7).Width = 1300 DataGrid1.Columns(7).Caption = "Kode Dokter" DataGrid1.Columns(7).Alignment = dbgCenter DataGrid1.Columns(8).Width = 1000 DataGrid1.Columns(8).Caption = "No. Resep"
DataGrid1.Columns(8).Alignment = dbgCenter DataGrid1.Font = "Times New Roman" End Sub Sub grid2() DataGrid2.HeadFont = "Times New Roman" DataGrid2.Columns(0).Width = 1000 DataGrid2.Columns(0).Caption = "Kode Obat" DataGrid2.Columns(0).Alignment = dbgCenter DataGrid2.Columns(1).Width = 2500 DataGrid2.Columns(1).Caption = "Nama Obat" DataGrid2.Columns(1).Alignment = dbgCenter DataGrid2.Columns(2).Width = 1300 DataGrid2.Columns(2).Caption = "Jenis Obat" DataGrid2.Columns(2).Alignment = dbgCenter DataGrid2.Columns(3).Width = 1000 DataGrid2.Columns(3).Caption = "Dosis" DataGrid2.Columns(3).Alignment = dbgCenter End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 nonaktif Me Call OpenConn ActConn.CursorLocation = adUseClient setgrid grid End Sub Private Sub optnama_Click() tnapas.Enabled = True tnapas.Locked = False tnapas.SetFocus tno.Enabled = False End Sub Private Sub optno_Click() tno.Enabled = True tno.Locked = False tno.SetFocus tnapas.Enabled = False End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_"
n = n + 1 If n > LenTemp Then n = 1 End If End Sub Private Sub tnapas_KeyPress(KeyAscii As Integer) On Error Resume Next KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from pasien where nm_pasien like '%" & tnapas.Text & "%'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If KeyAscii = 13 Then If Not RSRM.EOF Then tnopas.Text = RSpasien!no_pasien End If perintah = "select*from rm where no_pasien='" & tnopas.Text & "'" Set RSRM = ActConn.Execute(perintah, , 1) Set DataGrid1.DataSource = RSRM.DataSource If Not RSRM.EOF Then tnorm.Text = RSRM!no_rm tnopas.Text = RSRM!no_pasien tkode.Text = RSRM!kd_dokter ttgl.Text = RSRM!tgl_rm tdarah.Text = RSRM!tekanan_darah tanam.Text = RSRM!anamnesa tdiag.Text = RSRM!diagnosa tmedis.Text = RSRM!tindakan_medis tresep.Text = RSRM!no_resep setgrid2 grid2 item perintah = "select*from pasien where no_pasien='" & tnopas.Text & "'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If Not RSpasien.EOF Then tnama.Text = RSpasien!nm_pasien talamat.Text = RSpasien!alamat End If perintah = "select*from dokter where kd_dokter='" & tkode.Text & "'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) If Not RSDokter.EOF Then tdok.Text = RSDokter!nm_dokter End If Else MsgBox "Nama Pasien Tidak Ditemukan", vbInformation, "Info" tnapas.Text = "" tnapas.SetFocus End If
End If If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub Private Sub tno_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) perintah = "select*from rm where no_pasien like '%" & tno.Text & "%'" Set RSRM = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSRM.DataSource If KeyAscii = 13 Then If Not RSRM.EOF Then tnorm.Text = RSRM!no_rm tnopas.Text = RSRM!no_pasien tkode.Text = RSRM!kd_dokter ttgl.Text = RSRM!tgl_rm tdarah.Text = RSRM!tekanan_darah tanam.Text = RSRM!anamnesa tdiag.Text = RSRM!diagnosa tmedis.Text = RSRM!tindakan_medis tresep.Text = RSRM!no_resep setgrid2 grid2 item perintah = "select*from pasien where no_pasien='" & tnopas.Text & "'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If Not RSpasien.EOF Then tnama.Text = RSpasien!nm_pasien talamat.Text = RSpasien!alamat End If perintah = "select*from dokter where kd_dokter='" & tkode.Text & "'" Set RSDokter = ActConn.Execute(perintah, , adCmdText) If Not RSDokter.EOF Then tdok.Text = RSDokter!nm_dokter End If Else MsgBox "Nomor Pasien Tidak Ditemukan", vbInformation, "Info" tno.Text = "" tno.SetFocus End If End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub
H. Form Data Diagnosa Dim perintah As String Dim strTemp, LenTemp, n Sub jml() perintah = "select kd_obat,dosis,jml_hari,catatan from detail_resep where no_resep='" & tresep.Text & "'" Set RSResep = ActConn.Execute(perintah, , adCmdText) item.Text = RSResep.RecordCount End Sub Sub ngeprint() frm_resep.Show Call OpenConn frm_resep.FontName = "Comic Sans MS" frm_resep.FontSize = 8 frm_resep.Print Tab(37); "Klinik Keluarga" frm_resep.Print Tab(21); "Jl.Raya Jakarta-Bogor KM.34 Cimanggis-Depok" frm_resep.Print Tab(35); "Telp. (021)8746361" grs = String$(46, "*") grs2 = String$(68, "-") grs3 = String$(25, "-") frm_resep.Print Tab(18); grs frm_resep.Print Tab(37); "RESEP OBAT" frm_resep.Print Tab(35); grs3 frm_resep.Print Tab perintah = "select*from resep_obat where no_resep='" & tresep.Text & "'" Set RSResep = ActConn.Execute(perintah, , 1) frm_resep.Print Tab(29); "No. Resep"; Space(6); ":"; Space(1); (RSResep!no_resep) perintah = "select*from rm where no_rm='" & tnorm.Text & "'" Set RSRM = ActConn.Execute(perintah, , 1) frm_resep.Print Tab(29); "No.RM"; Space(12); ":"; Space(1); (RSRM!no_rm) frm_resep.Print Tab(29); "Tanggal"; Space(10); ":"; Space(1); Format(RSRM!tgl_rm, "dd mmmm yyyy") perintah = "select*from dokter where kd_dokter='" & tkode.Text & "'" Set RSDokter = ActConn.Execute(perintah, , 1) frm_resep.Print Tab(29); "Dokter"; Space(12); ":"; Space(1); (RSDokter!nm_dokter) perintah = "select*from pasien where no_pasien='" & tnopas.Text & "'" Set RSpasien = ActConn.Execute(perintah, , 1) frm_resep.Print Tab(29); "Nama Pasien"; Space(2); ":"; Space(1); (RSpasien!nm_pasien) perintah = "select*from rm where no_rm='" & tnorm.Text & "'" Set RSRM = ActConn.Execute(perintah, , 1) frm_resep.Print Tab(29); "Diagnosa"; Space(8); ":"; Space(1); (RSRM!diagnosa) frm_resep.Print Tab(18); grs2 perintah = "select*from detail_resep where no_resep='" & tresep.Text & "'" Set RSResep = ActConn.Execute(perintah, , 1)
RSResep.MoveFirst no = 0 Do While Not RSResep.EOF no = no + 1 perintah = "select*from obat where kd_obat='" & RSResep!kd_obat & "'" Set RSObat = ActConn.Execute(perintah, , 1) RSObat.Requery frm_resep.Print Tab(22); no; Space(3); RSObat!nm_obat; frm_resep.Print Tab(58); RKanan(RSResep!dosis, "###"); RSResep.MoveNext Loop frm_resep.Print Tab(18); grs2 frm_resep.Print Tab(22); "Konsumsi Obat Sesuai Dosis Yang Diberikan" frm_resep.Print Tab(28); "***Semoga Lekas Sembuh***" End Sub Private Function RKanan(NData, CFormat) As String RKanan = Format(NData, CFormat) RKanan = Space(Len(CFormat) - Len(RKanan)) + RKanan End Function Sub AutoNomor() perintah = "select*from resep_obat order by no_resep" Set RSResep = ActConn.Execute(perintah, , adCmdText) If RSResep.RecordCount = 0 Then tnoresep.Caption = "RO" & Format(Date, "yy") & Format(Date, "mm") & "0001" Else RSResep.MoveLast If Format(Date, "ddmm") <> Mid(RSResep!no_resep, 3, 4) Then tnoresep.Caption = "RO" + Format(Date, "yy") & Format(Date, "mm") & "0001" Else RSResep.MoveLast tnoresep.Caption = "RO" + Format(Date, "yy") & Format(Date, "mm") & Right(Val(Right(RSResep!no_resep, 4) + 10001), 4) End If End If End Sub Sub setgrid3() perintah = "select * from sm_resep" Set RSResep = ActConn.Execute(perintah, , adCmdText) Set DataGrid1.DataSource = RSResep.DataSource DataGrid1.Refresh End Sub Sub setgrid2() perintah = "select*from pasien order by no_pasien" Set RSpasien = ActConn.Execute(perintah, , adCmdText) Set DataGrid2.DataSource = RSpasien.DataSource DataGrid2.Refresh End Sub
Sub setgrid4() perintah = "select kd_obat,jns_obat,nm_obat from obat" Set RSObat = ActConn.Execute(perintah, , adCmdText) Set DataGrid3.DataSource = RSObat.DataSource DataGrid3.Refresh End Sub Sub grid4() DataGrid1.HeadFont = "Times New Roman" DataGrid1.Columns(0).Width = 1000 DataGrid1.Columns(0).Caption = "Kode Obat" DataGrid1.Columns(0).Alignment = dbgCenter DataGrid1.Columns(1).Width = 1300 DataGrid1.Columns(1).Caption = "Jenis Obat" DataGrid1.Columns(1).Alignment = dbgLeft DataGrid1.Columns(2).Width = 2000 DataGrid1.Columns(2).Caption = "Nama Obat" DataGrid1.Columns(2).Alignment = dbgLeft DataGrid1.Font = "Times New Roman" End Sub Sub semula() 'tnorm.Text = "" 'tnopas.Text = "" tdarah.Text = "" tanam.Text = "" tdiag.Text = "" tmedis.Text = "" lnama.Caption = "" lalamat.Caption = "" 'tresep.Text = "" item.Text = "" tnorm.Enabled = False tnopas.Enabled = False tkode.Enabled = False tdarah.Enabled = False tresep.Enabled = False item.Enabled = False tanam.Enabled = False tdiag.Enabled = False tmedis.Enabled = False badd.Enabled = True bb1.Enabled = False ccancel.Enabled = False csave.Enabled = False cclose.Enabled = True bresep.Enabled = False Command1.Enabled = False End Sub
Sub Nomor() perintah = "select*from rm order by no_rm" Set RSRM = ActConn.Execute(perintah, , adCmdText) If RSRM.RecordCount = 0 Then tnorm.Text = "RM" & Format(Date, "yy") & Format(Date, "mm") & "0001" Else RSRM.MoveLast If Format(Date, "yymm") <> Mid(RSRM!no_rm, 3, 4) Then tnorm.Text = "RM" & Format(Date, "yy") & Format(Date, "mm") & "0001" Else RSRM.MoveLast tnorm.Text = "RM" & Format(Date, "yy") & Format(Date, "mm") & Right(Val(Right(RSRM!no_rm, 4) + 10001), 4) End If End If End Sub Private Sub badd_Click() Nomor badd.Enabled = False bb1.Enabled = True ccancel.Enabled = True csave.Enabled = True cclose.Enabled = False tdarah.Enabled = True tdarah.Locked = False tanam.Enabled = True tanam.Locked = False tdiag.Enabled = True tdiag.Locked = False tmedis.Enabled = True tmedis.Locked = False tresep.Text = "" 'tnorm.Text = "" tnopas.Text = "" Command1.Enabled = False End Sub Private Sub bb1_Click() fpas.Visible = True fpas.Enabled = True tnama.Text = "" tno.Text = "" tnama.Enabled = False tno.Enabled = False setgrid2 End Sub
Private Sub bbrowse_Click()
bbrowse.Enabled = False fb.Visible = True setgrid4 'grid4 SSTab1.Visible = False End Sub Private Sub bcan_Click() fpas.Visible = False End Sub Private Sub bcel_Click() fb.Visible = False bbrowse.Enabled = True End Sub Private Sub binput_Click() If tkobat.Text <> "" Then perintah = "insert into sm_resep values('" & tkobat.Text & "','" & tjenis.Text & "','" & tnabat.Text & "','" & tcara.Text & "','" & tjum.Text & "','" & tcat.Text & "')" Set RSResep = ActConn.Execute(perintah, , adCmdText) perintah = "insert into detail_resep values('" & tcara.Text & "','" & tjum.Text & "','" & tcat.Text & "','" & tnoresep.Caption & "','" & tkobat.Text & "')" Set RSResep = ActConn.Execute(perintah, , adCmdText) setgrid3 End If bbrowse.Enabled = True binput.Enabled = False tkobat.Text = "" tnabat.Text = "" tjenis.Text = "" tcara.Text = "" tjum.Text = "" tcat.Text = "" End Sub Private Sub bok_Click() perintah = "select* from sm_resep" Set RSResep = ActConn.Execute(perintah, , adCmdText) If RSResep.RecordCount = 0 Then MsgBox "Anda Belum Memilih Obat, Yakin Tidak Membuat Resep?", , "Buat Resep" Fo.Visible = False Else perintah = "delete from sm_resep" Set RSResep = ActConn.Execute(perintah, , adCmdText) setgrid3 tresep.Text = tnoresep.Caption jml
Fo.Visible = False SSTab1.Visible = True tanam.Enabled = True tanam.SetFocus tdiag.Enabled = True tmedis.Enabled = True End If End Sub Private Sub bresep_Click() Fo.Visible = True Fo.Enabled = True fpas.Enabled = False AutoNomor bbrowse.Enabled = True binput.Enabled = False tkobat.Enabled = False tnabat.Enabled = False tjenis.Enabled = False tkobat.Text = "" tnabat.Text = "" tjenis.Text = "" End Sub Private Sub ccancel_Click() semula End Sub Private Sub cclose_Click() diagnosa.Visible = False rmd.Visible = True End Sub Private Sub Command1_Click() ngeprint End Sub Private Sub csave_Click() If tnopas = "" Or lnama = "" Or lalamat = "" Or tdarah = "" Or tanam = "" Or tdiag = "" Or tmedis = "" Then MsgBox "Data Belum Lengkap!..." Else perintah = "insert into rm values('" & tnorm.Text & "','" & Format(ltgl.Caption, "yyyy-mm-dd") & "','" & tdarah.Text & "','" & tanam.Text & "','" & tdiag.Text & "','" & tmedis.Text & "','" & tnopas.Text & "','" & tkode.Text & "','" & tresep.Text & "')" Set RSRM = ActConn.Execute(perintah, , adCmdText)
perintah = "insert into resep_obat values('" & tresep.Text & "','" & item.Text & "','" & tnorm.Text & "')" Set RSResep = ActConn.Execute(perintah, , adCmdText) MsgBox "Data Berhasil Disimpan", vbInformation, "Info" semula Command1.Enabled = True End If End Sub Private Sub DataGrid1_Click() X = MsgBox("Hapus Obat??", vbYesNo + vbQuestion) If X = vbYes Then perintah = "delete from sm_resep where kd_obat='" & DataGrid1.Columns(0) & "'" Set RSResep = ActConn.Execute(perintah, , 1) perintah = "delete from detail_resep where kd_obat='" & DataGrid1.Columns(0) & "'" Set RSResep = ActConn.Execute(perintah, , 1) setgrid3 End If End Sub Private Sub DataGrid3_Click() sqlcari = "select * from obat where kd_obat='" & DataGrid3.Columns(0) & "'" Set RSObat = ActConn.Execute(sqlcari, , adCmdText) fb.Visible = False tkobat = RSObat!kd_obat tnabat = RSObat!nm_obat tjenis = RSObat!jns_obat binput.Enabled = True tjum.Enabled = True tjum.Locked = False tjum.SetFocus End Sub Private Sub Form_Activate() ltgl.Caption = Format(Date, "dd mmmm yyyy") Fo.Visible = False fpas.Visible = False fb.Visible = False 'optno.Enabled = True 'optnama.Enabled = True tno.Enabled = False tnama.Enabled = False End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
Call OpenConn ActConn.CursorLocation = adUseClient semula End Sub Private Sub okna_Click() perintah = "select*from pasien where nm_pasien like '%" & tnama.Text & "%'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) Set DataGrid2.DataSource = RSpasien.DataSource If Not RSpasien.EOF Then tnopas.Text = RSpasien!no_pasien lnama.Caption = RSpasien!nm_pasien lalamat.Caption = RSpasien!alamat fpas.Visible = False bresep.Enabled = True Else MsgBox "Nama Pasien Tidak Ditemukan", vbInformation, "Info" tnama.Text = "" tnama.SetFocus End If End Sub Private Sub okno_Click() perintah = "select*from pasien where no_pasien like '%" & tno.Text & "%'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) Set DataGrid2.DataSource = RSpasien.DataSource If Not RSpasien.EOF Then tnopas.Text = RSpasien!no_pasien lnama.Caption = RSpasien!nm_pasien lalamat.Caption = RSpasien!alamat fpas.Visible = False bresep.Enabled = True Else MsgBox "Nomor Pasien Tidak Ditemukan", vbInformation, "Info" tno.Text = "" tno.SetFocus End If If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End Sub Private Sub optnama_Click() tnama.Enabled = True tnama.SetFocus tno.Enabled = False okna.Visible = True okna.Enabled = True okno.Visible = False End Sub Private Sub optno_Click()
tno.Enabled = True tno.SetFocus tnama.Enabled = False okno.Visible = True okno.Enabled = True okna.Visible = False End Sub Private Sub tcara_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then tcat.SetFocus End If End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub Private Sub tjum_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then tcara.SetFocus End If If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End Sub Private Sub tnama_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then okna_Click End If If Not (KeyAscii >= Asc("a") Or KeyAscii <= Asc("z") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySpace) Then KeyAscii = 0 If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Then KeyAscii = 0 End Sub Private Sub tno_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then okno_Click End If If (KeyAscii = vbKeySpace) Then KeyAscii = 0 End Sub
I. Form Data Transaksi Dim perintah As String Dim strTemp, LenTemp, n Sub setgrid1() perintah = "select kd_obat,dosis,jml_hari,catatan from detail_resep where no_resep='" & tresep.Text & "'" Set RSResep = ActConn.Execute(perintah, , 1) Set DGResep.DataSource = RSResep.DataSource DGResep.Refresh End Sub Sub semula() kosong badd.Enabled = True bcancel.Enabled = False bclose.Enabled = True bsave.Enabled = False tno.Visible = False tdok.Visible = False tsta.Visible = False tgl.Visible = False ltobay.Caption = "" End Sub Sub grid() DGDetail.HeadFont = "Times New Roman" DGDetail.Columns(0).Width = 1300 DGDetail.Columns(0).Caption = "Kode Obat" DGDetail.Columns(0).Alignment = dbgCenter DGDetail.Columns(1).Width = 2000 DGDetail.Columns(1).Caption = "Nama Obat" DGDetail.Columns(1).Alignment = dbgCenter DGDetail.Columns(2).Width = 1300 DGDetail.Columns(2).Caption = "Jenis Obat" DGDetail.Columns(2).Alignment = dbgCenter DGDetail.Columns(3).Width = 1000 DGDetail.Columns(3).Caption = "Quantity" DGDetail.Columns(3).Alignment = dbgCenter DGDetail.Font = "Times New Roman" End Sub Sub Nomor() perintah = "select*from transaksi order by no_nota" Set RSAdmin = ActConn.Execute(perintah, , adCmdText) If RSAdmin.RecordCount = 0 Then tnota.Text = "N" & Format(Date, "yy") & Format(Date, "mm") & "001"
Else RSAdmin.MoveLast If Format(Date, "yymm") <> Mid(RSAdmin!no_nota, 2, 4) Then tnota.Text = "N" & Format(Date, "yy") & Format(Date, "mm") & "001" Else RSAdmin.MoveLast tnota = "N" & Format(Date, "yy") & Format(Date, "mm") + Right(Val(Right(RSAdmin!no_nota, 3) + 1001), 3) End If End If End Sub Function item() perintah = "select kd_obat,dosis,jml_hari,catatan from detail_resep where no_resep='" & tresep.Text & "'" Set RSResep = ActConn.Execute(perintah, , adCmdText) litem.Caption = RSResep.RecordCount End Function Sub kosong() tnota.Text = "" tnorm.Text = "" tnapas.Text = "" talamat.Text = "" tresep.Text = "" litem.Caption = "" tkobat.Text = "" tnabat.Text = "" tjenis.Text = "" tharga.Text = "" tqty.Text = "" tsub.Text = "" tubay.Text = "" tbobat.Text = "" tadmin.Text = "" tjasa.Text = "" lkembali.Caption = "" End Sub Private Sub badd_Click() kosong ttgl.Text = Format(Date, "dd mmmm yyyy") Nomor tnorm.Enabled = True tnorm.Locked = False tnorm.SetFocus badd.Enabled = False bsave.Enabled = True bclose.Enabled = False bcancel.Enabled = True
tuntuk.Enabled = True tuntuk.Locked = False End Sub Private Sub bcancel_Click() semula End Sub Private Sub bclose_Click() X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then transaksi.Visible = False End If End Sub Private Sub bsave_Click() If tnorm = "" Or tnapas = "" Or talamat = "" Or tbobat = "" Or tuntuk.Text = "" Then MsgBox "Data Belum Lengkap" Else perintah = "insert into transaksi values('" & tnota.Text & "','" & Format(ttgl.Text, "yyyy-mm-dd") & "','" & tjasa.Text & "','" & tadmin.Text & "','" & ltobay.Caption & "','" & tid.Text & "','" & tnorm.Text & "')" Set RSTrans = ActConn.Execute(perintah, , adCmdText) perintah = "delete from sm_trans" Set RSTrans = ActConn.Execute(perintah, , 1) Set DGDetail.DataSource = RSTrans.DataSource MsgBox "Data Berhasil Disimpan", vbInformation, "Info" struk semula End If End Sub
Private Sub DGDetail_Click() X = MsgBox("Hapus Obat??", vbYesNo + vbQuestion) If X = vbYes Then perintah = "delete from detail_transaksi where kd_obat='" & DGDetail.Columns(0) & "'" Set RSResep = ActConn.Execute(perintah, , 1) perintah = "delete from sm_trans where kd_obat='" & DGDetail.Columns(0) & "'" Set RSObat = ActConn.Execute(perintah, , 1) setgrid End If End Sub Private Sub DGResep_Click() perintah = "select*from obat where kd_obat='" & DGResep.Columns(0) & "'" Set RSObat = ActConn.Execute(perintah, , 1) tkobat.Text = RSObat!kd_obat tnabat.Text = RSObat!nm_obat
tjenis.Text = RSObat!jns_obat tharga.Text = RSObat!harga tqty.Enabled = True tqty.Locked = False tqty.Text = "" tqty.SetFocus tsub.Text = "" End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 nonaktif Me Call OpenConn ActConn.CursorLocation = adUseClient semula ttgl.Text = Format(Date, "dd mmmm yyyy") End Sub Sub setgrid() perintah = "select sm_trans.kd_obat,obat.nm_obat,obat.jns_obat,sm_trans.qty from sm_trans,obat where sm_trans.kd_obat=obat.kd_obat" Set RSResep = ActConn.Execute(perintah, , adCmdText) Set DGDetail.DataSource = RSResep.DataSource DGDetail.Refresh End Sub Private Sub GetTotal() Dim VTotal As Double perintah = "select*from sm_trans" Set RSResep = ActConn.Execute(perintah, , adCmdText) If RSResep.RecordCount <> 0 Then RSResep.MoveFirst Do Until RSResep.EOF VTotal = VTotal + RSResep!subtotal RSResep.MoveNext Loop tbobat.Text = VTotal Else tbobat.Text = 0 End If End Sub Private Sub tkode_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then perintah = "select*from obat where kd_obat='" & tkode.Text & "'" Set RSObat = ActConn.Execute(perintah, , adCmdText) If Not RSObat.EOF Then
tkode.Enabled = False tnabat.Enabled = False tqty.Enabled = True tqty.Locked = False tqty.SetFocus tkode.Text = RSObat!kd_obat tjenis.Text = RSObat!jns_obat tnabat.Text = RSObat!nm_obat tharga.Text = RSObat!harga Else MsgBox "Obat Tidak Ditemukan!", vbExclamation, "Info" tkode.Text = "" tkode.SetFocus End If End If End Sub Private Function RKanan(NData, CFormat) As String RKanan = Format(NData, CFormat) RKanan = Space(Len(CFormat) - Len(RKanan)) + RKanan End Function Sub struk() frm_struk.Show frm_struk.FontName = "Times New Roman" frm_struk.FontSize = 10 frm_struk.Print Tab frm_struk.Print Tab(41); "Klinik Keluarga" frm_struk.Print Tab(25); "Jl.Raya Jakarta-Bogor KM.34 Cimanggis-Depok" frm_struk.Print Tab(39); "Telp. (021) 8746361" frm_struk.Print Tab grs1 = String$(49, "=") frm_struk.Print Tab(22); grs1 grs2 = String$(17, "-") grs3 = String$(60, "*") perintah = "select*from transaksi" Set RSTrans = ActConn.Execute(perintah, , 1) RSTrans.MoveFirst frm_struk.FontName = "Times New Roman" frm_struk.FontSize = 10 frm_struk.Print Tab frm_struk.Print Tab(32); "KWITANSI PEMBAYARAN" frm_struk.Print Tab(30); "-------------------------------------------"; frm_struk.Print Tab frm_struk.Print Tab frm_struk.Print Tab(5); "Tanggal"; Space(4); ":"; Space(1); Format(RSTrans!tgl_nota, "dd mmmm yyyy"); frm_struk.Print Tab(5); "No. Nota"; Space(2); ":"; Space(1); (RSTrans!no_nota); frm_struk.Print Tab(59); "NO. RM"; Space(10); ":"; Space(1); (RSTrans!no_rm); frm_struk.Print Tab(5); grs3
perintah = "select*from pasien where no_pasien='" & tno.Text & "'" Set RSpasien = ActConn.Execute(perintah, , 1) frm_struk.Print Tab(5); "Nama Pasien"; Space(5); ":"; Space(1); (RSpasien!nm_pasien); frm_struk.Print Tab perintah = "select*from detail_transaksi where no_nota='" & RSTrans!no_nota & "'" Set RSResep = ActConn.Execute(perintah, , adCmdText) frm_struk.Print Tab(5); "___________________________________________________________"; frm_struk.Print Tab(5); "No"; Space(3); "Kode Obat"; Space(15); "Nama Obat"; Space(21); "Harga"; Space(11); "Qty"; Space(7); "Subtotal"; frm_struk.Print Tab(5); "--------------------------------------------------------------------------------------------------------" RSResep.MoveFirst no = 0 Do While Not RSResep.EOF no = no + 1 perintah = "select*from obat where kd_obat='" & RSResep!kd_obat & "'" Set RSObat = ActConn.Execute(perintah, , 1) RSObat.Requery frm_struk.Print Tab(5); no; Space(4); RSObat!kd_obat; frm_struk.Print Tab(21); RKanan(RSObat!nm_obat, "#########################"); frm_struk.Print Tab(51); "Rp."; RKanan(RSObat!harga, "###,###,###"); frm_struk.Print Tab(68); RKanan(RSResep!qty, "###"); frm_struk.Print Tab(74); "Rp."; RKanan(RSResep!subtotal, "###,###,###"); RSResep.MoveNext Loop frm_struk.Print Tab(5); "--------------------------------------------------------------------------------------------------------" frm_struk.Print Tab frm_struk.Print Tab(50); "Total Harga Obat"; Space(10); "Rp."; RKanan(tbobat.Text, "###,###,###"); frm_struk.Print Tab(50); "Jasa Dokter"; Space(20); "Rp."; RKanan(RSTrans!biaya_dokter, "###,###,###"); frm_struk.Print Tab(50); "Biaya Admin"; Space(18); "Rp."; RKanan(RSTrans!biaya_admin, "###,###,###"); frm_struk.Print Tab frm_struk.Print Tab(75); grs2; " +" frm_struk.Print Tab(50); "Total Biaya"; Space(21); "Rp. "; RKanan(RSTrans!total_biaya, "###,###,###"); frm_struk.Print Tab frm_struk.Print Tab frm_struk.Print Tab(5); grs3 frm_struk.Print Tab(5); "Untuk Keperluan"; Space(4); ":"; Space(1); tuntuk.Text; frm_struk.FontItalic = True frm_struk.Print Tab(5); "Terbilang"; Space(16); ":"; Space(1); txtterbilang.Text; "rupiah"; frm_struk.FontItalic = False
frm_struk.Print Tab frm_struk.Print Tab frm_struk.Print Tab(10); "Kasir"; frm_struk.Print Tab frm_struk.Print Tab perintah = "select*from user where id_user='" & RSTrans!id_user & "'" Set RSUser = ActConn.Execute(perintah, , 1) frm_struk.Print Tab(10); (RSUser!nm_user); frm_struk.Print Tab frm_struk.Print Tab frm_struk.FontName = "Times new roman" frm_struk.FontSize = 10 frm_struk.FontBold = True frm_struk.Print Tab(24); "Terima Kasih Atas Kunjungan Anda" frm_struk.Print Tab(26); "*** Semoga Lekas Sembuh ***" End Sub Private Sub ltobay_Change() Dim angka As Double Dim teks As String angka = Val(ltobay.Caption) teks = Terbilang(angka) txtterbilang.Text = teks End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub Private Sub tnabat_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then perintah = "select*from obat where nm_obat like '%" & tnabat.Text & "%'" Set RSObat = ActConn.Execute(perintah, , adCmdText) If Not RSObat.EOF Then tkode.Enabled = False tnabat.Enabled = False tqty.Enabled = True tqty.Locked = False tqty.SetFocus tkode.Text = RSObat!kd_obat tjenis.Text = RSObat!jns_obat
tnabat.Text = RSObat!nm_obat tharga.Text = RSObat!harga Else MsgBox "Obat Tidak Ditemukan!", vbExclamation, "Info" tnabat.Text = "" tnabat.SetFocus End If End If End Sub Private Sub tnorm_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) If (KeyAscii = vbKeySpace) Then KeyAscii = 0 perintah = "select*from rm where no_rm='" & tnorm.Text & "'" Set RSRM = ActConn.Execute(perintah, , adCmdText) If KeyAscii = 13 Then If Not RSRM.EOF Then tnorm.Enabled = False tno.Text = RSRM!no_pasien tdok.Text = RSRM!kd_dokter tresep.Text = RSRM!no_resep setgrid1 item perintah = "select*from pasien where no_pasien='" & tno.Text & "'" Set RSpasien = ActConn.Execute(perintah, , adCmdText) If Not RSpasien.EOF Then tnapas.Text = RSpasien!nm_pasien talamat.Text = RSpasien!alamat tgl.Text = RSpasien!tgl_daftar tjasa.Text = 70000 If tgl.Text = Date Then tadmin.Text = 7000 Else tadmin.Text = 0 End If Else MsgBox "Data Tidak Ditemukan!", vbExclamation, "Info" tnorm.Text = "" tnorm.SetFocus tnapas.Text = "" talamat.Text = "" End If End If End If End Sub Private Sub tqty_KeyPress(KeyAscii As Integer) perintah = "select*from obat" Set RSObat = ActConn.Execute(perintah, , adCmdText) If KeyAscii = 13 Then
RSObat.Find "kd_obat='" & tkobat.Text & "'" If tqty.Text <> "" Then If Val(Int(tqty.Text)) > RSObat!stok Then MsgBox "Maaf, Stock Obat Tidak Cukup!", vbExclamation, "Konfirmasi" tqty.Text = "" tqty.SetFocus Else tsub.Text = Val(tharga.Text) * Val(tqty.Text) perintah = "insert into detail_transaksi values ('" & tqty.Text & "','" & tsub.Text & "','" & tnota.Text & "','" & tkobat.Text & "')" Set RSResep = ActConn.Execute(perintah, , adCmdText) perintah = "insert into sm_trans values ('" & tqty.Text & "','" & tsub.Text & "','" & tnota.Text & "','" & tkobat.Text & "')" Set RSResep = ActConn.Execute(perintah, , adCmdText) setgrid grid tubay.Enabled = True tubay.Locked = False perintah = "update obat set stok='" & RSObat!stok - Val(Int(tqty.Text)) & "' where kd_obat='" & tkobat.Text & "'" Set RSObat = ActConn.Execute(perintah, , adCmdText) GetTotal ltobay.Caption = Val(tbobat.Text) + Val(tjasa.Text) + Val(tadmin.Text) End If End If End If If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End Sub Private Sub tubay_Change() lkembali.Caption = Val(tubay.Text) - Val(ltobay.Caption) End Sub
J. Form Laporan Data Pasien
Dim strTemp, LenTemp, n Private Sub cclose_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend
While Top - Height < Screen.Height DoEvents Top = Top + cepat Wend Unload Me End If End Sub Private Sub cp1_Click() If cbtgl.Text = "" Or cbtgl.Text = "--PILIH--" Then MsgBox "Maaf, Data Tidak Ditemukan", , "Cetak Laporan" Exit Sub Else CR.SelectionFormula = "totext({pasien.tgl_daftar})='" & cbtgl.Text & "'" CR.ReportFileName = App.Path & "\laporan_pasien_harian.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End If End Sub Private Sub cp2_Click() If cbawal = "" Or cbawal = "--PILIH--" Then MsgBox "Pilih Tanggal Awal Dulu", , "Cetak Laporan" Exit Sub ElseIf cbakhir = "" Or cbakhir = "-PILIH-" Then MsgBox "Pilih Tanggal Akhir Dulu", , "Cetak Laporan" Exit Sub Else CR.SelectionFormula = "{pasien.tgl_daftar} in date (" & cbawal.Text & ")to date(" & cbakhir.Text & ")" CR.ReportFileName = App.Path & "\laporan_pasien_mingguan.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End If End Sub Private Sub cp3_Click() If cbbln.Text = "" Or cbbln.Text = "--PILIH--" Then MsgBox "Pilih Bulan Dulu", , "Cetak Laporan" ElseIf cbthn = "" Or cbthn = "--PILIH--" Then MsgBox "Pilih Tahun Dulu", , "Cetak Laporan" Else a = "select*from pasien where month(tgl_daftar)='" & Val(cbbln) & "' and year(tgl_daftar)='" & (cbthn) & "'" Set RSpasien = ActConn.Execute(a, , 1) If RSpasien.EOF Then MsgBox "Maaf, Data Tidak Ditemukan", , "Cetak Laporan"
Else CR.SelectionFormula = "month({pasien.tgl_daftar})=" & Val(cbbln.Text) & " and year ({pasien.tgl_daftar})=" & Val(cbthn.Text) CR.ReportFileName = App.Path & "\laporan_pasien_bulanan.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End If End If End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 Call OpenConn ActConn.CursorLocation = adUseClient cbtgl.Text = "--PILIH--" cbbln.Text = "--PILIH--" cbthn.Text = "--PILIH--" cbawal.Text = "--PILIH--" cbakhir.Text = "--PILIH--" a = "select distinct tgl_daftar from pasien order by 1" Set RSpasien = ActConn.Execute(a, , 1) RSpasien.Requery Do Until RSpasien.EOF cbtgl.AddItem (RSpasien!tgl_daftar) cbawal.AddItem Format(RSpasien!tgl_daftar, "yyyy,mm,dd") cbakhir.AddItem Format(RSpasien!tgl_daftar, "yyyy,mm,dd") RSpasien.MoveNext Loop For i = 1 To 12 cbbln.AddItem i Next i For i = 1 To 20 cbthn.AddItem 2000 + i Next i End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1
End If End Sub
K. Form Laporan Data Obat Dim strTemp, LenTemp, n Private Sub cclose_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend While Top - Height < Screen.Height DoEvents Top = Top + cepat Wend Unload Me End If End Sub Private Sub cprint_Click() a = "select*from obat where kategori='" & cbobat.Text & "'" Set RSObat = ActConn.Execute(a, , 1) If RSObat.EOF Then MsgBox "Maaf, Data Tidak Ditemukan", , "Cetak Laporan" Exit Sub cbobat.SetFocus End If CR.SelectionFormula = "({obat.kategori})='" & cbobat & "'" CR.ReportFileName = App.Path & "\laporan_obat.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 Call OpenConn cbobat.Text = "--PILIH--" cbobat.AddItem "Antibiotik" cbobat.AddItem "Vitamin" cbobat.AddItem "Penyembuh" End Sub
Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub
L. Form Laporan Data Rekam Medis Dim strTemp, LenTemp, n Private Sub cclose_Click() Dim cepat As Long cepat = 80 X = MsgBox("Yakin Mau Keluar", vbQuestion + vbYesNo, "Konfirmasi") If X = vbYes Then While Left + Width < Screen.Width DoEvents Left = Left + cepat Wend While Top - Height < Screen.Height DoEvents Top = Top + cepat Wend Unload Me End If End Sub Private Sub cp1_Click() If cbtgl.Text = "" Or cbtgl.Text = "--PILIH--" Then MsgBox "Maaf, Data Tidak Ditemukan", , "Cetak Laporan" Exit Sub Else CR.SelectionFormula = "totext({rm.tgl_rm})='" & cbtgl.Text & "'" CR.ReportFileName = App.Path & "\laporan_rm_harian.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End If End Sub Private Sub cp2_Click() If cbawal = "" Or cbawal = "--PILIH--" Then MsgBox "Pilih Tanggal Awal Dulu", , "Cetak Laporan" Exit Sub
ElseIf cbakhir = "" Or cbakhir = "-PILIH-" Then MsgBox "Pilih Tanggal Akhir Dulu", , "Cetak Laporan" Exit Sub Else CR.SelectionFormula = "{rm.tgl_rm} in date (" & cbawal.Text & ")to date(" & cbakhir.Text & ")" CR.ReportFileName = App.Path & "\laporan_rm_mingguan.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End If End Sub Private Sub cp3_Click() If cbbln.Text = "" Or cbbln.Text = "--PILIH--" Then MsgBox "Pilih Bulan Dulu", , "Cetak Laporan" ElseIf cbthn = "" Or cbthn = "--PILIH--" Then MsgBox "Pilih Tahun Dulu", , "Cetak Laporan" Else a = "select*from rm where month(tgl_rm)='" & Val(cbbln) & "' and year(tgl_rm)='" & (cbthn) & "'" Set RSpasien = ActConn.Execute(a, , 1) If RSpasien.EOF Then MsgBox "Maaf, Data Tidak Ditemukan", , "Cetak Laporan" Else CR.SelectionFormula = "month({rm.tgl_rm})=" & Val(cbbln.Text) & " and year ({rm.tgl_rm})=" & Val(cbthn.Text) CR.ReportFileName = App.Path & "\laporan_rm_bulanan.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End If End If End Sub Private Sub cp4_Click() CR.SelectionFormula = "{rm.no_rm}='" & tno.Text & "'" CR.ReportFileName = App.Path & "\laporan_rm_pasien.rpt" CR.WindowState = crptMaximized CR.RetrieveDataFiles CR.Action = 1 End Sub Private Sub Form_Load() strTemp = Me.Caption n = 1 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 tno.Enabled = False
Call OpenConn ActConn.CursorLocation = adUseClient cbtgl.Text = "--PILIH--" cbbln.Text = "--PILIH--" cbthn.Text = "--PILIH--" cbawal.Text = "--PILIH--" cbakhir.Text = "--PILIH--" a = "select distinct tgl_rm from rm order by no_rm" Set RSRM = ActConn.Execute(a, , 1) RSRM.Requery Do Until RSRM.EOF cbtgl.AddItem (RSRM!tgl_rm) cbawal.AddItem Format(RSRM!tgl_rm, "yyyy,mm,dd") cbakhir.AddItem Format(RSRM!tgl_rm, "yyyy,mm,dd") RSRM.MoveNext Loop For i = 1 To 12 cbbln.AddItem i Next i For i = 1 To 20 cbthn.AddItem 2000 + i Next i End Sub Private Sub Timer1_Timer() LenTemp = Len(strTemp) Dim Form As String LenTemp = Len(strTemp) Me.Caption = Left(strTemp, n) + "_" n = n + 1 If n > LenTemp Then n = 1 End If End Sub Private Sub tnama_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then a = "select distinct rm.no_rm from pasien,rm where pasien.no_pasien=rm.no_pasien and pasien.nm_pasien like '%" & tnama.Text & "%'" Set RSpasien = ActConn.Execute(a, , 1) If RSpasien.EOF Then MsgBox "Maaf, Data Tidak Ditemukan", , "Cetak Laporan" tno.Text = "" tnama.Text = "" tnama.SetFocus
Else tno.Text = RSpasien!no_rm End If End If End Sub