APLIKASI RAWAT JALAN - VB.NET Database access, Crystal Report 8.5 Harga khusus untuk pembelajaran Rp. 100.000,- Permintaan revisi dikenakan biaya sesuai tingkat kesulitan Cara pembayaran melalui transfer ke salah satu rekening di bawah ini : No Rek: 066-0525 - 947 (BCA an. Uus Rusmawan) No Rek: 156-000 - 250-2146 (Mandiri an. Uus Rusmawan) No Rek : 0139-0106 - 3038-504 (BRI an. Uus Rusmawan) Program dikirim lewat email/face Book (id : konsultasivb@ymail.com) Peminat Hub Email : uusrusmawan71@gmail.com Rancangan Database 1
Normalisasi File dan Relasi Tabel Membuat Module Imports System.Data.OleDb Module Module1 Public Conn As OleDbConnection Public da As OleDbDataAdapter Public ds As DataSet Public cmd As OleDbCommand Public rd As OleDbDataReader Public str As String Public hasil As Integer Public Sub Koneksi() str = "provider=microsoft.jet.oledb.4.0;data source=dbrawatjalan.mdb" Conn = New OleDbConnection(str) If Conn.State = ConnectionState.Closed Then Conn.Open() End Module 2
Menu Utama Form Pasien 3
Form Petugas Form Poli 4
Form Dokter Form Obat 5
Pendaftaran Pasien Proses dalam pendaftaran diawali dengan memilih kode poli, kemudian melilih dokter, setelah itu mengisi kode pasien (jika pasien baru) atau memilih kode pasien (jika pasien lama). 6
Coding : Imports System.Data.OleDb Public Class Pendaftaran Private Sub Pendaftaran_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call Koneksi() LblTanggal.Text = Today Call NomorOtomatis() Call TampilPoli() Call TampilKodePasien() Call Tampilpendaftaran() Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged cmd = New OleDbCommand("select * from dokter where kodepl='" & Microsoft.VisualBasic.Left(ComboBox1.Text, 2) & "'", Conn) rd = cmd.executereader ListBox1.Items.Clear() Do While rd.read ListBox1.Items.Add(rd.Item(0) & Space(5) & rd.item(1)) Loop Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged cmd = New OleDbCommand("select * from dokter where kodedkt='" & Microsoft.VisualBasic.Left(ListBox1.Text, 5) & "'", Conn) rd = cmd.executereader rd.read() If rd.hasrows Then LblBiaya.Text = rd.item(5) cmd = New OleDbCommand("SELECT COUNT(KODEDKT) AS ANTRI FROM pendaftaran where cdate(tanggaldft)='" & LblTanggal.Text & "' AND KODEDKT='" & Microsoft.VisualBasic.Left(ListBox1.Text, 5) & "'", Conn) rd = cmd.executereader rd.read() If Not rd.hasrows Then LblAntri.Text = "1" Else Dim Hitung As Integer = rd.item(0) + 1 LblAntri.Text = Microsoft.VisualBasic.Right("0" & Hitung, 1) 7
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Call Bersihkan() Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Call NomorPasienOtomatis() ComboBox2.Enabled = False Call DataBaru() TextBox1.Focus() Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress If e.keychar = Chr(13) Then If Microsoft.VisualBasic.Left(TextBox3.Text, 1) <> "P" And Microsoft.VisualBasic.Left(TextBox3.Text, 1) <> "p" And Microsoft.VisualBasic.Left(TextBox3.Text, 1) <> "W" And Microsoft.VisualBasic.Left(TextBox3.Text, 1) <> "w" Then MsgBox("Huruf awal harus p atau w untuk mengisi 'Pria' atau 'Wanita'") Exit Sub Else If Microsoft.VisualBasic.Left(TextBox3.Text, 1) = "P" Or Microsoft.VisualBasic.Left(TextBox3.Text, 1) = "p" Then TextBox3.Text = "PRIA" TextBox4.Focus() ElseIf Microsoft.VisualBasic.Left(TextBox3.Text, 1) = "W" Or Microsoft.VisualBasic.Left(TextBox3.Text, 1) = "w" Then TextBox3.Text = "WANITA" TextBox4.Focus() 6.12 Transaksi Resep Proses dalam transaksi resep ini diawali dengan memilih nomor resep yang sebenarnya nomor pendaftaran, kemudian mengisi kode-kode obat dalam grid dan menentikan jumlah dosisnya. Jika sudah selesai transaksi diakhiri dengan mengisi jumlah pembayaran. 8
Laporan Data Master 9
10
Laporan Pembayaran Coding : Imports System.Data.OleDb Public Class LaporanPembayaran Sub TampilTanggalByr() Call Koneksi() cmd = New OleDbCommand("select distinct TanggalByr from Pembayaran", Conn) rd = cmd.executereader Do While rd.read ComboBox1.Items.Add(rd.Item(0)) 11
ComboBox2.Items.Add(Format(rd.Item(0), "yyyy, MM, dd")) ComboBox3.Items.Add(Format(rd.Item(0), "yyyy, MM, dd")) Loop cmd = New OleDbCommand("select distinct month(tanggalbyr) as bulan from Pembayaran", Conn) rd = cmd.executereader Do While rd.read ComboBox4.Items.Add(rd.Item(0)) Loop cmd = New OleDbCommand("select distinct year(tanggalbyr) as tahun from Pembayaran", Conn) rd = cmd.executereader Do While rd.read ComboBox5.Items.Add(rd.Item(0)) Loop Private Sub LaporanPembayaran_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call TampilTanggalByr() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try If ComboBox1.Text = "" Then MsgBox("Pilih tanggal terlebih dahulu") ComboBox1.Focus() Else Laporan.Show() Laporan.CRV.ReportSource = Nothing Laporan.CRV.RefreshReport() Laporan.CRV.SelectionFormula = "totext({pembayaran.tanggalbyr})='" & ComboBox1.Text & "'" Laporan.CRV.ReportSource = "Bayar harian.rpt" Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Try If ComboBox2.Text = "" Or ComboBox3.Text = "" Then MsgBox("Pilih TanggalByr awal dan TanggalByr akhir") Exit Sub Else Laporan.Show() 12
Laporan.CRV.ReportSource = Nothing Laporan.CRV.RefreshReport() Laporan.CRV.SelectionFormula = "{Pembayaran.TanggalByr} in date (" & ComboBox2.Text & ") to date (" & ComboBox3.Text & ")" Laporan.CRV.ReportSource = "bayar mingguan.rpt" Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If ComboBox4.Text = "" Or ComboBox5.Text = "" Then MsgBox("Pilih dulu bulan dan tahun") Exit Sub Else Laporan.Show() Laporan.CRV.ReportSource = Nothing Laporan.CRV.RefreshReport() Laporan.CRV.SelectionFormula = "Month({Pembayaran.TanggalByr})=" & Val(ComboBox4.Text) & " and Year({Pembayaran.TanggalByr})=" & Val(ComboBox5.Text) Laporan.CRV.ReportSource = "Bayar Bulanan.rpt" End Class 13
14
Backup database Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click On Error Resume Next OpenFileDialog1.Filter = "(*.mdb) *.mdb" OpenFileDialog1.ShowDialog() TextBox1.Text = OpenFileDialog1.FileName FileListBox1.FileName = OpenFileDialog1.FileName Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click FolderBrowserDialog1.ShowDialog() TextBox2.Text = FolderBrowserDialog1.SelectedPath & "\" & FileListBox1.FileName Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Try If TextBox1.Text = "" Then MsgBox("Anda belum memilih file yang akan dicopy") Exit Sub ElseIf TextBox2.Text = "" Then MsgBox("Anda tidak memilih direktori tujuan peng-copy-an") Exit Sub My.Computer.FileSystem.CopyFile(TextBox1.Text, TextBox2.Text) MsgBox("Copy File sukses") TextBox1.Text = "" TextBox2.Text = "" Me.Close() Catch ex As Exception MsgBox(ex.Message) End Try End Class 15