Form Pasien Sistem Informasi Laboratorium Pada Rumah Sakit Umum Tere-Margareth Menggunakan Visual Basic 6.0

End Select End Sub Private Sub Form_Resize On Error Resume Next TreeMenu.Height = Me.Height - 435 5 - 200 frmMenu2.Height = MainForm.Height - MainForm.StatusBar.Height - 650 End Sub

6. Form Pasien

Option Explicit Dim AddStatus As Boolean Dim StrFilePath As String Dim NewForm As Form Private Sub cmdHapus_Click On Error GoTo ErrLocal SQL = DELETE FROM T_PASIEN WHERE KODE = txtKdPasien.Text pADO.Execute SQL ADO.Refresh AddStatus = False cmdTambah.SetFocus Exit Sub ErrLocal: MsgBox errDelete End Sub Private Sub cmdPrint_Click If MsgBoxCetak Kartu Pasien?, vbYesNo, Pasien = vbYes Then cvReset cvFormulaLengthSP = 2 cvFormulaLength = 2 ReDim cvFormulaFieldsSP1 To 2, 1 To 2 ReDim cvFormulaFields1 To 2, 1 To 2 cvFormulaFieldsSP1, 1 = {?KD_PASIEN}: cvFormulaFieldsSP1, 2 = txtKdPasien.Text cvFormulaFieldsSP2, 1 = {?KD_RS}: cvFormulaFieldsSP2, 2 = pKdRS cvHeader = KARTU PASIEN cvReportFilename = App.Path \REPORTS\KARTU PASIEN.Rpt Set NewForm = New frmPrintSP NewForm.Show Else cvReset cvFormulaLengthSP = 2 cvFormulaLength = 2 Universitas Sumatera Utara ReDim cvFormulaFieldsSP1 To 2, 1 To 2 ReDim cvFormulaFields1 To 2, 1 To 2 cvFormulaFieldsSP1, 1 = {?KD_RS}: cvFormulaFieldsSP1, 2 = pKdRS cvHeader = DAFTAR PASIEN cvReportFilename = App.Path \REPORTS\DAFTAR PASIEN.Rpt Set NewForm = New frmPrintSP NewForm.Show End If End Sub Private Sub cmdSearch_Click If txtKey.Text Then If txtKeyAlamat.Text Then If IsNulldtKeyTglLahir.Value Then SQL = SELECT FROM T_PASIEN WHERE ReFormQuerytxtKey.Text, NAMA AND _ ReFormQuerytxtKeyAlamat.Text, ALAMAT Else SQL = SELECT FROM T_PASIEN WHERE ReFormQuerytxtKey.Text, NAMA AND _ ReFormQuerytxtKeyAlamat.Text, ALAMAT AND TGL_LAHIR = _ Date2SqldtKeyTglLahir.Value End If Else If IsNulldtKeyTglLahir.Value Then SQL = SELECT FROM T_PASIEN WHERE ReFormQuerytxtKey.Text, NAMA Else SQL = SELECT FROM T_PASIEN WHERE ReFormQuerytxtKey.Text, NAMA AND _ TGL_LAHIR = Date2SqldtKeyTglLahir.Value End If End If ADO_Search.RecordSource = SQL ADO_Search.Refresh End If End Sub Private Sub cmdSimpan_Click On Error GoTo ErrLocal If txtKdPasien.Text = Or txtKdPasien.Text = 0 Then MsgBox Klik Tambah Terlebih Dahulu, vbOKOnly, Registrasi Exit Sub End If If FieldValueT_PASIEN, COUNT, KODE = txtKdPasien.Text = 0 Then Universitas Sumatera Utara SQL = INSERT INTO T_PASIEN KODE, NAMA, TEMPAT_LAHIR, TGL_LAHIR, ALAMAT, KD_AGAMA, JK, _ KD_PEKERJAAN, NO_TELP, HP VALUES txtKdPasien.Text , _ String2SQLtxtNama.Text , String2SQLtxtTempatLahir.Text , _ Date2SqldtTglLahir.Value , String2SQLtxtAlamat.Text , _ cmbAgama.BoundText , cmbJK.BoundText , cmbPekerjaan.BoundText , _ String2SQLtxtNoTelp.Text , String2SQLtxtHP.Text Else If txtKdPasien.Text Then SQL = UPDATE T_PASIEN SET _ NAMA = String2SQLtxtNama.Text , _ TEMPAT_LAHIR = String2SQLtxtTempatLahir.Text , _ TGL_LAHIR = Date2SqldtTglLahir.Value , _ ALAMAT = String2SQLtxtAlamat.Text , _ KD_AGAMA = cmbAgama.BoundText , _ JK = cmbJK.BoundText , _ KD_PEKERJAAN = cmbPekerjaan.BoundText , _ NO_TELP = String2SQLtxtNoTelp.Text , _ HP = String2SQLtxtHP.Text _ WHERE KODE = txtKdPasien.Text Else AddStatus = False Exit Sub End If End If pADO.Execute SQL AddStatus = False Exit Sub ErrLocal: MsgBox ErrSave End Sub Private Sub cmdTambah_Click On Error GoTo ErrLocal AddStatus = True Call ResetData txtKdPasien.SetFocus Exit Sub ErrLocal: MsgBox ErrAdd End Sub Universitas Sumatera Utara Private Sub cmdTutup_Click Unload Me End Sub Private Sub ResetData txtKdPasien.Text = FieldValueT_PASIEN, TOP 1 KODE, 1=1 ORDER BY KODE DESC + 1 txtNama.Text = txtTempatLahir.Text = dtTglLahir.Value = TODAY cmbJK.Text = cmbAgama.Text = txtNoTelp.Text = txtHP.Text = cmbPekerjaan.Text = txtAlamat.Text = End Sub Private Sub DGSearch_Click On Error Resume Next txtKdPasien.Text = DGSearch.Columns0.Text Call ReLoadData End Sub Private Sub dtKeyTglLahir_KeyPressKeyAscii As Integer If KeyAscii = 13 Then KeyAscii = 0 dtKeyTglLahir.SetFocus SendKeys {End} Call cmdSearch_Click End If End Sub Private Sub Form_Activate If Me.left = frmLogo.left Then Me.left = frmLogo.left End If End Sub Private Sub Form_Load txtKey.Text = dtKeyTglLahir.Value = TODAY End Sub Private Sub ReLoadData SQL = SELECT FROM T_PASIEN WHERE KODE = txtKdPasien.Text pRS.CursorLocation = adUseClient pRS.Open SQL, pADO If Not pRS.EOF Then txtNama.Text = pRS.FieldsNAMA Universitas Sumatera Utara txtTempatLahir.Text = pRS.FieldsTEMPAT_LAHIR FillDateValue dtTglLahir, pRS.FieldsTGL_LAHIR txtAlamat.Text = pRS.FieldsALAMAT cmbAgama.BoundText = pRS.FieldsKD_AGAMA cmbJK.BoundText = pRS.FieldsJK cmbPekerjaan.BoundText = pRS.FieldsKD_PEKERJAAN txtNoTelp.Text = pRS.FieldsNO_TELP txtHP.Text = pRS.FieldsHP End If pRS.Close End Sub Private Sub Timer1_Timer If Me.left = frmLogo.left Then Me.left = frmLogo.left End If End Sub Private Sub txtKdPasien_LostFocus Call ReLoadData End Sub Private Sub txtkey_KeyPressKeyAscii As Integer If KeyAscii = 13 Then KeyAscii = 0 txtKey.SetFocus SendKeys {End} Call cmdSearch_Click End If End Sub Private Sub txtKeyAlamat_KeyPressKeyAscii As Integer If KeyAscii = 13 Then KeyAscii = 0 txtKeyAlamat.SetFocus SendKeys {End} Call cmdSearch_Click End If End Sub

7. Form Pegawai