1
BAGIAN I Tujuan : 1. 2. 3.
Membuat Project File Membuat menu program Menguji Menu Program
A.
BAHAN PRAKTEK I
1.1
Membuat Project File SKA 1. Buka Program Microsoft Visual FoxPro 9.0 2. Klik Menu File pada Menu Bar 3. Pilih New pada Sub Menu File
4. 5.
Pilih Type File Project Klik Tombol New File
6.
Pada kotak dialog Save in Pindahkan folder ke Forder PRG di Folder Anda, Jika belum ada silahkan anda buatkan dulu: O:\SKA\KARB\NamaAnda\PRG Isi baris Enter Project File dengan SKA (Nama File Project) Klik tombol Save
7. 8. 1.2
Membuat Menu Program 1. Klik Page Other pada Project File SKA 2. Pilih Menu 3. Klik tombol New
AMIK Al Ma’soem
2
1.3
4. Klik Tombol Menu Membuat Menu Bar
Ketik Menu Bar di atas seperti berikut ini :
1.4
Sub Menu File
1. 2. 3.
Klik pada prompt File Pilih Result Submenu, kemudian Klik tombol Create sebelah kanan Submenu Ketik submenu berikut :
AMIK Al Ma’soem
3
4. 5.
1.5
Untuk memasukan perintah CTRL+W, klik pada tombol Option, kemudian klik pada textbox (press the key) tekan CTRL+W. Lalu tekan tombol Ok untuk mengakhiri. Pada prompt Logout, ganti result dengan Procedure, kemudian ketik prosedur berikut : IF TYPE("MENUTAMA1")#"0" DO O:\ska\MINR\NAMA\prg\MENUTAMA1.MPR ENDIF
Sub Menu Master
1. 2. 3. 4.
Pindahkan Menu Level ke Menu Bar Klik Prompt Master Pilih Result Submenu, kemudian klik tombol Create sebelah kanan Submenu Ketik submenu berikut :
1.6
Sub Menu Transaksi Lakukan perintah seperti di atas, untuk membuat submenu dari Transaksi berikut ini :
1.7
Sub Menu Laporan Buatkan lagi submenu Laporan berikut dengan cara seperti membuat submenu Master.
1.8
Sub Menu BackUp Lakukan perintan yang sama untuk membuat submenu Backup berikut :
AMIK Al Ma’soem
4
1.9
Sub Menu Utility Lakukan pula perintah seperti di atas untuk membuat submenu Utility berikut :
1.10
Menyimpan Menu Program 1. Klik Menu File pada Menu Bar 2. Pilih Save
3. 4. 1.11
B.
Pada kotak dialog Save in, pindahkan ke folder PRG di folder Anda Ketik nama file Menutama pada baris Save Menu As, kemudian Klik tombol Save
Menguji Menu Program 1. Klik tanda + di sebelah kiri Menus pada page Other 2. Klik File Menutama, kemudian Klik tombol Run
LATIHAN I
Buatkan Menu Program Beikut, dan simpan dengan nama Menutama1 : 1.
Sub menu File
AMIK Al Ma’soem
5
2.
Sub menu Master
3.
Sub menu Transaksi
4.
Sub menu Laporan
5.
Sub menu BackUp
6.
Sub menu Utility
C.
TUGAS I
Buatkan Menu Program berikut, dan simpan dengen nama Menutama2 : 1. Sub menu File dan BackUp sama dengan Menutama
AMIK Al Ma’soem
6
2.
Sub menu Master adalah sbb :
3.
Sub menu Transaksi adalah sbb :
4.
Sub menu Laporan adalah sbb :
5.
Sub menu Utility adalah sbb :
AMIK Al Ma’soem
7
BAGIAN II Tujuan : 1. 2. 3. 4. 5. 6.
A.
Membuat Database DATASKA Membuat Tabel USER Membuat Free Table TMPUSER Membuat Form Login Connection File Form Menguji Form dan Menu Program
BAHAN PRAKTEK II
2.1 Membuat Database DATASKA dan Tabel USER, serta Free Tabel TMPUSER 1. Buatkan Database DATASKA pada folder DATA di folder Anda (O:\SKA\KARA\NAMA\DATA) 2. Buatkan Tabel USER pada database DATASKA dengan struktur sbb :
3. 4. 5.
Berikan Primary Key pada field NMID Simpan dengan nama file USER Buatkan lagi Tabel TMPUSER pada Free Tabel dengan struktur file yang sama dengan Tabel USER
2.2 Membuat Form LOGIN 1. Buatkan Form Login sbb :
2.
Isikan Procedure berikut pada form Login a. Object Form1 Procedure ACTIVATE set exact on set defa to O:\SKA\KELAS\NAMA\DATA if used('user')
AMIK Al Ma’soem
8
use in user endif if used('tmpuser') use in tmpuser endif SELECT a USE tmpuser SELECT b use user set order to tag nmid set order to tag pswd thisform.nmid.value="" thisform.pswd.value="" RETURN b. Object Form1 Procedure UNLOAD close data close index RETURN c.
Object LOGIN Procedure CLICK IF EMPTY(thisform.nmid.value) messagebox("User Id tidak boleh kosong...!",; 0,"Perhatian...") thisform.nmid.setfocus RETURN ELSE IF EMPTY(thisform.PSWD.value) messagebox("Password tidak boleh kosong...!",; 0,"Perhatian...") thisform.pswd.setfocus RETURN else use user set order to tag nmid LOCATE FOR NMID=TRIM(thisform.nmid.value) if ! found() messagebox("Maaf User Id Anda Belum Terdaftar...!",; 0,"Perhatian...") thisform.nmid.setfocus() retu else set order to tag pswd LOCATE for nmid=TRIM(thisform.nmid.value) .and.; pswd=TRIM(thisform.pswd.value)
if ! found() messagebox("Maaf Password Tidak Dikenal...!",; 0,"Perhatian...") thisform.pswd.setfocus() retu ELSE
AMIK Al Ma’soem
9
SELECT tmpuser DELETE ALL SET DELETED OFF PACK APPEND BLANK REPLACE nmid WITH thisform.nmid.Value REPLACE pswd WITH thisform.pswd.Value IF user.jabat=1 DO o:\ska\kelas\nama\prg\MENUTAMA2.MPR ELSE IF user.jabat=2 DO o:\ska\kelas\nama\prg\MENUTAMA.MPR ENDIF ENDIF ENDIF thisform.release() endif endif ENDIF ENDIF d. Object BATAL Procedure CLICK thisform.release() retu 2.3 1. 2. 3. 4. 5. 6.
7. 8.
Connection Form LOGIN ke Menutama1 Buka Menu Program Menutama1 Klik Prompt File pada Menu Level MenuBar Pilih Result Submenu, kemudian Klik Edit Klik Prompt Login pada Submenu File Pilih Result Procedure, kemudian klik Create Isikan procedure berikut : IF TYPE("FORMLOGIN")#"0" DO FORM o:\ska\kelas\nama\prg\FormLogin.SCX ENDIF Simpan MenuUtama1 Klik Tombol RUN, untuk menguji MenuUtama1
B. LATIHAN II 1.
Buatkan Form Kelola Data USER dengan LayOut sbb :
AMIK Al Ma’soem
10
2.
Procedure Form Kelola Data USER : a. Object Form1 Procedure LOAD close data close index set exact on set defa to o:\ska\kelas\nama\data if USED("user") USE IN user endif SELECT A USE user set order to tag nmid RETURN b.
Object Form1 Procedure UNLOAD CLOSE DATABASES CLOSE INDEXES RETURN
c.
Object Form1 Procedure Aktifkan PARAMETERS x thisform.pswd.Enabled=x thisform.jabat.Enabled=x RETURN
d.
Object Form1 Procedure Kendali PARAMETERS y thisform.pertama.Enabled=y thisform.sebelumnya.Enabled=y thisform.berikutnya.Enabled=y thisform.terakhir.Enabled=y RETURN
AMIK Al Ma’soem
11
e.
Object Form1 Procedure Kosongkan thisform.pswd.value="" thisform.jabat.value=0 retu
f.
Object Form1 Procedure Tampilkan thisform.nmid.value=user.nmid thisform.pswd.value=user.pswd thisform.jabat.value=user.jabat retu
g.
Object Form1 Procedure Activate thisform.nmid.enabled=.f. thisform.aktifkan(.f.) thisform.kendali(.t.) thisform.baru.enabled=.t. thisform.keluar.enabled=.t. thisform.hapus.enabled=.f. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.perbaiki.enabled=.f. thisform.ud.enabled=.f. thisform.kosongkan() thisform.baru.setfocus() thisform.grid1.readonly=.t. thisform.grid1.enabled=.t. return
h. Object NMID Procedure LOSTFOCUS if empty(thisform.nmid.value) messagebox("Nama Id Harus Diisi !",0,"Perhatian...!") thisform.nmid.setfocus() return endif IF len(trim(thisform.nmid.Value))<4 messagebox("User Id tidak boleh kurang dari 5 digit !",; 0,"Perhatian...")
thisform.nmid.setfocus RETURN ENDIF SELECT user SET ORDER TO TAG nmid SET EXACT ON if seek(thisform.nmid.value) thisform.grid1.setfocus() thisform.refresh() MESSAGEBOX("Data tersebut sudah ada..",; 0+48,"Perhatian...") else thisform.perbaiki.enabled=.f. thisform.ud.enabled=.f.
AMIK Al Ma’soem
12
thisform.batal.enabled=.t. thisform.baru.enabled=.f. thisform.simpan.enabled=.t. thisform.keluar.enabled=.f. thisform.hapus.enabled=.f. thisform.nmid.enabled=.f. thisform.aktifkan(.t.) thisform.kendali(.f.) thisform.kosongkan() thisform.pswd.setfocus() thisform.grid1.readonly=.t. thisform.grid1.enabled=.f. endif return i.
Oject PSWD Procedure LOSTFOCUS IF len(trim(thisform.pswd.Value))<4 messagebox("Password tidak boleh kurang dari 5 digit !",; 0,"Perhatian...")
thisform.pswd.setfocus RETURN ENDIF j.
Oject CARI Procedure CLICK if empty(thisform.nmid.value) messagebox("User Id Harus Diisi !",0,"Perhatian...!") thisform.nmid.setfocus() return endif SELECT user SET ORDER TO TAG nmid SET EXACT OFF LOCATE FOR nmid=TRIM(thisform.nmid.value) if FOUND() thisform.grid1.setfocus() thisform.refresh() ELSE MESSAGEBOX("Data tidak ditemukan...",0,"Perhatian...") thisform.perbaiki.enabled=.f. thisform.ud.enabled=.f. thisform.batal.enabled=.t. thisform.baru.enabled=.f. thisform.simpan.enabled=.f. thisform.keluar.enabled=.f. thisform.hapus.enabled=.f. thisform.nmid.enabled=.f. thisform.aktifkan(.f.) thisform.kendali(.f.) thisform.kosongkan thisform.pswd.enabled=.t. thisform.nmid.value=""
AMIK Al Ma’soem
13
thisform.pswd.setfocus thisform.grid1.readonly=.t. thisform.grid1.enabled=.f. endif return k.
Oject CARI Procedure RIGHTCLICK thisform.nmid.Enabled=.t. thisform.nmid.setfocus return
l.
Oject TAMBAH Procedure CLICK thisform.nmid.enabled=.t. thisform.aktifkan(.f.) thisform.kendali(.f.) thisform.baru.enabled=.f. thisform.keluar.enabled=.f. thisform.hapus.enabled=.f. thisform.simpan.enabled=.f. thisform.batal.enabled=.t. thisform.perbaiki.enabled=.f. thisform.ud.enabled=.f. thisform.grid1.readonly=.t. thisform.grid1.enabled=.f. thisform.kosongkan() thisform.nmid.setfocus() return
m. Oject SIMPAN Procedure CLICK IF EMPTY(thisform.nmid.value) messagebox("Isi dulu User Id-nya !",0,"Perhatian...") thisform.nmid.setfocus RETURN ELSE IF EMPTY(thisform.pswd.value) messagebox("Isi dulu Password-nya !",0,"Perhatian...") thisform.pswd.setfocus RETURN ELSE IF EMPTY(thisform.pswd.value) messagebox("Isi dulu Status-nya !",0,"Perhatian...") thisform.pswd.setfocus RETURN ELSE IF len(thisform.NMID.value)<4 messagebox("User Id minimal 4 Character...!",0,; "Perhatian...") thisform.nmid.setfocus RETURN ELSE IF len(thisform.PSWD.value)<4
AMIK Al Ma’soem
14
messagebox("Password minimal 4 Character...!",0,; "Perhatian...") thisform.pswd.setfocus RETURN ELSE SELECT user locate for nmid=trim(thisform.nmid.value) if found() messagebox("User Id ada yang sama !",0,; "Penyimpanan tidak bisa dilakukan") thisform.nmid.setfocus() RETURN endif locate for pswd=trim(thisform.pswd.value) if found() messagebox("Password ada yang sama !",0,; "Penyimpanan tidak bisa dilakukan") thisform.pswd.setfocus() return ENDIF IF ! EMPTY(thisform.jabat.Value) locate for nmid=space(14) if ! found() append blank endif repl nmid with thisform.nmid.value repl pswd with thisform.pswd.value repl jabat with thisform.jabat.value thisform.grid1.setfocus() thisform.Refresh() messagebox("Penyimpanan data sudah dilakukan !",0,; "Perhatian...") thisform.perbaiki.enabled=.t. thisform.ud.enabled=.f. thisform.batal.enabled=.f. thisform.baru.enabled=.t. thisform.simpan.enabled=.f. thisform.keluar.enabled=.t. thisform.hapus.enabled=.t. thisform.nmid.enabled=.f. thisform.aktifkan(.f.) thisform.kendali(.t.) thisform.grid1.readonly=.t. thisform.grid1.enabled=.t. return ELSE messagebox("Isi dulu Status-nya !",0,"Perhatian...") ENDIF ENDIF ENDIF ENDIF
AMIK Al Ma’soem
15
ENDIF Endif n. Oject BATAL Procedure CLICK thisform.nmid.enabled=.f. thisform.aktifkan(.f.) thisform.kendali(.t.) thisform.baru.enabled=.t. thisform.keluar.enabled=.t. thisform.hapus.enabled=.f. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.perbaiki.enabled=.f. thisform.ud.enabled=.f. thisform.grid1.readonly=.t. thisform.grid1.enabled=.t. thisform.kosongkan() thisform.nmid.setfocus() return o. Oject HAPUS Procedure CLICK SELECT user LOCATE FOR nmid=TRIM(THISFORM.nmid.Value) ln=RECNO() ljawab=messagebox("Anda Yakin ?",4+32+256,; "Record ini mau dihapus !") if ljawab=6 DELETE FOR nmid=TRIM(THISFORM.nmid.Value) set dele on ENDIF goto ln thisform.grid1.setfocus() thisform.refresh() thisform.perbaiki.enabled=.t. thisform.ud.enabled=.f. thisform.batal.enabled=.f. thisform.baru.enabled=.t. thisform.simpan.enabled=.f. thisform.keluar.enabled=.t. thisform.hapus.enabled=.t. thisform.nmid.enabled=.f. thisform.aktifkan(.f.) thisform.kendali(.t.) thisform.grid1.readonly=.t. thisform.grid1.enabled=.t. return p. Oject KELUAR Procedure CLICK set order to set dele off SELECT user
AMIK Al Ma’soem
16
pack thisform.release() return q.
Oject PERBAIKI Procedure CLICK thisform.perbaiki.enabled=.f. thisform.ud.enabled=.t. thisform.batal.enabled=.t. thisform.baru.enabled=.f. thisform.simpan.enabled=.f. thisform.keluar.enabled=.f. thisform.hapus.enabled=.f. thisform.aktifkan(.t.) thisform.kendali(.f.) thisform.nmid.enabled=.f. thisform.pswd.setfocus() thisform.grid1.readonly=.t. thisform.grid1.enabled=.f. return
r.
Oject PERTAMA Procedure CLICK SELECT user go top if eof() messagebox("Tidak ada record...",0,"Perhatian...!") return ENDIF thisform.grid1.setfocus thisform.refresh return
s.
Oject SEBELUMNYA Procedure CLICK SELECT user skip -1 if bof() go top ENDIF thisform.grid1.setfocus thisform.refresh return
t.
Oject BERIKUTNYA Procedure CLICK SELECT user skip if bof() go bottom ENDIF thisform.grid1.setfocus thisform.refresh return Oject TERAKHIR Procedure CLICK
u.
AMIK Al Ma’soem
17
SELECT user go bottom if eof() messagebox("Tidak ada record...",0,"Perhatian...!") return ENDIF thisform.grid1.setfocus thisform.refresh return v.
Oject GRID1 Procedure AfterRowColChange LPARAMETERS nColIndex thisform.perbaiki.enabled=.t. thisform.hapus.enabled=.t. thisform.batal.enabled=.f. thisform.nmid.enabled=.f. thisform.aktifkan(.f.) thisform.kendali(.t.) thisform.baru.enabled=.t. thisform.simpan.enabled=.f. thisform.keluar.enabled=.t. thisform.grid1.enabled=.t. thisform.grid1.readonly=.t. thisform.tampilkan() retu
C. TUGAS II Buatkan Form Mengganti Password dengan LayOut sbb :
AMIK Al Ma’soem
18
BAGIAN III Tujuan : 1. 2. 3.
Membuat Table Perkiraan Membuat Table Jurnal Membuat Form untuk mengelola data Perkiraan
A.
BAHAN PRAKTEK III
3.1
Table Perkiraan Nama Table Primary Key
: Perkiraan : Noper
Table Jurnal Nama Table Primary Key
: Jurnal :-
3.2
1.3
Form Kelola Data Perkiraan Nama Form : Perkiraan
AMIK Al Ma’soem
19
3.4
Procedure Program
*Object FORM1 Procedure LOAD SET DEFAULT TO O:\SKA\KELAS\NAMA\DATA CLOSE DATABASES CLOSE INDEXES IF USED("PERKIRAAN") USE IN PERKIRAAN ENDIF IF USED("JURNAL") USE IN JURNAL ENDIF SELECT A USE PERKIRAAN SET ORDER TO TAG NOPER SELECT B USE JURNAL RETU *Object FORM1 Procedure UNLOAD CLOSE DATABASES CLOSE INDEXES
AMIK Al Ma’soem
20
USE IN perkiraan RETURN *Object FORM1 Procedure AKTIFKAN PARAMETERS X THISFORM.noper.Enabled=X THISFORM.namaper.Enabled=X THISFORM.saldoa.Enabled=X RETU *Object FORM1 Procedure KENDALI PARAMETERS Y THISFORM.PERTAMA.Enabled=Y THISFORM.SEBELUMNYA.Enabled=Y THISFORM.BERIKUTNYA.Enabled=Y THISFORM.TERAKHIR.Enabled=Y RETU *Object FORM1 Procedure KOSONGKAN THISFORM.noper.Value="" THISFORM.namaper.Value="" THISFORM.saldoa.Value=0 RETU *Object FORM1 Procedure TAMPILKAN THISFORM.noac.Value=PERKIRAAN.noac+"-" THISFORM.noper.Value=RIGHT(PERKIRAAN.NOPER,4) THISFORM.namaper.Value=PERKIRAAN.NAMAPER THISFORM.saldoa.Value=PERKIRAAN.SALDOJ RETU *Object FORM1 Procedure ACTIVATE thisform.perkiraan.ActivePage =1 SELECT perkiraan SET FILTER TO NOAC="1" thisform.refresh THISFORM.KOSONGKAN THISFORM.KENDALI(.T.) THISFORM.AKTIFKAN(.F.) THISFORM.tambah.Enabled=.T. THISFORM.batal.Enabled=.f. THISFORM.simpan.Enabled=.f. THISFORM.hapus.Enabled=.f. THISFORM.perbaiki.Enabled=.f. THISFORM.ud.Enabled=.f. THISFORM.keluar.Enabled=.T. RETU *Object PERKIRAAN Procedure CLICK SELECT perkiraan IF thisform.perkiraan.activepage=1
AMIK Al Ma’soem
21
thisform.kosongkan thisform.noac.value="1-" SET FILTER TO LEFT(perkiraan.noper,1)="1" thisform.refresh else IF thisform.perkiraan.activepage=2 thisform.kosongkan thisform.noac.value="2-" SET FILTER TO LEFT(perkiraan.noper,1)="2" thisform.refresh else IF thisform.perkiraan.activepage=3 thisform.kosongkan thisform.noac.value="3-" SET FILTER TO LEFT(perkiraan.noper,1)="3" thisform.refresh ELSE IF thisform.perkiraan.activepage=4 thisform.kosongkan thisform.noac.value="4-" SET FILTER TO LEFT(perkiraan.noper,1)="4" thisform.refresh ELSE IF thisform.perkiraan.activepage=5 thisform.kosongkan thisform.noac.value="5-" SET FILTER TO LEFT(perkiraan.noper,1)="5" thisform.refresh ELSE thisform.kosongkan thisform.noac.value="6-" SET FILTER TO LEFT(perkiraan.noper,1)="6" thisform.refresh endif endif ENDIF endif endif *Object TAMBAH Procedure CLICK IF EMPTY(thisform.noac.Value) MESSAGEBOX("Pilih dulu Account yang akan diisi...",0,; "Perhatian...!") RETURN ENDIF THISFORM.KOSONGKAN THISFORM.KENDALI(.f.) THISFORM.AKTIFKAN(.t.) THISFORM.tambah.Enabled=.f. THISFORM.simpan.Enabled=.t. THISFORM.batal.Enabled=.T.
AMIK Al Ma’soem
22
THISFORM.hapus.Enabled=.f. THISFORM.perbaiki.Enabled=.f. THISFORM.ud.Enabled=.f. THISFORM.cetak.Enabled=.f. THISFORM.keluar.Enabled=.f. thisform.noper.setfocus RETU *Object SIMPAN Procedure CLICK IF EMPTY(thisform.noper.Value) .or. EMPTY(thisform.namaper.Value) MESSAGEBOX("Nomor & Nama Perkiraan harus diisi !",0,; "perhatian..!") thisform.noper.SetFocus RETURN ENDIF SELECT perkiraan vnoper=TRIM(thisform.noac.Value)+thisform.noper.Value LOCATE FOR NOPER=vNOPER IF FOUND() thisform.grid1.setfocus() thisform.refresh() messagebox("Perkiraan tsb sudah tercatat...!",0,; "Perhatian...") THISFORM.KENDALI(.t.) THISFORM.AKTIFKAN(.f.) THISFORM.tambah.Enabled=.t. THISFORM.batal.Enabled=.f. THISFORM.simpan.Enabled=.f. THISFORM.hapus.Enabled=.f. THISFORM.perbaiki.Enabled=.f. THISFORM.ud.Enabled=.f. THISFORM.keluar.Enabled=.t. return ENDIF SET FILTER TO LOCATE FOR perkiraan.noper=SPACE(6) IF .not. FOUND() APPEND BLANK ENDIF vnoper=TRIM(thisform.noac.Value)+thisform.noper.Value REPLACE Noper WITH vNoper REPLACE noac WITH LEFT(Thisform.noac.Value,1) REPLACE namaper WITH thisform.namaper.Value REPLACE saldoa WITH thisform.saldoa.Value REPLACE saldoj WITH thisform.saldoa.Value SET FILTER TO noac=LEFT(Thisform.noac.Value,1) thisform.grid1.SetFocus thisform.Refresh THISFORM.KENDALI(.t.) THISFORM.AKTIFKAN(.f.) THISFORM.tambah.Enabled=.t.
AMIK Al Ma’soem
23
THISFORM.batal.Enabled=.f. THISFORM.simpan.Enabled=.f. THISFORM.hapus.Enabled=.f. THISFORM.perbaiki.Enabled=.f. THISFORM.ud.Enabled=.f. THISFORM.keluar.Enabled=.t. RETURN *Object BATAL Procedure CLICK THISFORM.KOSONGKAN THISFORM.KENDALI(.t.) THISFORM.AKTIFKAN(.f.) THISFORM.tambah.Enabled=.t. THISFORM.batal.Enabled=.f. THISFORM.simpan.Enabled=.f. THISFORM.hapus.Enabled=.f. THISFORM.perbaiki.Enabled=.f. THISFORM.ud.Enabled=.f. THISFORM.keluar.Enabled=.t. RETURN *Object HAPUS Procedure CLICK vnoper=TRIM(thisform.noac.Value)+thisform.noper.Value * IF vnoper="1-1100" .or. vnoper="1-2000" .or. vnoper="2-1000" * MESSAGEBOX("Maaf nomor ini tidak bisa dihapus...",0,; "Perhatian...") * RETURN *endif SELECT jurnal LOCATE FOR NOPER=vnoper IF FOUND() MESSAGEBOX("Maaf nomor perkiraan ini tidak bisa dihapus..."+; CHR(13)+"karena sudah digunakan dalam transaksi...",0,; "Perhatian...") thisform.Refresh() RETURN ENDIF SELECT perkiraan LOCATE FOR NOPER=vnoper jawab=MESSAGEBOX("Anda Yakin Record ini mau dihapus...?",; 4+32+256,"Pehatian...") IF jawab=6 DELETE &&FOR noper=vnoper SET DELETED ON thisform.refresh ENDIF *Object KELUAR Procedure CLICK thisform.Release SELECT perkiraan
AMIK Al Ma’soem
24
SET DELETED OFF pack RETURN *Object CETAK Procedure CLICK SELECT perkiraan SET FILTER TO REPORT FORM O:\SKA\KELAS\NAMA\PRG\perkiraan preview Return *Object PERBAIKI Procedure CLICK vnoper=TRIM(thisform.noac.Value)+thisform.noper.Value SELECT jurnal LOCATE FOR NOPER=vnoper IF FOUND() MESSAGEBOX("Maaf Perkiraan tersebut tidak bisa diperbaiki"+;
CHR(13)+"karena sudah digunakan dalam transaksi...",; 0,"Perhatian...") thisform.Refresh RETURN ENDIF SELECT perkiraan LOCATE FOR NOPER=vnoper * IF vnoper="1-1100" .or. vnoper="1-2000" .or. vnoper="2-1000" * MESSAGEBOX("Maaf nomor perkiraan ini tidak bisa diperbaiki...",; 0,"Perhatian...")
* RETURN *endif THISFORM.KENDALI(.f.) THISFORM.AKTIFKAN(.t.) THISFORM.tambah.Enabled=.f. THISFORM.simpan.Enabled=.f. THISFORM.batal.Enabled=.T. THISFORM.hapus.Enabled=.f. THISFORM.perbaiki.Enabled=.f. THISFORM.ud.Enabled=.f. THISFORM.cetak.Enabled=.f. THISFORM.keluar.Enabled=.f. thisform.namaper.setfocus return *Object UD Procedure CLICK vnoper=TRIM(thisform.noac.Value)+thisform.noper.Value jawab=MESSAGEBOX("Anda Yakin Mau Memperbaiki data Sebelumnya ?",; 4+32+512,"Perhatian...") IF jawab=6 * REPLACE Noper WITH vNoper REPLACE namaper WITH thisform.namaper.Value REPLACE saldoa WITH thisform.saldoa.Value REPLACE saldoj WITH thisform.saldoa.Value ENDIF
AMIK Al Ma’soem
25
thisform.grid1.SetFocus thisform.refresh THISFORM.KENDALI(.t.) THISFORM.AKTIFKAN(.f.) THISFORM.tambah.Enabled=.t. THISFORM.simpan.Enabled=.f. THISFORM.batal.Enabled=.f. THISFORM.hapus.Enabled=.t. THISFORM.perbaiki.Enabled=.f. THISFORM.ud.Enabled=.f. THISFORM.keluar.Enabled=.t. thisform.namaper.setfocus return *Object PERTAMA Procedure CLICK SELECT perkiraan GO top IF EOF() MESSAGEBOX("Tidak ada data...",0,"Perhatian...") RETURN ENDIF thisform.grid1.SetFocus() thisform.Refresh() RETURN *Object SEBELUMNYA Procedure CLICK SELECT perkiraan SKIP -1 IF EOF() GO top ENDIF thisform.grid1.SetFocus() thisform.Refresh() RETURN *Object BERIKUTNYA Procedure CLICK SELECT perkiraan SKIP 1 IF EOF() GO bottom ENDIF thisform.grid1.SetFocus() thisform.Refresh() RETURN *Object TERAKHIR Procedure CLICK SELECT perkiraan GO bottom IF EOF() MESSAGEBOX("Tidak ada data...",0,"Perhatian...") RETURN
AMIK Al Ma’soem
26
ENDIF thisform.grid1.SetFocus() thisform.Refresh() RETURN *Object GRID1 Procedure AfterRowCollChenge LPARAMETERS nColIndex thisform.tampilkan THISFORM.KENDALI(.t.) THISFORM.AKTIFKAN(.f.) THISFORM.tambah.Enabled=.t. THISFORM.simpan.Enabled=.f. THISFORM.batal.Enabled=.f. THISFORM.hapus.Enabled=.t. THISFORM.perbaiki.Enabled=.t. THISFORM.ud.Enabled=.f. THISFORM.keluar.Enabled=.t. thisform.namaper.setfocus return
B. TUGAS III : 1.
2.
Lakukan survey ke perusahaan UKM, untuk mengetahui : Harta Kekayaan Perusahaan (Kas, Perlengkapan, Peralatan, dll), Utang, Modal, Jenis-jenis pendapatan, dan Biaya-biaya (beban) yang dikeluarkan perusahaan. Buat Form perkiraannya.
AMIK Al Ma’soem
27
BAGIAN IV Tujuan : 1. 2. 3.
Membuat Report Saldo Perkiraan Filter Grouping
A. BAHAN PRAKTEK IV
Formula : Per : cmonth(date())+" "+str(year(date()),4) Nomor Perkiraan : Perkiraan.noper Nama Perkiraan : Perkiraan.namaper Saldo Berjalan : Perkiraan.saldoj (Format Exp : 999,999,999,999 ; Alignment : Right ) Total : iif(Perkiraan.noac="1","Aktiva",iif(Perkiraan.noac="2","Utang",iif(Perkiraan.noac="3","Modal", iif(perkiraan.noac="4","Pendapatan",iif(Perkiraan.noac="5","Harga Pokok",iif(perkiraan.noac="6", ”Biaya”, iif(Perkiraan.noac="7","Pend.Jasa",""))))))) Perkiraan.saldoj (Format exp : 999,999,999,999 ; Alignment : Right ; Calculate type : Sum & Reset based on : Group Perkiraan.noac)
B. TUGAS IV Buatkan Report Daftar/Saldo Perkiraan dari Tugas III di atas.
AMIK Al Ma’soem
28
BAGIAN V Tujuan : 1. 2. 3.
Transaksi Jurnal Umum Link File Relasi File
A. BAHAN PRAKTEK V: 5.1
Free Table Temporary Jurnal Nama Free Table : TMPJURNAL Primary Key :-
5.2
Free Table Temporary Total Jurnal Nama Free Table : TMPJ Primary Key :-
5.3
Free Table Nomor Bukti Nama Free Table Primary Key
: NoBukti :-
AMIK Al Ma’soem
29
5.4
Form Jurnal
* Object FORM1 Procedure LOAD SET DEFAULT TO O:\SKA\KELAS\NAMA\DATA CLOSE DATABASES CLOSE INDEXES SET DATE BRITISH SET EXACT ON IF USED("perkiraan") USE IN perkiraan ENDIF IF USED("jurnal") USE IN jurnal ENDIF IF USED("tmpjurnal") USE IN tmpjurnal ENDIF IF USED("NoBukti") USE IN NoBukti ENDIF SELECT 1 USE perkiraan SET ORDER TO tag Noper SELECT 2 USE jurnal SET ORDER TO TAG NOBUKTI SELECT 3 USE tmpjurnal SET ORDER TO TAG NoBukti SELECT 4 USE NoBukti SELECT 5 USE tmpj RETURN
AMIK Al Ma’soem
30
* Object FORM1 Procedure UNLOAD CLOSE DATABASES CLOSE INDEXES RETURN * Object FORM1 Procedure AKTIFKAN PARAMETERS x thisform.tgltran.enabled=x thisform.catatan.enabled=x thisform.noper.enabled=x thisform.namaper.enabled=x thisform.debet.enabled=x thisform.kredit.enabled=x RETURN * Object FORM1 Procedure KENDALI PARAMETERS Y thisform.pertama.Enabled=Y thisform.berikutnya.Enabled=Y thisform.sebelumnya.Enabled=Y thisform.terakhir.Enabled=Y RETURN * Object FORM1 Procedure KOSONGKAN thisform.noper.Value="" thisform.debet.Value=0 thisform.kredit.Value=0 thisform.namaper.Value="" RETURN * Object FORM1 Procedure TAMPIL thisform.namaper.value=tmpjurnal.namaper thisform.noper.value=tmpjurnal.noper thisform.debet.value=tmpjurnal.debet thisform.kredit.value=tmpjurnal.kredit RETURN * Object FORM1 Procedure TAMPILKAN SELECT jurnal thisform.nobukti.value=jurnal.noBukti thisform.tgltran.value=jurnal.tgltran thisform.catatan.value=jurnal.catatan thisform.noper.value=jurnal.noper thisform.debet.value=jurnal.debet thisform.kredit.value=jurnal.kredit SELECT perkiraan SEEK thisform.noper.Value thisform.namaper.Value=perkiraan.namaper SELECT tmpjurnal
AMIK Al Ma’soem
31
DELETE ALL SET DELETED ON APPEND FROM jurnal FOR NoBukti=TRIM(thisform.nobukti.Value) GO top vjd=0 vjk=0 DO WHILE ! EOF() SELECT perkiraan LOCATE FOR NOPER=tmpjurnal.noper IF FOUND() vnamaper=perkiraan.namaper ELSE vnamaper="" ENDIF SELECT tmpjurnal REPLACE namaper WITH vnamaper vjd=vjd+tmpjurnal.debet vjk=vjk+tmpjurnal.kredit skip ENDDO SELECT tmpj GO bottom REPLACE NoBukti WITH thisform.nobukti.Value REPLACE Jdebet WITH vJD REPLACE Jkredit WITH vJK SELECT tmpjurnal GO top thisform.lihat.enabled=.t. thisform.grid1.SetFocus thisform.Refresh RETURN * Object FORM1 Procedure ACTIVATE thisform.aktifkan(.f.) SELECT TMPJURNAL DELETE ALL SET DELETED ON thisform.nobukti.Value="" thisform.kosongkan thisform.tgltran.Value=DATE() thisform.kendali(.t.) thisform.ok.enabled=.f. thisform.tambah.enabled=.t. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.keluar.enabled=.t. thisform.tambah.setfocus RETURN
AMIK Al Ma’soem
32
* Object TAMBAH Procedure CLICK PUBLIC vNo thisform.noper.Value="" thisform.kosongkan SELECT tmpjurnal SET DELETED ON DELETE ALL SELECT tmpj DELETE ALL PACK thisform.refresh thisform.aktifkan(.t.) SELECT NoBukti GO BOTTOM IF YEAR(NoBukti.Tanggal)<>YEAR(DATE()) DELETE ALL PACK APPEND BLANK Vno=1 ELSE Vno=NoBukti.No+1 ENDIF IF vNo<10 VNoBukti="GL0000000"+STR(Vno,1) else IF vNo<100 VNoBukti="GL000000"+STR(Vno,2) ELSE IF vNo<1000 VNoBukti="GL00000"+STR(Vno,3) ELSE IF vNo<10000 VNoBukti="GL0000"+STR(Vno,4) ELSE IF vNo<100000 VNoBukti="GL000"+STR(Vno,5) ELSE IF vNo<1000000 VNoBukti="GL00"+STR(Vno,6) ELSE IF vNo<10000000 VNoBukti="GL0"+STR(Vno,7) ELSE vNoBukti="GL"+STR(VNo,8) ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF endif
AMIK Al Ma’soem
33
thisform.nobukti.Value=vNoBukti thisform.tgltran.Value=DATE() thisform.kendali(.f.) thisform.ok.enabled=.t. thisform.tambah.enabled=.f. thisform.simpan.enabled=.f. thisform.batal.enabled=.t. thisform.keluar.enabled=.f. thisform.lihat.enabled=.f. thisform.tgltran.setfocus RETURN * Object NAMAPER Procedure InteractiveChange SELECT Perkiraan LOCATE FOR namaper=thisform.namaper.Value thisform.noper.Value=Noper thisform.debet.Value=0 thisform.kredit.Value=0 thisform.ok.Enabled=.t. RETURN * Object NOPER Procedure LOSTFOCUS SELECT perkiraan LOCATE FOR NOPER=TRIM(thisform.noper.Value) IF FOUND() thisform.namaper.Value=perkiraan.namaper ELSE thisform.namaper.Value="" ENDIF thisform.ok.Enabled=.t. RETURN * Object NOPER Procedure Click SELECT Perkiraan LOCATE FOR noper=thisform.noper.Value thisform.namaper.Value=Namaper thisform.debet.Value=0 thisform.kredit.Value=0 thisform.ok.Enabled=.t. RETURN * Object KREDIT Procedure Click SELECT tmpjurnal thisform.kredit.Value=tmpj.jdebet-tmpj.jkredit RETURN * Object OK Procedure Click IF thisform.debet.Value=thisform.kredit.Value MESSAGEBOX("Lakukan proses jurnal dengan benar...",0,"Perhatian...") thisform.kredit.SetFocus
AMIK Al Ma’soem
34
RETURN ENDIF SELECT tmpjurnal LOCATE FOR Noper=thisform.noper.Value IF FOUND() MESSAGEBOX("Nomor perkiraan yang anda masukan duplikasi..."+; CHR(13)+"Coba anda periksa lagi jurnalnya...!",0,; "Perhatian...") thisform.noper.SetFocus RETURN ENDIF SELECT perkiraan LOCATE FOR Noper=thisform.noper.Value IF thisform.kredit.Value>0 IF perkiraan.saldoj
ELSE REPLACE saldoj WITH saldoj-thisform.debet.Value+thisform.kredit.value
ENDIF SELECT jurnal LOCATE FOR noBukti=space(10) IF ! FOUND() APPEND BLANK ENDIF REPLACE NoBukti WITH thisform.nobukti.value REPLACE tgltran WITH thisform.tgltran.value REPLACE Catatan WITH thisform.catatan.value REPLACE Noper WITH thisform.noper.value REPLACE debet WITH thisform.debet.value REPLACE kredit WITH thisform.kredit.value SELECT tmpjurnal APPEND BLANK REPLACE NoBukti WITH thisform.nobukti.value REPLACE tgltran WITH thisform.tgltran.value REPLACE Catatan WITH thisform.catatan.value REPLACE Noper WITH thisform.noper.value REPLACE debet WITH thisform.debet.value REPLACE kredit WITH thisform.kredit.value REPLACE namaper WITH thisform.namaper.value SELECT tmpj GO bottom
AMIK Al Ma’soem
35
IF EOF() APPEND BLANK ENDIF REPLACE NoBukti WITH thisform.nobukti.value REPLACE jdebet WITH jdebet+thisform.debet.Value REPLACE jkredit WITH jkredit+thisform.kredit.Value thisform.grid1.setfocus thisform.refresh thisform.kendali(.f.) thisform.ok.enabled=.f. thisform.tambah.enabled=.f. thisform.simpan.enabled=.t. thisform.batal.enabled=.t. thisform.keluar.enabled=.f. RETURN * Object SIMPAN Procedure Click SELECT tmpj SET FILTER TO NoBUkti=thisform.nobukti.value IF jdebet<>Jkredit MESSAGEBOX("Soory Transaksi tidak bisa disimpan"+CHR(13)+; "Periksa lagi sisi Debet dan Kreditnya...",0,"Perhatian...") RETURN ENDIF SELECT NoBukti GO bottom REPLACE No WITH Vno REPLACE tanggal WITH thisform.tgltran.value thisform.kendali(.t.) thisform.ok.enabled=.f. thisform.tambah.enabled=.t. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.keluar.enabled=.t. thisform.lihat.enabled=.t. thisform.tambah.setfocus RETURN * Object BATAL Procedure Click SELECT perkiraan LOCATE FOR NOPER=TRIM(thisform.noper.Value) IF noac="1" .or. noac="6" IF thisform.debet.Value>0 REPLACE perkiraan.saldoj WITH perkiraan.saldoj - thisform.debet.Value
ELSE IF thisform.kredit.Value>0 REPLACE perkiraan.saldoj WITH perkiraan.saldoj + thisform.kredit.Value
ENDIF ENDIF ELSE IF thisform.debet.Value>0
AMIK Al Ma’soem
36
REPLACE perkiraan.saldoj WITH perkiraan.saldoj + thisform.debet.Value
ELSE IF thisform.kredit.Value>0 REPLACE perkiraan.saldoj WITH perkiraan.saldoj - thisform.kredit.Value
ENDIF ENDIF ENDIF SELECT jurnal DELETE FOR noper=TRIM(thisform.noper.Value) .and.; NoBukti=TRIM(thisform.nobukti.Value)
PACK thisform.aktifkan(.f.) SELECT TMPJURNAL DELETE FOR noper=TRIM(thisform.noper.Value) .and.; NoBukti=TRIM(thisform.nobukti.Value)
SET DELETED ON thisform.noper.Value="" thisform.kosongkan thisform.tgltran.Value=DATE() thisform.kendali(.t.) thisform.ok.enabled=.f. thisform.tambah.enabled=.t. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.keluar.enabled=.t. thisform.refresh thisform.tambah.setfocus RETURN * Object LIHAT Procedure Click SELECT Jurnal SET RELATION TO Noper INTO Perkiraan SET FILTER TO MONTH(tgltran)=MONTH(thisform.tgltran.Value) REPORT FORM d:\SKA\KELAS\NAMA\PRG\Jurnal PREVIEW RETURN * Object PERK Procedure Click do form d:\ska\prg\perk.scx return * Object PERTAMA Procedure Click SELECT jurnal GO top IF EOF() MESSAGEBOX("Record Kosong...",0,"Perhatian...") RETURN ENDIF thisform.tampilkan thisform.kendali(.t.) thisform.ok.enabled=.f. thisform.tambah.enabled=.t.
AMIK Al Ma’soem
37
thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.keluar.enabled=.t. thisform.grid1.SetFocus() thisform.Refresh RETURN * Object SEBELUMNYA Procedure Click SELECT jurnal SKIP -1 IF EOF() GO bottom ENDIF thisform.tampilkan thisform.kendali(.t.) thisform.ok.enabled=.f. thisform.tambah.enabled=.t. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.keluar.enabled=.t. thisform.grid1.SetFocus() thisform.Refresh RETURN * Object BERIKUTNYA Procedure Click SELECT jurnal SKIP IF EOF() GO bottom ENDIF thisform.tampilkan thisform.kendali(.t.) thisform.ok.enabled=.f. thisform.tambah.enabled=.t. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.keluar.enabled=.t. thisform.grid1.SetFocus() thisform.Refresh RETURN * Object TERAKHIR Procedure Click SELECT jurnal GO Bottom IF EOF() MESSAGEBOX("Record Kosong...",0,"Perhatian...") RETURN ENDIF thisform.tampilkan thisform.kendali(.t.) thisform.ok.enabled=.f.
AMIK Al Ma’soem
38
thisform.tambah.enabled=.t. thisform.simpan.enabled=.f. thisform.batal.enabled=.f. thisform.keluar.enabled=.t. thisform.grid1.SetFocus() thisform.Refresh RETURN * Object GRID1 Procedure AfterRowCollChenge LPARAMETERS nColIndex thisform.tampil RETURN * Object KELUAR Procedure Click SELECT tmpjurnal SET DELETED OFF PACK thisform.Release RETURN
B. TUGAS V: Buatkan Form Jurnal dari Tugas III di atas.
AMIK Al Ma’soem
39
BAGIAN VI Tujuan : 1. 2.
Membuat Report Jurnal Umum Grouping
A. BAHAN PRAKTEK VI 6.1 Membuat Report Laporan Jurnal
Formula : Data Grouping : Jurnal.nobukti Nomor Bukti : Jurnal.NoBukti Tanggal Transaksi : Jurnal.tanggal Nomor Perkiraan : Jurnal.noper Nama Perkiraan : Perkiraan.namaper Debet : Jurnal.debet Kredit : Jurnal.kredit
AMIK Al Ma’soem
40
6.2
Membuat Form Laporan Jurnal
* Object FORM1 Procedure LOAD SET DEFAULT TO O:\SKA\KELAS\NAMA\DATA CLOSE DATABASES CLOSE INDEXES SET DATE BRITISH SET EXACT ON IF USED("perkiraan") USE IN perkiraan ENDIF IF USED("jurnal") USE IN jurnal ENDIF SELECT 1 USE perkiraan SET ORDER TO tag Noper SELECT 2 USE jurnal SET ORDER TO TAG NOBUKTI SET RELATION TO NOPER INTO PERKIRAAN RETURN * Object FORM1 Procedure UNLOAD CLOSE DATABASE CLOSE INDEX USE IN JURNAL * Object FORM1 Procedure ACTIVATE thisform.t1.year=YEAR(DATE()) thisform.t2.day=day(DATE()) thisform.t2.month=month(DATE()) thisform.t2.year=YEAR(DATE()) return * Object CETAK Procedure CLICK ta=thisform.t1.day
AMIK Al Ma’soem
41
ma=thisform.t1.month ya=thisform.t1.year tb=thisform.t2.day mb=thisform.t2.month yb=thisform.t2.year tgl1=STR(ta)+"/"+STR(ma)+"/"+STR(ya) tgl2=STR(tb)+"/"+STR(mb)+"/"+STR(yb) SELECT jurnal SET FILTER TO tgltran>=CTOD(tgl1) .and.; tgltran<=CTOD(tgl2) REPORT FORM d:\SKA\prg\jurnal preview RETURN * Object KELUAR Procedure CLICK thisform.release RETURN
B. TUGAS VI Buatkan Laporan Jurnal untuk Tugas V di atas.
AMIK Al Ma’soem
42
BAGIAN VII Tujuan : 1. 2.
Membuat Report Neraca Saldo Penggunaan File Mirror
A. BAHAN PRAKTEK VII 7.1
Table Temporary (Miror) dibuat pada Free Table Nama Table : TMPPER Primary Key :-
7.2
Report Neraca Saldo
AMIK Al Ma’soem
43
Formula : Per : cmonth(tmpper.tanggal)+" "+str(year(tmpper.tanggal),4) Header : IIF( Tmpper.noac="1","AKTIVA",IIF( Tmpper.noac="2","UTANG","MODAL")) Nama Perkiraan : tmpper.namaper Saldo : tmpper.saldoj (Format exp : 999,999,999,999 ; alignment : right) Total : iif(left(tmpper.noper,1)="1","Aktiva",iif(left(tmpper.noper,1)="2","Utang","Modal")) Tmpper.saldoj (Format exp : 999,999,999,999 ; alignment : right ; calculation type : sum ; reset based on : Group tmpper.noac) Laba berjalan : tmpper.laba Selisih : tmpper.selisih Total Pasiva : tmpper.pasiva
7.3
Form Laporan Neraca Saldo
AMIK Al Ma’soem
44
* Object FORM1 Procedure LOAD SET TALK OFF SET DEFAULT TO O:\ska\kelas\nama\data SET DATE BRITISH SET CENTURY ON CLOSE DATABASES CLOSE INDEXES IF USED("Perkiraan") USE IN perkiraan ENDIF IF USED("TMPPER") USE IN tmpper ENDIF SELECT 1 USE PERKIRAAN SET ORDER TO TAG NOPER SELECT 2 USE tmpper SET ORDER TO TAG NOPER RETURN * Object FORM1 Procedure UNLOAD CLOSE DATABASE CLOSE INDEX RETURN * Object FORM1 Procedure ACTIVATE thisform.tgl.day=DAY(DATE()) thisform.tgl.month=month(DATE()) thisform.tgl.year=year(DATE()) return * Object CETAK Procedure CLICK d=thisform.tgl.day m=thisform.tgl.month y=thisform.tgl.year tgl1=STR(d,2)+"/"+STR(m,2)+"/"+STR(y,4) tgl=CTOD(tgl1) Vaktiva=0 Vutang=0 Vmodal=0 Vpend=0 Vhp=0 Vjasa=0 Vbiaya=0 Vpasiva=0 vselisih=0 vlaba=0 vp=0
AMIK Al Ma’soem
45
SELECT tmpper SET DELETED OFF DELETE ALL PACK APPEND FROM perkiraan FOR noac="1" .or. noac="2" .or. noac="3" SELECT perkiraan SUM saldoj FOR LEFT(noper,1)="1" TO vaktiva SUM saldoj FOR LEFT(noper,1)="2" TO vutang SUM saldoj FOR LEFT(noper,1)="3" TO vmodal SUM saldoj FOR LEFT(noper,1)="4" TO vpend SUM saldoj FOR LEFT(noper,1)="6" TO vbiaya SUM saldoj FOR LEFT(noper,1)="5" TO vhp SELECT TMPPER DELETE ALL FOR saldoj=0 PACK GO bottom REPLACE Aktiva WITH vaktiva REPLACE UTANG WITH vUTANG REPLACE modal WITH vmodal REPLACE pend WITH vpend REPLACE biaya WITH vbiaya REPLACE hp WITH vhp vlaba=vpend-vhp-vbiaya vp=vmodal+vutang+vlaba vselisih=vaktiva-vp vpasiva=vmodal+vutang+vselisih+vlaba REPLACE LABA WITH vlaba REPLACE selisih WITH vselisih REPLACE pasiva WITH vpasiva REPLACE ALL TGLTRAN WITH TGL REPORT FORM O:\SKA\KELAS\NAMA\PRG\NERACA PREVIEW RETURN * Object KELUAR Procedure CLICK SELECT tmpper SET DELETED OFF PACK thisform.Release RETURN
B. TUGAS VII Buatkan Neraca Saldo untuk Tugas IV dan V. Buatkan Menu Program untuk kasus pada Tugas III di atas, dan buatkan procedure seperti pada praktek VII untuk menampilkan Neraca Saldo pada Tugas VII.
AMIK Al Ma’soem
46
BAGIAN VIII Tujuan : 1. 2.
Membuat Report Buku Besar Form Untuk MemFilter Report
A. BAHAN PRAKTEK VIII 8.1
Report Laporan Buku Besar Nama Report : BukuBesar “
Formula : Nama Perkiraan : Tmpjurnal.namaper Saldo Awal : Perkiraan.saldoa (Format exp. : 999,999,999,999 ; Alignment : Right) Tanggal Transaksi : Tmpjurnal.tanggal Catatan : Tmpjurnal.catatan Debet : Tmpjurnal.debet (Format exp. : 999,999,999,999 ; Alignment : Right) Kredit : Tmpjurnal.kredit (Format exp. : 999,999,999,999 ; Alignment : Right) Jumlah Debet : Tmpjurnal.debet (Format exp. : 999,999,999,999 ; Alignment : Right ; Calculate Type : Sum ; Reset Based On : Report) Jumlah Kredit : Tmpjurnal.kredit (Format exp. : 999,999,999,999 ; Alignment : Right ; Calculate Type : Sum ; Reset Based On : Report) Saldo Akhir : Perkiraan.saldoj (Format exp. : 999,999,999,999 ; Alignment : Right)
8.2
Form Laporan Buku Besar Nama Form : BukuBesar
AMIK Al Ma’soem
47
* Object FORM1 Procedure LOAD SET DEFAULT TO o:\ska\kelas\Nama\data SET TALK OFF CLOSE DATABASES CLOSE INDEXES SET DATE BRITISH SET EXACT ON IF USED("perkiraan") USE IN perkiraan ENDIF IF USED("jurnal") USE IN jurnal ENDIF IF USED("tmpjurnal") USE IN tmpjurnal ENDIF SELECT 1 USE perkiraan SET ORDER TO tag Noper SELECT 2 USE jurnal SET ORDER TO TAG NOBUKTI SELECT 3 USE tmpjurnal SET ORDER TO TAG NoBukti RETURN * Object FORM1 Procedure ACTIVATE THISFORM.T.DAY=DAY(DATE()) THISFORM.T.MONTH=MONTH(DATE()) THISFORM.T.YEAR=YEAR(DATE()) * Object CETAK Procedure CLICK M=thisform.T.month Y=thisform.T.year
AMIK Al Ma’soem
48
SELECT tmpjurnal DELETE ALL SET DELETED OFF PACK APPEND FROM jurnal FOR noper=TRIM(thisform.text1.Value) .and. ; (MONTH(tgltran)=M .and. YEAR(tgltran)=Y) SELECT perkiraan LOCATE FOR noper=TRIM(thisform.text1.Value) IF FOUND() vsaldoa=perkiraan.saldoa vsaldoj=perkiraan.saldoj vnamaper=perkiraan.namaper ELSE vsaldoa=0 vsaldoj=0 vnamaper="" ENDIF
SELECT TMPJURNAL GO TOP SUM DEBET TO DB SUM KREDIT TO KR IF LEFT(noper,1)="1" .or. LEFT(noper,1)="6" SELISIH=DB-KR ELSE SELISIH=KR-DB ENDIF VSALDOJ=VSALDOA+SELISIH REPLACE ALL SALDOA WITH VSALDOA REPLACE ALL SALDOJ WITH VSALDOJ REPLACE ALL NAMAPER WITH VNAMAPER GO BOTTOM IF EOF() SELECT TMPJURNAL APPEND BLANK REPLACE SALDOA WITH VSALDOA REPLACE SALDOJ WITH VSALDOJ REPLACE NAMAPER WITH VNAMAPER ENDIF REPORT FORM o:\ska\kelas\Nama\prg\BukuBesar Preview RETURN * Object KELUAR Procedure CLICK thisform.release RETURN * Object COMBO1 Procedure InteractiveChange thisform.text1.Value=perkiraan.noper
AMIK Al Ma’soem
49
B. TUGAS VIII Buatkan Form dan Report untuk menampilkan Buku Besar dari hasil transaksi pada tugas sebelumnya.
AMIK Al Ma’soem
50
BAGIAN IX Tujuan : 1. 2.
Membuat Report Laba Rugi Form Untuk MemFilter Report
A. BAHAN PRAKTEK IX 9.1
Report Laporan Laba Rugi Nama Report : LabaRugi
Formula : Per Bulan : cmonth(tmpper.tgltran)+" "+str(year(tmpper.tgltran),4) NamaPerkiraan : tmpper.namaper SaldoJ pada Group Noper : tmpper.saldoj (Format exp. : 999,999,999 ; Alignment : Right; Calculate Type : Sum ; Reset Based On : Group TmpPer.Noper) Total : "Total "+iif(left(noper,1)="4","Pendapatan",iif(left(noper,1)="5", "HPP Penjualan",iif(left(noper,1)="6","Biaya",""))) SaldoJ pada Group Left(tmpper.noper,1) : tmpper.saldoj (Format exp. : 999,999,999 ; Alignment : Right; Calculate Type : Sum ; Reset Based On : Group left(TmpPer.Noper,1)) Laba/Rugi : iif(tmpper.laba>0,"Laba ","Rugi ") Jumlah Laba/Rugi : tmpper.laba (Format exp. : 999,999,999 ; Alignment : Right)
AMIK Al Ma’soem
51
9.2
Form Laporan Laba Rugi Nama Form : LabaRugi
* Object FORM1 Procedure LOAD SET DEFAULT TO o:\ska\kelas\Nama\data SET TALK OFF CLOSE DATABASES CLOSE INDEXES IF USED("jurnal") USE IN jurnal ENDIF IF USED("TMPJURNAL") USE IN tmpjurnal ENDIF SELECT 1 USE JURNAL SET ORDER TO TAG NOPER SELECT 2 USE perkiraan SET ORDER TO TAG NOPER SELECT 3 USE tmpper SET ORDER TO TAG NOPER SELECT 4 USE tmpjurnal SET ORDER TO TAG NOPER RETURN * Object FORM1 Procedure ACTIVATE thisform.tgl.day=DAY(DATE()) thisform.tgl.month=month(DATE()) thisform.tgl.year=year(DATE()) return * Object CETAK Procedure CLICK SET DATE BRITISH SET CENTURY ON m=thisform.tgl.month y=thisform.tgl.year SELECT tmpjurnal SET DELETED OFF DELETE ALL
AMIK Al Ma’soem
52
PACK APPEND FROM jurnal FOR MONTH(tgltran)=m .and. YEAR(tgltran)=y DELETE FOR LEFT(tmpjurnal.noper,1)="1" DELETE FOR LEFT(tmpjurnal.noper,1)="2" DELETE FOR LEFT(tmpjurnal.noper,1)="3" pack GO top DO WHILE ! EOF() SELECT perkiraan LOCATE FOR NOPER=tmpjurnal.noper IF FOUND() vnamaper=perkiraan.namaper ELSE vnamaper="" ENDIF SELECT tmpjurnal REPLACE namaper WITH vnamaper SKIP ENDDO SELECT tmpjurnal GO top DO WHILE ! EOF() IF LEFT(noper,1)="4" REPLACE saldoj WITH kredit-debet ELSE IF LEFT(noper,1)="5" REPLACE saldoj WITH debet-kredit ELSE IF LEFT(noper,1)="6" REPLACE saldoj WITH debet-kredit ENDIF ENDIF ENDIF SKIP enddo Vpend=0 Vjasa=0 Vbiaya=0 vlaba=0 vhp=0 SELECT tmpper SET DELETED OFF DELETE ALL PACK APPEND FROM TMPJURNAL SELECT TMPPER SUM saldoj FOR LEFT(noper,1)="4" TO vpend SUM saldoj FOR LEFT(noper,1)="5" TO vhp SUM saldoj FOR LEFT(noper,1)="6" TO vbiaya SELECT tmpper GO bottom
AMIK Al Ma’soem
53
REPLACE pend WITH vpend REPLACE hp WITH vhp REPLACE biaya WITH vbiaya vlaba=vpend-vbiaya-vhp REPLACE LABA WITH vlaba SET ORDER TO TAG NOPER IF EOF() MESSAGEBOX("Laporan Laba Rugi tidak bisa ditampilkan"+CHR(13)+; "Karena belum ada transaksi penerimaan dan Pengeluaran",; 0,"Mohon Maaf...")
RETURN else REPORT FORM O:\SKA\KELAS\NAMA\PRG\LABARUGI PREVIEW endif RETURN * Object KELUAR Procedure CLICK THISFORM.Release RETURN
B. TUGAS IX Buatkan Report dan Form untuk menampilkan Laporan Laba/Rugi Perusahaan
AMIK Al Ma’soem
54
BAGIAN X Tujuan : 1. 2.
Membuat Program Compiler File Mengcopiler file menjadi file EXE
A. BAHAN PRAKTEK X : 1.
Buatkan file Program pada Page Code, sbb : CLOSE DATABASE all CLEAR ALL CLOSE ALL SET TALK OFF SET STAT OFF SET AUTOSAVE ON SET CENTURY ON SET DATE BRITISH SET DEFA TO O:\SKA\KELAS\NAMA\DATA PUSH MENU _MSYSMENU MODI WINDOWS SCREEN TITLE 'SISTEM INFORMASI KEUANGAN' WITH _SCREEN .VISIBLE=.T. .WINDOWSTATE=2 .picture='D:\SKA\KELAS\NAMA\Gb\LATAR1.JPG' ENDWITH RELEASE ALL DO o:\SKA\KELAS\NAMA\prg\menutama1.mpr READ EVENTS QUIT
2. 3.
Simpan dengan nama SKA.PRG Klik kanan File SKA.PRG tersebut, kemudian pilih Set Main
4. 5. 6.
Klik Build Pilih Win32 executable / COM server (exe) Pada kolom Option klik kota CheckBox Recompile All Files dan Display Errors
AMIK Al Ma’soem
55
6.
Klik tombol OK
B. TUGAS X Buatkan Program Compiler untuk tugas anda seperti pada praktek ke XIII dan lakukan compiler pada tugas anda.
AMIK Al Ma’soem
56
BAGIAN XI Tujuan : Membackup File
11.1. Membuat Program Backup File Jurnal 1. Membuat Form BackUpJurnal
2.
Procedure : * Object FORM1 Procedure ACTIVATE set defa to o:\SKA\KELAS\NAMA\DATA close data close index if used("jurnal") use in jurnal endif set date BRITISH set cent on select a use jurnal a=date() b=alltrim(left(cmont(a),3)) t=alltrim(right(str(year(a),4),2)) ext=".DBF" e="JUR" f=e+b+t+ext thisform.text1.value=f retu
AMIK Al Ma’soem
57
* Object FORM1 Procedure UNLOAD close data close inde retu * Object PROSES Procedure CLICK
thisform.proses.Enabled= .F. nfp=alltrim(thisform.text1.value) select jurnal copy to o:\SKA\KELAS\NAMA\backup\&nfp messagebox(“Backup File Jurnal sudah dilakukan”,0,; ”Perhatian..”) thisform.release() retu * Object KELUAR Procedure CLICK thisform.release() retu
11.2.
Membuat Program Backup File PERKIRAAN
1.
Membuat Form BackUp Perkiraan
2.
Procedure : * Object FORM1 Procedure LOAD set defa to o:\SKA\KELAS\NAMA\DATA close data close index if used("perkiraan") use in perkiraan endif set date BRITISH set cent on select a use perkiraan RETURN * Object FORM1 Procedure ACTIVATE a=date() b=alltrim(left(cmont(a),3)) t=alltrim(right(str(year(a),4),2))
AMIK Al Ma’soem
58
ext=".DBF" fp="PERK" g=fp+b+t+ext thisform.text1.value=g retu * Object FORM1 Procedure UNLOAD close data close inde retu * Object PROSES Procedure CLICK thisform.PROSES.Enabled=.f. nfp=alltrim(thisform.text1.value) select perkiraan copy to o:\ska\kelas\nama\backup\&nfp messagebox(“Backup File Perkiraan sudah dilakukan”,0,; ”Perhatian..”) RETURN * Object KELUAR Procedure CLICK thisform.release() retu
AMIK Al Ma’soem
59
BAGIAN XII Tujuan : 1. 2.
Membuat Program Tutup Buku Membuat Program Pemindah Bukuan
12.1. Membuat Program Tutup Buku 1. Buka Menutama 2. Buka submenu Utility 3. Pilih prompt Tutup Buku 4. Ganti Result submenu menjadi Procedure 5. Ketik prosedur berikut : jawab=messagebox("Anda sudah membackup semua file ?",4+32+512,; "Perhatian...!") if jawab=6 ljwb=messagebox("Anda yakin mau mengosongkan semua file ?",; 4+32+256,"Perhatian...!") if ljwb=6 close data close index set dele off if used("jurnal") use in jurnal endif SET DEFAULT TO o:\ska\kelas\nama\data * Mengosongkan File Jurnal use jurnal dele all PACK USE endif endif Messagebox(“File jurnal sudah dikosongkan...”,0,”Perhatian...”) retur 12.2. Membuat Program Pemindah Bukuan 1. Pilih prompt Tutup Buku 2. Ganti Result submenu menjadi Procedure 3. Ketik prosedur berikut : jawab=messagebox("Anda sudah membackup semua file ?",4+32+512,; "Perhatian...!") if jawab=6 ljwb=messagebox("Anda yakin mau memindah bukukan ?",4+32+256,; "Perhatian...!") if ljwb=6 close data close index
AMIK Al Ma’soem
60
set dele off IF USED("PERKIRAAN") USE IN PERKIRAAN ENDIF SET DEFAULT TO o:\ska\kelas\nama\data USE perkiraan GO top DO WHILE ! EOF() REPLACE saldos WITH saldoa REPLACE saldoa WITH saldoj SKIP enddo endif endif MESSAGEBOX("Pemindahbukuan sudah dilakukan",0,"Perhatian...") retur
12.3. Membuat Program Restore File 1. Pilih prompt Restore File 2. Ganti Result submenu menjadi Procedure 3. Ketik prosedur berikut : SET DEFAULT TO o:\ska\kelas\nama\data jawab=messagebox("Anda sudah membackup semua file ?",4+32+512,"Perhatian...!") if jawab=6 close data close index set dele off if used("jurnal") use in jurnal endif if used("PERKIRAAN") use in PERKIRAAN endif use jurnal dele all PACK USE use PERKIRAAN dele all PACK USE do form o:\SKA\kelas\nama\prg\restfile.scx endif retur
AMIK Al Ma’soem
61
4.
Buatkan Form RestFile sbb :
5.
Procedure : * Object FORM1 Procedure ACTIVATE set defa to o:\ska\kelas\nama\data thisform.tgl.day=DAY(DATE()) thisform.tgl.month=MONTH(DATE()) thisform.tgl.year=year(DATE()) * Object FORM1 Procedure UNLOAD close data close inde retu * Object PROSES Procedure CLICK tgl =thisform.tgl.day bulan=thisform.tgl.month tahun=thisform.tgl.year do case case bulan=1 bln="Jan" case bulan=2 bln="Feb" case bulan=3 bln="Mar" case bulan=4 bln="Apr" case bulan=5 bln="May" case bulan=6 bln="Jun" case bulan=7 bln="Jul" case bulan=8 bln="Aug" case bulan=9 bln="Sep" case bulan=10 bln="Oct" case bulan=11 bln="Nov"
AMIK Al Ma’soem
62
othe bln="Dec" endc thn=right(STR(tahun,4),2) ext=".DBF" jur="JUR" perk="PERK" ju =jur +bln+thn+ext per =perk+bln+thn+ext use jurnal appe from o:\ska\kelas\nama\backup\&ju use use perkiraan appe from o:\ska\kelas\nama\backup\&per use messagebox(“Restore file sudah dilakukan”+chr(13)+; “Silahkan anda periksa”,0,”Perhatian...”) thisform.release() RETURN * Object KELUAR Procedure CLICK thisform.release() retu
AMIK Al Ma’soem
63
DAFTAR PUSTAKA
Asroel Kamal. (2009). “Panduan Laporan Keuangan dengan MYOB”. Media Kita. Aryanto, S.E., Ak. (2003). “Tip dan Trik Pemrograman Profesional Microsoft Visual FoxPro 6.0”. PT. Elex Media Komputindo. Jakarta. Aryanto, S.E., Ak. (2002). “Pengolahan Database dengan Microsoft Visual FoxPro 6.0”. PT. Elex Media Komputindo. Jakarta. Inge Martina, Ir. (2001). “Visual FoxPro 6.0 ; 36 Jam Belajar Komputer”. PT. Elex Media Komputindo. Jakarta. Sugiri – Eni Munarsih. (2008). “Akuntansi & Aplikasinya pada MYOB Accounting”. Graha Ilmu. Wahana Komputer. (2007). “Pengembangan Sistem Akuntansi bagi Usaha Perdagangan Ritel dengan MYOB” Salemba Empat.
AMIK Al Ma’soem