APLIKASI RUMAH SAKIT RAWAT JALAN VB.NET

KONSULTASIVB.COM

 

 

 

Module

 

Imports System.Data.OleDb

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

 

Module Module1

 

    Public Conn As OleDbConnection

    Public DA As OleDbDataAdapter

    Public DS As DataSet

    Public CMD As OleDbCommand

    Public DR As OleDbDataReader

 

    Public laporan As New ReportDocument

    Public TabelLogon As CrystalDecisions.Shared.TableLogOnInfo

 

    Public Sub SetingLaporan()

        Dim BacaTabel As CrystalDecisions.CrystalReports.Engine.Table

        For Each BacaTabel In laporan.Database.Tables

            TabelLogon = BacaTabel.LogOnInfo

            With TabelLogon.ConnectionInfo

                .ServerName = Application.StartupPath & "\rawatjalan.mdb"

                .UserID = ""

                .Password = ""

                .DatabaseName = ""

            End With

            BacaTabel.ApplyLogOnInfo(TabelLogon)

        Next BacaTabel

    End Sub

 

    Public Sub Koneksi()

        Try

            Conn = New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=rawatjalan.mdb")

            Conn.Open()

        Catch ex As Exception

            MsgBox(ex.Message)

            End

        End Try

    End Sub

End Module

 

 

Imports System.Data.OleDb

 

Public Class frmLogin

 

    Private Sub tnama_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Tnama.KeyPress

        If e.KeyChar = Chr(13) Then Tpassword.Focus()

    End Sub

 

    Private Sub tpassword_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Tpassword.KeyPress

        If e.KeyChar = Chr(13) Then BTNOK.Focus()

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNOK.Click

        Call Koneksi()

        CMD = New OleDbCommand("select * from muser where nama_user='" & Tnama.Text & "' and password_user='" & Tpassword.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            MsgBox("Login gagal")

            Tnama.Clear()

            Tpassword.Clear()

            Tnama.Focus()

        Else

            Me.Visible = False

            frmmenu.Show()

            frmmenu.PanelKode.Text = DR.Item("kode_User")

            frmmenu.PanelNama.Text = DR.Item("nama_User")

            frmmenu.PanelStatus.Text = UCase(DR.Item("level_User"))

            If frmmenu.PanelStatus.Text <> "ADMIN" Then

                frmmenu.UserToolStripMenuItem.Enabled = False

            End If

        End If

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCanel.Click

        End

    End Sub

 

    Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

    End Sub

End Class

 

 

 

Imports System.Data.OleDb

 

Public Class frmmenu

 

    Private Sub UserToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserToolStripMenuItem.Click

        frmuser.Show()

    End Sub

 

    Private Sub PoliToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PoliToolStripMenuItem.Click

        frmpoli.Show()

    End Sub

 

    Private Sub ObatToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ObatToolStripMenuItem.Click

        frmobat.Show()

    End Sub

 

    Private Sub DokterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DokterToolStripMenuItem.Click

        frmdokter.Show()

    End Sub

 

    Private Sub PasienToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasienToolStripMenuItem.Click

        frmpasien.Show()

    End Sub

 

    Private Sub PendaftaranToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PendaftaranToolStripMenuItem.Click

        frmtpendaftaran.Show()

    End Sub

 

    Private Sub ResepToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResepToolStripMenuItem.Click

        frmtresep.Show()

    End Sub

 

    Private Sub TutupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TutupToolStripMenuItem.Click

        End

    End Sub

 

    Private Sub frmmenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        On Error Resume Next

        Me.WindowState = FormWindowState.Maximized

        PictureBox1.Load("1.jpg")

        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage

    End Sub

 

    Private Sub PembayaranToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PembayaranToolStripMenuItem.Click

        frmtpembayaran.Show()

    End Sub

 

    Private Sub UjiSqlToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UjiSqlToolStripMenuItem.Click

        UjiSql.Show()

    End Sub

 

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNPembayaran.Click

        frmtpembayaran.Show()

    End Sub

 

    Private Sub BTNUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNUser.Click

        frmuser.Show()

    End Sub

 

    Private Sub BTNPoli_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNPoli.Click

        frmpoli.Show()

    End Sub

 

    Private Sub BTNObat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNObat.Click

        frmobat.Show()

    End Sub

 

    Private Sub BTNDokter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNDokter.Click

        frmdokter.Show()

    End Sub

 

    Private Sub BTNPasien_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNPasien.Click

        frmpasien.Show()

    End Sub

 

    Private Sub BTNPendaftaran_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNPendaftaran.Click

        frmtpendaftaran.Show()

    End Sub

 

    Private Sub BTNResep_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNResep.Click

        frmtresep.Show()

    End Sub

 

    Private Sub BTNlapmaster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNlapmaster.Click

        frmtlaporanmaster.Show()

    End Sub

 

    Private Sub BTNLappendaftaran_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNLappendaftaran.Click

        frmtlaporanpendaftaran.Show()

    End Sub

 

    Private Sub BTNLapresep_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNLapresep.Click

        frmtlaporanresep.Show()

    End Sub

 

    Private Sub BTNLappembayaran_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNLappembayaran.Click

        frmtlaporanpembayaran.Show()

    End Sub

 

    Private Sub BTNTutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNTutup.Click

        If MessageBox.Show("Tutup aplikasi...?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

            End

        End If

    End Sub

 

    Private Sub BTNLogoff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNLogoff.Click

        Me.Close()

        frmLogin.Show()

        frmLogin.Tnama.Clear()

        frmLogin.Tpassword.Clear()

        frmLogin.Tnama.Focus()

    End Sub

 

    Private Sub GantiBackgroundToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GantiBackgroundToolStripMenuItem.Click

        On Error Resume Next

        OpenFileDialog1.InitialDirectory = Application.StartupPath

        OpenFileDialog1.ShowDialog()

        OpenFileDialog1.Filter = "(*.jpg)|*.jpg|(*.bmp)|*.bmp|(*.png)|*.png"

        PictureBox1.Load(OpenFileDialog1.FileName)

        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        frmtlaporanmedis.Show()

    End Sub

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmuser

 

    Sub otomatis()

        CMD = New OleDbCommand("select kode_user from muser order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            tkode.Text = "USR01"

        Else

            tkode.Text = "USR" + Format(Microsoft.VisualBasic.Right(DR(0), 2) + 1, "00")

        End If

        tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call otomatis()

        tnama.Text = "-"

        tpassword.Text = "-"

        cmbhakakses.Text = "Pilih"

        tcaridata.Text = ""

        tnama.Focus()

        Call TampilGrid()

        Call tampilhak()

    End Sub

 

    Sub DataBaru()

        tnama.Text = "-"

        tpassword.Text = "-"

        cmbhakakses.Text = "Pilih"

        tcaridata.Text = ""

        tnama.Focus()

    End Sub

 

    Sub Ketemu()

        On Error Resume Next

        tnama.Text = DR(1)

        tpassword.Text = DR(2)

        cmbhakakses.Text = DR(3)

        tnama.Focus()

    End Sub

 

    Sub tampilhak()

        CMD = New OleDbCommand("select distinct level_user from muser", Conn)

        DR = CMD.ExecuteReader

        cmbhakakses.Items.Clear()

        Do While DR.Read

            cmbhakakses.Items.Add(DR(0))

        Loop

    End Sub

 

    Sub CariKode()

        CMD = New OleDbCommand("select * from muser where kode_user='" & tkode.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

    End Sub

 

    Sub TampilGrid()

        DA = New OleDbDataAdapter("select * from muser", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub frmuser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Call CariKode()

        If Not DR.HasRows Then

            Dim simpan As String = "insert into muser values ('" & tkode.Text & "','" & tnama.Text & "','" & tpassword.Text & "','" & cmbhakakses.Text & "','AKTIF')"

            CMD = New OleDbCommand(simpan, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Dim edit As String = "update muser set nama_user='" & tnama.Text & "',password_user='" & tpassword.Text & "',level_user='" & cmbhakakses.Text & "' where kode_user='" & tkode.Text & "'"

            CMD = New OleDbCommand(edit, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Call CariKode()

        If Not DR.HasRows Then

            MsgBox("user tidak terdaftar")

            Exit Sub

        End If

 

        If MessageBox.Show("yakin akan dihapus...?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

            Dim hapus As String = "delete * from  muser where kode_user='" & tkode.Text & "'"

            CMD = New OleDbCommand(hapus, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Call Kosongkan()

    End Sub

 

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        Me.Close()

    End Sub

 

    Private Sub tcaridata_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tcaridata.TextChanged

        DA = New OleDbDataAdapter("select * from muser where kode_user like '%" & tcaridata.Text & "%' or nama_user like '%" & tcaridata.Text & "%'", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub DGV_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV.CellMouseClick

        On Error Resume Next

        tkode.Text = DGV.Rows(e.RowIndex).Cells(0).Value

        Call CariKode()

        If DR.HasRows Then

            Call Ketemu()

        End If

    End Sub

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmpoli

 

    Sub otomatis()

        CMD = New OleDbCommand("select kode_poli from mpoli order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            tkode.Text = "PLI01"

        Else

            tkode.Text = "PLI" + Format(Microsoft.VisualBasic.Right(DR(0), 2) + 1, "00")

        End If

        tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call otomatis()

        tnama.Text = "-"

        tcaridata.Text = ""

        tnama.Focus()

        Call TampilGrid()

 

    End Sub

 

    Sub DataBaru()

        tnama.Text = "-"

        tcaridata.Text = ""

        tnama.Focus()

    End Sub

 

    Sub Ketemu()

        On Error Resume Next

        tnama.Text = DR(1)

        tnama.Focus()

    End Sub

 

    Sub CariKode()

        CMD = New OleDbCommand("select * from mpoli where kode_poli='" & tkode.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

    End Sub

 

    Sub TampilGrid()

        DA = New OleDbDataAdapter("select * from mpoli", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub frmpoli_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Call CariKode()

        If Not DR.HasRows Then

            Dim simpan As String = "insert into mpoli values ('" & tkode.Text & "','" & tnama.Text & "')"

            CMD = New OleDbCommand(simpan, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Dim edit As String = "update mpoli set nama_poli='" & tnama.Text & "' where kode_poli='" & tkode.Text & "'"

            CMD = New OleDbCommand(edit, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Call CariKode()

        If Not DR.HasRows Then

            MsgBox("poli tidak terdaftar")

            Exit Sub

        End If

 

        If MessageBox.Show("yakin akan dihapus...?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

            Dim hapus As String = "delete * from  mpoli where kode_poli='" & tkode.Text & "'"

            CMD = New OleDbCommand(hapus, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Call Kosongkan()

    End Sub

 

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        Me.Close()

    End Sub

 

    Private Sub tcaridata_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tcaridata.TextChanged

        DA = New OleDbDataAdapter("select * from mpoli where kode_poli like '%" & tcaridata.Text & "%' or nama_poli like '%" & tcaridata.Text & "%'", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub DGV_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV.CellMouseClick

        On Error Resume Next

        tkode.Text = DGV.Rows(e.RowIndex).Cells(0).Value

        Call CariKode()

        If DR.HasRows Then

            Call Ketemu()

        End If

    End Sub

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmobat

 

    Sub otomatis()

        CMD = New OleDbCommand("select kode_obat from mobat order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            tkode.Text = "OB001"

        Else

            tkode.Text = "OB" + Format(Microsoft.VisualBasic.Right(DR(0), 3) + 1, "000")

        End If

        tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call otomatis()

        tnama.Text = "-"

        cmbsatuan.Text = "Pilih"

        cmbjenis.Text = "Pilih"

        tstok.Text = 0

        ttarif.Text = 0

        tcaridata.Text = ""

        tnama.Focus()

        Call TampilGrid()

        Call Tampilsatuan()

        Call Tampiljenis()

    End Sub

 

    Sub DataBaru()

        tnama.Text = "-"

        cmbsatuan.Text = "Pilih"

        cmbjenis.Text = "Pilih"

        tstok.Text = 0

        ttarif.Text = 0

        tcaridata.Text = ""

        tnama.Focus()

    End Sub

 

    Sub Ketemu()

        On Error Resume Next

        tnama.Text = DR(1)

        cmbsatuan.Text = DR(2)

        cmbjenis.Text = DR(3)

        tstok.Text = DR(4)

        ttarif.Text = DR(5)

        tnama.Focus()

 

    End Sub

 

    Sub Tampilsatuan()

        CMD = New OleDbCommand("select distinct satuan_obat from mobat", Conn)

        DR = CMD.ExecuteReader

        cmbsatuan.Items.Clear()

        Do While DR.Read

            cmbsatuan.Items.Add(DR(0))

        Loop

    End Sub

 

    Sub Tampiljenis()

        CMD = New OleDbCommand("select distinct jenis_Obat from mobat", Conn)

        DR = CMD.ExecuteReader

        cmbjenis.Items.Clear()

        Do While DR.Read

            cmbjenis.Items.Add(DR(0))

        Loop

    End Sub

 

    Sub CariKode()

        CMD = New OleDbCommand("select * from mobat where kode_obat='" & tkode.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

    End Sub

 

    Sub TampilGrid()

        DA = New OleDbDataAdapter("select * from mobat", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub frmobat_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Call CariKode()

        If Not DR.HasRows Then

            Dim simpan As String = "insert into mobat values ('" & tkode.Text & "','" & tnama.Text & "','" & cmbsatuan.Text & "','" & cmbjenis.Text & "','" & tstok.Text & "','" & ttarif.Text & "','AKTIF')"

            CMD = New OleDbCommand(simpan, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Dim edit As String = "update mobat set nama_obat='" & tnama.Text & "',satuan_obat='" & cmbsatuan.Text & "',jenis_obat='" & cmbjenis.Text & "',stok_obat='" & tstok.Text & "',tarif_obat='" & ttarif.Text & "' where kode_obat='" & tkode.Text & "'"

            CMD = New OleDbCommand(edit, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Call CariKode()

        If Not DR.HasRows Then

            MsgBox("obat tidak terdaftar")

            Exit Sub

        End If

 

        If MessageBox.Show("yakin akan dihapus...?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

            Dim hapus As String = "delete * from  mobat where kode_obat='" & tkode.Text & "'"

            CMD = New OleDbCommand(hapus, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Call Kosongkan()

    End Sub

 

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        Me.Close()

    End Sub

 

    Private Sub tcaridata_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tcaridata.TextChanged

        DA = New OleDbDataAdapter("select * from mobat where kode_obat like '%" & tcaridata.Text & "%' or nama_obat like '%" & tcaridata.Text & "%'", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub DGV_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV.CellMouseClick

        On Error Resume Next

        tkode.Text = DGV.Rows(e.RowIndex).Cells(0).Value

        Call CariKode()

        If DR.HasRows Then

            Call Ketemu()

        End If

    End Sub

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmdokter

 

    Sub otomatis()

        CMD = New OleDbCommand("select kode_dokter from mdokter order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            tkode.Text = "DKT01"

        Else

            tkode.Text = "DKT" + Format(Microsoft.VisualBasic.Right(DR(0), 2) + 1, "00")

        End If

        tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call otomatis()

        tnama.Text = "-"

        talamat.Text = "-"

        cmbjeniskelamin.Text = "Pilih"

        ttarif.Text = 0

        ttelepon.Text = "-"

        cmbpoli.Text = "Pilih"

        tcaridata.Text = ""

        tnama.Focus()

        Call TampilGrid()

        Call TampilPoli()

    End Sub

 

    Sub DataBaru()

        tnama.Text = "-"

        talamat.Text = "-"

        cmbjeniskelamin.Text = "Pilih"

        ttarif.Text = 0

        ttelepon.Text = "-"

        cmbpoli.Text = "Pilih"

        tcaridata.Text = ""

        tnama.Focus()

    End Sub

 

    Sub Ketemu()

        On Error Resume Next

        tnama.Text = DR(1)

        talamat.Text = DR(2)

        cmbjeniskelamin.Text = DR(3)

        ttelepon.Text = DR(4)

        ttarif.Text = DR(5)

        cmbpoli.Text = DR(6)

        tnama.Focus()

        Dim kodepoli As String = cmbpoli.Text

        CMD = New OleDbCommand("select * from mpoli where kode_poli='" & cmbpoli.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If DR.HasRows Then

            cmbpoli.Items.Add(DR(0) & Space(2) & DR(1))

        End If

    End Sub

 

    Sub TampilPoli()

        CMD = New OleDbCommand("select * from mpoli ", Conn)

        DR = CMD.ExecuteReader

        cmbpoli.Items.Clear()

        Do While DR.Read

            cmbpoli.Items.Add(DR(0) & Space(2) & DR(1))

        Loop

    End Sub

 

    Sub CariKode()

        CMD = New OleDbCommand("select * from mdokter where kode_dokter='" & tkode.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

    End Sub

 

    Sub TampilGrid()

        DA = New OleDbDataAdapter("select * from mdokter", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub frmdokter_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Call CariKode()

        If Not DR.HasRows Then

            Dim simpan As String = "insert into mdokter values ('" & tkode.Text & "','" & tnama.Text & "','" & talamat.Text & "','" & cmbjeniskelamin.Text & "','" & ttelepon.Text & "','" & ttarif.Text & "','" & Microsoft.VisualBasic.Left(cmbpoli.Text, 5) & "','AKTIF')"

            CMD = New OleDbCommand(simpan, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Dim edit As String = "update mdokter set nama_dokter='" & tnama.Text & "',alamat_dokter='" & talamat.Text & "',gender_dokter='" & cmbjeniskelamin.Text & "',telepon_dokter='" & ttelepon.Text & "',tarif_dokter='" & ttarif.Text & "',kode_poli='" & Microsoft.VisualBasic.Left(cmbpoli.Text, 5) & "' where kode_dokter='" & tkode.Text & "'"

            CMD = New OleDbCommand(edit, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Call CariKode()

        If Not DR.HasRows Then

            MsgBox("dokter tidak terdaftar")

            Exit Sub

        End If

 

        If MessageBox.Show("yakin akan dihapus...?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

            Dim hapus As String = "delete * from  mdokter where kode_dokter='" & tkode.Text & "'"

            CMD = New OleDbCommand(hapus, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Call Kosongkan()

    End Sub

 

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        Me.Close()

    End Sub

 

    Private Sub tcaridata_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tcaridata.TextChanged

        DA = New OleDbDataAdapter("select * from mdokter where kode_dokter like '%" & tcaridata.Text & "%' or nama_dokter like '%" & tcaridata.Text & "%' or alamat_dokter like '%" & tcaridata.Text & "%'", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub DGV_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV.CellMouseClick

        On Error Resume Next

        tkode.Text = DGV.Rows(e.RowIndex).Cells(0).Value

        Call CariKode()

        If DR.HasRows Then

            Call Ketemu()

        End If

    End Sub

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmpasien

 

    Sub otomatis()

        CMD = New OleDbCommand("select kode_pasien from mpasien order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            tkode.Text = "PSN00001"

        Else

            tkode.Text = "PSN" + Format(Microsoft.VisualBasic.Right(DR(0), 5) + 1, "00000")

        End If

        tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call otomatis()

        tnama.Text = "-"

        talamat.Text = "-"

        cmbjeniskelamin.Text = "Pilih"

        ttempatlahir.Text = "-"

        ttelepon.Text = "-"

        cmbgolongandarah.Text = "Pilih"

        cmbpekerjaan.Text = "Pilih"

        cmbagama.Text = "Pilih"

        cmbstatuspernikahan.Text = "Pilih"

        tcaridata.Text = ""

        tnama.Focus()

        Call TampilGrid()

    End Sub

 

    Sub DataBaru()

        tnama.Text = "-"

        talamat.Text = "-"

        cmbjeniskelamin.Text = "Pilih"

        ttempatlahir.Text = "-"

        ttelepon.Text = "-"

        cmbgolongandarah.Text = "Pilih"

        cmbpekerjaan.Text = "Pilih"

        cmbagama.Text = "Pilih"

        cmbstatuspernikahan.Text = "Pilih"

        tcaridata.Text = ""

        tnama.Focus()

    End Sub

 

    Sub Ketemu()

        On Error Resume Next

        tnama.Text = DR(1)

        talamat.Text = DR(2)

        cmbjeniskelamin.Text = DR(3)

        ttempatlahir.Text = DR(4)

        ttanggallahir.Text = DR(5)

        ttelepon.Text = DR(6)

        cmbgolongandarah.Text = DR(7)

        cmbpekerjaan.Text = DR(8)

        cmbagama.Text = DR(9)

        cmbstatuspernikahan.Text = DR(10)

        tnama.Focus()

    End Sub

 

    Sub CariKode()

        CMD = New OleDbCommand("select * from mpasien where kode_pasien='" & tkode.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

    End Sub

 

    Sub TampilGrid()

        DA = New OleDbDataAdapter("select * from mpasien", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub frmpasien_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Call CariKode()

        If Not DR.HasRows Then

            Dim simpan As String = "insert into mpasien values ('" & tkode.Text & "','" & tnama.Text & "','" & talamat.Text & "','" & cmbjeniskelamin.Text & "','" & ttempatlahir.Text & "','" & ttanggallahir.Text & "','" & ttelepon.Text & "','" & cmbgolongandarah.Text & "','" & cmbpekerjaan.Text & "','" & cmbagama.Text & "','" & cmbstatuspernikahan.Text & "')"

            CMD = New OleDbCommand(simpan, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Dim edit As String = "update mpasien set nama_pasien='" & tnama.Text & "',alamat_pasien='" & talamat.Text & "',gender_pasien='" & cmbjeniskelamin.Text & "',tempatlahir_pasien='" & ttempatlahir.Text & "',tanggallahir_pasien='" & ttanggallahir.Text & "',telepon_pasien='" & ttelepon.Text & "',golongandarah_pasien='" & cmbgolongandarah.Text & "',pekerjaan_pasien='" & cmbpekerjaan.Text & "',agama_pasien='" & cmbagama.Text & "',statuspernikahan_pasien='" & cmbstatuspernikahan.Text & "' where kode_pasien='" & tkode.Text & "'"

            CMD = New OleDbCommand(edit, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Call CariKode()

        If Not DR.HasRows Then

            MsgBox("Pasien tidak terdaftar")

            Exit Sub

        End If

 

        If MessageBox.Show("yakin akan dihapus...?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

            Dim hapus As String = "delete * from  mpasien where kode_pasien='" & tkode.Text & "'"

            CMD = New OleDbCommand(hapus, Conn)

            CMD.ExecuteNonQuery()

            Call Kosongkan()

        Else

            Call Kosongkan()

        End If

    End Sub

 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Call Kosongkan()

    End Sub

 

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        Me.Close()

    End Sub

 

    Private Sub tcaridata_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tcaridata.TextChanged

        DA = New OleDbDataAdapter("select * from mpasien where kode_pasien like '%" & tcaridata.Text & "%' or nama_pasien like '%" & tcaridata.Text & "%' or alamat_pasien like '%" & tcaridata.Text & "%'", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Private Sub DGV_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV.CellMouseClick

        On Error Resume Next

        tkode.Text = DGV.Rows(e.RowIndex).Cells(0).Value

        Call CariKode()

        If DR.HasRows Then

            Call Ketemu()

        End If

    End Sub

End Class

 

Imports System.Data.OleDb

 

Public Class frmtpendaftaran

 

    Sub kodeotomatis()

        CMD = New OleDbCommand("select kode_pendaftaran from tpendaftaran order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            Tkode.Text = "DFT00001"

        Else

            Tkode.Text = "DFT" + Format(Microsoft.VisualBasic.Right(DR(0), 5) + 1, "00000")

        End If

        Tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call kodeotomatis()

        TTanggal.Text = Today

        cmbkodepasien.Text = "Pilih"

        tnamapasien.Text = "-"

        cmbpoli.Text = "Pilih"

        cmbdokter.Text = "Pilih"

        Tkeluhan.Text = "-"

        TxtCari.Clear()

        TTanggal.Focus()

    End Sub

 

    Sub DataBaru()

        cmbkodepasien.Text = "Pilih"

        tnamapasien.Text = "-"

        cmbpoli.Text = "Pilih"

        cmbdokter.Text = "Pilih"

        Tkeluhan.Text = "-"

        TxtCari.Clear()

        TTanggal.Focus()

    End Sub

 

    Sub Ketemu()

        On Error Resume Next

        TTanggal.Text = DR.Item(1)

        cmbkodepasien.Text = DR.Item(2)

        cmbpoli.Text = DR.Item(2)

        TTanggal.Focus()

        Call Caridokter1()

        Call CariPasien()

    End Sub

 

    Sub Tampilgrid()

        DA = New OleDbDataAdapter("select * from Tpendaftaran", Conn)

        DS = New DataSet

        DA.Fill(DS)

        DGV.DataSource = DS.Tables(0)

        DGV.ReadOnly = True

    End Sub

 

    Sub Tampilpasien()

        CMD = New OleDbCommand("select kode_pasien from mpasien where kode_pasien not in (select kode_pasien from tpendaftaran WHERE status_pendaftaran='TERDAFTAR')", Conn)

        DR = CMD.ExecuteReader

        cmbkodepasien.Items.Clear()

        Do While DR.Read

            cmbkodepasien.Items.Add(DR.Item("kode_pasien"))

        Loop

    End Sub

 

    Sub Tampilpoli()

        CMD = New OleDbCommand("select mpoli.kode_poli,nama_poli from mpoli,mdokter where mpoli.kode_poli=mdokter.kode_poli", Conn)

        DR = CMD.ExecuteReader

        cmbpoli.Items.Clear()

        Do While DR.Read

            cmbpoli.Items.Add(DR.Item(0) & Space(2) & DR(1))

        Loop

    End Sub

 

 

    Private Sub frmtpendaftaran_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

        Call Tampilgrid()

        Call Tampilpoli()

        Call Tampilpasien()

    End Sub

 

    Private Sub BTNTutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNTutup.Click

        Me.Close()

    End Sub

 

    Private Sub BTNBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBatal.Click

        Call Kosongkan()

    End Sub

 

    Sub CariPasien()

        CMD = New OleDbCommand("select * from mpasien where kode_pasien='" & cmbkodepasien.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If DR.HasRows Then

            tnamapasien.Text = DR.Item("nama_pasien")

        End If

    End Sub

    Private Sub cmbkodepasien_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbkodepasien.SelectedIndexChanged

        Call CariPasien()

    End Sub

 

    Sub Caridokter1()

        CMD = New OleDbCommand("select mdokter.kode_dokter,nama_dokter from mdokter,mpoli where mdokter.kode_poli=mpoli.kode_poli and mdokter.kode_poli='" & Microsoft.VisualBasic.Left(cmbpoli.Text, 5) & "'", Conn)

        DR = CMD.ExecuteReader

        cmbdokter.Items.Clear()

        Do While DR.Read

            cmbdokter.Items.Add(DR.Item(0) & Space(2) & DR(1))

        Loop

    End Sub

 

    Private Sub cmbpoli_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbpoli.SelectedIndexChanged

        Call Caridokter1()

    End Sub

 

    Sub CariKodePendaftaran()

        CMD = New OleDbCommand("select * from Tpendaftaran where kode_pendaftaran='" & Tkode.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

    End Sub

 

    Sub Caridokter2()

        CMD = New OleDbCommand("select mdokter.kode_dokter,nama_dokter from mdokter,tpendaftaran where mdokter.kode_dokter=tpendaftaran.kode_dokter and tpendaftaran.kode_pendaftaran='" & Tkode.Text & "'", Conn)

        DR = CMD.ExecuteReader

        cmbdokter.Items.Clear()

        Do While DR.Read

            cmbdokter.Items.Add(DR.Item(0) & Space(2) & DR(1))

        Loop

    End Sub

 

       Private Sub DGV_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV.CellMouseClick

        On Error Resume Next

        Tkode.Text = DGV.Rows(e.RowIndex).Cells(0).Value

        TTanggal.Text = DGV.Rows(e.RowIndex).Cells(1).Value

        cmbkodepasien.Text = DGV.Rows(e.RowIndex).Cells(2).Value

        Call CariPasien()

        Call Caridokter2()

    End Sub

 

       Private Sub BTNHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHapus.Click

        If Tkode.Text = "" Then

            MsgBox("Nomor harus diisi")

            Exit Sub

        End If

 

        Call CariKodePendaftaran()

        If Not DR.HasRows Then

            MsgBox("Nomor tidak terdaftar")

            Exit Sub

        End If

 

        If MessageBox.Show("yakin akan dihapus...?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

            Dim hapus As String = "delete * from Tpendaftaran where nomor_registrasi='" & Tkode.Text & "'"

            CMD = New OleDbCommand(hapus, Conn)

            CMD.ExecuteNonQuery()

 

            Call Tampilgrid()

            Call Kosongkan()

            Call kodeotomatis()

        Else

            Call Kosongkan()

 

        End If

    End Sub

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmtresep

    Sub kodeotomatis()

        CMD = New OleDbCommand("select kode_resep from tresep order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            Tkode.Text = "RSP00001"

        Else

            Tkode.Text = "RSP" + Format(Microsoft.VisualBasic.Right(DR(0), 5) + 1, "00000")

        End If

        Tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call kodeotomatis()

        cmbpendaftaran.Text = "Pilih"

        Lpasien.Text = "-"

        Ldokter.Text = "-"

        Lpoli.Text = "-"

        Tcariobat.Clear()

        TTotalHarga.Text = 0

        Tkeluhan.Text = "-"

        Tdiagnosa.Text = "-"

        Ttindakan.Text = "-"

        DGV.Rows.Clear()

        Call Tampilobat()

        Call Tampilpendaftaran()

    End Sub

 

    Sub Tampilobat()

        CMD = New OleDbCommand("select * from mobat where stok_obat>0", Conn)

        DR = CMD.ExecuteReader

        ListObat.Items.Clear()

        Do While DR.Read

            ListObat.Items.Add(DR(0) & Space(2) & DR(1))

        Loop

    End Sub

 

    Sub Tampilpendaftaran()

        CMD = New OleDbCommand("select kode_pendaftaran from tpendaftaran where status_pendaftaran='TERDAFTAR'", Conn)

        DR = CMD.ExecuteReader

        cmbpendaftaran.Items.Clear()

        Do While DR.Read

            cmbpendaftaran.Items.Add(DR(0))

        Loop

    End Sub

 

    Private Sub frmtresep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

 

    End Sub

 

    Private Sub cmbpendaftaran_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbpendaftaran.SelectedIndexChanged

        CMD = New OleDbCommand("select tpendaftaran.keluhan,mpasien.nama_pasien,mdokter.nama_dokter,mpoli.nama_Poli from tpendaftaran,mpasien,mdokter,mpoli where tpendaftaran.kode_pasien=mpasien.kode_pasien and tpendaftaran.kode_dokter=mdokter.kode_dokter and mpoli.kode_poli=mdokter.kode_poli and tpendaftaran.kode_pendaftaran='" & cmbpendaftaran.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If DR.HasRows Then

            Tkeluhan.Text = DR("keluhan")

            Lpasien.Text = DR("nama_pasien")

            Ldokter.Text = DR("nama_dokter")

            Lpoli.Text = DR("nama_poli")

 

            Dim kodepasien As String

            CMD = New OleDbCommand("select kode_pasien from mpasien where nama_pasien='" & Lpasien.Text & "'", Conn)

            DR = CMD.ExecuteReader

            DR.Read()

            If DR.HasRows Then

                kodepasien = DR(0)

            End If

        End If

    End Sub

 

    Private Sub ListObat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListObat.SelectedIndexChanged

 

        Dim baris As Integer = DGV.RowCount - 1

        DGV.Rows.Add(Microsoft.VisualBasic.Left(ListObat.Text, 5))

 

 

        For barisatas As Integer = 0 To DGV.RowCount - 1

            For barisbawah As Integer = barisatas + 1 To DGV.RowCount - 1

                If DGV.Rows(barisbawah).Cells(0).Value = DGV.Rows(barisatas).Cells(0).Value Then

 

                    DGV.Rows(barisatas).Cells(3).Value = DGV.Rows(barisatas).Cells(3).Value + 1

                    DGV.Rows(barisatas).Cells(4).Value = DGV.Rows(barisatas).Cells(2).Value * DGV.Rows(barisatas).Cells(3).Value

                    DGV.Rows.RemoveAt(barisbawah)

                    Call HitungHarga()

                    Exit Sub

                End If

            Next

        Next

 

        CMD = New OleDbCommand("select * from mobat where kode_obat='" & DGV.Rows(baris).Cells(0).Value & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If DR.HasRows Then

            DGV.Rows(baris).Cells(1).Value = DR("nama_obat")

            DGV.Rows(baris).Cells(2).Value = DR("tarif_obat")

            DGV.Rows(baris).Cells(3).Value = 1

            DGV.Rows(baris).Cells(4).Value = DGV.Rows(baris).Cells(2).Value * DGV.Rows(baris).Cells(3).Value

 

        End If

        Call HitungHarga()

        Tcariobat.Clear()

    End Sub

 

    Sub HitungHarga()

        Dim x As Double

        For baris As Integer = 0 To DGV.RowCount - 1

            x = x + DGV.Rows(baris).Cells(4).Value

        Next

        TTotalHarga.Text = x

    End Sub

 

    Private Sub DGV_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV.CellEndEdit

        If e.ColumnIndex = 3 Then

            Try

                DGV.Rows(e.RowIndex).Cells(4).Value = DGV.Rows(e.RowIndex).Cells(2).Value * DGV.Rows(e.RowIndex).Cells(3).Value

            Catch ex As Exception

                MsgBox("harus angka")

                SendKeys.Send("{UP}")

                DGV.Rows(e.RowIndex).Cells(3).Value = 1

                DGV.Rows(e.RowIndex).Cells(4).Value = DGV.Rows(e.RowIndex).Cells(2).Value * DGV.Rows(e.RowIndex).Cells(3).Value

            End Try

        End If

        Call HitungHarga()

    End Sub

 

    Private Sub DGV_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DGV.KeyDown

        On Error Resume Next

        If e.KeyCode = Keys.Delete Or e.KeyCode = Keys.Escape Then

            DGV.Rows.Remove(DGV.CurrentRow)

            Call HitungHarga()

        End If

    End Sub

 

    Private Sub Tcariobat_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tcariobat.TextChanged

        Call Koneksi()

        CMD = New OleDbCommand("select * from mobat where nama_obat like '%" & Tcariobat.Text & "%'", Conn)

        DR = CMD.ExecuteReader

        ListObat.Items.Clear()

        Do While DR.Read

            ListObat.Items.Add(DR(0) & Space(2) & DR(1))

        Loop

    End Sub

 

    Private Sub BTNBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBatal.Click

        Call Kosongkan()

    End Sub

 

    Private Sub BTNTutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNTutup.Click

        Me.Close()

    End Sub

End Class

 

 

 

Imports System.Data.OleDb

 

Public Class frmtpembayaran

    Sub kodeotomatis()

        CMD = New OleDbCommand("select kode_pembayaran from tpembayaran order by 1 desc", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If Not DR.HasRows Then

            Tkode.Text = "BYR00001"

        Else

            Tkode.Text = "BYR" + Format(Microsoft.VisualBasic.Right(DR(0), 5) + 1, "00000")

        End If

        Tkode.Enabled = False

    End Sub

 

    Sub Kosongkan()

        Call kodeotomatis()

        cmbnomorresep.Text = "Pilih"

        Lpasien.Text = "-"

        Ldokter.Text = "-"

        Lpoli.Text = "-"

        TTotalHarga.Text = 0

        Tdibayar.Text = 0

        Tkembali.Text = 0

        Tkeluhan.Text = "-"

        Tdiagnosa.Text = "-"

        Ttindakan.Text = "-"

        DGV.Columns.Clear()

        Call Tampilresep()

    End Sub

 

    Sub Tampilresep()

        CMD = New OleDbCommand("select kode_resep from tresep where status_pembayaran='BELUM LUNAS'", Conn)

        DR = CMD.ExecuteReader

        cmbnomorresep.Items.Clear()

        Do While DR.Read

            cmbnomorresep.Items.Add(DR(0))

        Loop

    End Sub

 

    Private Sub frmtpembayaran_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.CenterToScreen()

        Call Koneksi()

        Call Kosongkan()

    End Sub

 

    Private Sub cmbnomorresep_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbnomorresep.SelectedIndexChanged

        CMD = New OleDbCommand("select mpasien.nama_pasien,mdokter.nama_dokter,mpoli.nama_Poli,tpendaftaran.keluhan, tresep.diagnosa,tindakan,total_harga from tresep,tpendaftaran,mpasien,mdokter,mpoli where tpendaftaran.kode_pasien=mpasien.kode_pasien and tpendaftaran.kode_dokter=mdokter.kode_dokter and mpoli.kode_poli=mdokter.kode_poli and tpendaftaran.kode_pendaftaran=tresep.kode_pendaftaran and tresep.kode_resep='" & cmbnomorresep.Text & "'", Conn)

        DR = CMD.ExecuteReader

        DR.Read()

        If DR.HasRows Then

            Tkeluhan.Text = DR("keluhan")

            Lpasien.Text = DR("nama_pasien")

            Ldokter.Text = DR("nama_dokter")

            Lpoli.Text = DR("nama_poli")

            Tdiagnosa.Text = DR("diagnosa")

            Ttindakan.Text = DR("tindakan")

            TTotalHarga.Text = DR("total_harga")

 

            DA = New OleDbDataAdapter("select tresepdetail.kode_obat,mobat.nama_obat,tresepdetail.harga,jumlah,total from tresep,tresepdetail,mobat where tresep.kode_resep=tresepdetail.kode_resep  and tresepdetail.kode_obat=mobat.kode_obat and tresep.kode_resep='" & cmbnomorresep.Text & "'", Conn)

            DS = New DataSet

            DA.Fill(DS)

            DGV.DataSource = DS.Tables(0)

            DGV.ReadOnly = True

        End If

    End Sub

 

    Sub HitungHarga()

        Dim x As Double

        For baris As Integer = 0 To DGV.RowCount - 1

            x = x + DGV.Rows(baris).Cells(4).Value

        Next

        TTotalHarga.Text = x

    End Sub

 

    Private Sub BTNBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBatal.Click

        Call Kosongkan()

    End Sub

 

    Private Sub BTNTutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNTutup.Click

        Me.Close()

    End Sub

 

    Private Sub Tdibayar_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tdibayar.TextChanged

        Tkembali.Text = Val(Tdibayar.Text) - Val(TTotalHarga.Text)

        If Tkembali.Text >= 0 Then

            BTNSimpan.Focus()

        End If

    End Sub

End Class

 

 

 

Public Class frmtlaporanmaster

 

    Private Sub BTNUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNUser.Click

        laporan.Load("masterUser.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNPoli_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNPoli.Click

        laporan.Load("masterpoli.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNObat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNObat.Click

        laporan.Load("masterobat.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNDokter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNDokter.Click

        laporan.Load("masterdokter.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNPasien_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNPasien.Click

        laporan.Load("masterpasien.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNTutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNTutup.Click

        Me.Close()

    End Sub

 

    Private Sub frmtlaporanmaster_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Call Koneksi()

    End Sub

End Class

 

 

 

Imports System.Data.OleDb

 

Public Class frmtlaporanpendaftaran

 

    Private Sub frmtlaporanpendaftaran_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Call Koneksi()

        CMD = New OleDbCommand("select distinct year(tanggal_pendaftaran) from tpendaftaran", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox1.Items.Add(DR(0))

        Loop

 

        CMD = New OleDbCommand("select kode_pendaftaran from tpendaftaran", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox2.Items.Add(DR(0))

        Loop

 

        CMD = New OleDbCommand("select distinct mdokter.nama_dokter from mdokter,tpendaftaran where mdokter.kode_dokter=tpendaftaran.kode_dokter", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox3.Items.Add(DR(0))

        Loop

 

        CMD = New OleDbCommand("select distinct mpoli.nama_poli from mpoli,mdokter,tpendaftaran where mdokter.kode_dokter=tpendaftaran.kode_dokter and mpoli.kode_poli=mdokter.kode_poli", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox4.Items.Add(DR(0))

        Loop

    End Sub

 

    Private Sub BTNHarian_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHarian.Click

        CRV.SelectionFormula = "{tpendaftaran.tanggal_pendaftaran} = date ('" & DTPharian.Text & "')"

        laporan.Load("pendaftaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNMingguan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNMingguan.Click

        CRV.SelectionFormula = "{tpendaftaran.tanggal_pendaftaran} in date ('" & DTPawal.Text & "') to date ('" & DTPakhir.Text & "')"

        laporan.Load("pendaftaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNBUlanan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBUlanan.Click

        CRV.SelectionFormula = "month({tpendaftaran.tanggal_pendaftaran}) = (" & Month(DTPBUlanan.Text) & ") and year({tpendaftaran.tanggal_pendaftaran}) = (" & Year(DTPBUlanan.Text) & ") "

        laporan.Load("pendaftaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

        CRV.SelectionFormula = "year({tpendaftaran.tanggal_pendaftaran}) = (" & (ListBox1.Text) & ")"

        laporan.Load("pendaftaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged

        CRV.SelectionFormula = "{tpendaftaran.kode_pendaftaran} = '" & ListBox2.Text & "'"

        laporan.Load("pendaftaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        Me.Close()

    End Sub

 

    Private Sub ListBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox3.SelectedIndexChanged

        CRV.SelectionFormula = "{mdokter.nama_dokter} = '" & ListBox3.Text & "'"

        laporan.Load("pendaftaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox4.SelectedIndexChanged

        CRV.SelectionFormula = "{mpoli.nama_poli} = '" & ListBox4.Text & "'"

        laporan.Load("pendaftaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub Tnamapasien_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Tnamapasien.KeyDown

        If e.KeyCode = Keys.Enter Then

            CRV.SelectionFormula = "{mpasien.nama_pasien} like  '*" & Tnamapasien.Text & "*'"

            laporan.Load("pendaftaran.rpt")

            Call SetingLaporan()

            CRV.ReportSource = laporan

            CRV.RefreshReport()

        End If

    End Sub

End Class

 

 

 

Imports System.Data.OleDb

 

Public Class frmtlaporanresep

 

    Private Sub frmtlaporanresep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Call Koneksi()

        CMD = New OleDbCommand("select distinct year(tanggal_resep) from tresep", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox1.Items.Add(DR(0))

        Loop

 

        CMD = New OleDbCommand("select kode_resep from tresep", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox2.Items.Add(DR(0))

        Loop

 

        CMD = New OleDbCommand("select distinct mdokter.nama_dokter from mdokter,tresep,tpendaftaran where mdokter.kode_dokter=tpendaftaran.kode_dokter and tpendaftaran.kode_pendaftaran=tresep.kode_pendaftaran", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox3.Items.Add(DR(0))

        Loop

 

        CMD = New OleDbCommand("select distinct mpoli.nama_poli from mpoli,mdokter,tresep,tpendaftaran where mdokter.kode_dokter=tpendaftaran.kode_dokter and mpoli.kode_poli=mdokter.kode_poli and tpendaftaran.kode_pendaftaran=tresep.kode_pendaftaran", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox4.Items.Add(DR(0))

        Loop

    End Sub

 

    Private Sub BTNHarian_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHarian.Click

        CRV.SelectionFormula = "{tresep.tanggal_resep} = date ('" & DTPharian.Text & "')"

        laporan.Load("resep.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNMingguan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNMingguan.Click

        CRV.SelectionFormula = "{tresep.tanggal_resep} in date ('" & DTPawal.Text & "') to date ('" & DTPakhir.Text & "')"

        laporan.Load("resep.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNBUlanan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBUlanan.Click

        CRV.SelectionFormula = "month({tresep.tanggal_resep}) = (" & Month(DTPBUlanan.Text) & ") and year({tresep.tanggal_resep}) = (" & Year(DTPBUlanan.Text) & ") "

        laporan.Load("resep.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

        CRV.SelectionFormula = "year({tresep.tanggal_resep}) = (" & (ListBox1.Text) & ")"

        laporan.Load("resep.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged

        CRV.SelectionFormula = "{tresep.kode_resep} = '" & ListBox2.Text & "'"

        laporan.Load("resep.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        Me.Close()

    End Sub

 

    Private Sub ListBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox3.SelectedIndexChanged

        CRV.SelectionFormula = "{mdokter.nama_dokter} = '" & ListBox3.Text & "'"

        laporan.Load("resep.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox4.SelectedIndexChanged

        CRV.SelectionFormula = "{mpoli.nama_poli} = '" & ListBox4.Text & "'"

        laporan.Load("resep.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub Tnamapasien_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Tnamapasien.KeyDown

        If e.KeyCode = Keys.Enter Then

            CRV.SelectionFormula = "{mpasien.nama_pasien} like  '*" & Tnamapasien.Text & "*'"

            laporan.Load("resep.rpt")

            Call SetingLaporan()

            CRV.ReportSource = laporan

            CRV.RefreshReport()

        End If

    End Sub

 

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmtlaporanpembayaran

 

    Private Sub frmtlaporanpembayaran_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Call Koneksi()

        CMD = New OleDbCommand("select distinct year(tanggal_pembayaran) from tpembayaran", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox1.Items.Add(DR(0))

        Loop

 

        CMD = New OleDbCommand("select kode_pembayaran from tpembayaran", Conn)

        DR = CMD.ExecuteReader

        Do While DR.Read

            ListBox2.Items.Add(DR(0))

        Loop

    End Sub

 

    Private Sub BTNHarian_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHarian.Click

        CRV.SelectionFormula = "{tpembayaran.tanggal_pembayaran} = date ('" & DTPharian.Text & "')"

        laporan.Load("pembayaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNMingguan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNMingguan.Click

        CRV.SelectionFormula = "{tpembayaran.tanggal_pembayaran} in date ('" & DTPawal.Text & "') to date ('" & DTPakhir.Text & "')"

        laporan.Load("pembayaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub BTNBUlanan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBUlanan.Click

        CRV.SelectionFormula = "month({tpembayaran.tanggal_pembayaran}) = (" & Month(DTPBUlanan.Text) & ") and year({tpembayaran.tanggal_pembayaran}) = (" & Year(DTPBUlanan.Text) & ") "

        laporan.Load("pembayaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

        CRV.SelectionFormula = "year({tpembayaran.tanggal_pembayaran}) = (" & (ListBox1.Text) & ")"

        laporan.Load("pembayaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged

        CRV.SelectionFormula = "{tpembayaran.kode_pembayaran} = '" & ListBox2.Text & "'"

        laporan.Load("pembayaran.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        Me.Close()

    End Sub

End Class

 

 

Imports System.Data.OleDb

 

Public Class frmtlaporanmedis

 

    Private Sub frmtlaporanmedis_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Call Koneksi()

 

    End Sub

 

    Private Sub TnamaPasien_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TNamaPasien.KeyDown

        If e.KeyCode = Keys.Enter Then

            DA = New OleDbDataAdapter("select tpendaftaran.tanggal_pendaftaran,keluhan,mpoli.nama_poli,mdokter.nama_dokter,tresep.diagnosa,tindakan from tpendaftaran,mpoli,tresep,mpasien,mdokter where tpendaftaran.kode_pendaftaran=tresep.kode_pendaftaran and mdokter.kode_poli=mpoli.kode_poli and tpendaftaran.kode_pasien=mpasien.kode_pasien and tpendaftaran.kode_dokter=mdokter.kode_dokter and mpasien.nama_pasien like '%" & TNamaPasien.Text & "%'", Conn)

            DS = New DataSet

            DA.Fill(DS)

            DGV.DataSource = DS.Tables(0)

            DGV.ReadOnly = True

 

            CMD = New OleDbCommand("select kode_pasien from mpasien where nama_pasien like '%" & TNamaPasien.Text & "%'", Conn)

            DR = CMD.ExecuteReader

            DR.Read()

            If DR.HasRows Then

                TkodePasien.Text = DR(0)

            End If

        End If

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        CRV.SelectionFormula = "{mpasien.kode_pasien} ='" & TkodePasien.Text & "'"

        laporan.Load("rekam medis.rpt")

        Call SetingLaporan()

        CRV.ReportSource = laporan

        CRV.RefreshReport()

    End Sub

 

    Private Sub TkodePasien_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TkodePasien.KeyDown

        If e.KeyCode = Keys.Enter Then

            DA = New OleDbDataAdapter("select tpendaftaran.tanggal_pendaftaran,keluhan,mpoli.nama_poli,mdokter.nama_dokter,tresep.diagnosa,tindakan from tpendaftaran,mpoli,tresep,mpasien,mdokter where tpendaftaran.kode_pendaftaran=tresep.kode_pendaftaran and mdokter.kode_poli=mpoli.kode_poli and tpendaftaran.kode_pasien=mpasien.kode_pasien and tpendaftaran.kode_dokter=mdokter.kode_dokter and mpasien.kode_pasien  ='" & TkodePasien.Text & "'", Conn)

            DS = New DataSet

            DA.Fill(DS)

            DGV.DataSource = DS.Tables(0)

            DGV.ReadOnly = True

 

            CMD = New OleDbCommand("select * from mpasien where kode_pasien='" & TkodePasien.Text & "'", Conn)

            DR = CMD.ExecuteReader

            DR.Read()

            If DR.HasRows Then

                TNamaPasien.Text = DR(1)

            Else

                TNamaPasien.Text = ""

            End If

        End If

    End Sub

 

End Class