Membuat Program Aplikasi Sistem Informasi Rumah Sakit "RS.ASIH" Berbasis Dekstop Terkoneksi Database Menggunakan Visual Studio.Net

Assalamu'allaikum
Hey Bertemu lagi dengan sefta disini. Program aplikasi ini bertujuan untuk memudahkan admin dalam proses pendaftaran para pasien, pencarian data pasien, poliklinik, dokter dan obat. Memudahkan dalam pembayaran sehingga admin tidak perlu lagi menghitung jumlah kembalian secara manual karna pada aplikasi ini sudah di terapkan perhitungan seperti kalkulator sesuai kebutuhan aplikasi ini. Pada program aplikasi ini secara otomatis terkoneksi ke Microsoft Word. Gunanya terkoneksi ke Microsoft Word adalah untuk mencetak Resep Obat dan list pembayaran. Aplikasi ini juga sudah terkoneksi dengan database MS. Access.

Mari kita simak apa saja yang di butuhkan dan apa saja yang harus dilakukan dalam pembuatan aplikasi ini !

1. Database
Dibawah ini adalah database yang diberikan nama "dbrumahsakit - Copy.accdb". Ada kata-kata copy karna awalnya database sebelumnya memiliki beberapa kesalahan. dan pada database selanjutnya saya coba menggunakan nama itu. nama database bebas. database ini gunanya untuk menyimpan data. di dalam database ini terdapat 8 tabel diantaranya tabel Poliklinik, Dokter, Pasien, Obat, Resep, Petugas, Pendaftaran, Pembayaran







 Nah kalau yang di bawah ini adalah gambaran tabel relasi dari aplikasi ini. tabel relasi ini menjelaskan bahwa didalam aplikasi ini ada beberapa bahkan hampir semua form saling berhubungan

2. Form - Form Untuk Desain Aplikasi
Form Login
Form Menu Utama

Form Poliklinik

Form Dokter


Form Pendaftaran

Form Pasien

Form Info Pasien

Form Obat

Form Resep

 Pada Setiap Form memiliki button yang fungsinya hampir sama semua yaitu menyimpan, mengubah, menghapus, mencari, menampilkan data pada datagridview. namun pada form resep saya menambahkan fungsi mencetak form resep dengan automation ms.word fungsi ini berada di button simpan & cetak. Pada Form Resep saya juga menambahkan button fungsi menghitung dan mentotal semua total yang harus dibayar dan jumlah kembalian. ada beberapa form yang didalamnya terdapat source code untuk mengambil data dari tabel-tabel lain yang artinya form tersebut saling berhubungan, contohnya pada form pendafataran itu data pasiennya diambil dari database form pasien. agar fungsi - fungsi tersebut dapat berfungsi tentunya saya menambahkan source code seperti dibawah ini :

Source Code di Form Login


Imports System.Data.OleDb
Public Class Login
    Dim x, y

    Private Sub jalankansql(ByVal sQl As String)
        Koneksi()
        Dim objcmd As New OleDb.OleDbCommand
        Try
            objcmd.Connection = conn
            objcmd.CommandType = CommandType.Text
            objcmd.CommandText = sQl
            objcmd.ExecuteNonQuery()
            objcmd.Dispose()
            MsgBox("Data Sudah Disimpan", vbInformation)
        Catch ex As Exception
            MsgBox("Tidak Bisa Menyimpan Data ke Database" & ex.Message)
        End Try
    End Sub
    Private Sub btnLog_Click(sender As Object, e As EventArgs) Handles btnLog.Click
        If txtuser.Text = "" Or txtpass.Text = "" Then
            MsgBox("Data Login Belum Lengkap")
            Exit Sub
        Else
            Koneksi()
            cmd = New OleDbCommand("select * from Petugas where NmPetugas='" & txtuser.Text & "' and Password='" & txtpass.Text & "'", Conn)
            rd = cmd.ExecuteReader
            rd.Read()
            If rd.HasRows Then
                Me.Hide()
                MenuUtama.Show()
                txtuser.Text = ""
                txtpass.Text = ""
            Else
                MsgBox("Kode Admin atau Password Salah !")
            End If
        End If
    End Sub

    Private Sub Btnexit_Click(sender As Object, e As EventArgs) Handles Btnexit.Click
        Me.Close()
    End Sub
End Class

Source Code di Form Menu Utama

Public Class MenuUtama

    Private Sub pbpoli_Click(sender As Object, e As EventArgs) Handles pbpoli.Click
        Dim DataPoli As New FormPoliklinik
        FormPoliklinik.MdiParent = Me
        FormPoliklinik.Show()
        FormDokter.Close()
        formInfoPasien.Close()
        FormObat.Close()
        FormPasien.Close()
        FormPendaftaran.Close()
        FormResep.Close()

    End Sub

    Private Sub pbdokter_Click(sender As Object, e As EventArgs) Handles pbdokter.Click
        Dim Datadok As New FormDokter
        FormDokter.MdiParent = Me
        FormPoliklinik.Close()
        formInfoPasien.Close()
        FormObat.Close()
        FormPasien.Close()
        FormPendaftaran.Close()
        FormResep.Close()
        FormDokter.Show()
    End Sub

    Private Sub pbpendaftaran_Click(sender As Object, e As EventArgs) Handles pbpendaftaran.Click
        Dim DataPendaftaran As New FormPendaftaran
        FormPendaftaran.MdiParent = Me
        FormPendaftaran.Show()
        FormDokter.Close()
        formInfoPasien.Close()
        FormObat.Close()
        FormPasien.Close()
        FormResep.Close()
        FormPoliklinik.Close()
    End Sub

    Private Sub pbpasien_Click(sender As Object, e As EventArgs) Handles pbpasien.Click
        Dim DataPasien As New FormPasien
        FormPasien.MdiParent = Me
        FormPasien.Show()
        FormDokter.Close()
        formInfoPasien.Close()
        FormObat.Close()
        FormPendaftaran.Close()
        FormResep.Close()
        FormPoliklinik.Close()
    End Sub
    Private Sub pbinfopas_Click(sender As Object, e As EventArgs) Handles pbinfopas.Click
        Dim Datainfo As New formInfoPasien
        formInfoPasien.MdiParent = Me
        formInfoPasien.Show()
        FormDokter.Close()
        FormObat.Close()
        FormPasien.Close()
        FormPendaftaran.Close()
        FormResep.Close()
        FormPoliklinik.Close()
    End Sub
    Private Sub pbobat_Click(sender As Object, e As EventArgs) Handles pbobat.Click
        Dim DataPoli As New FormObat
        FormObat.MdiParent = Me
        FormObat.Show()
        FormDokter.Close()
        formInfoPasien.Close()
        FormPoliklinik.Close()
        FormPasien.Close()
        FormPendaftaran.Close()
        FormResep.Close()
    End Sub
    Private Sub pbresep_Click(sender As Object, e As EventArgs) Handles pbresep.Click
        Dim DataPoli As New FormResep
        FormResep.MdiParent = Me
        FormResep.Show()
        FormDokter.Close()
        formInfoPasien.Close()
        FormObat.Close()
        FormPasien.Close()
        FormPendaftaran.Close()
        FormPoliklinik.Close()
    End Sub
End Class

Source Code di Poliklinik

Imports System.Data.OleDb

Public Class FormPoliklinik

    Dim simpan As String
    Dim edit As String

    Private Sub jalankansql(ByVal sQl As String)
        Koneksi()
        Dim objcmd As New OleDb.OleDbCommand
        Try
            objcmd.Connection = Conn
            objcmd.CommandType = CommandType.Text
            objcmd.CommandText = sQl
            objcmd.ExecuteNonQuery()
            objcmd.Dispose()
            MsgBox("Data Sudah Disimpan", vbInformation)
        Catch ex As Exception
            MsgBox("Tidak Bisa Menyimpan Data ke Database" & ex.Message)
        End Try
    End Sub

    Private Sub ShowData()
        Koneksi()
        Dim str As String = "Select KdPoli as [Kode Poli], NmPoli as [Nama Poli] from Poliklinik ORDER By KdPoli "
        DA = New OleDb.OleDbDataAdapter(str, Conn)
        DS = New DataSet
        DS.Clear()
        DA.Fill(DS, "Poliklinik")
        DataGridView1.DataSource = DS.Tables("Poliklinik")
        DA.Dispose()
        DS.Dispose()
        Conn.Close()
    End Sub

    Private Sub FormPoliklinik_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        koneksi()
        ShowData()
        isiTextBox()
        Conn.Open()

    End Sub

    Private Sub isiTextBox()
        Dim i As Integer
        i = DataGridView1.CurrentRow.Index
        kpoli.Text = DataGridView1.Item(0, i).Value
        npoli.Text = DataGridView1.Item(1, i).Value
    End Sub
    Public Sub clear()
        kpoli.Text = ""
        npoli.Text = ""
        ShowData()
    End Sub


    Sub TampilKode()
        Dim str As String
        str = "SELECT * FROM Poliklinik where KdPoli='" & kpoli.Text & "'"
        cmd = New OleDbCommand(str, Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            npoli.Text = rd.Item("NmPoli")
        Else
            MsgBox("KODE JENIS INI TIDAK TERDAFTAR")
        End If
    End Sub

    Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        isiTextBox()
    End Sub

    Private Sub btnsimpan_Click(sender As Object, e As EventArgs) Handles btnsimpan.Click
        Conn.Close()
        Conn.Open()
        If kpoli.Text = "" Or npoli.Text = "" Then
            MsgBox("Data Belum Lengkap")
        End If

        simpan = "INSERT INTO Poliklinik (KdPoli, NmPoli) VALUES ('" + kpoli.Text + "','" + npoli.Text + "') "
        jalankansql(simpan)
        MsgBox("Berhasil Di Simpan", vbInformation)
        clear()
        ShowData()
        kpoli.Focus()

    End Sub


    Private Sub btnedit_Click(sender As Object, e As EventArgs) Handles btnedit.Click
        Conn.Close()
        Conn.Open()
        edit = "UPDATE Poliklinik SET NmPoli ='" & npoli.Text & "' WHERE KdPoli=" & kpoli.Text & ""
        jalankansql(edit)
        MsgBox("Berhasil Di Ubah", vbInformation)
        clear()
        ShowData()
        kpoli.Focus()
    End Sub

    Private Sub btnhapus_Click(sender As Object, e As EventArgs) Handles btnhapus.Click
        Dim hapussql As String
        Dim pesan As Integer
        pesan = MsgBox("Apakah Anda Yakin Akan Menghapus Kode Poli " + DataGridView1.SelectedCells(0).Value.ToString + " ? ", vbExclamation + vbYesNo, "Attention!")
        If pesan = vbNo Then Exit Sub
        hapussql = "DELETE FROM Poliklinik WHERE KdPoli = " & DataGridView1.SelectedCells(0).Value.ToString & ""
        jalankansql(hapussql)
        Me.Cursor = Cursors.WaitCursor
        clear()
        ShowData()
        kpoli.Focus()
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub kpoli_KeyPress(sender As Object, e As KeyPressEventArgs) Handles kpoli.KeyPress
        Dim x As String = kpoli.Text
        Conn.Close()
        Conn.Open()
        cmd = New OleDbCommand("SELECT * FROM Poliklinik where KdPoli like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Poliklinik where KdPoli like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            DataGridView1.DataSource = DS.Tables("Ketemu")
            DataGridView1.ReadOnly = True
            npoli.Text = rd.Item("NmPoli")
        Else
            MsgBox("Nama Poliklinik Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub btncari_Click(sender As Object, e As EventArgs) Handles btncari.Click
        Dim x As String = kpoli.Text
        Conn.Close()
        Conn.Open()
        cmd = New OleDbCommand("SELECT * FROM Poliklinik where KdPoli like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Poliklinik where KdPoli like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            DataGridView1.DataSource = DS.Tables("Ketemu")
            DataGridView1.ReadOnly = True
            kpoli.Text = rd.Item("KdPoli")
            npoli.Text = rd.Item("NmPoli")
        Else
            MsgBox("Nama Poliklinik Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub


    Private Sub btntutup_Click(sender As Object, e As EventArgs) Handles btntutup.Click
        MenuUtama.Show()
        Me.Hide()
    End Sub

    Private Sub btnbatal_Click(sender As Object, e As EventArgs) Handles btnbatal.Click
        clear()
    End Sub
End Class

Source Code di Form Dokter

Imports System.Data.OleDb
Imports System.Data.DataTable
Public Class FormDokter
    Dim source1 As New BindingSource()
    Public Databaru As Boolean

    Dim tables As DataTableCollection

    Dim simpan As String
    Dim edit As String

    Private Sub jalankansql(ByVal sQl As String)
        Koneksi()
        Dim objcmd As New OleDb.OleDbCommand
        Try
            objcmd.Connection = Conn
            objcmd.CommandType = CommandType.Text
            objcmd.CommandText = sQl
            objcmd.ExecuteNonQuery()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("Tidak Bisa Menyimpan Data ke Database" & ex.Message)
        End Try
    End Sub
    Private Sub ShowData()
        Koneksi()
        Dim str As String = "Select KdPoli as [Kode Poliklinik], Kode as [Kode Dokter], NmDokter as [Nama Dokter], AlmtDokter as [Alamat Dokter], TelpDokter as [No Telp Dokter], Tarif as [Tarif Dokter] from Dokter ORDER By KdPoli "
        DA = New OleDb.OleDbDataAdapter(str, Conn)
        DS = New DataSet
        DS.Clear()
        DA.Fill(DS, "Dokter")
        tview1.DataSource = DS.Tables("Dokter")
        DA.Dispose()
        DS.Dispose()
        Conn.Close()
    End Sub
   
    Private Sub FormDokter_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TampilPoli()
        koneksi()
        Databaru = False
        ShowData()

    End Sub

    Private Sub isiTextBox()
        Dim i As Integer
        i = tview1.CurrentRow.Index
        cbPoli.Text = tview1.Item(0, i).Value
        txtkode.Text = tview1.Item(1, i).Value
        txtnama.Text = tview1.Item(2, i).Value
        txtalmt.Text = tview1.Item(3, i).Value
        txttelp.Text = tview1.Item(4, i).Value
        txttarif.Text = tview1.Item(5, i).Value
    End Sub

    Public Sub clear()
        cbPoli.Text = "~PILIH~"
        txtkode.Text = ""
        txtnama.Text = ""
        txtalmt.Text = ""
        txttelp.Text = ""
        txttarif.Text = ""
        ShowData()
    End Sub
    Sub TampilPoli()
        cmd = New OleDbCommand("select * from Poliklinik", Conn)
        rd = cmd.ExecuteReader
        cbPoli.Items.Clear()
        Do While rd.Read
            cbPoli.Items.Add(rd.Item(0))
        Loop
    End Sub


    Private Sub tview1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles tview1.CellClick
        Databaru = False
        isiTextBox()
    End Sub

    Private Sub btnsimpan_Click(sender As Object, e As EventArgs) Handles btnsimpan.Click
        Conn.Close()
        Conn.Open()
        If txtkode.Text = "" Or cbPoli.Text = "" Or txtnama.Text = "" Or txtalmt.Text = "" Or txttelp.Text = "" Or txttarif.Text = "" Then
            MsgBox("Data Belum Lengkap")
        End If

        simpan = "INSERT INTO Dokter (Kode, KdPoli, NmDokter, AlmtDokter, TelpDokter, Tarif) VALUES ('" & txtkode.Text & "','" & cbPoli.Text & "','" & txtnama.Text & "','" & txtalmt.Text & "','" & txttelp.Text & "','" & txttarif.Text & "') "
        jalankansql(simpan)
        MsgBox("Berhasil Di Simpan", vbInformation)
        clear()
        ShowData()
        txtkode.Focus()
    End Sub

    Private Sub btnhapus_Click(sender As Object, e As EventArgs) Handles btnhapus.Click
        Dim hapussql As String
        Dim pesan As Integer
        pesan = MsgBox("Apakah Anda Yakin Akan Menghapus Kode Dokter " + tview1.SelectedCells(0).Value.ToString + " ? ", vbExclamation + vbYesNo, "Attention!")
        If pesan = vbNo Then Exit Sub
        hapussql = "DELETE FROM Dokter WHERE KdPoli = " & tview1.SelectedCells(0).Value.ToString & ""
        jalankansql(hapussql)
        Me.Cursor = Cursors.WaitCursor
        clear()
        ShowData()
        txtkode.Focus()
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub btnedit_Click(sender As Object, e As EventArgs) Handles btnedit.Click
        Conn.Close()
        Conn.Open()
        edit = "UPDATE Dokter SET Kode ='" & txtkode.Text & "',NmDokter ='" & txtnama.Text & "',AlmtDokter ='" & txtalmt.Text & "',TelpDokter ='" & txttelp.Text & "',Tarif ='" & txttarif.Text & "' WHERE KdPoli=" & cbPoli.Text & ""
        jalankansql(edit)
        MsgBox("Berhasil Di Ubah", vbInformation)
        clear()
        ShowData()
    End Sub

    Private Sub CmdBatal_Click(sender As Object, e As EventArgs) Handles CmdBatal.Click
        clear()
    End Sub

    Private Sub btntutup_Click(sender As Object, e As EventArgs) Handles btntutup.Click
        MenuUtama.Show()
        Me.Hide()
    End Sub

    Private Sub cbPoli_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbPoli.SelectedIndexChanged
        Dim x As String = cbPoli.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Poliklinik where KdPoli like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Poliklinik where KdPoli like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
           
        Else
            MsgBox("Nama Dokter Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub btncari_Click(sender As Object, e As EventArgs) Handles btncari.Click
        Dim x As String = txtnama.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Dokter where NmDokter like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Dokter where NmDokter like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            tview1.DataSource = DS.Tables("Ketemu")
            tview1.ReadOnly = True
            cbPoli.Text = rd.Item(0)
            txtkode.Text = rd.Item(1)
            txtnama.Text = rd.Item(2)
            txtalmt.Text = rd.Item(3)
            txttelp.Text = rd.Item(4)
            txttarif.Text = rd.Item(5)
        Else
            MsgBox("Nama Dokter Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub
End Class

Source Code di Form Pendaftaran

Imports System.Data.OleDb
Imports System.Data.DataTable
Public Class FormPendaftaran
    Dim source1 As New BindingSource()
    Public Databaru As Boolean

    Dim tables As DataTableCollection

    Dim simpan As String
    Dim edit As String

    Private Sub jalankansql(ByVal sQl As String)
        Koneksi()
        Dim objcmd As New OleDb.OleDbCommand
        Try
            objcmd.Connection = Conn
            objcmd.CommandType = CommandType.Text
            objcmd.CommandText = sQl
            objcmd.ExecuteNonQuery()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("Tidak Bisa Menyimpan Data ke Database" & ex.Message)
        End Try
    End Sub

    Private Sub ShowData()
        Koneksi()
        Dim str As String = "Select NoDaftar as [No Daftar], TglDaftar as [Tanggal Daftar], KdDokter as [Kode Dokter], KdPasien as [Kode Pasien], KdPoli as [Kode Poli], Biaya as [Biaya], Ket as [Ket] from Pendaftaran ORDER By NoDaftar "
        DA = New OleDb.OleDbDataAdapter(str, Conn)
        DS = New DataSet
        DS.Clear()
        DA.Fill(DS, "Pendaftaran")
        DA.Dispose()
        DS.Dispose()
        Conn.Close()
    End Sub
 
    Private Sub FormPendaftaran_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        koneksi()
        Databaru = False
        ShowData()
        CbPoli.Items.Add("Pilih")
        CbPoli.Items.Add("10001")
        CbPoli.Items.Add("10002")
        CbPoli.Items.Add("10003")
        CbPoli.Items.Add("10004")


    End Sub


    Private Sub isilistview()
        ListView1.Items.Add(txtno.Text)
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(txtdate.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(CbPoli.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(cbdok.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(txtpasien.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(Txtnama.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(txtalmt.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(txtJK.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(txtumur.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(txttelp.Text))
        ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(Format(txtbiaya.Text))
    End Sub

    Public Sub clear()
        txtdate.Text = ""
        CbPoli.Text = ""
        cbdok.Text = ""
        txtpasien.Text = ""
        txtJK.Text = ""
        txtbiaya.Text = ""
        Txtnama.Text = ""
        txtalmt.Text = ""
        txttelp.Text = ""
        txtumur.Text = ""
        ShowData()
    End Sub

    Private Sub btnsimpan_Click(sender As Object, e As EventArgs) Handles btnsimpan.Click
        Conn.Close()
        Conn.Open()
        If txtno.Text = "" Or txtdate.Text = "" Or CbPoli.Text = "" Or cbdok.Text = "" Or txtpasien.Text = "" Or
            Txtnama.Text = "" Or txtJK.Text = "" Or txtalmt.Text = "" Or txttelp.Text = "" Or txtumur.Text = "" Then
            MsgBox("Data Belum Lengkap")
        End If

        simpan = "INSERT INTO Pendaftaran (NoDaftar, TglDaftar, KdDokter, KdPasien, KdPoli, Biaya, Ket) VALUES ('" & txtno.Text &
            "','" & txtdate.Text & "','" & cbdok.Text & "','" & txtpasien.Text & "','" & CbPoli.Text & "','" & txtbiaya.Text & "','" & txtket.Text & "') "
        jalankansql(simpan)
        MsgBox("Berhasil Di Simpan", vbInformation)
        isilistview()
        clear()
        ShowData()
        CbPoli.Focus()
    End Sub

    Private Sub CbPoli_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbPoli.SelectedIndexChanged
        Dim x As String = CbPoli.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Dokter where KdPoli like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Dokter where KdPoli like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            cbdok.Items.Clear()
            cbdok.Items.Add(rd.Item(2))
        Else
            MsgBox("Nama Dokter Tidak Ada", vbInformation)
        End If
        rd.Close()

    End Sub
    Private Sub btnbaru_Click(sender As Object, e As EventArgs) Handles btnbaru.Click
        FormPasien.Show()
        Me.Hide()
    End Sub

    Private Sub Txtnama_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Txtnama.KeyPress
        If e.KeyChar = Chr(13) Then
            Txtnama.Text = UCase(Txtnama.Text)
            txtalmt.Focus()
        End If
    End Sub

    Private Sub txtpasien_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtpasien.KeyPress
        Dim x As String = txtpasien.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Pasien where KdPasien like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Pasien where KdPasien like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            Txtnama.Text = rd.Item(1)
            txtalmt.Text = rd.Item(2)
            txtJK.Text = rd.Item(3)
            txtumur.Text = rd.Item(4)
            txttelp.Text = rd.Item(5)

        Else
            MsgBox("Nama Pasien Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub



    Private Sub txtpasien_TextChanged(sender As Object, e As EventArgs) Handles txtpasien.TextChanged
        Dim x As String = txtpasien.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Pasien where KdPasien like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Pasien where KdPasien like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            Txtnama.Text = rd.Item(1)
            txtalmt.Text = rd.Item(2)
            txtJK.Text = rd.Item(3)
            txtumur.Text = rd.Item(4)
            txttelp.Text = rd.Item(5)

        Else
            MsgBox("Nama Pasien Tidak Ada", vbInformation)
        End If
        rd.Close()

    End Sub


    Private Sub btncari_Click(sender As Object, e As EventArgs) Handles btncari.Click
        Dim x As String = txtpasien.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Pendaftaran where KdPasien like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Pendaftaran where KdPasien like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            txtno.Text = rd.Item(1)
            txtdate.Text = rd.Item(2)
            cbdok.Text = rd.Item(3)
            CbPoli.Text = rd.Item(5)
            txtbiaya.Text = rd.Item(7)
            txtket.Text = rd.Item(8)
        Else
            MsgBox("Nama Pasien Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub cbdok_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbdok.SelectedIndexChanged
        Dim x As String = cbdok.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Dokter where NmDokter like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Dokter where NmDokter like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            txtbiaya.Text = rd.Item(5)

        Else
            MsgBox("Nama Dokter Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub Btnbatal_Click(sender As Object, e As EventArgs) Handles Btnbatal.Click
        clear()
    End Sub

    Private Sub btntutup_Click(sender As Object, e As EventArgs) Handles btntutup.Click
        MenuUtama.Show()
        Me.Hide()
    End Sub

End Class

Source Code di Form Pasien

Imports System.Data.OleDb
Imports System.Data.DataTable
Public Class FormPasien
    Dim source1 As New BindingSource()
    Public Databaru As Boolean

    Dim tables As DataTableCollection

    Dim simpan As String
    Dim edit As String

    Private Sub jalankansql(ByVal sQl As String)
        Koneksi()
        Dim objcmd As New OleDb.OleDbCommand
        Try
            objcmd.Connection = Conn
            objcmd.CommandType = CommandType.Text
            objcmd.CommandText = sQl
            objcmd.ExecuteNonQuery()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("Tidak Bisa Menyimpan Data ke Database" & ex.Message)
        End Try
    End Sub

    Private Sub ShowData()
        Koneksi()
        Dim str As String = "Select KdPasien as [Kode Pasien], NmPasien as [Nama Pasien], almtPasien as [Alamat Pasien], JK as [Jenis Kelamin], UmurPasien as [Umur Pasien], TelpPasien as [Telpon Pasien] from Pasien ORDER By KdPasien "
        DA = New OleDb.OleDbDataAdapter(str, Conn)
        DS = New DataSet
        DS.Clear()
        DA.Fill(DS, "Pasien")
        tview1.DataSource = DS.Tables("Pasien")
        DA.Dispose()
        DS.Dispose()
        Conn.Close()
    End Sub
    'Sub NomorOtomatis()
    'Dim x As String = noOto.Text
    'End Sub
    Private Sub FormPasien_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        koneksi()
        Databaru = False
        ShowData()
        'NomorOtomatis()
    End Sub
    Private Sub isiTextBox()
        Dim i As Integer
        i = tview1.CurrentRow.Index
        txtkode.Text = tview1.Item(0, i).Value
        txtnama.Text = tview1.Item(1, i).Value
        txtalmt.Text = tview1.Item(2, i).Value
        txtJK.Text = tview1.Item(3, i).Value
        txtumur.Text = tview1.Item(4, i).Value
        txttelp.Text = tview1.Item(5, i).Value
    End Sub

    Public Sub clear()
        txtkode.Text = ""
        txtnama.Text = ""
        txtalmt.Text = ""
        txtJK.Text = ""
        txtumur.Text = ""
        txttelp.Text = ""
        ShowData()
    End Sub

    Private Sub tview1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles tview1.CellClick
        Databaru = False
        isiTextBox()
    End Sub

    Private Sub btnsimpan_Click(sender As Object, e As EventArgs) Handles btnSimpan.Click
        Conn.Close()
        Conn.Open()
        If txtkode.Text = "" Or txtnama.Text = "" Or txtalmt.Text = "" Or txtJK.Text = "" Or txtumur.Text = "" Or txttelp.Text = "" Then
            MsgBox("Data Belum Lengkap")
        End If

        simpan = "INSERT INTO Pasien (KdPasien, NmPasien, almtPasien, JK, UmurPasien, TelpPasien) VALUES ('" & txtkode.Text & "','" & txtnama.Text & "','" & txtalmt.Text & "','" & txtJK.Text & "','" & txtumur.Text & "','" & txtumur.Text & "') "
        jalankansql(simpan)
        MsgBox("Berhasil Di Simpan", vbInformation)
        clear()
        ShowData()
        txtkode.Focus()

    End Sub

    Private Sub txtkode_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtkode.KeyPress
        ' If e.KeyChar = Chr(13) Then
        'cmd = New OleDbCommand("select * from Pasien where KdPasien='" & txtkode.Text & "'", Conn)
        'rd = cmd.ExecuteReader
        'rd.Read()
        'If rd.HasRows = True Then
        'txtnama.Text = rd.Item(1)
        'txtalmt.Text = rd.Item(2)
        'txtJK.Text = rd.Item(3)
        'txtumur.Text = rd.Item(4)
        'txttelp.Text = rd.Item(5)
        'txtnama.Focus()
        'Else
        'Call clear()
        'txtnama.Focus()
        'End If
        'End If
        'If Not ((e.KeyChar >= "0" And e.KeyChar <= "9") Or e.KeyChar = vbBack) Then e.Handled() = True
    End Sub

    Private Sub txtJK_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtJK.KeyPress
        If e.KeyChar = Chr(13) Then
            If Microsoft.VisualBasic.Left(txtJK.Text, 1) <> "P" And Microsoft.VisualBasic.Left(txtJK.Text, 1) <> "p" And Microsoft.VisualBasic.Left(txtJK.Text, 1) <> "W" And Microsoft.VisualBasic.Left(txtJK.Text, 1) <> "w" Then
                MsgBox("Huruf awal harus p atau w untuk mengisi 'Pria' atau 'Wanita'")
                Exit Sub
            Else
                If Microsoft.VisualBasic.Left(txtJK.Text, 1) = "P" Or Microsoft.VisualBasic.Left(txtJK.Text, 1) = "p" Then
                    txtJK.Text = "PRIA"
                    txtumur.Focus()
                ElseIf Microsoft.VisualBasic.Left(txtJK.Text, 1) = "W" Or Microsoft.VisualBasic.Left(txtJK.Text, 1) = "w" Then
                    txtJK.Text = "WANITA"
                    txtumur.Focus()
                End If
            End If
        End If
    End Sub

    Private Sub CmdHapus_Click(sender As Object, e As EventArgs) Handles CmdHapus.Click
        Dim hapussql As String
        Dim pesan As Integer
        pesan = MsgBox("Apakah Anda Yakin Akan Menghapus Kode Poli " + tview1.SelectedCells(0).Value.ToString + " ? ", vbExclamation + vbYesNo, "Attention!")
        If pesan = vbNo Then Exit Sub
        hapussql = "DELETE FROM Pasien WHERE KdPasien = " & tview1.SelectedCells(0).Value.ToString & ""
        jalankansql(hapussql)
        Me.Cursor = Cursors.WaitCursor
        clear()
        ShowData()
        txtkode.Focus()
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub RbtnPria_CheckedChanged(sender As Object, e As EventArgs) Handles RbtnPria.CheckedChanged
        txtJK.Text = "Pria"
    End Sub

    Private Sub RbtnWanita_CheckedChanged(sender As Object, e As EventArgs) Handles RbtnWanita.CheckedChanged
        txtJK.Text = "Wanita"
    End Sub

    Private Sub btnedit_Click(sender As Object, e As EventArgs) Handles btnedit.Click
        Conn.Close()
        Conn.Open()
        edit = "UPDATE Pasien SET NmPasien ='" & txtnama.Text & "',AlmtPasien ='" & txtalmt.Text & "',JK ='" & txtJK.Text & "',UmurPasien ='" & txtumur.Text & "',TelpPasien ='" & txttelp.Text & "' WHERE KdPasien=" & txtkode.Text & ""
        jalankansql(edit)
        MsgBox("Berhasil Di Ubah", vbInformation)
        clear()
        ShowData()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        clear()
    End Sub


    Private Sub btntutup_Click(sender As Object, e As EventArgs) Handles btntutup.Click
        MenuUtama.Show()
        Me.Hide()
    End Sub
End Class

Source Code di Form Info Pasien

Imports System.Data.OleDb
Public Class formInfoPasien
    Sub Tampilkan()
        DA = New OleDbDataAdapter("select NmPasien as [Nama Pasien],TglDaftar as [Tgl Daftar],NmDokter as [Nama Dokter],NmPoli as [Nama Poli] from Pasien,Pendaftaran,Dokter,Poliklinik where Pasien.KdPasien=Pendaftaran.KdPasien and Dokter.KdDokter=Pendaftaran.KdDokter and Poliklinik.KdPoli=Pendaftaran.KdPoli and NmPasien  like '%" & txtnama.Text & "%'", Conn)
        DS = New DataSet
        DS.Clear()
        DA.Fill(DS)
        tview1.DataSource = (DS.Tables(0))
        tview1.Columns(0).Width = 150
        tview1.Columns(2).Width = 150
        tview1.ReadOnly = True
    End Sub

 
    Private Sub txtnama_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtnama.KeyPress
       Dim x As String = txtnama.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Pasien where NmPasien like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Pasien where NmPasien like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            tview1.DataSource = DS.Tables("Ketemu")
            tview1.ReadOnly = True
        Else
            MsgBox("Nama Pasien Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub
End Class

Source Code di Form Obat

Imports System.Data.OleDb
Imports System.Data.DataTable
Public Class FormObat
    Dim source1 As New BindingSource()
    Public Databaru As Boolean

    Dim tables As DataTableCollection

    Dim simpan As String
    Dim edit As String

    Private Sub jalankansql(ByVal sQl As String)
        Koneksi()
        Dim objcmd As New OleDb.OleDbCommand
        Try
            objcmd.Connection = Conn
            objcmd.CommandType = CommandType.Text
            objcmd.CommandText = sQl
            objcmd.ExecuteNonQuery()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("Tidak Bisa Menyimpan Data ke Database" & ex.Message)
        End Try
    End Sub
    Private Sub ShowData()
        Koneksi()
        Dim str As String = "Select KdObat as [Kode Obat], NmObat as [Nama Obat], JenisObat as [Jenis Obat], Katagori as [Katagori], HrgaObat as [Harga Obat], JmlObat as [Jumlah Obat] from Obat ORDER By KdObat "
        DA = New OleDb.OleDbDataAdapter(str, Conn)
        DS = New DataSet
        DS.Clear()
        DA.Fill(DS, "Obat")
        tview1.DataSource = DS.Tables("Obat")
        DA.Dispose()
        DS.Dispose()
        Conn.Close()
    End Sub
    Private Sub FormObat_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        koneksi()
        Databaru = False
        ShowData()

        cbkat.Items.Add("GIGI")
        cbkat.Items.Add("KULIT")
        cbkat.Items.Add("KANDUNGAN")
        cbkat.Items.Add("THT")

        cbjenis.Items.Add("CAIR")
        cbjenis.Items.Add("KAPSUL")
        cbjenis.Items.Add("PUYER")
        cbjenis.Items.Add("TABLET")
       
    End Sub
    Private Sub isiTextBox()
        Dim i As Integer
        i = tview1.CurrentRow.Index
        txtkode.Text = tview1.Item(0, i).Value
        txtnama.Text = tview1.Item(1, i).Value
        cbjenis.Text = tview1.Item(2, i).Value
        cbkat.Text = tview1.Item(3, i).Value
        txtharga.Text = tview1.Item(4, i).Value
        txtjml.Text = tview1.Item(5, i).Value

    End Sub

    Public Sub clear()
        cbkat.Text = "~PILIH~"
        txtkode.Text = ""
        txtnama.Text = ""
        cbjenis.Text = "~PILIH~"
        txtharga.Text = ""
        txtjml.Text = ""
        ShowData()
    End Sub

    Private Sub tview1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles tview1.CellContentClick
        isiTextBox()
    End Sub

    Private Sub btnSimpan_Click(sender As Object, e As EventArgs) Handles btnSimpan.Click
        Conn.Close()
        Conn.Open()
        If txtkode.Text = "" Or cbkat.Text = "" Or txtnama.Text = "" Or cbjenis.Text = "" Or txtharga.Text = "" Or txtjml.Text = "" Then
            MsgBox("Data Belum Lengkap")
        End If

        simpan = "INSERT INTO Obat (Katagori, KdObat, NmObat, JenisObat, HrgaObat, JmlObat) VALUES ('" & cbkat.Text & "','" & txtkode.Text & "','" & txtnama.Text & "','" & cbjenis.Text & "','" & txtharga.Text & "','" & txtjml.Text & "') "
        jalankansql(simpan)
        MsgBox("Berhasil Di Simpan", vbInformation)
        clear()
        ShowData()
        txtkode.Focus()
    End Sub

    Private Sub CmdHapus_Click(sender As Object, e As EventArgs) Handles CmdHapus.Click
        Dim hapussql As String
        Dim pesan As Integer
        pesan = MsgBox("Apakah Anda Yakin Akan Menghapus Kode Obat " + tview1.SelectedCells(0).Value.ToString + " ? ", vbExclamation + vbYesNo, "Attention!")
        If pesan = vbNo Then Exit Sub
        hapussql = "DELETE FROM Obat WHERE KdObat = " & tview1.SelectedCells(0).Value.ToString & ""
        jalankansql(hapussql)
        Me.Cursor = Cursors.WaitCursor
        clear()
        ShowData()
        txtkode.Focus()
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub btnedit_Click(sender As Object, e As EventArgs) Handles btnedit.Click
        Conn.Close()
        Conn.Open()
        edit = "UPDATE Obat SET Katagori ='" & cbkat.Text & "',NmObat ='" & txtnama.Text & "' JenisObat ='" & cbjenis.Text & "',HargaObat ='" & txtharga.Text & "',JmlObat ='" & txtjml.Text & "' WHERE KdObat=" & txtkode.Text & ""
        jalankansql(edit)
        MsgBox("Berhasil Di Ubah", vbInformation)
        clear()
        ShowData()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        clear()
    End Sub

    Private Sub CmdTutup_Click(sender As Object, e As EventArgs) Handles CmdTutup.Click
        MenuUtama.Show()
        Me.Hide()
    End Sub
End Class

Soucre Code di Form Resep
Imports System.Data.OleDb
Imports System.Data.DataTable
Imports word = Microsoft.Office.Interop.Word
Public Class FormResep
    Dim Appnya As New word.Application
    Dim Dokumennya As word.Document

    Dim source1 As New BindingSource()
    Public Databaru As Boolean

    Dim tables As DataTableCollection

    Dim simpan As String
    Dim edit As String

    Private Sub jalankansql(ByVal sQl As String)
        koneksi()
        Dim objcmd As New OleDb.OleDbCommand
        Try
            objcmd.Connection = Conn
            objcmd.CommandType = CommandType.Text
            objcmd.CommandText = sQl
            objcmd.ExecuteNonQuery()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("Tidak Bisa Menyimpan Data ke Database" & ex.Message)
        End Try
    End Sub
    Public Sub clear()
        cbno.Text = "PILIH"
        txtnmdok.Text = ""
        txtpasien.Text = ""
        txtpoli.Text = ""
        cbgigi.Text = "PILIH"
        cbtht.Text = "PILIH"
        cbk.Text = "PILIH"
        cbkul.Text = "PILIH"
        cbvit.Text = "PILIH"
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        txttotal.Text = ""
        TxtDibayar.Text = ""
        txtkem.Text = ""
    End Sub
    Sub TampilNo()
        cmd = New OleDbCommand("select * from Pendaftaran ", Conn)
        rd = cmd.ExecuteReader
        cbno.Items.Clear()
        Do While rd.Read
            cbno.Items.Add(rd.Item(0))
        Loop
    End Sub

    Private Sub cbno_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbno.SelectedIndexChanged
        Dim x As String = cbno.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Pendaftaran where NoDaftar like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Pendaftaran where NoDaftar like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            txtnmdok.Text = rd.Item(2)
            txtpasien.Text = rd.Item(3)
            txtpoli.Text = rd.Item(4)
            hrgdok.Text = rd.Item(6)

        Else
            MsgBox("Nama No Daftar Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub FormResep_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TampilNo()

        cbgigi.Items.Add("ASAM MEFENAMAT")
        cbgigi.Items.Add("BASUDIN")
        cbgigi.Items.Add("DEXAMETHAZON")
        cbgigi.Items.Add("CLINDAMYCIN")

        cbtht.Items.Add("NIKARA")
        cbtht.Items.Add("AKINU")
        cbtht.Items.Add("LAKONI")
        cbtht.Items.Add("BUSITA")

        cbkul.Items.Add("ASPIRIN")
        cbkul.Items.Add("SUDIRE")
        cbkul.Items.Add("MAKINE")
        cbkul.Items.Add("BASADA")

        cbk.Items.Add("AKSUMO")
        cbk.Items.Add("BAISUN")
        cbk.Items.Add("LITORE")
        cbk.Items.Add("REFANOL")

    End Sub

    Private Sub cbgigi_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbgigi.SelectedIndexChanged
        Dim x As String = cbgigi.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Obat where NmObat like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Obat where NmObat like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            TextBox1.Text = rd.Item(4)
        Else
            MsgBox("Harga Obat Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub cbtht_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbtht.SelectedIndexChanged
        Dim x As String = cbtht.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Obat where NmObat like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Obat where NmObat like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            TextBox2.Text = rd.Item(4)
        Else
            MsgBox("Harga Obat Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub cbk_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbk.SelectedIndexChanged
        Dim x As String = cbk.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Obat where NmObat like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Obat where NmObat like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            TextBox3.Text = rd.Item(4)
        Else
            MsgBox("Harga Obat Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub cbkul_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbkul.SelectedIndexChanged
        Dim x As String = cbkul.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Obat where NmObat like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Obat where NmObat like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            TextBox4.Text = rd.Item(4)
        Else
            MsgBox("Harga Obat Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub cbvit_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbvit.SelectedIndexChanged
        Dim x As String = cbvit.Text
        Conn.Close()
        Conn.Open()

        cmd = New OleDbCommand("SELECT * FROM Obat where NmObat like '%" + x + "%'", Conn)
        rd = cmd.ExecuteReader
        rd.Read()
        If rd.HasRows Then
            DA = New OleDbDataAdapter("select * from Obat where NmObat like '%" + x + "%'", Conn)
            DS = New DataSet
            DA.Fill(DS, "Ketemu")
            TextBox5.Text = rd.Item(4)
        Else
            MsgBox("Harga Obat Tidak Ada", vbInformation)
        End If
        rd.Close()
    End Sub

    Private Sub btntotal_Click(sender As Object, e As EventArgs) Handles btntotal.Click
        Dim a, b, c, d, f, hargadok, hasil As Integer
        a = TextBox1.Text
        b = TextBox2.Text
        c = TextBox3.Text
        d = TextBox4.Text
        f = TextBox5.Text
        hargadok = hrgdok.Text
        hasil = a + b + c + d + f + hargadok
        txttotal.Text = hasil
    End Sub

    Private Sub btnsim_Click(sender As Object, e As EventArgs) Handles btnsim.Click
        Dokumennya = Appnya.Documents.Open("E:\KULIAH\SEMESTER 5\Visual\UAS1\UAS1\bin\Debug\FORM RESEP OBAT.docx")
        Dokumennya.Bookmarks("Nores").Select()
        Appnya.Selection.TypeText(cbno.Text)

        Dokumennya.Bookmarks("Dokter").Select()
        Appnya.Selection.TypeText(txtnmdok.Text)

        Dokumennya.Bookmarks("harga1").Select()
        Appnya.Selection.TypeText(TextBox1.Text)

        Dokumennya.Bookmarks("harga2").Select()
        Appnya.Selection.TypeText(TextBox2.Text)

        Dokumennya.Bookmarks("harga3").Select()
        Appnya.Selection.TypeText(TextBox3.Text)

        Dokumennya.Bookmarks("harga4").Select()
        Appnya.Selection.TypeText(TextBox4.Text)

        Dokumennya.Bookmarks("tgl").Select()
        Appnya.Selection.TypeText(txtdate.Text)

        Dokumennya.Bookmarks("obat1").Select()
        Appnya.Selection.TypeText(cbgigi.Text)

        Dokumennya.Bookmarks("obat2").Select()
        Appnya.Selection.TypeText(cbtht.Text)

        Dokumennya.Bookmarks("obat3").Select()
        Appnya.Selection.TypeText(cbk.Text)

        Dokumennya.Bookmarks("obat4").Select()
        Appnya.Selection.TypeText(cbkul.Text)

        Dokumennya.Bookmarks("obat5").Select()
        Appnya.Selection.TypeText(cbvit.Text)

        Dokumennya.Bookmarks("Pasien").Select()
        Appnya.Selection.TypeText(txtpasien.Text)

        Dokumennya.Bookmarks("Poli").Select()
        Appnya.Selection.TypeText(txtpoli.Text)

        Dokumennya.Bookmarks("total").Select()
        Appnya.Selection.TypeText(txttotal.Text)

        Dokumennya.Bookmarks("kembali").Select()
        Appnya.Selection.TypeText(txtkem.Text)

        Dokumennya.Bookmarks("dibayar").Select()
        Appnya.Selection.TypeText(TxtDibayar.Text)
        Dokumennya.SaveAs("E:\KULIAH\SEMESTER 5\Visual\UAS1\UAS1\bin\Debug\FORM RESEP OBAT" & txtdate.Text & ".docx")
        Appnya.Visible = True

        Conn.Close()
        Conn.Open()
        If cbno.Text = "" Or txtdate.Text = "" Or txtnmdok.Text = "" Or txtpasien.Text = "" Or txtpoli.Text = "" Or
            hrgdok.Text = "" Or TxtDibayar.Text = "" Or txttotal.Text = "" Or txtkem.Text = "" Then
            MsgBox("Data Belum Lengkap")
        End If

        simpan = "INSERT INTO Resep (NoResep, TglResep, KdDokter, KdPasien, KdPoli, Total, Dibayar, Kembali) VALUES ('" & cbno.Text &
            "','" & txtdate.Text & "','" & txtnmdok.Text & "','" & txtpasien.Text & "','" & txtpoli.Text & "','" & txttotal.Text & "','" & TxtDibayar.Text & "','" & txtkem.Text & "') "
        jalankansql(simpan)
        MsgBox("Berhasil Di Simpan", vbInformation)
        clear()
        cbno.Focus()
    End Sub

       Private Sub btntup_Click(sender As Object, e As EventArgs) Handles btntup.Click
        MenuUtama.Show()
        Me.Hide()
    End Sub

    Private Sub btntotal2_Click(sender As Object, e As EventArgs) Handles btntotal2.Click
        Dim a, b, hasil As Integer
        a = TxtDibayar.Text
        b = txttotal.Text
        hasil = a - b
        txtkem.Text = hasil
    End Sub
End Class


Nah ini adalah hasil data yang berhasil disimpan ke database menggunakan aplikasi ini







Nah kalau yang ini adalah form hasil dari penyimpanan resep. guna form ini adalah memudahkan apoteker mencari obat karna didalam form ini sudah terdapat menu obat yang disarankan oleh dokter dan form ini juga memudahkan kasir dan pasien dalam proses pembayaran karna di form ini sudah terdapat total pembayaran
Berikut hasil run dari aplikasi yang telah saya buat


Sekian Penjelasan mengenai aplikasi sistem informasi rumah sakit berbasis desktop terkoneksi database menggunakan Visual Studio. Net. Semoga bermanfaat untuk teman - teman semua

Terimakasih

Comments

  1. panjang bener, kalah kereta! lol

    Anyun

    ReplyDelete
  2. Nice your articles.
    You can search latest govt jobs in Telangana TSPSC Recruitment visit here.

    ReplyDelete
  3. Excellent your post.
    You can find latest govt result Rojgar Result visit here.

    ReplyDelete
  4. Bisa kirim gak aplikasi jadinya ke gwarnetjava@gmail.com

    ReplyDelete
  5. kak bisa kirim ga sodfcopy nya ke email aku? mia.isnaeni@gmail.com

    ReplyDelete
  6. mba minta softcopy nya yaa bisa minta tolong kirim ksni edoiyan@gmail.com

    ReplyDelete

Post a Comment

Popular posts from this blog

Program Aplikasi Pemesanan Tiket Pesawat Menggunakan Visual Studio.Net dan Automatic Microsoft

Pemrograman Aplikasi Registrasi Hotel menggunakan Java NetBeans

APLIKASI TIKET PESAWAT menggunakan java netbeans