Form Tupel 1. 2. 3. 4. 5. Buat project dengan nama”EHR” Buat database dengan nama “tupel” Buat tabel berikut dengan nama “tbtupel” Buat Form dengan nama “frmtupel” Berikut ini script “Form Tujuan Pelayanan” 5.1 Script Form procedure Load SET DELETED ON 5.2 Script Form Procedure Init thisform.text1.Enabled= .F. thisform.text2.Enabled= .F. 5.3 Script Text 1 Procedure Valid IF THISFORM.COMmand1.Enabled= .T. &&TAMBAH DATA IF NOT EMPTY(THISFORM.TExt1.Value ) SEEK THISFORM.TExt1.Value &&LOCATE IF FOUND() &&JIKA KETEMU THISFORM.TExt2.Value=TUPEL MESSAGEBOX('DATA SUDAH ADA, ISI LAINYA',0+64,'DATA ADA') RETURN(.F.) ELSE &&TIDAK KETEMU ENDIF ENDIF ENDIF IF THISFORM.COMmand2.Enabled= .T. &&KOREKSI DATA IF NOT EMPTY(THISFORM.TExt1.Value ) SEEK THISFORM.TExt1.Value &&LOCATE IF FOUND() &&JIKA KETEMU THISFORM.TExt2.Value=TUPEL ELSE &&TIDAK KETEMU MESSAGEBOX('DATA BELUM ADA, ISI LAINYA',0+64,'DATA TIDAK ADA') RETURN(.F.) ENDIF ENDIF ENDIF 5.4 Script Grid Procedure AfterRowColChance LPARAMETERS nColIndex THISFORM.TExt1.Value=IDTUPEL THISFORM.TExt2.Value=TUPEL 5.5 Script Tambah Data procedure Click IF thisform.command1.Caption='TAMBAH DATA' THISFORM.COMmand1.Caption='SIMPAN' THISFORM.COMmand2.Enabled= .F. THISFORM.TExt1.Enabled= .T. THISFORM.TExt2.Enabled= .T. THISFORM.TExt1.Value='' THISFORM.TExt2.Value='' THISFORM.TExt1.SetFocus ELSE &&SIMPAN IF EMPTY(THISFORM.TExt1.Value) OR EMPTY(THISFORM.TExt2.Value) MESSAGEBOX('ADA DATA YANG BELUM DIISI, KLIK BATAL UTK MEMBATALKAN',0+64,'KOSONG') ELSE THISFORM.COMmand1.Caption='TAMBAH DATA' THISFORM.COMmand2.Enabled= .T. APPEND BLANK REPLACE IDTUPEL WITH THISFORM.TExt1.Value REPLACE TUPEL WITH THISFORM.TExt2.Value THISFORM.TExt1.Enabled= .F. THISFORM.TExt2.Enabled= .F. THISFORM.GRdTbtupel.Refresh ENDIF ENDIF 5.6 Script Koreksi Data Procedure Click IF thisform.command2.Caption='KOREKSI DATA' THISFORM.COMmand2.Caption='SIMPAN' THISFORM.COMmand1.Enabled= .F. THISFORM.TExt1.Enabled= .T. THISFORM.TExt2.Enabled= .T. THISFORM.TExt1.Value='' THISFORM.TExt2.Value='' THISFORM.TExt1.SetFocus ELSE &&SIMPAN IF EMPTY(THISFORM.TExt1.Value) OR EMPTY(THISFORM.TExt2.Value) MESSAGEBOX('ADA DATA YANG BELUM DIISI, KLIK BATAL UTK MEMBATALKAN',0+64,'KOSONG') ELSE THISFORM.COMmand2.Caption='KOREKSI DATA' THISFORM.COMmand1.Enabled= .T. REPLACE IDTUPEL WITH THISFORM.TExt1.Value REPLACE TUPEL WITH THISFORM.TExt2.Value THISFORM.TExt1.Enabled= .F. THISFORM.TExt2.Enabled= .F. THISFORM.GRdTbtupel.Refresh ENDIF ENDIF 5.7 Script Hapus Data procedure Click IF MESSAGEBOX('BETUL DATA :'+ALLTRIM(TUPEL)+' YG MAU DIHAPUS?',4+32,'HAPUS')=6 DELETE THISFORM.GRdTbtupel.Refresh ENDIF 5.8 Script Batal Procedure Click THISFORM.TExt1.Value='' THISFORM.TExt2.Value='' THISFORM.TExt1.Enabled= .F. THISFORM.TExt2.Enabled= .F. THISFORM.COMmand1.Enabled= .T. THISFORM.COMmand2.Enabled= .T. THISFORM.COMmand1.Caption='TAMBAH DATA' THISFORM.COMmand2.Caption='KOREKSI DATA' 5.9 Script Keluar Procedure Click THISFORM.Release