A. Entity Relationship Diagram (ERD)
B. Transformasi ERD ke LRS
C. Logical Record Structure (LRS)
1. Form Login
Coding :
Imports System.Data
Public Class Login
Dim oleconn As New OleDb.OleDbConnection
Private Sub Login_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ConnectToServer()
txtuser.Focus()
ProgressBar1.Value = 0
End Sub
Private Sub btnlogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnlogin.Click
Try
Dim login As OleDb.OleDbDataAdapter
login = New OleDb.OleDbDataAdapter("select * from Login where Username ='" & txtuser.Text & "'", mycn)
Dim dt As New DataTable
dt.Clear()
login.Fill(dt)
If dt.Rows.Count = 0 Then
MsgBox("Anda Tidak Terdaftar, Silahkan Mencoba Lagi")
bersih()
txtuser.Focus()
Exit Sub
End If
Dim dr As DataRow
For Each dr In dt.Rows
If txtpass.Text = dr("Password") Then
MsgBox("Selamat Datang" & _
vbCrLf & txtuser.Text & vbCrLf & "Tekan OK Untuk Masuk", _
MsgBoxStyle.OkOnly)
Timer1.Enabled = True
End If
Next dr
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
End Try
Private Sub bersih()
txtuser.Clear()
txtpass.Clear()
End Sub
Private Sub btncancel_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ask As String
ask = MsgBox("Apa anda yakin ingin keluar?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Application.Exit()
End If
End Sub
Private Sub txtpass_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpass.KeyPress
If e.KeyChar = Chr(13) Then
Me.btnlogin.Focus()
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 4
If ProgressBar1.Value <= 50 Then
lblloading.Text = "Loading..."
ElseIf ProgressBar1.Value <= 70 Then
lblloading.Text = "Please wait..."
End If
If ProgressBar1.Value = 100 Then
Timer1.Enabled = False
Me.Hide()
'Dim a As New frmMenuUtama
'a.Show()
End If
End Sub
Private Sub btndaftar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btndaftar.Click
frmDaftar.ShowDialog()
End Sub
End Class
2. Form Daftar
Coding :
Imports System.Data.OleDb
Public Class frmDaftar
Dim cmmd As OleDbCommand
Private Sub daftar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ConnectToServer()
Me.Opacity = 0.99
End Sub
Private Sub btncancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancel.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnsave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsave.Click
Dim sql As String
sql = "insert into login " & _
"values ('" & txtuser.Text & "','" & txtpass.Text & "')"
cmmd = New OleDbCommand(sql, mycn)
Dim a As Integer = cmmd.ExecuteNonQuery
If a = 1 Then
MessageBox.Show("Success To " & sender.text)
End If
Login.Show()
Me.Close()
End Sub
End Class
3. Form Menu Utama
Coding :
Public Class frmMenuUtama
Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim ask As String
ask = MsgBox("Apa anda yakin ingin Logout?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Login.ShowDialog()
End If
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPasien.Click
frmEntryPasien.ShowDialog()
End Sub
Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblKamar.Click
frmEntryKamar.ShowDialog()
End Sub
Private Sub Label21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblObat.Click
frmEntryObat.ShowDialog()
End Sub
Private Sub Label23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblBiaya.Click
frmEntryBiaya.ShowDialog()
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblRegistrasi.Click
frmRegistrasi.ShowDialog()
End Sub
Private Sub Label10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblResep.Click
frmResep.ShowDialog()
End Sub
Private Sub Label18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblLaporan.Click
frmCetakLapReg.ShowDialog()
End Sub
Private Sub Label3_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPasien.MouseHover
lblPasien.ForeColor = Color.Blue
End Sub
Private Sub Label3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPasien.MouseLeave
lblPasien.ForeColor = Color.Black
End Sub
Private Sub lblKamar_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblKamar.MouseHover
lblKamar.ForeColor = Color.Blue
End Sub
Private Sub lblKamar_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblKamar.MouseLeave
lblKamar.ForeColor = Color.Black
End Sub
Private Sub lblBiaya_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblBiaya.MouseHover
lblBiaya.ForeColor = Color.Blue
End Sub
Private Sub lblBiaya_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblBiaya.MouseLeave
lblBiaya.ForeColor = Color.Black
End Sub
Private Sub lblLaporan_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLaporan.MouseHover
lblLaporan.ForeColor = Color.Blue
End Sub
Private Sub lblLaporan_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLaporan.MouseLeave
lblLaporan.ForeColor = Color.Black
End Sub
Private Sub lblObat_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblObat.MouseHover
lblObat.ForeColor = Color.Blue
End Sub
Private Sub lblObat_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblObat.MouseLeave
lblObat.ForeColor = Color.Black
End Sub
Private Sub lblRegistrasi_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblRegistrasi.MouseHover
lblRegistrasi.ForeColor = Color.Blue
End Sub
Private Sub lblRegistrasi_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblRegistrasi.MouseLeave
lblRegistrasi.ForeColor = Color.Black
End Sub
Private Sub lblResep_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblResep.MouseHover
lblResep.ForeColor = Color.Blue
End Sub
Private Sub lblResep_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblResep.MouseLeave
lblResep.ForeColor = Color.Black
End Sub
Private Sub frmMenuUtama_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
groupMaster.Hide()
GroupTransaksi.Hide()
GroupLaporan.Hide()
Me.Opacity = 0.99
Login.ShowDialog()
End Sub
Private Sub lblFileMaster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblFileMaster.Click
groupMaster.Show()
GroupTransaksi.Hide()
GroupLaporan.Hide()
End Sub
Private Sub lblFileMaster_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblFileMaster.MouseHover
lblFileMaster.ForeColor = Color.Blue
End Sub
Private Sub lblFileMaster_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblFileMaster.MouseLeave
lblFileMaster.ForeColor = Color.Black
End Sub
Private Sub lblTransaksi_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblTransaksi.MouseHover
lblTransaksi.ForeColor = Color.Blue
End Sub
Private Sub lblTransaksi_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblTransaksi.MouseLeave
lblTransaksi.ForeColor = Color.Black
End Sub
Private Sub lblCetak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblCetak.Click
GroupLaporan.Show()
GroupTransaksi.Hide()
groupMaster.Hide()
End Sub
Private Sub lblCetak_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblCetak.MouseHover
lblCetak.ForeColor = Color.Blue
End Sub
Private Sub lblCetak_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblCetak.MouseLeave
lblCetak.ForeColor = Color.Black
End Sub
Private Sub lblLog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblLog.Click
Login.ShowDialog()
End Sub
Private Sub lblLog_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLog.MouseHover
lblLog.ForeColor = Color.Blue
End Sub
Private Sub lblLog_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLog.MouseLeave
lblLog.ForeColor = Color.Black
End Sub
Private Sub lblTransaksi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTransaksi.Click
groupMaster.Hide()
GroupTransaksi.Show()
GroupLaporan.Hide()
End Sub
Private Sub lblPem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
frmPembayaran.ShowDialog()
End Sub
Private Sub lblend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblend.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub lblend_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblend.MouseHover
lblend.ForeColor = Color.Blue
End Sub
Private Sub lblend_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblend.MouseLeave
lblend.ForeColor = Color.Black
End Sub
Private Sub Label3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
frmPembayaran.ShowDialog()
End Sub
Private Sub Label14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label14.Click
frmCetakResep.ShowDialog()
End Sub
Private Sub Label16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
frmCetakPembayaran.ShowDialog()
End Sub
End Class
4. Form Menu Master
5. Form Menu Transaksi
6. Form Menu Laporan
7. Form Entry Data Biaya
Coding :
Public Class frmEntryBiaya
Dim objBiaya As New clsBiaya
Dim AmbilclsBiaya As New clsBiaya
Private Sub frmEntryBiaya_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtIdBiaya.Text = AmbilclsBiaya.AutoNumber()
DisableObject()
Me.Opacity = 0.99
End Sub
Sub DisableObject()
txtIDBiaya.Enabled = True
txtIDBiaya.Focus()
txtJenis.Enabled = False
txtHarga.Enabled = False
btnSimpan.Enabled = False
btnUbah.Enabled = False
btnHapus.Enabled = False
End Sub
Sub EnableObject()
txtIDBiaya.Enabled = True
txtIDBiaya.Focus()
txtJenis.Enabled = True
txtHarga.Enabled = True
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
End Sub
Sub TextClear()
txtIDBiaya.Clear()
txtJenis.Clear()
txtHarga.Clear()
txtIDBiaya.BackColor = Color.White
txtIDBiaya.ForeColor = Color.Black
txtJenis.BackColor = Color.White
txtJenis.ForeColor = Color.Black
txtHarga.BackColor = Color.White
txtHarga.ForeColor = Color.Black
End Sub
#Region "Text_KeyPress"
Private Sub txtIDBiaya_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIDBiaya.KeyPress
If Asc(e.KeyChar) = 13 Then
txtJenis.Enabled = True
txtJenis.Focus()
End If
End Sub
Private Sub txtJenis_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtJenis.KeyPress
If Asc(e.KeyChar) = 13 Then
txtHarga.Enabled = True
txtHarga.Focus()
End If
End Sub
Private Sub txtHarga_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtHarga.KeyPress
If Asc(e.KeyChar) = 13 Then
btnSimpan.Enabled = True
btnSimpan.Focus()
End If
End Sub
#End Region
#Region "LostFocus"
Private Sub txtIDBiaya_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtIDBiaya.LostFocus
txtIDBiaya.BackColor = Color.PaleTurquoise
txtIDBiaya.ForeColor = Color.Black
End Sub
Private Sub txtJenis_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtJenis.LostFocus
txtJenis.BackColor = Color.PaleTurquoise
txtJenis.ForeColor = Color.Black
End Sub
Private Sub txtHarga_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtHarga.LostFocus
txtHarga.BackColor = Color.PaleTurquoise
txtHarga.ForeColor = Color.Black
End Sub
#End Region
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
objBiaya.PIDBiaya = txtIDBiaya.Text
objBiaya.PJenis = txtJenis.Text
objBiaya.PHarga = txtHarga.Text
If objBiaya.Simpan = 1 Then
MessageBox.Show("Data Berhasil Disimpan", "Berhasil")
Else
MessageBox.Show("Data Gagal Disimpan", "Gagal")
End If
DisableObject()
TextClear()
txtIDBiaya.Text = AmbilclsBiaya.AutoNumber()
End Sub
Private Sub btnUbah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUbah.Click
objBiaya.PIDBiaya = txtIDBiaya.Text
objBiaya.PJenis = txtJenis.Text
objBiaya.PHarga = txtHarga.Text
If objBiaya.Ubah = 1 Then
MessageBox.Show("Data Berhasil Diubah", "Berhasil")
Else
MessageBox.Show("Data Gagal Diubah", "Gagal")
End If
DisableObject()
TextClear()
txtIDBiaya.Text = AmbilclsBiaya.AutoNumber()
End Sub
Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
objBiaya.PIDBiaya = txtIDBiaya.Text
If objBiaya.Hapus = 1 Then
MessageBox.Show("Data Berhasil Dihapus", "Berhasil")
Else
MessageBox.Show("Data Gagal Dihapus", "Gagal")
End If
DisableObject()
TextClear()
txtIDBiaya.Text = AmbilclsBiaya.AutoNumber()
End Sub
Private Sub txtCari_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCari.KeyPress
If Asc(e.KeyChar) = 13 Then
EnableObject()
txtIDBiaya.Enabled = False
objBiaya.PIDBiaya = txtCari.Text
If objBiaya.Cari = True Then
txtIDBiaya.Text = objBiaya.PIDBiaya
txtJenis.Text = objBiaya.PJenis
txtHarga.Text = objBiaya.PHarga
txtCari.Clear()
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
Else
btnSimpan.Enabled = True
End If
End If
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
DisableObject()
TextClear()
txtIDBiaya.Text = AmbilclsBiaya.AutoNumber()
End Sub
Private Sub btnCari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCari.Click
popupBiaya.ShowDialog()
If popupBiaya.refIDBiaya <> "" Then
txtIDBiaya.Text = popupBiaya.refIDBiaya
txtJenis.Text = popupBiaya.refJenis
txtHarga.Text = popupBiaya.refHarga
EnableObject()
txtJenis.Focus()
txtIDBiaya.Enabled = False
btnSimpan.Enabled = False
btnHapus.Enabled = True
btnUbah.Enabled = True
End If
End Sub
Private Sub btnKembali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKembali.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Dim ask As String
ask = MsgBox("Apa anda yakin ingin keluar?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Application.Exit()
End If
End Sub
End Class
8. Form Entry Data Pasien
Coding :
9. Form Entry Data Kamar
Public Class frmEntryPasien
Dim objPasien As New clsPasien
Dim AmbilclsPasien As New clsPasien
Private Sub frmEntryPasien_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtIDPasien.Text = AmbilclsPasien.AutoNumber()
DisableObject()
Me.Opacity = 0.99
End Sub
Sub DisableObject()
txtIDPasien.Enabled = True
txtIDPasien.Focus()
txtNmPasien.Enabled = False
txtAlamat.Enabled = False
cmbJenkel.Enabled = False
txtTmptLahir.Enabled = False
dtpTglLahir.Enabled = False
txtTelp.Enabled = False
txtRujukan.Enabled = False
cmbAgama.Enabled = False
btnSimpan.Enabled = False
btnUbah.Enabled = False
btnHapus.Enabled = False
End Sub
Sub EnableObject()
txtIDPasien.Enabled = True
txtIDPasien.Focus()
txtNmPasien.Enabled = True
txtAlamat.Enabled = True
cmbJenkel.Enabled = True
txtTmptLahir.Enabled = True
dtpTglLahir.Enabled = True
txtTelp.Enabled = True
txtRujukan.Enabled = True
cmbAgama.Enabled = True
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
End Sub
Sub TextClear()
txtIDPasien.Clear()
txtNmPasien.Clear()
txtAlamat.Clear()
cmbJenkel.Text = "Pilih"
txtTmptLahir.Clear()
dtpTglLahir.Value = Date.Now
txtTelp.Clear()
txtRujukan.Clear()
cmbAgama.Text = "Pilih"
txtIDPasien.BackColor = Color.White
txtIDPasien.ForeColor = Color.Black
txtNmPasien.BackColor = Color.White
txtNmPasien.ForeColor = Color.Black
txtAlamat.BackColor = Color.White
txtAlamat.ForeColor = Color.Black
cmbJenkel.BackColor = Color.White
cmbJenkel.ForeColor = Color.Black
txtTmptLahir.BackColor = Color.White
txtTmptLahir.ForeColor = Color.Black
dtpTglLahir.BackColor = Color.White
dtpTglLahir.ForeColor = Color.Black
txtTelp.BackColor = Color.White
txtTelp.ForeColor = Color.Black
txtRujukan.BackColor = Color.White
txtRujukan.ForeColor = Color.Black
cmbAgama.BackColor = Color.White
cmbAgama.ForeColor = Color.Black
End Sub
#Region "Text_KeyPress"
Private Sub txtIDPasien_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIDPasien.KeyPress
If Asc(e.KeyChar) = 13 Then
txtNmPasien.Enabled = True
txtNmPasien.Focus()
End If
End Sub
Private Sub txtNmPasien_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNmPasien.KeyPress
If Asc(e.KeyChar) = 13 Then
txtAlamat.Enabled = True
txtAlamat.Focus()
End If
End Sub
Private Sub txtAlamat_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAlamat.KeyPress
If Asc(e.KeyChar) = 13 Then
cmbJenkel.Enabled = True
cmbJenkel.Focus()
End If
End Sub
Private Sub cmbJenkel_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles cmbJenkel.KeyPress
If Asc(e.KeyChar) = 13 Then
txtTmptLahir.Enabled = True
txtTmptLahir.Focus()
End If
End Sub
Private Sub txtTmptLahir_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTmptLahir.KeyPress
If Asc(e.KeyChar) = 13 Then
dtpTglLahir.Enabled = True
dtpTglLahir.Focus()
End If
End Sub
Private Sub dtpTglLahir_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles dtpTglLahir.KeyPress
If Asc(e.KeyChar) = 13 Then
txtTelp.Enabled = True
txtTelp.Focus()
End If
End Sub
Private Sub txtTelp_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTelp.KeyPress
If Asc(e.KeyChar) = 13 Then
txtRujukan.Enabled = True
txtRujukan.Focus()
End If
End Sub
Private Sub txtRujukan_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtRujukan.KeyPress
If Asc(e.KeyChar) = 13 Then
cmbAgama.Enabled = True
cmbAgama.Focus()
End If
End Sub
Private Sub cmbAgama_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles cmbAgama.KeyPress
If Asc(e.KeyChar) = 13 Then
btnSimpan.Enabled = True
btnSimpan.Focus()
End If
End Sub
#End Region
#Region "LostFocus"
Private Sub txtIDPasien_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtIDPasien.LostFocus
txtIDPasien.BackColor = Color.PaleTurquoise
txtIDPasien.ForeColor = Color.Black
End Sub
Private Sub txtNmPasien_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNmPasien.LostFocus
txtNmPasien.BackColor = Color.PaleTurquoise
txtNmPasien.ForeColor = Color.Black
End Sub
Private Sub txtAlamat_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAlamat.LostFocus
txtAlamat.BackColor = Color.PaleTurquoise
txtAlamat.ForeColor = Color.Black
End Sub
Private Sub cmbJenkel_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbJenkel.LostFocus
cmbJenkel.BackColor = Color.PaleTurquoise
cmbJenkel.ForeColor = Color.Black
End Sub
Private Sub txtTmptLahir_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTmptLahir.LostFocus
txtTmptLahir.BackColor = Color.PaleTurquoise
txtTmptLahir.ForeColor = Color.Black
End Sub
Private Sub dtpTglLahir_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles dtpTglLahir.LostFocus
dtpTglLahir.BackColor = Color.PaleTurquoise
dtpTglLahir.ForeColor = Color.Black
End Sub
Private Sub txtTelp_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTelp.LostFocus
txtTelp.BackColor = Color.PaleTurquoise
txtTelp.ForeColor = Color.Black
End Sub
Private Sub txtRujukan_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtRujukan.LostFocus
txtRujukan.BackColor = Color.PaleTurquoise
txtRujukan.ForeColor = Color.Black
End Sub
Private Sub cmbAgama_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbAgama.LostFocus
cmbAgama.BackColor = Color.PaleTurquoise
cmbAgama.ForeColor = Color.Black
End Sub
#End Region
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
objPasien.PIDPasien = txtIDPasien.Text
objPasien.PNmPasien = txtNmPasien.Text
objPasien.PAlamat = txtAlamat.Text
objPasien.PJenkel = cmbJenkel.Text
objPasien.PTmptLahir = txtTmptLahir.Text
objPasien.PTglLahir = dtpTglLahir.Text
objPasien.PTelepon = txtTelp.Text
objPasien.PRujukan = txtRujukan.Text
objPasien.PAgama = cmbAgama.Text
If objPasien.Simpan = 1 Then
MessageBox.Show("Data Berhasil Disimpan", "Berhasil")
Else
MessageBox.Show("Data Gagal Disimpan", "Gagal")
End If
DisableObject()
TextClear()
txtIDPasien.Text = AmbilclsPasien.AutoNumber()
End Sub
Private Sub btnUbah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUbah.Click
objPasien.PIDPasien = txtIDPasien.Text
objPasien.PNmPasien = txtNmPasien.Text
objPasien.PAlamat = txtAlamat.Text
objPasien.PJenkel = cmbJenkel.Text
objPasien.PTmptLahir = txtTmptLahir.Text
objPasien.PTglLahir = dtpTglLahir.Text
objPasien.PTelepon = txtTelp.Text
objPasien.PRujukan = txtRujukan.Text
objPasien.PAgama = cmbAgama.Text
If objPasien.Ubah = 1 Then
MessageBox.Show("Data Berhasil Diubah", "Berhasil")
Else
MessageBox.Show("Data Gagal Diubah", "Gagal")
End If
DisableObject()
TextClear()
txtIDPasien.Text = AmbilclsPasien.AutoNumber()
End Sub
Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
objPasien.PIDPasien = txtIDPasien.Text
If objPasien.Hapus = 1 Then
MessageBox.Show("Data Berhasil Dihapus", "Berhasil")
Else
MessageBox.Show("Data Gagal Dihapus", "Gagal")
End If
DisableObject()
TextClear()
txtIDPasien.Text = AmbilclsPasien.AutoNumber()
End Sub
Private Sub txtCari_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCari.KeyPress
If Asc(e.KeyChar) = 13 Then
EnableObject()
txtIDPasien.Enabled = False
objPasien.PIDPasien = txtCari.Text
If objPasien.Cari = True Then
txtIDPasien.Text = objPasien.PIDPasien
txtNmPasien.Text = objPasien.PNmPasien
txtAlamat.Text = objPasien.PAlamat
cmbJenkel.Text = objPasien.PJenkel
txtTmptLahir.Text = objPasien.PTmptLahir
dtpTglLahir.Text = objPasien.PTglLahir
txtTelp.Text = objPasien.PTelepon
txtRujukan.Text = objPasien.PRujukan
cmbAgama.Text = objPasien.PAgama
txtCari.Clear()
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
Else
btnSimpan.Enabled = True
End If
End If
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
DisableObject()
TextClear()
txtIDPasien.Text = AmbilclsPasien.AutoNumber()
End Sub
Private Sub btnCari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCari.Click
popupPasien.ShowDialog()
If popupPasien.refIDPasien <> "" Then
txtIDPasien.Text = popupPasien.refIDPasien
txtNmPasien.Text = popupPasien.refNmPasien
txtAlamat.Text = popupPasien.refAlamat
cmbJenkel.Text = popupPasien.refJenkel
txtTmptLahir.Text = popupPasien.refTmptLahir
dtpTglLahir.Text = popupPasien.refTglLahir
txtRujukan.Text = popupPasien.refRujukan
txtTelp.Text = popupPasien.refTelepon
cmbAgama.Text = popupPasien.refAgama
EnableObject()
txtNmPasien.Focus()
txtIDPasien.Enabled = False
btnSimpan.Enabled = False
btnHapus.Enabled = True
btnUbah.Enabled = True
End If
End Sub
Private Sub btnKembali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKembali.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Dim ask As String
ask = MsgBox("Apa anda yakin ingin keluar?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Application.Exit()
End If
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
End Class
9. Form Entry Data Kamar
Coding :
10. Form Entry Data Obat
Public Class frmEntryKamar
Dim objKamar As New clsKamar
Dim AmbilclsKamar As New clsKamar
Private Sub frmEntryKamar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtIdKamar.Text = AmbilclsKamar.AutoNumber()
DisableObject()
Me.Opacity = 0.99
End Sub
Sub DisableObject()
txtIdKamar.Enabled = True
txtIdKamar.Focus()
txtNmKamar.Enabled = False
txtKelas.Enabled = False
txtHrgPaket.Enabled = False
btnSimpan.Enabled = False
btnUbah.Enabled = False
btnHapus.Enabled = False
End Sub
Sub EnableObject()
txtIdKamar.Enabled = True
txtIdKamar.Focus()
txtNmKamar.Enabled = True
txtKelas.Enabled = True
txtHrgPaket.Enabled = True
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
End Sub
Sub TextClear()
txtIdKamar.Clear()
txtNmKamar.Clear()
txtKelas.Clear()
txtHrgPaket.Clear()
txtIdKamar.BackColor = Color.White
txtIdKamar.ForeColor = Color.Black
txtNmKamar.BackColor = Color.White
txtNmKamar.ForeColor = Color.Black
txtKelas.BackColor = Color.White
txtKelas.ForeColor = Color.Black
txtHrgPaket.BackColor = Color.White
txtHrgPaket.ForeColor = Color.Black
End Sub
#Region "Text_KeyPress"
Private Sub txtIDKamar_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIdKamar.KeyPress
If Asc(e.KeyChar) = 13 Then
txtNmKamar.Enabled = True
txtNmKamar.Focus()
End If
End Sub
Private Sub txtNmKamar_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNmKamar.KeyPress
If Asc(e.KeyChar) = 13 Then
txtKelas.Enabled = True
txtKelas.Focus()
End If
End Sub
Private Sub txtKelas_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtKelas.KeyPress
If Asc(e.KeyChar) = 13 Then
txtHrgPaket.Enabled = True
txtHrgPaket.Focus()
End If
End Sub
Private Sub txtHrgPaket_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtHrgPaket.KeyPress
If Asc(e.KeyChar) = 13 Then
btnSimpan.Enabled = True
btnSimpan.Focus()
End If
End Sub
#End Region
#Region "LostFocus"
Private Sub txtIDKamar_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtIdKamar.LostFocus
txtIdKamar.BackColor = Color.PaleTurquoise
txtIdKamar.ForeColor = Color.Black
End Sub
Private Sub txtNmKamar_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNmKamar.LostFocus
txtNmKamar.BackColor = Color.PaleTurquoise
txtNmKamar.ForeColor = Color.Black
End Sub
Private Sub txtKelas_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtKelas.LostFocus
txtKelas.BackColor = Color.PaleTurquoise
txtKelas.ForeColor = Color.Black
End Sub
Private Sub txtHrgPaket_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtHrgPaket.LostFocus
txtHrgPaket.BackColor = Color.PaleTurquoise
txtHrgPaket.ForeColor = Color.Black
End Sub
#End Region
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
objKamar.PIDKamar = txtIdKamar.Text
objKamar.PNmKamar = txtNmKamar.Text
objKamar.PKelas = txtKelas.Text
objKamar.PHrgPaket = txtHrgPaket.Text
If objKamar.Simpan = 1 Then
MessageBox.Show("Data Berhasil Disimpan", "Berhasil")
Else
MessageBox.Show("Data Gagal Disimpan", "Gagal")
End If
DisableObject()
TextClear()
txtIdKamar.Text = AmbilclsKamar.AutoNumber()
End Sub
Private Sub btnUbah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUbah.Click
objKamar.PIDKamar = txtIdKamar.Text
objKamar.PNmKamar = txtNmKamar.Text
objKamar.PKelas = txtKelas.Text
objKamar.PHrgPaket = txtHrgPaket.Text
If objKamar.Ubah = 1 Then
MessageBox.Show("Data Berhasil Diubah", "Berhasil")
Else
MessageBox.Show("Data Gagal Diubah", "Gagal")
End If
DisableObject()
TextClear()
txtIdKamar.Text = AmbilclsKamar.AutoNumber()
End Sub
Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
objKamar.PIDKamar = txtIdKamar.Text
If objKamar.Hapus = 1 Then
MessageBox.Show("Data Berhasil Dihapus", "Berhasil")
Else
MessageBox.Show("Data Gagal Dihapus", "Gagal")
End If
DisableObject()
TextClear()
txtIdKamar.Text = AmbilclsKamar.AutoNumber()
End Sub
Private Sub txtCari_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCari.KeyPress
If Asc(e.KeyChar) = 13 Then
EnableObject()
txtIdKamar.Enabled = False
objKamar.PIDKamar = txtCari.Text
If objKamar.Cari = True Then
txtIdKamar.Text = objKamar.PIDKamar
txtNmKamar.Text = objKamar.PNmKamar
txtKelas.Text = objKamar.PKelas
txtHrgPaket.Text = objKamar.PHrgPaket
txtCari.Clear()
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
Else
btnSimpan.Enabled = True
End If
End If
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
DisableObject()
TextClear()
txtIdKamar.Text = AmbilclsKamar.AutoNumber()
End Sub
Private Sub btnCari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCari.Click
popupKamar.ShowDialog()
If popupKamar.refIDKamar <> "" Then
txtIdKamar.Text = popupKamar.refIDKamar
txtNmKamar.Text = popupKamar.refNmKamar
txtKelas.Text = popupKamar.refKelas
txtHrgPaket.Text = popupKamar.refHrgPaket
EnableObject()
txtNmKamar.Focus()
txtIdKamar.Enabled = False
btnSimpan.Enabled = False
btnHapus.Enabled = True
btnUbah.Enabled = True
End If
End Sub
Private Sub btnKembali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKembali.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Dim ask As String
ask = MsgBox("Apa anda yakin ingin keluar?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Application.Exit()
End If
End Sub
End Class
10. Form Entry Data Obat
Coding :
Public Class frmEntryObat
Dim objObat As New clsObat
Dim AmbilclsObat As New clsObat
Private Sub frmEntryObat_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtIdObat.Text = AmbilclsObat.AutoNumber()
DisableObject()
Me.Opacity = 0.99
End Sub
Sub DisableObject()
txtIdObat.Enabled = True
txtIdObat.Focus()
txtNmObat.Enabled = False
txtJnsObat.Enabled = False
txtHrgObat.Enabled = False
btnSimpan.Enabled = False
btnUbah.Enabled = False
btnHapus.Enabled = False
End Sub
Sub EnableObject()
txtIdObat.Enabled = True
txtIdObat.Focus()
txtNmObat.Enabled = True
txtJnsObat.Enabled = True
txtHrgObat.Enabled = True
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
End Sub
Sub TextClear()
txtIdObat.Clear()
txtNmObat.Clear()
txtJnsObat.Clear()
txtHrgObat.Clear()
txtIdObat.BackColor = Color.White
txtIdObat.ForeColor = Color.Black
txtNmObat.BackColor = Color.White
txtNmObat.ForeColor = Color.Black
txtJnsObat.BackColor = Color.White
txtJnsObat.ForeColor = Color.Black
txtHrgObat.BackColor = Color.White
txtHrgObat.ForeColor = Color.Black
End Sub
#Region "Text_KeyPress"
Private Sub txtIDObat_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIdObat.KeyPress
If Asc(e.KeyChar) = 13 Then
txtNmObat.Enabled = True
txtNmObat.Focus()
End If
End Sub
Private Sub txtNmObat_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNmObat.KeyPress
If Asc(e.KeyChar) = 13 Then
txtJnsObat.Enabled = True
txtJnsObat.Focus()
End If
End Sub
Private Sub txtJnsObat_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtJnsObat.KeyPress
If Asc(e.KeyChar) = 13 Then
txtHrgObat.Enabled = True
txtHrgObat.Focus()
End If
End Sub
Private Sub txtHrgObat_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtHrgObat.KeyPress
If Asc(e.KeyChar) = 13 Then
btnSimpan.Enabled = True
btnSimpan.Focus()
End If
End Sub
#End Region
#Region "LostFocus"
Private Sub txtIDObat_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtIdObat.LostFocus
txtIdObat.BackColor = Color.PaleTurquoise
txtIdObat.ForeColor = Color.Black
End Sub
Private Sub txtNmObat_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNmObat.LostFocus
txtNmObat.BackColor = Color.PaleTurquoise
txtNmObat.ForeColor = Color.Black
End Sub
Private Sub txtJnsObat_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtJnsObat.LostFocus
txtJnsObat.BackColor = Color.PaleTurquoise
txtJnsObat.ForeColor = Color.Black
End Sub
Private Sub txtHrgObat_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtHrgObat.LostFocus
txtHrgObat.BackColor = Color.PaleTurquoise
txtHrgObat.ForeColor = Color.Black
End Sub
#End Region
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
objObat.PIDObat = txtIdObat.Text
objObat.PNmObat = txtNmObat.Text
objObat.PJenis = txtJnsObat.Text
objObat.PHarga = txtHrgObat.Text
If objObat.Simpan = 1 Then
MessageBox.Show("Data Berhasil Disimpan", "Berhasil")
Else
MessageBox.Show("Data Gagal Disimpan", "Gagal")
End If
DisableObject()
TextClear()
txtIdObat.Text = AmbilclsObat.AutoNumber()
End Sub
Private Sub btnUbah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUbah.Click
objObat.PIDObat = txtIdObat.Text
objObat.PNmObat = txtNmObat.Text
objObat.PJenis = txtJnsObat.Text
objObat.PHarga = txtHrgObat.Text
If objObat.Ubah = 1 Then
MessageBox.Show("Data Berhasil Diubah", "Berhasil")
Else
MessageBox.Show("Data Gagal Diubah", "Gagal")
End If
DisableObject()
TextClear()
txtIdObat.Text = AmbilclsObat.AutoNumber()
End Sub
Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
objObat.PIDObat = txtIdObat.Text
If objObat.Hapus = 1 Then
MessageBox.Show("Data Berhasil Dihapus", "Berhasil")
Else
MessageBox.Show("Data Gagal Dihapus", "Gagal")
End If
DisableObject()
TextClear()
txtIdObat.Text = AmbilclsObat.AutoNumber()
End Sub
Private Sub txtCari_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCari.KeyPress
If Asc(e.KeyChar) = 13 Then
EnableObject()
txtIdObat.Enabled = False
objObat.PIDObat = txtCari.Text
If objObat.Cari = True Then
txtIdObat.Text = objObat.PIDObat
txtNmObat.Text = objObat.PNmObat
txtJnsObat.Text = objObat.PJenis
txtHrgObat.Text = objObat.PHarga
txtCari.Clear()
btnSimpan.Enabled = False
btnUbah.Enabled = True
btnHapus.Enabled = True
Else
btnSimpan.Enabled = True
End If
End If
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
DisableObject()
TextClear()
txtIdObat.Text = AmbilclsObat.AutoNumber()
End Sub
Private Sub btnCari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCari.Click
popupObat.ShowDialog()
If popupObat.refIDObat <> "" Then
txtIdObat.Text = popupObat.refIDObat
txtNmObat.Text = popupObat.refNmObat
txtJnsObat.Text = popupObat.refJenis
txtHrgObat.Text = popupObat.refHarga
EnableObject()
txtNmObat.Focus()
txtIdObat.Enabled = False
btnSimpan.Enabled = False
btnHapus.Enabled = True
btnUbah.Enabled = True
End If
End Sub
Private Sub btnKembali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKembali.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Dim ask As String
ask = MsgBox("Apa anda yakin ingin keluar?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Application.Exit()
End If
End Sub
End Class
11. Form Transaksi Entry Registrasi
Coding :
Public Class frmRegistrasi
Dim objRegistrasi As New clsRegistrasi
Dim AmbilclsRegistrasi As New clsRegistrasi
Private Sub frmRegistrasi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtNoReg.Text = AmbilclsRegistrasi.AutoNumber()
DisableObject()
Me.Opacity = 0.99
End Sub
Sub TextClear()
dtpReg.Value = Date.Now
txtIDPasien.Clear()
txtIDKamar.Clear()
txtNmPasien.Clear()
txtNmKamar.Clear()
txtKelas.Clear()
txtHrgPaket.Clear()
btnSimpan.Enabled = False
End Sub
Sub DisableObject()
txtIDPasien.Enabled = False
txtNoReg.Focus()
txtNoReg.Enabled = True
txtNmPasien.Enabled = False
txtIDKamar.Enabled = False
txtNmKamar.Enabled = False
txtKelas.Enabled = False
txtHrgPaket.Enabled = False
btnSimpan.Enabled = False
End Sub
Sub EnableObject()
btnSimpan.Enabled = True
End Sub
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
objRegistrasi.PNoReg = txtNoReg.Text
objRegistrasi.PTglReg = dtpReg.Text
objRegistrasi.PIDPasien = txtIDPasien.Text
objRegistrasi.PIDKamar = txtIDKamar.Text
If objRegistrasi.Simpan = 1 Then
MessageBox.Show("Data Berhasil Disimpan", "Berhasil")
Else
MessageBox.Show("Data Gagal Disimpan", "Gagal")
End If
TextClear()
txtNoReg.Text = AmbilclsRegistrasi.AutoNumber()
DisableObject()
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
txtNoReg.Text = AmbilclsRegistrasi.AutoNumber()
TextClear()
End Sub
Private Sub btnCariPasien_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCariPasien.Click
popupPasien.ShowDialog()
If popupPasien.refIDPasien <> "" Then
txtIDPasien.Text = popupPasien.refIDPasien
txtNmPasien.Text = popupPasien.refNmPasien
Txtalamt.Text = popupPasien.refAlamat
btnCariKamar.Focus()
DisableObject()
End If
End Sub
Private Sub btnKembali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKembali.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Dim ask As String
ask = MsgBox("Apa anda yakin ingin keluar?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Application.Exit()
End If
End Sub
Private Sub btnCariKamar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCariKamar.Click
popupKamar.ShowDialog()
If popupKamar.refIDKamar <> "" Then
txtIDKamar.Text = popupKamar.refIDKamar
txtNmKamar.Text = popupKamar.refNmKamar
txtKelas.Text = popupKamar.refKelas
txtHrgPaket.Text = popupKamar.refHrgPaket
EnableObject()
btnSimpan.Focus()
End If
End Sub
Private Sub txtNoReg_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNoReg.KeyPress
btnCariPasien.Focus()
txtNoReg.Enabled = False
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txtalamt.TextChanged
End Sub
End Class
Coding :
13. Form Cetak Laporan Registrasi
Public Class frmResep
Dim objResep As New clsResep
Dim objPasien As New clsPasien
Dim AmbilclsResep As New clsResep
Dim objDetil As New clsDetil
Private index As Integer = 0
Private Total As Double = 0.0
Private Sub frmResep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtIDResep.Text = AmbilclsResep.AutoNumber()
DisableObject()
Me.Opacity = 0.99
txtIDResep.Focus()
End Sub
Sub TextClear()
dtpResep.Value = Date.Now
txtNoReg.Clear()
dtpReg.Value = Date.Now
txtIDPasien.Clear()
txtNmPasien.Clear()
txtIDObat.Clear()
txtNmObat.Clear()
txtHrgObat.Clear()
txtNmObat.Clear()
txtJumBeli.Clear()
txtJumBayar.Hide()
btnSimpan.Enabled = False
End Sub
Sub DisableObject()
txtIDResep.Focus()
txtNoReg.Enabled = False
dtpReg.Enabled = False
txtIDPasien.Enabled = False
txtNmPasien.Enabled = False
txtIDObat.Enabled = False
txtNmObat.Enabled = False
txtHrgObat.Enabled = False
txtJumBeli.Enabled = False
txtTotal.Enabled = False
txtJumBayar.Enabled = False
btnTambah.Enabled = False
btnSimpan.Enabled = False
End Sub
Private Sub txtJumBel_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtJumBeli.KeyPress
If Asc(e.KeyChar) = 13 Then
SetTotal()
txtTotal.Focus()
End If
End Sub
Sub SetTotal()
Dim a As Integer
a = CInt(txtHrgObat.Text) * CInt(txtJumBeli.Text)
txtTotal.Text = Format(CDbl(CStr(a)), "##,###,###,###")
txtJumBayar.Focus()
End Sub
Private Sub txtJumBay_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
If Asc(e.KeyChar) = 13 Then
btnTambah.Focus()
End If
End Sub
Private Sub btnTambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTambah.Click
Dim Value() As String = {txtIDObat.Text, txtNmObat.Text, txtHrgObat.Text, txtJumBeli.Text, txtTotal.Text}
AddList(Value)
Total += CDbl(txtTotal.Text) : txtJumBayar.Text = Format(CDbl(CStr(Total)), "##,###,###,###")
txtIDObat.Text = "" : txtNmObat.Text = "" : txtHrgObat.Text = "" : txtJumBeli.Text = "" : txtTotal.Text = ""
btnCariObat.Focus()
End Sub
Sub AddList(ByVal Value() As String)
Dim subIndex As Integer
ListView1.Items.Add("")
For subIndex = 0 To 4
ListView1.Items(index).SubItems.Add("")
ListView1.Items(index).SubItems(subIndex).Text = Value(subIndex)
Next
index = index + 1
End Sub
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
objResep.PIDResep = txtIDResep.Text
objResep.PTglResep = dtpResep.Text
objResep.PJmlBayar = txtJumBayar.Text
objResep.PNoReg = txtNoReg.Text
If objResep.Simpan = 1 Then
For i As Integer = 0 To ListView1.Items.Count - 1
objDetil.PIDResep = txtIDResep.Text
objDetil.PIDObat = ListView1.Items(i).Text
objDetil.PJmlObat = ListView1.Items(i).SubItems(3).Text
objDetil.PHrgTotal = ListView1.Items(i).SubItems(4).Text
objDetil.Simpan()
Next
MessageBox.Show("Data Berhasil Disimpan", "Berhasil")
Else
MessageBox.Show("Data Gagal Disimpan", "Gagal")
End If
TextClear()
DisableObject()
txtIDResep.Text = AmbilclsResep.AutoNumber()
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
txtIDResep.Text = AmbilclsResep.AutoNumber()
TextClear()
End Sub
Private Sub btnCariReg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCariReg.Click
Dim popupReg As New popupReg
popupReg.ShowDialog()
If popupReg.refNoReg <> "" Then
txtNoReg.Text = popupReg.refNoReg
dtpReg.Text = popupReg.refTglReg
txtIDPasien.Text = popupReg.refIDPasien
txtNoReg.Enabled = False
txtIDPasien.Enabled = True
txtIDPasien.Focus()
btnTambah.Enabled = False
btnSimpan.Enabled = False
End If
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnCariObat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCariObat.Click
Dim popupObat As New popupObat
popupObat.ShowDialog()
If popupObat.refIDObat <> "" Then
txtIDObat.Text = popupObat.refIDObat
txtNmObat.Text = popupObat.refNmObat
txtHrgObat.Text = popupObat.refHarga
txtJumBeli.Enabled = True
txtTotal.Enabled = True
txtJumBeli.Focus()
btnTambah.Enabled = True
btnSimpan.Enabled = True
End If
End Sub
Private Sub txtTotal_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTotal.KeyPress
btnTambah.Enabled = True
btnSimpan.Enabled = True
btnTambah.Focus()
End Sub
Private Sub txtIDResep_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIDResep.KeyPress
btnCariReg.Focus()
txtIDResep.Enabled = False
End Sub
Private Sub txtIDPasien_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIDPasien.KeyPress
If Asc(e.KeyChar) = 13 Then
txtIDPasien.Enabled = False
objPasien.PIDPasien = txtIDPasien.Text
If objPasien.Cari = True Then
txtIDPasien.Text = objPasien.PIDPasien
txtNmPasien.Text = objPasien.PNmPasien
btnCariObat.Focus()
Else
btnSimpan.Enabled = True
End If
End If
End Sub
End Class
Coding :
Public Class frmCetakLapReg
Private Sub btnKembali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKembali.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
Dim ask As String
ask = MsgBox("Apa anda yakin ingin keluar?", MsgBoxStyle.OkCancel, "Warning!")
If ask = vbOK Then
Application.Exit()
End If
End Sub
Private Sub btnCetak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCetak.Click
frmCrLapReg.tgl1 = DateTimePicker1.Value.Date
frmCrLapReg.tgl2 = DateTimePicker2.Value.Date
frmCrLapReg.ShowDialog()
End Sub
Private Sub frmCetakLapReg_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Opacity = 0.99
End Sub
End Class
14. Popup Registrasi
Coding :
Imports System.Data.OleDb
Imports System.Data
Public Class popupReg
Public refNoReg As String
Public refTglReg As String
Public refIDPasien As String
Public refIDKamar As String
Dim objRegistrasi As New clsRegistrasi
Private Sub popupRegistrasi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
objRegistrasi.Baca(ListView1)
list_data()
Me.Opacity = 0.99
End Sub
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
Pilih()
End Sub
Private Sub Pilih()
Try
refNoReg = ListView1.SelectedItems(0).SubItems(0).Text.ToString
refTglReg = ListView1.SelectedItems(0).SubItems(1).Text.ToString
refIDPasien = ListView1.SelectedItems(0).SubItems(2).Text.ToString
refIDKamar = ListView1.SelectedItems(0).SubItems(3).Text.ToString
Me.Close()
Catch ex As Exception
MsgBox("pilih salah satu data", MsgBoxStyle.Information)
End Try
End Sub
Public Sub list_data()
ConnectToServer()
Call clear_list()
Dim sqlx As String
Dim x As Integer = 1
sqlx = "SELECT * from REGISTRASI WHERE TglReg like '%" & Trim(txtKey.Text) & "%' order by IDPasien Asc"
If mycn.State <> ConnectionState.Closed Then mycn.Close()
mycn.Open()
myCmd = New OleDbCommand(sqlx, mycn)
myRead = myCmd.ExecuteReader
Try
While myRead.Read = True
x = Val(txtCounter.Text)
txtCounter.Text = Str(Val(txtCounter.Text) + 1)
With ListView1
.Items.Add("")
.Items(ListView1.Items.Count - 1).SubItems.Add("")
.Items(ListView1.Items.Count - 1).SubItems.Add("")
.Items(ListView1.Items.Count - 1).SubItems.Add("")
.Items(ListView1.Items.Count - 1).SubItems.Add("")
.Items(x).SubItems(0).Text = myRead.GetString(0)
.Items(x).SubItems(1).Text = myRead.GetDateTime(1)
.Items(x).SubItems(2).Text = myRead.GetString(2)
.Items(x).SubItems(3).Text = myRead.GetString(3)
End With
End While
Finally
myRead.Close()
x = 0
End Try
mycn.Close()
End Sub
Private Sub clear_list()
While Val(txtCounter.Text) > 0
ListView1.Items.Clear()
txtCounter.Text = Val(txtCounter.Text) - 1
End While
End Sub
Private Sub txtKey_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtKey.TextChanged
list_data()
End Sub
Private Sub btnPilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPilih.Click
Pilih()
frmEntryPasien.EnableObject()
frmEntryPasien.btnUbah.Enabled = True
frmEntryPasien.btnHapus.Enabled = True
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Dim iCount As Integer
For iCount = 90 To 10 Step -10
Me.Opacity = iCount / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next
Me.Close()
End Sub
End Class
15. Hasil Cetakan Laporan Registrasi
Jangan lupa module koneksinya nih :D
Imports System.Data.OleDb
Module koneksi
Public mycn As OleDbConnection ' Variabel KOneksi
Public myCmd As OleDbCommand ' Variabel Command
Public myRead As OleDbDataReader
Public Q As String ' variabel Untuk Menampung perintah SQL
Public Sub ConnectToServer()
Dim strConn As String
Dim strDriver As String = "SQLOLEDB.1"
Dim strServer As String = "maherga-bayu\SQLEXPRESS"
Dim strDatabase As String = "dbRawatInap"
'Dim strUserName As String = ""
'dim strPassword as string = ""
strConn = "Provider=" & strDriver & ";"
strConn &= "Data Source=" & strServer & ";"
strConn &= "Initial Catalog=" & strDatabase & ";Integrated Security=SSPI"
'strConn &= "User ID=" & strUsername & ";"
'strConn &= "Pwd=" & strPassword & ";"
'strConn &= "Persist Security Info=True"
'buka koneksi
mycn = New OleDbConnection(strConn)
'MsgBox(mycn.State)
If mycn.State = ConnectionState.Closed Then
Try
'MsgBox("Database Connected")
mycn.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
End Module
Tidak ada komentar:
Posting Komentar