Berikut script pada aplikasi diatas tersebut
- Public Class Home
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- opendb()
- End Sub
- Sub tutup()
- rekam_medis.Close()
- pasien.Close()
- dokter.Close()
- Obat.Close()
- poliklinik.Close()
- Tindakan.Close()
- kunjungan.Close()
- Laboratorium.Close()
- TampilDataPasien.Close()
- End Sub
- Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
- tutup()
- Laboratorium.TopLevel = False
- Panel3.Controls.Add(Laboratorium)
- Laboratorium.Show()
- Laboratorium.BringToFront()
- End Sub
- Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
- End Sub
- Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
- Me.Hide()
- first.Show()
- End Sub
- Private Sub Panel2_Paint(sender As Object, e As PaintEventArgs) Handles Panel2.Paint
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- tutup()
- pasien.TopLevel = False
- Panel3.Controls.Add(pasien)
- pasien.Show()
- pasien.BringToFront()
- End Sub
- Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
- tutup()
- Tindakan.TopLevel = False
- Panel3.Controls.Add(Tindakan)
- Tindakan.Show()
- Tindakan.BringToFront()
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- tutup()
- Obat.TopLevel = False
- Panel3.Controls.Add(Obat)
- Obat.Show()
- Obat.BringToFront()
- End Sub
- Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
- tutup()
- poliklinik.TopLevel = False
- Panel3.Controls.Add(poliklinik)
- poliklinik.Show()
- poliklinik.BringToFront()
- End Sub
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
- tutup()
- kunjungan.TopLevel = False
- Panel3.Controls.Add(kunjungan)
- kunjungan.Show()
- kunjungan.BringToFront()
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- tutup()
- dokter.TopLevel = False
- Panel3.Controls.Add(dokter)
- dokter.Show()
- dokter.BringToFront()
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- tutup()
- rekam_medis.TopLevel = False
- Panel3.Controls.Add(rekam_medis)
- rekam_medis.Show()
- rekam_medis.BringToFront()
- End Sub
- Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
- tutup()
- Cetak.TopLevel = False
- Panel3.Controls.Add(Cetak)
- Cetak.Show()
- Cetak.BringToFront()
- End Sub
- Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
- rekam_medis.Close()
- TampilDataPasien.Close()
- pasien.Close()
- dokter.Close()
- Obat.Close()
- kunjungan.Close()
- Tindakan.Close()
- poliklinik.Close()
- End Sub
- End Class
Form Diatas Terdiri dari, datagridview, button, label, textbox,panel,grupbox.
Berikut script pada form diatas
- Imports System.Data.SqlClient
- Public Class rekam_medis
- Dim pasien, obat, tindakan As String
- Sub bersih()
- txtrekmedis.Text = ""
- cbkdtindakan.Text = ""
- cbkdobat.Text = ""
- cbkduser.Text = ""
- cbnopas.Text = ""
- txtdiagnosa.Text = ""
- txtkeluhan.Text = ""
- txtresep.Text = ""
- tglperiksa.Text = ""
- txtket.Text = ""
- End Sub
- Sub header()
- DataGridView1.Columns(0).HeaderText = "NoRekamMedis"
- DataGridView1.Columns(1).HeaderText = "Kode Tindakan"
- DataGridView1.Columns(2).HeaderText = "Kode Obat"
- DataGridView1.Columns(3).HeaderText = "Kode User"
- DataGridView1.Columns(4).HeaderText = "No Pasien"
- DataGridView1.Columns(5).HeaderText = "Diagnosa"
- DataGridView1.Columns(6).HeaderText = "Resep"
- DataGridView1.Columns(7).HeaderText = "Keluhan"
- DataGridView1.Columns(8).HeaderText = "Tgl Pemeriksa"
- DataGridView1.Columns(9).HeaderText = "Keterangan"
- End Sub
- Sub bukatabelrekammedis()
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM rekam_medis"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End Sub
- Sub bukatabeltindakan()
- cmd = New SqlCommand("SELECT * FROM tindakan", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbkdtindakan.Items.Add(rd("kd_tindakan") & " | " & (rd("nm_tindakan")))
- End While
- rd.Close()
- End Sub
- Sub bukatabelobat()
- cmd = New SqlCommand("SELECT * FROM obat", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbkdobat.Items.Add(rd("kd_obat") & " | " & (rd("nm_obat")))
- End While
- rd.Close()
- End Sub
- Sub bukatabeluser()
- cmd = New SqlCommand("SELECT kd_user FROM login", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbkduser.Items.Add(rd("kd_user"))
- End While
- rd.Close()
- End Sub
- Sub bukanopasien()
- cmd = New SqlCommand("SELECT * FROM pasien", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbnopas.Items.Add(rd("no_pasien") & " | " & (rd("nm_pasien")))
- End While
- rd.Close()
- End Sub
- Sub kodeotomatis()
- cmd = New SqlCommand("SELECT no_rm FROM rekam_medis ORDER BY no_rm DESC", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- rd.Read()
- If Not rd.HasRows Then
- txtrekmedis.Text = "RM001"
- Else
- txtrekmedis.Text = Val(Microsoft.VisualBasic.Mid(rd.Item("no_rm").ToString, 3, 3)) + 1
- If Len(txtrekmedis.Text) = 1 Then
- txtrekmedis.Text = "RM00" & txtrekmedis.Text & ""
- ElseIf Len(txtrekmedis.Text) = 2 Then
- txtrekmedis.Text = "RM0" & txtrekmedis.Text & ""
- ElseIf Len(txtrekmedis.Text) = 3 Then
- txtrekmedis.Text = "RM" & txtrekmedis.Text & ""
- End If
- End If
- rd.Close()
- End Sub
- Private Sub btntambah_Click(sender As Object, e As EventArgs) Handles btntambah.Click
- cmd.Connection = cn
- cmd.CommandText = "INSERT INTO rekam_medis VALUES ('" & txtrekmedis.Text & "','" & tindakan & "','" & obat & "','" & cbkduser.Text & _
- "','" & pasien & "','" & txtdiagnosa.Text & "','" & txtresep.Text & "','" & txtkeluhan.Text & "','" & tglperiksa.Value & "','" & txtket.Text & "')"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Masukan")
- bersih()
- bukatabelrekammedis()
- kodeotomatis()
- End Sub
- Private Sub btnubah_Click(sender As Object, e As EventArgs) Handles btnubah.Click
- cmd.Connection = cn
- cmd.CommandText = "UPDATE rekam_medis SET kd_tindakan = '" & cbkdtindakan.Text & "',kd_obat= '" & obat & "', kd_user= '" & tindakan &"', no_pasien ='" & cbnopas.Text & _
- "', diagnosa = '" & txtdiagnosa.Text & "', resep = '" & txtresep.Text & "', keluhan ='" & txtkeluhan.Text & "', tgl_pemeriksaan ='" & tglperiksa.Value & "',ket = '" & txtket.Text & "' WHERE no_rm ='" & txtrekmedis.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Ubah")
- bersih()
- bukatabelrekammedis()
- kodeotomatis()
- End Sub
- Private Sub btnhapus_Click(sender As Object, e As EventArgs) Handles btnhapus.Click
- cmd.Connection = cn
- cmd.CommandText = "DELETE FROM rekam_medis WHERE no_rm ='" & txtrekmedis.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Hapus")
- bersih()
- bukatabelrekammedis()
- kodeotomatis()
- End Sub
- Private Sub rekam_medis_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- bukatabelrekammedis()
- header()
- bukanopasien()
- bukatabelobat()
- bukatabeltindakan()
- bukatabeluser()
- kodeotomatis()
- End Sub
- Private Sub DataGridView1_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs)
- txtrekmedis.Text = DataGridView1.SelectedCells(0).Value.ToString
- cbkdtindakan.Text = DataGridView1.SelectedCells(1).Value.ToString
- cbkdobat.Text = DataGridView1.SelectedCells(2).Value.ToString
- cbkduser.Text = DataGridView1.SelectedCells(3).Value.ToString
- cbnopas.Text = DataGridView1.SelectedCells(4).Value.ToString
- txtdiagnosa.Text = DataGridView1.SelectedCells(5).Value.ToString
- txtkeluhan.Text = DataGridView1.SelectedCells(6).Value.ToString
- txtresep.Text = DataGridView1.SelectedCells(7).Value.ToString
- tglperiksa.Text = DataGridView1.SelectedCells(8).Value.ToString
- txtket.Text = DataGridView1.SelectedCells(9).Value.ToString
- End Sub
- Private Sub Label13_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
- End Sub
- Private Sub txtcari_TextChanged(sender As Object, e As EventArgs) Handles txtcari.TextChanged
- If txtcari.Text = "" Then
- bukatabelrekammedis()
- Else
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM rekam_medis WHERE (no_rm like '" & txtcari.Text & "%') OR (kd_tindakan Like'" & txtcari.Text &"%')"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End If
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- End Sub
- Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter
- End Sub
- Private Sub cbnopas_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbnopas.SelectedIndexChanged
- pasien = Mid(cbnopas.Text, 1, 6)
- End Sub
- Private Sub cbkdobat_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbkdobat.SelectedIndexChanged
- obat = Mid(cbkdobat.Text, 1, 6)
- End Sub
- Private Sub cbkdtindakan_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbkdtindakan.SelectedIndexChanged
- tindakan = Mid(cbkdtindakan.Text, 1, 6)
- End Sub
- End Class
Form diatas Terdiri dari label,button,textbox,panel,datagridview,grupbox
- Imports System.Data.SqlClient
- Public Class pasien
- Dim jen_kel As String
- Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles txtalamat.TextChanged
- End Sub
- Sub tampildatapasien()
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM pasien"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End Sub
- Private Sub pasien_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- kodeotomatis()
- cari()
- kategori()
- tampildatapasien()
- End Sub
- Sub bersih()
- txtnopasien.Text = ""
- txtnmpasien.Text = ""
- txtagama.Text = ""
- txtalamat.Text = ""
- tgllahir.Text = ""
- txtusia.Text = ""
- txtnotelp.Text = ""
- txtnokk.Text = ""
- txthubkel.Text = ""
- txtcari.Text = ""
- End Sub
- Sub kodeotomatis()
- cmd = New SqlCommand("SELECT no_pasien FROM pasien ORDER BY no_pasien DESC", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- rd.Read()
- If Not rd.HasRows Then
- txtnopasien.Text = "NP001"
- Else
- txtnopasien.Text = Val(Microsoft.VisualBasic.Mid(rd.Item("no_pasien").ToString, 3, 3)) + 1
- If Len(txtnopasien.Text) = 1 Then
- txtnopasien.Text = "NP00" & txtnopasien.Text & ""
- ElseIf Len(txtnopasien.Text) = 2 Then
- txtnopasien.Text = "NP0" & txtnopasien.Text & ""
- ElseIf Len(txtnopasien.Text) = 3 Then
- txtnopasien.Text = "NP" & txtnopasien.Text & ""
- End If
- End If
- rd.Close()
- End Sub
- Sub kategori()
- cbcari.Items.Add("Nomor Pasien")
- cbcari.Items.Add("Nama Pasien")
- End Sub
- Sub cari()
- If cbcari.Text = "Nomor Pasien" Then
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM pasien WHERE no_pasien like '%" & txtcari.Text & "%'"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- ElseIf cbcari.Text = "Nama Pasien" Then
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM pasien WHERE nm_pasien like '%" & txtcari.Text & "%'"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End If
- End Sub
- Sub jenkel()
- If rblaki.Checked Then
- jen_kel = "Laki - Laki"
- ElseIf rbprmpuan.Checked Then
- jen_kel = "Perempuan"
- End If
- End Sub
- Private Sub btntambah_Click(sender As Object, e As EventArgs)
- jenkel()
- cmd.Connection = cn
- cmd.CommandText = ("INSERT INTO pasien VALUES ('" & txtnopasien.Text & "','" & txtnmpasien.Text & "','" & jen_kel & "','" & txtagama.Text & "','" & txtalamat.Text & "','" & tgllahir.Value & "','" & txtusia.Text & "','" & txtnotelp.Text & "','" & txtnokk.Text &"','" & txthubkel.Text & "')")
- cmd.ExecuteNonQuery()
- MsgBox("Data Berhasil Dimasukan")
- bersih()
- tampildatapasien()
- End Sub
- Private Sub btnubah_Click(sender As Object, e As EventArgs)
- jenkel()
- cmd.Connection = cn
- cmd.CommandText = "UPDATE pasien SET nm_pasien='" & txtnmpasien.Text & "',j_kel='" & jen_kel & "',agama='" & txtagama.Text &"',alamat='" & txtalamat.Text & "',tgl_lhr='" & tgllahir.Value & "',usia='" & txtusia.Text & "',no_tlp='" & txtnotelp.Text & "',nm_kk='" & txtnokk.Text & "', hub_kel='" & txthubkel.Text & "' WHERE no_pasien='" & txtnopasien.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Ubah")
- bersih()
- tampildatapasien()
- End Sub
- Private Sub DataGridView1_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
- txtnopasien.Text = DataGridView1.SelectedCells(0).Value
- txtnmpasien.Text = DataGridView1.SelectedCells(1).Value
- If DataGridView1.SelectedCells(2).Value = "Laki - Laki" Then
- rblaki.Checked = True
- ElseIf DataGridView1.SelectedCells(2).Value = "perempuan" Then
- rbprmpuan.Checked = True
- End If
- txtagama.Text = DataGridView1.SelectedCells(3).Value
- txtalamat.Text = DataGridView1.SelectedCells(4).Value
- tgllahir.Text = DataGridView1.SelectedCells(5).Value
- txtusia.Text = DataGridView1.SelectedCells(6).Value
- txtnotelp.Text = DataGridView1.SelectedCells(7).Value
- txtnokk.Text = DataGridView1.SelectedCells(8).Value
- txthubkel.Text = DataGridView1.SelectedCells(9).Value
- End Sub
- Private Sub btnhapus_Click(sender As Object, e As EventArgs)
- cmd.Connection = cn
- cmd.CommandText = "DELETE FROM pasien WHERE no_pasien='" & txtnopasien.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Hapus")
- bersih()
- tampildatapasien()
- End Sub
- Private Sub txtcari_TextChanged(sender As Object, e As EventArgs) Handles txtcari.TextChanged
- cari()
- End Sub
- Private Sub txtnopasien_TextChanged(sender As Object, e As EventArgs) Handles txtnopasien.TextChanged
- End Sub
- Private Sub txtagama_TextChanged(sender As Object, e As EventArgs) Handles txtagama.TextChanged
- End Sub
- Private Sub btntambah_Click_1(sender As Object, e As EventArgs) Handles btntambah.Click
- jenkel()
- cmd.Connection = cn
- cmd.CommandText = ("INSERT INTO pasien VALUES ('" & txtnopasien.Text & "','" & txtnmpasien.Text & "','" & jen_kel & "','" & txtagama.Text & "','" & txtalamat.Text & "','" & tgllahir.Value & "','" & txtusia.Text & "','" & txtnotelp.Text & "','" & txtnokk.Text &"','" & txthubkel.Text & "')")
- cmd.ExecuteNonQuery()
- MsgBox("Data Berhasil Dimasukan")
- bersih()
- tampildatapasien()
- kodeotomatis()
- End Sub
- Private Sub btnubah_Click_1(sender As Object, e As EventArgs) Handles btnubah.Click
- jenkel()
- cmd.Connection = cn
- cmd.CommandText = "UPDATE pasien SET nm_pasien='" & txtnmpasien.Text & "',j_kel='" & jen_kel & "',agama='" & txtagama.Text &"',alamat='" & txtalamat.Text & "',tgl_lhr='" & tgllahir.Value & "',usia='" & txtusia.Text & "',no_tlp='" & txtnotelp.Text & "',nm_kk='" & txtnokk.Text & "', hub_kel='" & txthubkel.Text & "' WHERE no_pasien='" & txtnopasien.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Ubah")
- bersih()
- tampildatapasien()
- kodeotomatis()
- End Sub
- Private Sub btnhapus_Click_1(sender As Object, e As EventArgs) Handles btnhapus.Click
- cmd.Connection = cn
- cmd.CommandText = "DELETE FROM pasien WHERE no_pasien='" & txtnopasien.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Hapus")
- bersih()
- tampildatapasien()
- kodeotomatis()
- End Sub
- End Class
Form diatas Terdiri dari label,button,textbox,panel,datagridview,grupbox
Berikut script pada form dokter diatas
- Imports System.Data.SqlClient
- Public Class dokter
- Dim poliklinik As String
- Sub bersih()
- txtkddokter.Text = ""
- cbkdpoliklinik.Text = ""
- cbkduser.Text = ""
- txtnmdokter.Text = ""
- txtsip.Text = ""
- txtlahir.Text = ""
- txtnotelp.Text = ""
- txtalamat.Text = ""
- End Sub
- Sub kategori()
- cbcari.Items.Add("Kode Dokter")
- cbcari.Items.Add("Nama Dokter")
- End Sub
- Sub cari()
- If cbcari.Text = "Kode Dokter" Then
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM dokter WHERE kd_dokter like '%" & txtcari.Text & "%'"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- ElseIf cbcari.Text = "Nama Dokter" Then
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM dokter WHERE nm_dokter like '%" & txtcari.Text & "%'"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End If
- End Sub
- Sub tampildata()
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM dokter"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End Sub
- Sub kodeotomatis()
- cmd = New SqlCommand("SELECT kd_dokter FROM dokter ORDER BY kd_dokter DESC", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- rd.Read()
- If Not rd.HasRows Then
- txtkddokter.Text = "KD001"
- Else
- txtkddokter.Text = Val(Microsoft.VisualBasic.Mid(rd.Item("kd_dokter").ToString, 3, 3)) + 1
- If Len(txtkddokter.Text) = 1 Then
- txtkddokter.Text = "KD00" & txtkddokter.Text & ""
- ElseIf Len(txtkddokter.Text) = 2 Then
- txtkddokter.Text = "KD0" & txtkddokter.Text & ""
- ElseIf Len(txtkddokter.Text) = 3 Then
- txtkddokter.Text = "KD" & txtkddokter.Text & ""
- End If
- End If
- rd.Close()
- End Sub
- Sub header()
- DataGridView1.Columns(0).HeaderText = "Kode Dokter"
- DataGridView1.Columns(1).HeaderText = "Kode Poliklinik"
- DataGridView1.Columns(2).HeaderText = "Kode User"
- DataGridView1.Columns(3).HeaderText = "Nama Dokter"
- DataGridView1.Columns(4).HeaderText = "SIP"
- DataGridView1.Columns(5).HeaderText = "Tempat Lahir"
- DataGridView1.Columns(6).HeaderText = "No Telpone"
- DataGridView1.Columns(7).HeaderText = "Alamat"
- End Sub
- Private Sub dokter_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- tampildata()
- header()
- kodeotomatis()
- bukatabelpoliklinik()
- bukatabeluser()
- kategori()
- End Sub
- Sub bukatabelpoliklinik()
- cmd = New SqlCommand("SELECT * FROM poliklinik", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbkdpoliklinik.Items.Add(rd("kd_poli") & " | " & (rd("nm_poli")))
- End While
- rd.Close()
- End Sub
- Sub bukatabeluser()
- cmd = New SqlCommand("SELECT kd_user FROM login", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbkduser.Items.Add(rd("kd_user"))
- End While
- rd.Close()
- End Sub
- Private Sub btntambah_Click(sender As Object, e As EventArgs)
- cmd.Connection = cn
- cmd.CommandText = "INSERT INTO dokter VALUES ('" & txtkddokter.Text & "','" & cbkdpoliklinik.Text & "','" & cbkduser.Text & "','" & txtnmdokter.Text & "','" & txtsip.Text & "','" & txtlahir.Text & "','" & txtnotelp.Text & "','" & txtalamat.Text & "')"
- cmd.ExecuteNonQuery()
- MsgBox("Data Sukses Di Masukan")
- tampildata()
- bersih()
- kodeotomatis()
- End Sub
- Private Sub btnubah_Click(sender As Object, e As EventArgs)
- cmd.Connection = cn
- cmd.CommandText = "UPDATE dokter SET kd_poli = '" & cbkdpoliklinik.Text & "', kd_user = '" & cbkduser.Text & "', nm_dokter = '" & txtnmdokter.Text & "', sip = '" & txtsip.Text & "', tmpt_lhr = '" & txtlahir.Text & "', no_telp = '" & txtnotelp.Text & "', alamat = '" & txtalamat.Text & "' WHERE kd_dokter = '" & txtkddokter.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox(" Data Sukses Di Ubah ")
- bersih()
- tampildata()
- kodeotomatis()
- End Sub
- Private Sub btnhapus_Click(sender As Object, e As EventArgs)
- cmd.Connection = cn
- cmd.CommandText = "DELETE FROM dokter WHERE kd_dokter='" & txtkddokter.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Sukses Di Hapus")
- bersih()
- tampildata()
- kodeotomatis()
- End Sub
- Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
- End Sub
- Private Sub DataGridView1_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
- txtkddokter.Text = DataGridView1.SelectedCells(0).Value.ToString
- cbkdpoliklinik.Text = DataGridView1.SelectedCells(1).Value.ToString
- cbkduser.Text = DataGridView1.SelectedCells(2).Value.ToString
- txtnmdokter.Text = DataGridView1.SelectedCells(3).Value.ToString
- txtsip.Text = DataGridView1.SelectedCells(4).Value.ToString
- txtlahir.Text = DataGridView1.SelectedCells(5).Value.ToString
- txtnotelp.Text = DataGridView1.SelectedCells(6).Value.ToString
- txtalamat.Text = DataGridView1.SelectedCells(7).Value.ToString
- End Sub
- Private Sub txtcari_TextChanged(sender As Object, e As EventArgs) Handles txtcari.TextChanged
- cari()
- End Sub
- Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter
- End Sub
- Private Sub btntambah_Click_1(sender As Object, e As EventArgs) Handles btntambah.Click
- cmd.Connection = cn
- cmd.CommandText = "INSERT INTO dokter VALUES ('" & txtkddokter.Text & "','" & poliklinik & "','" & cbkduser.Text & "','" & txtnmdokter.Text & "','" & txtsip.Text & "','" & txtlahir.Text & "','" & txtnotelp.Text & "','" & txtalamat.Text & "')"
- cmd.ExecuteNonQuery()
- MsgBox("Data Sukses Di Masukan")
- tampildata()
- bersih()
- kodeotomatis()
- End Sub
- Private Sub btnubah_Click_1(sender As Object, e As EventArgs) Handles btnubah.Click
- cmd.Connection = cn
- cmd.CommandText = "UPDATE dokter SET kd_poli = '" & poliklinik & "', kd_user = '" & cbkduser.Text & "', nm_dokter = '" & txtnmdokter.Text & "', sip = '" & txtsip.Text & "', tmpt_lhr = '" & txtlahir.Text & "', no_tep = '" & txtnotelp.Text & "', alamat = '" & txtalamat.Text & "' WHERE kd_dokter = '" & txtkddokter.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox(" Data Sukses Di Ubah ")
- bersih()
- tampildata()
- kodeotomatis()
- End Sub
- Private Sub btnhapus_Click_1(sender As Object, e As EventArgs) Handles btnhapus.Click
- cmd.Connection = cn
- cmd.CommandText = "DELETE FROM dokter WHERE kd_dokter='" & txtkddokter.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Sukses Di Hapus")
- bersih()
- tampildata()
- kodeotomatis()
- End Sub
- Private Sub cbkdpoliklinik_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbkdpoliklinik.SelectedIndexChanged
- poliklinik = Mid(cbkdpoliklinik.Text, 1, 6)
- End Sub
- End Class
Form diatas Terdiri dari label,button,textbox.
Berikut script pada form login diatas
- Imports System.Data.SqlClient
- Public Class first
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- login()
- End Sub
- Private Sub first_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- login()
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs)
- Application.Exit()
- End Sub
- Sub login()
- cmd.Connection = cn
- cmd.CommandText = "SELECT PASSWORD FROM login WHERE password = '" & TextBox1.Text & "' AND PASSWORD ='" & TextBox2.Text & "'"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- rd.Read()
- If rd.HasRows Then
- Me.Hide()
- Home.Show()
- TextBox1.Clear()
- TextBox2.Clear()
- Else
- MessageBox.Show("Data Salah")
- End If
- rd.Close()
- End Sub
- Private Sub TextBox2_KeyPress(sender As Object, e As KeyPressEventArgs)
- If e.KeyChar = Chr(13) Then
- MsgBox("Kayaknya Bisa")
- End If
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- Me.Close()
- End Sub
- End Class
- Imports System.Data.SqlClient
- Public Class kunjungan
- Sub tampildatakunjungan()
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM kunjungan"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End Sub
- Sub kategori()
- cbcari.Items.Add("Nomor Pasien")
- End Sub
- Sub cari()
- cbcari.Text = "Nomor Pasien"
- cmd.Connection = cn
- cmd.CommandText = "SELECT * FROM pasien WHERE no_pasien like '%" & txtcari.Text & "%'"
- Dim rd As SqlDataReader = cmd.ExecuteReader
- Dim dt As New DataTable
- dt.Load(rd)
- DataGridView1.DataSource = dt
- End Sub
- Sub bukatabelpoliklinik()
- cmd = New SqlCommand("SELECT kd_poli FROM poliklinik", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbkdpol.Items.Add(rd("kd_poli"))
- End While
- rd.Close()
- End Sub
- Private Sub kunjungan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- tampildatakunjungan()
- bukatabelpoliklinik()
- bukatabelpasien()
- bukatabeldokter()
- kategori()
- End Sub
- Sub bukatabelpasien()
- cmd = New SqlCommand("SELECT no_pasien FROM pasien", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbnopas.Items.Add(rd("no_pasien"))
- End While
- rd.Close()
- End Sub
- Sub bukatabeldokter()
- cmd = New SqlCommand("SELECT kd_dokter FROM dokter", cn)
- Dim rd As SqlDataReader = cmd.ExecuteReader
- While rd.Read
- cbkddok.Items.Add(rd("kd_dokter"))
- End While
- rd.Close()
- End Sub
- Sub bersih()
- tglkunjungan.Text = ""
- cbnopas.Text = ""
- cbkddok.Text = ""
- cbkdpol.Text = ""
- jam.Text = ""
- End Sub
- Private Sub btntambah_Click(sender As Object, e As EventArgs) Handles btntambah.Click
- cmd.Connection = cn
- cmd.CommandText = ("INSERT INTO kunjungan VALUES ('" & tglkunjungan.Value & "','" & cbkddok.Text & "','" & cbnopas.Text & "','" &cbkdpol.Text & "','" & jam.Value & "')")
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Masukan")
- bersih()
- tampildatakunjungan()
- End Sub
- Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
- End Sub
- Private Sub DataGridView1_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) HandlesDataGridView1.CellMouseDoubleClick
- tglkunjungan.Value = DataGridView1.SelectedCells(0).Value
- cbnopas.Text = DataGridView1.SelectedCells(1).Value
- cbkddok.Text = DataGridView1.SelectedCells(2).Value
- cbkdpol.Text = DataGridView1.SelectedCells(3).Value
- jam.Text = DataGridView1.SelectedCells(4).FormattedValue
- End Sub
- Private Sub btnhapus_Click(sender As Object, e As EventArgs) Handles btnhapus.Click
- cmd.Connection = cn
- cmd.CommandText = "DELETE FROM kunjungan WHERE tgl_kunjungan='" & tglkunjungan.Value & "' and no_pasien='" & cbnopas.Text & "'"
- cmd.ExecuteNonQuery()
- MsgBox("Data Telah Di Hapus")
- bersih()
- tampildatakunjungan()
- End Sub
- Private Sub txtcari_TextChanged(sender As Object, e As EventArgs) Handles txtcari.TextChanged
- cari()
- End Sub
- End Class
0 komentar:
Post a Comment