1
AMIK Al Ma’soem
BAGIAN I Tujuan :
1. Membuat Project File 2. Membuat menu program 3. 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. Pilih Type File Project 5. 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
7. Isi baris Enter Project File dengan SKA (Nama File Project) 8. Klik tombol Save
1.2 Membuat Menu Program
1. Klik Page Other pada Project File SKA 2. Pilih Menu 3. Klik tombol New
2
AMIK Al Ma’soem
4. Klik Tombol Menu
1.3 Membuat Menu Bar
Ketik Menu Bar di atas seperti berikut ini :
1.4 Sub Menu File
1. Klik pada prompt File 2. Pilih Result Submenu, kemudian Klik tombol Create sebelah kanan Submenu 3. Ketik submenu berikut :
4. 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. 5. Pada prompt Logout, ganti result dengan Procedure, kemudian ketik prosedur berikut :
IF TYPE("MENULOGIN")#"0"
DO D:\SKA\NAMA\PRG\MENULOGIN.MPR
ENDIF
1.5 Sub Menu Master
3
AMIK Al Ma’soem
1. Pindahkan Menu Level ke Menu Bar 2. Klik Prompt Master 3. Pilih Result Submenu, kemudian klik tombol Create sebelah kanan Submenu 4. Ketik submenu berikut :
1.6 Sub Menu Transaksi Buatkan lagi submenu Transaksi berikut dengan cara seperti membuat submenu Master.
1.7 Sub Menu Laporan Lakukan perintan yang sama untuk membuat submenu Laporan berikut :
1.8 Sub Menu Backup Lakukan pula perintah seperti di atas untuk membuat submenu Backup berikut :
1.9 Sub Menu Utility Lakukan pula perintah seperti di atas untuk membuat submenu Utility berikut :
4
AMIK Al Ma’soem
1.10 Menyimpan Menu Program 1. Klik Menu File pada Menu Bar 2. Pilih Save
3. Pada kotak dialog Save in, pindahkan ke folder PRG di folder Anda 4. Ketik nama file MenuLogin pada baris Save Menu As, kemudian Klik tombol Save
1.11 Menguji Menu Program 1. Klik tanda + di sebelah kiri Menus pada page Other 2. Klik File MenuLogin, kemudian Klik tombol Run
B. LATIHAN I Buatkan Menu Program Beikut, dan simpan dengan nama MenuUser : 1. Sub menu File
2. Sub menu Master
3. Sub menu Transaksi
4. Sub menu Laporan
5
AMIK Al Ma’soem
5. Sub menu Backup
6. Sub menu Utility
C. TUGAS I Buatkan Menu Program berikut, dan simpan dengen nama MenAdmin : 1. Sub menu File, Jurnal Umum, Laporan dan BackUp sama dengan MenuUser 2. Sub menu Master adalah sbb :
3. Sub menu Utility adalah sbb :
6
AMIK Al Ma’soem
BAGIAN II Tujuan :
1. Membuat Database DATASKA 2. Membuat Tabel USER 3. Membuat Free Table TMPUSER 4. Membuat Form Login 5. Connection File Form 6. Menguji Form dan Menu Program
A. 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\DATA) 2. Buatkan Tabel USER pada database DATASKA dengan struktur sbb :
3. Berikan Primary Key pada field NMID 4. Simpan dengan nama file USER 5. Buatkan lagi Tabel TMPUSER pada Free Tabel dengan struktur file yang sama dengan Tabel USER Simpan di D:\SKA\NAMA\DATA 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 D:\BPR\DATA
if used('USER')
7
AMIK Al Ma’soem
use in USER
endif
if used('tmpuser')
use in tmpuser
endif
SELECT a
USE TMPUSER
SELECT b
use USER
set order to tag NoUser
set order to tag pswd
thisform.NoUser.value=""
thisform.pswd.value=""
RETURN
b. Object Form1 Procedure UNLOAD close databases
RETURN
c. Object LOGIN Procedure CLICK IF EMPTY(thisform.NoUser.value)
messagebox("User Id tidak boleh kosong...!",0,"Perhatian...")
thisform.NoUser.setfocus
RETURN
ELSE
IF EMPTY(thisform.PSWD.value)
messagebox("Password tidak boleh kosong...!",0,"Perhatian...")
thisform.pswd.setfocus
RETURN
else
SELECT User
set order to tag NoUser
LOCATE FOR NoUser=TRIM(thisform.NoUser.value)
if ! found()
messagebox("Maaf User Id Anda Belum Terdaftar...!",0,"Perhatian...")
thisform.NoUser.setfocus()
retu
else
set order to tag pswd
LOCATE for NoUser=TRIM(thisform.NoUser.value) .and.
pswd=TRIM(thisform.pswd.value)
if ! found()
messagebox("Maaf Password Tidak Dikenal...!",0,"Perhatian...")
thisform.pswd.setfocus()
retu
ELSE
SELECT tmpuser
DELETE ALL
SET DELETED OFF
PACK
8
AMIK Al Ma’soem
APPEND FROM user FOR NoUser=TRIM(thisform.NoUser.Value)
IF tmpuser.jabat=1
DO d:\BPR\prg\MENUUSER.MPR
ELSE
IF tmpuser.jabat=2
DO d:\bpr\prg\MENUADMIN.MPR
ENDIF
ENDIF
thisform.release
endif
endif
ENDIF
ENDIF
d. Object BATAL Procedure CLICK thisform.release
retu 2.3 Connection Form LOGIN ke MenuLogin 1. Buka Menu Program MenuLogin 2. Klik Prompt File pada Menu Level MenuBar 3. Pilih Result Submenu, kemudian Klik Edit 4. Klik Prompt Login pada Submenu File 5. Pilih Result Procedure, kemudian klik Create 6. Isikan procedure berikut :
IF TYPE("FORMLOGIN")#"0"
DO FORM D:\ska\NAMA\prg\FormLogin.SCX
ENDIF 7. Simpan MenuLogin 8. Klik Tombol RUN, untuk menguji MenuLogin
B. LATIHAN II 1. Buatkan Form Kelola Data USER dengan LayOut sbb :
9
AMIK Al Ma’soem
2. Procedure Form Kelola Data USER : a. Object Form1 Procedure LOAD close data
close index
set exact on
set defa to D:\BPR\data
IF USED("USER")
USE IN USER
ENDIF
SELECT A
USE user
set order to tag nouser
RETURN
b. Object Form1 Procedure UNLOAD CLOSE DATABASES
USE IN TMPUSER
RETURN
c. Object Form1 Procedure Aktifkan PARAMETERS x
thisform.namauser.Enabled=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
e. Object Form1 Procedure Kosongkan thisform.pswd.value=""
thisform.namauser.value="”
thisform.jabat.value=0
retu
f. Object Form1 Procedure Tampilkan thisform.namauser.value=tmpuser.nmid
thisform.nmid.value=tmpuser.nmid
thisform.pswd.value=tmpuser.pswd
thisform.jabat.value=tmpuser.jabat
retu
g. Object Form1 Procedure Activate PUBLIC n
thisform.nouser.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.baru.enabled=.t.
thisform.keluar.enabled=.t.
10
AMIK Al Ma’soem
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 NOUSER Procedure LOSTFOCUS IF ! empty(thisform.nouser.Value)
IF len(trim(thisform.nouser.Value))<4
messagebox("Nomor User tidak boleh kurang dari 4 digit !",;
0,"Perhatian...")
thisform.nouser.setfocus
RETURN
ENDIF
SELECT user
SET ORDER TO TAG nouser
SET EXACT ON
LOCATE FOR nouser=trim(thisform.nouser.value)
IF FOUND()
thisform.grid1.setfocus()
thisform.refresh()
MESSAGEBOX("Data tersebut sudah ada..",0+48,"Perhatian...")
RETURN
ELSE
thisform.nouser.enabled=.f.
thisform.aktifkan(.t.)
thisform.kendali(.f.)
thisform.baru.enabled=.f.
thisform.keluar.enabled=.f.
thisform.hapus.enabled=.f.
thisform.simpan.enabled=.t.
thisform.batal.enabled=.t.
thisform.perbaiki.enabled=.f.
thisform.ud.enabled=.f.
thisform.namauser.setfocus
endif
endif
return
i. Oject NAMAUSER Procedure LOSTFOCUS SELECT user
LOCATE FOR namauser=trim(thisform.namauser.value)
IF FOUND()
thisform.grid1.setfocus()
thisform.refresh()
MESSAGEBOX("Sorry nama user ada yang sama..",0+48,"Perhatian...")
return
11
AMIK Al Ma’soem
ENDIF
j. Oject PSWD Procedure CLICK IF ! empty(thisform.pswd.Value)
IF len(trim(thisform.pswd.Value))<4
messagebox("Password tidak boleh kurang dari 4 digit !",;
0,"Perhatian...")
thisform.pswd.setfocus
RETURN
ENDIF
ENDIF
k. Oject CARI Procedure RIGHTCLICK thisform.nmid.Enabled=.t.
thisform.nmid.setfocus
return
l. Oject CARI Procedure RIGHTCLICK if empty(thisform.nouser.value)
messagebox("Nomor user Harus Diisi !",0,"Perhatian...!")
thisform.nouser.setfocus()
return
endif
SELECT user
SET ORDER TO TAG nouser
SET EXACT OFF
LOCATE FOR nouser=TRIM(thisform.nouser.value)
if FOUND()
thisform.grid1.setfocus()
thisform.refresh()
ELSE
jawab=MESSAGEBOX("Data tidak ditemukan..."+CHR(13)+;
CHR(13)+"Mau menambah data baru ?",4+32,"Perhatian...")
IF jawab=6
thisform.perbaiki.enabled=.f.
thisform.ud.enabled=.f.
thisform.batal.enabled=.t.
thisform.baru.enabled=.f.
thisform.simpan.enabled=.t.
thisform.keluar.enabled=.f.
thisform.hapus.enabled=.f.
thisform.nouser.enabled=.f.
thisform.aktifkan(.t.)
thisform.kendali(.f.)
thisform.kosongkan
thisform.namauser.setfocus
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.f.
ELSE
thisform.perbaiki.enabled=.f.
thisform.ud.enabled=.f.
thisform.batal.enabled=.f.
thisform.baru.enabled=.t.
thisform.simpan.enabled=.f.
12
AMIK Al Ma’soem
thisform.keluar.enabled=.f.
thisform.hapus.enabled=.f.
thisform.nouser.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.f.
endif
endif
return
m. Oject BARU Procedure CLICK thisform.nouser.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.nouser.setfocus
return
n. Oject SIMPAN Procedure CLICK
IF EMPTY(thisform.nouser.value)
messagebox("Isi dulu User Id-nya !",0,"Perhatian...")
thisform.nouser.setfocus
RETURN
ELSE
IF EMPTY(thisform.pswd.value)
messagebox("Isi dulu Password-nya !",0,"Perhatian...")
thisform.pswd.setfocus
RETURN
ELSE
IF EMPTY(thisform.jabat.value)
messagebox("Isi dulu Jabatannya-nya !",0,"Perhatian...")
*thisform.jabat.setfocus
RETURN
ELSE
IF len(thisform.nouser.value)<4
messagebox("User Id minimal 4 Character...!",0,"Perhatian...")
thisform.nouser.setfocus
RETURN
ELSE
IF len(thisform.PSWD.value)<4
13
AMIK Al Ma’soem
messagebox("Password minimal 4 Character...!",0,"Perhatian...")
thisform.pswd.setfocus
RETURN
ELSE
SELECT user
locate for nouser=trim(thisform.nouser.value)
if found()
messagebox("User Id ada yang sama !",0,;
"Penyimpanan tidak bisa dilakukan")
thisform.nouser.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 nouser=space(10)
if ! found()
append blank
endif
repl nouser with thisform.nouser.value
repl NAMAUSER with thisform.NAMAUSER.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.nouser.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
ENDIF
endif
14
AMIK Al Ma’soem
o. Oject BATAL Procedure CLICK thisform.nouser.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.nouser.setfocus
return
p. Oject HAPUS Procedure CLICK SELECT user
LOCATE FOR nouser=TRIM(THISFORM.nouser.Value)
n=RECNO()
ljawab=messagebox("Anda Yakin ?",4+32+256,"Record ini mau dihapus !")
if ljawab=6
DELETE FOR nouser=TRIM(THISFORM.nouser.Value)
set dele on
ENDIF
goto n
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.nouser.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.t.
return
q. Oject KELUAR Procedure CLICK set order to
set dele off
SELECT user
pack
15
AMIK Al Ma’soem
thisform.release
return
q. Oject PERBAIKI Procedure CLICK SELECT user
n=RECNO()
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.pswd.setfocus()
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.f.
return
r. Oject UD Procedure CLICK IF EMPTY(thisform.nouser.value)
messagebox("Isi dulu User Id-nya !",0,"Perhatian...")
thisform.nouser.setfocus
RETURN
ENDIF
IF EMPTY(thisform.pswd.value)
messagebox("Isi dulu Password-nya !",0,"Perhatian...")
thisform.pswd.setfocus
RETURN
ENDIF
IF EMPTY(thisform.jabat.value)
messagebox("Isi dulu Jabatannya-nya !",0,"Perhatian...")
RETURN
ENDIF
IF len(thisform.nouser.value)<4
messagebox("User Id minimal 4 Character...!",0,"Perhatian...")
thisform.nouser.setfocus
RETURN
ENDIF
IF len(thisform.PSWD.value)<4
messagebox("Password minimal 4 Character...!",0,"Perhatian...")
thisform.pswd.setfocus
RETURN
ENDIF
jawab=messagebox("Mau Memperbaiki Data Sebelumnya ?",4+32,"Perhatian...!")
if jawab=6
SELECT user
GOTO N
repl nouser with thisform.nouser.value
repl NAMAUSER with thisform.NAMAUSER.value
repl pswd with thisform.pswd.value
16
AMIK Al Ma’soem
repl jabat with thisform.jabat.value
thisform.refresh
endif
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.nouser.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.pswd.setfocus
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.t.
return
s. Oject PERTAMA Procedure CLICK SELECT TMPUSER
go top
if eof()
messagebox("Tidak ada record...",0,"Perhatian...!")
return
ENDIF
thisform.grid1.setfocus
thisform.refresh
return
t. Oject SEBELUMNYA Procedure CLICK SELECT TMPUSER
skip -1
if bof()
go top
ENDIF
thisform.grid1.setfocus
thisform.refresh
return
u. Oject BERIKUTNYA Procedure CLICK SELECT TMPUSER
skip
if bof()
go bottom
ENDIF
thisform.grid1.setfocus
thisform.refresh
return
v. Oject TERAKHIR Procedure CLICK SELECT TMPUSER
go bottom
if eof()
messagebox("Tidak ada record...",0,"Perhatian...!")
17
AMIK Al Ma’soem
return
ENDIF
thisform.grid1.setfocus
thisform.refresh
return
w. Oject GRID1 Procedure AfterRowColChange
LPARAMETERS nColIndex
thisform.perbaiki.enabled=.t.
thisform.hapus.enabled=.t.
thisform.batal.enabled=.f.
thisform.NoUser.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 :
18
AMIK Al Ma’soem
BAGIAN III Tujuan :
1. Membuat Table Nasabah 2. Membuat Table Pinjaman 3. Membuat Form untuk mengelola data Nasabah
A. BAHAN PRAKTEK III 3.1 Table Nasabah Nama Table : Nasabah Primary Key : Norek
3.2 Table Pinjaman Nama Table : Pinjam Primary Key : NoPinjam
19
AMIK Al Ma’soem
3.3 Table Miror Pinjaman Nama Table : TMPPINJAM Primary Key : NoPinjam
3.4 Form Kelola Data Nasabah Nama Form : Nasabah
20
AMIK Al Ma’soem
3.5 Procedure Program
*Object FORM1 Procedure LOAD
SET DATE BRITISH
SET CENTURY ON
set defa to d:\bpr\data
close index
close data
if USED("nasabah")
USE IN nasabah
ENDIF
if USED("Pinjam")
USE IN pinjam
ENDIF
SELECT A
USE nasabah
SET ORDER TO NOREK
SELECT B
USE PINJAM
RETURN
*Object FORM1 Procedure UNLOAD
close index
close data
RETURN
*Object FORM1 Procedure AKTIFKAN
parameter keadaan
thisform.norek.enabled=keadaan
thisform.nama.enabled=keadaan
thisform.noktp.enabled=keadaan
thisform.tlahir.enabled=keadaan
thisform.pekerjaan.enabled=keadaan
thisform.alamat.enabled=keadaan
thisform.kota.enabled=keadaan
thisform.telp.enabled=keadaan
RETURN
*Object FORM1 Procedure KENDALI
PARAMETERS z
thisform.pertama.Enabled=z
thisform.sebelumnya.Enabled=z
thisform.berikutnya.Enabled=z
thisform.terakhir.Enabled=z
retu
21
AMIK Al Ma’soem
*Object FORM1 Procedure KOSONGKAN
thisform.nama.value=""
thisform.noktp.value=""
thisform.tlahir.value=""
thisform.pekerjaan.value=""
thisform.alamat.value=""
thisform.kota.value=""
thisform.telp.value=""
thisform.tgllahir.day=DAY(DATE())
thisform.tgllahir.month=month(DATE())
thisform.tgllahir.year=year(DATE())
return
*Object FORM1 Procedure TAMPILKAN
thisform.norek.value=nasabah.norek
thisform.nama.value=nasabah.nama
thisform.noktp.value=nasabah.noktp
thisform.pekerjaan.value=nasabah.pekerjaan
thisform.alamat.value=nasabah.alamat
thisform.kota.value=nasabah.kota
thisform.telp.value=nasabah.telp
thisform.tlahir.value=nasabah.tlahir
thisform.tgllahir.day=DAY(nasabah.tgllahir)
thisform.tgllahir.month=month(nasabah.tgllahir)
thisform.tgllahir.year=year(nasabah.tgllahir)
return
*Object FORM1 Procedure ACTIVATE
thisform.norek.enabled=.f.
thisform.kendali(.t.)
thisform.AKTIFKAN(.F.)
thisform.kosongkan
thisform.baru.enabled=.t.
thisform.batal.enabled=.f.
thisform.hapus.enabled=.t.
thisform.keluar.enabled=.t.
thisform.simpan.enabled=.f.
thisform.perbaiki.enabled=.f.
thisform.ud.enabled=.f.
thisform.baru.setfocus
return
*Object CARINOREK Procedure CLICK
if empty(thisform.norek.value)
messagebox("Nomor Rekening harus diisi !",0,"Perhatian...!")
thisform.norek.setfocus
return
22
AMIK Al Ma’soem
endif
SELECT nasabah
SET EXACT ON
LOCATE FOR norek=TRIM(thisform.norek.Value)
IF ! FOUND()
MESSAGEBOX("Maaf Nomor Rekening tsb tidak ada dalam
database",0,"Perhatian...")
thisform.norek.SetFocus
RETURN
ELSE
thisform.grid1.setfocus
thisform.refresh
thisform.tampilkan
ENDIF
thisform.perbaiki.enabled=.t.
thisform.ud.enabled=.f.
thisform.cetak.enabled=.t.
thisform.batal.enabled=.f.
thisform.baru.enabled=.t.
thisform.simpan.enabled=.f.
thisform.keluar.enabled=.t.
thisform.hapus.enabled=.t.
thisform.NOREK.enabled=.f.
thisform.kendali(.f.)
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.t.
return
*Object CARINAMA Procedure CLICK
if empty(thisform.nama.value)
messagebox("Nama Nasabah harus diisi !",0,"Perhatian...!")
thisform.nama.setfocus
return
endif
SELECT nasabah
SET EXACT OFF
LOCATE FOR UPPER(nama)=UPPER(TRIM(thisform.nama.Value))
IF ! FOUND()
MESSAGEBOX("Maaf Nama Nasabah tsb tidak ada dalam
database",0,"Perhatian...")
thisform.nama.SetFocus
RETURN
ELSE
thisform.grid1.setfocus
thisform.refresh
thisform.tampilkan
ENDIF
23
AMIK Al Ma’soem
thisform.perbaiki.enabled=.t.
thisform.ud.enabled=.f.
thisform.cetak.enabled=.t.
thisform.batal.enabled=.f.
thisform.baru.enabled=.t.
thisform.simpan.enabled=.f.
thisform.keluar.enabled=.t.
thisform.hapus.enabled=.t.
thisform.NOREK.enabled=.f.
thisform.kendali(.f.)
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.t.
return
*Object TAMBAH Procedure CLICK
thisform.kosongkan
t=DAY(DATE())
b=MONTH(DATE())
y=YEAR(DATE())
IF t<10
tgl="0"+STR(t,1)
ELSE
tgl=STR(t,2)
ENDIF
IF b<10
bln="0"+STR(b,1)
ELSE
bln=STR(b,2)
ENDIF
thn=RIGHT(STR(y,4),2)
hh=LEFT(TIME(),2)
mm=SUBSTR(TIME(),4,2)
vnorek=tgl+bln+thn+hh+mm
thisform.norek.value=vnorek
thisform.kendali(.f.)
thisform.AKTIFKAN(.T.)
thisform.baru.enabled=.f.
thisform.keluar.enabled=.f.
thisform.hapus.enabled=.f.
thisform.simpan.enabled=.t.
thisform.batal.enabled=.t.
thisform.perbaiki.enabled=.f.
thisform.ud.enabled=.f.
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.f.
thisform.nama.setfocus
return
24
AMIK Al Ma’soem
*Object SIMPAN Procedure CLICK
IF EMPTY(thisform.nama.Value)
MESSAGEBOX("Nama Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.nama.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.alamat.Value)
MESSAGEBOX("Alamat Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.alamat.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.kota.Value)
MESSAGEBOX("Nama Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.kota.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.tlahir.Value)
MESSAGEBOX("Nama Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.tlahir.SetFocus
RETURN
ENDIF
SELECT nasabah
LOCATE FOR UPPER(nama)=UPPER(TRIM(thisform.nama.Value)) .and. ;
UPPER(noktp)=UPPER(TRIM(thisform.noktp.Value))
IF FOUND()
MESSAGEBOX("Maaf data tesebut sudah di entry sebelumnya !",0,;
"Perhatian....")
thisform.nama.SetFocus
RETURN
ENDIF
SELECT NASABAH
LOCATE FOR NOREK=SPACE(12)
IF ! FOUND()
APPEND BLANK
ENDIF
dd=thisform.tgllahir.day
mm=thisform.tgllahir.month
yy=thisform.tgllahir.year
tgl=STR(dd,2)+"/"+STR(mm,2)+"/"+STR(yy,4)
Replace norek WITH thisform.NOREK.Value
Replace nama WITH thisform.nama.Value
Replace noktp WITH thisform.noktp.Value
Replace tlahir WITH thisform.tlahir.Value
Replace tgllahir WITH CTOD(tgl)
Replace pekerjaan WITH thisform.pekerjaan.Value
Replace alamat WITH thisform.alamat.Value
25
AMIK Al Ma’soem
Replace kota WITH thisform.kota.Value
Replace telp WITH thisform.telp.Value
thisform.grid1.SetFocus
thisform.Refresh
thisform.grid1.Enabled=.t.
thisform.aktifkan(.f.)
thisform.baru.Enabled=.t.
thisform.simpan.Enabled=.f.
thisform.keluar.Enabled=.t.
return
*Object BATAL Procedure CLICK
thisform.norek.enabled=.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.enabled=.t.
thisform.kosongkan
thisform.baru.setfocus
return
*Object HAPUS Procedure CLICK
LOCAL ljawab
SELECT PINJAM
LOCATE FOR NOREK=TRIM(thisform.norek.Value)
IF FOUND()
MESSAGEBOX("Sorry Record ini tidak bisa dihapus"+CHR(13)+;
"Karena sudah digunakan dalam transaksi...!",0,"Perhatian.... ")
RETURN
ENDIF
ljawab=MESSAGEBOX("Anda yakin?",4+32+256,"Record ini akan dihapus !")
IF ljawab=6
SELECT NASABAH
SET DELETED on
DELETE
ENDIF
thisform.grid1.setfocus
thisform.refresh
return
26
AMIK Al Ma’soem
*Object 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.norek.enabled=.f.
thisform.kendali(.f.)
thisform.aktifkan(.t.)
thisform.nama.setfocus
thisform.grid1.enabled=.f.
return
*Object UD Procedure CLICK
local jawab
IF EMPTY(thisform.nama.Value)
MESSAGEBOX("Nama Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.nama.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.alamat.Value)
MESSAGEBOX("Alamat Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.alamat.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.kota.Value)
MESSAGEBOX("Nama Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.kota.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.tlahir.Value)
MESSAGEBOX("Nama Nasabah tidak boleh kosong !",0,"Perhatian...")
thisform.tlahir.SetFocus
RETURN
ENDIF
jawab=messagebox("Mau Memperbaiki Data Sebelumnya
?",4+32,"Perhatian...!")
if jawab=6
SELECT NASABAH
dd=thisform.tgllahir.day
mm=thisform.tgllahir.month
yy=thisform.tgllahir.year
tgl=STR(dd,2)+"/"+STR(mm,2)+"/"+STR(yy,4)
Replace norek WITH thisform.NOREK.Value
27
AMIK Al Ma’soem
Replace nama WITH thisform.nama.Value
Replace noktp WITH thisform.noktp.Value
Replace tlahir WITH thisform.tlahir.Value
Replace tgllahir WITH CTOD(tgl)
Replace pekerjaan WITH thisform.pekerjaan.Value
Replace alamat WITH thisform.alamat.Value
Replace kota WITH thisform.kota.Value
Replace telp WITH thisform.telp.Value
ENDIF
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.kendali(.t.)
thisform.grid1.enabled=.t.
return
*Object CETAK Procedure CLICK
SELECT nasabah
Report FORM d:\bpr\prg\dafnasabah preview
return
*Object KELUAR Procedure CLICK
jawab=MESSAGEBOX("Anda yakin mau keluar ?",4+32,"Perhatian...")
IF jawab=6
SELECT nasabah
SET DELETED off
PACK
thisform.Release
ENDIF
RETURN
*Object PERTAMA Procedure CLICK
SELECT nasabah
GO top
IF EOF()
MESSAGEBOX("Record tidak ada. . .",0,"Perhatian. . .!")
RETURN
ENDIF
thisform.grid1.SetFocus
thisform.Refresh
return
28
AMIK Al Ma’soem
*Object SEBELUMNYA Procedure CLICK
SELECT nasabah
SKIP -1
IF BOF()
GO TOP
ENDIF
THISFORM.grid1.SetFocus
thisform.Refresh
return
*Object BERIKUTNYA Procedure CLICK
SELECT nasabah
SKIP
IF EOF()
GO BOTTOM
ENDIF
THISFORM.grid1.SetFocus
thisform.Refresh
return
*Object TERAKHIR Procedure CLICK
SELECT nasabah
GO bottom
IF EOF()
MESSAGEBOX("Record tidak ada...",0,"Perhatian...!")
return
ENDIF
thisform.grid1.SetFocus
thisform.Refresh
return
*Object GRID1 Procedure AfterRowCollChenge
LPARAMETERS nColIndex
thisform.tampilkan
thisform.norek.enabled=.f.
thisform.kendali(.t.)
thisform.baru.enabled=.t.
thisform.batal.enabled=.f.
thisform.hapus.enabled=.t.
thisform.keluar.enabled=.t.
thisform.simpan.enabled=.f.
thisform.perbaiki.enabled=.t.
thisform.ud.enabled=.f.
return
29
AMIK Al Ma’soem
B. TUGAS III :
1. Lakukan survey ke BANK atau KOPERASI, untuk mengetahui : Formulir Permohonan Pembiayaan, Biaya Proses Pembiayaan, Sistem Pinjaman dan Pembayarannya.
2. Buat Form Nasabah atau Anggota
30
AMIK Al Ma’soem
BAGIAN IV
Tujuan : 1. Membuat Report Daftar Nasabah 2. Filter 3. Grouping
A. BAHAN PRAKTEK IV
B. TUGAS IV Buatkan Report Daftar Nasabah dari Tugas III di atas.
31
AMIK Al Ma’soem
BAGIAN V
Tujuan : 1. Transaksi Pinjaman 2. Link File 3. Relasi File
A. BAHAN PRAKTEK V: 5.1 Form Pinjaman
* Object FORM1 Procedure LOAD SET DATE BRITISH
SET CENTURY on
SET DEFAULT TO D:\BPR\DATA
CLOSE DATABASES
CLOSE INDEXES
IF USED('nasabah')
USE IN nasabah
ENDIF
IF USED('pinjam')
USE IN pinjam
ENDIF
SELECT a
USE nasabah
SET ORDER TO tag nama
SELECT b
32
AMIK Al Ma’soem
USE pinjam
SET ORDER TO nopinjam
SELECT c
USE tmpuser
RETURN
* Object FORM1 Procedure UNLOAD CLOSE INDEXES
CLOSE DATABASES
RETURN
* Object FORM1 Procedure AKTIFKAN PARAMETERS Y
thisform.nama.enabled=Y
thisform.nopinjam.enabled=Y
thisform.TglPinjam.enabled=Y
thisform.Bunga.enabled=Y
thisform.JmlPinjam.enabled=Y
thisform.tenor.enabled=Y
thisform.Jaminan.enabled=Y
thisform.BiayaAdm.enabled=Y
thisform.BA.enabled=Y
thisform.Materai.enabled=Y
thisform.Asuransi.enabled=Y
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.norek.Value=""
thisform.nama.Value=""
thisform.nopinjam.Value=""
thisform.TglPinjam.Value=DATE()
thisform.JTempo.Value=CTOD(" / / ")
thisform.Bunga.Value=0
thisform.JmlPinjam.Value=0
thisform.tenor.Value=0
thisform.Jaminan.Value=""
thisform.BiayaAdm.Value=0
thisform.BA.Value=0
thisform.Materai.Value=0
thisform.Asuransi.Value=0
thisform.sisapinjam.Value=0
thisform.sisapokok.Value=0
thisform.sisabunga.Value=0
RETURN
33
AMIK Al Ma’soem
* Object FORM1 Procedure TAMPILKAN SELECT pinjam
thisform.Nopinjam.Value=pinjam.NoPinjam
thisform.TglPinjam.Value=pinjam.TglPinjam
thisform.Norek.Value=pinjam.Norek
thisform.JmlPinjam.Value=pinjam.JmlPinjam
thisform.Bunga.Value=pinjam.bunga
thisform.Tenor.Value=pinjam.Tenor
thisform.JTempo.Value=pinjam.JTempo
thisform.NoUser.Value=pinjam.NoUser
thisform.SisaPinjam.Value=pinjam.SisaPinjam
thisform.BiayaAdm.Value=pinjam.BiayaAdm
thisform.BA.Value=thisform.JmlPinjam.Value/thisform.BiayaAdm.Value
thisform.Materai.Value=pinjam.Materai
thisform.Asuransi.Value=pinjam.Asuransi
thisform.Jaminan.Value=pinjam.Jaminan
thisform.JmlTerima.Value=pinjam.JmlTerima
thisform.sisapokok.Value=pinjam.sisapokok
thisform.sisabunga.Value=pinjam.sisabunga
thisform.no.Value=RECNO()
SELECT nasabah
LOCATE FOR norek=TRIM(thisform.norek.Value)
thisform.nama.Value=nasabah.nama
RETURN
* Object FORM1 Procedure ACTIVATE thisform.NOREK.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.kosongkan
thisform.baru.enabled=.t.
thisform.batal.enabled=.f.
thisform.keluar.enabled=.t.
thisform.simpan.enabled=.f.
thisform.cetak.enabled=.f.
thisform.perbaiki.enabled=.f.
thisform.baru.setfocus
thisform.Refresh
return
* Object Form1 Procedure DoubleClick thisform.keluar.enabled=.t.
* Object BARU Procedure CLICK thisform.norek.enabled=.t.
thisform.nama.enabled=.t.
thisform.baru.enabled=.f.
thisform.keluar.enabled=.f.
thisform.simpan.enabled=.t.
thisform.batal.enabled=.t.
thisform.perbaiki.enabled=.f.
thisform.cetak.enabled=.f.
34
AMIK Al Ma’soem
thisform.grid1.readonly=.t.
thisform.grid1.enabled=.f.
thisform.kosongkan
thisform.kendali(.f.)
thisform.norek.setfocus
return
* Object CARINOREK Procedure CLICK SELECT Nasabah
LOCATE FOR norek=TRIM(thisform.Norek.Value)
IF ! FOUND()
MESSAGEBOX("Nomor Rekening Tidak ditemukan",0,"Perhatian")
thisform.norek.SetFocus
RETURN
ENDIF
thisform.Nama.Value=nasabah.nama
SELECT Pinjam
LOCATE FOR norek=TRIM(thisform.norek.Value)
IF pinjam.sisapinjam>0
MESSAGEBOX("Nasabah tersebut belum melunasi pinjamannya!",0,;
"Ganti dengan nomor rekening lain")
thisform.norek.SetFocus
return
endif
SELECT PINJAM
COUNT FOR LEFT(nopinjam,10)=rTRIM(thisform.nopinjam.value) TO A
IF a>0
b=a
ELSE
b=1
ENDIF
IF b<10
aa="0000"+STR(b,1)
ELSE
IF b<100
aa="000"+STR(b,2)
ELSE
IF b<1000
aa="00"+STR(b,3)
ELSE
IF b<10000
aa="0"+STR(b,4)
ELSE
aa=STR(b,5)
ENDIF
ENDIF
ENDIF
ENDIF
thisform.NoPinjam.Value=RTRIM(thisform.norek.value)+aa
35
AMIK Al Ma’soem
SELECT PINJAM
LOCATE FOR nopinjam=TRIM(thisform.norek.Value) .and. pinjam.sisapinjam>0
IF FOUND()
thisform.nopinjam.Value=pinjam.nopinjam
thisform.tglpinjam.Value=pinjam.tglpinjam
thisform.jmlpinjam.Value=pinjam.jmlpinjam
thisform.sisapinjam.Value=pinjam.sisapinjam
MESSAGEBOX("Nasabah tersebut masih memiliki sisa pinjaman...",0,"Perhatian...")
thisform.nama.SetFocus
RETURN
ELSE
thisform.aktifkan(.t.)
thisform.bunga.Value=2
thisform.BA.Value=3
ENDIF
SELECT tmpuser
thisform.nouser.Value=tmpuser.nouser
thisform.jmlPinjam.SetFocus
RETURN
* Object NAMA Procedure InteractiveChange SELECT nasabah
SET ORDER TO NAMA
LOCATE FOR nama=TRIM(thisform.nama.Value)
thisform.norek.Value=nasabah.norek
SELECT PINJAM
COUNT FOR LEFT(nopinjam,10)=rTRIM(thisform.nopinjam.value) TO A
IF a>0
b=a
ELSE
b=1
ENDIF
IF b<10
aa="0000"+STR(b,1)
ELSE
IF b<100
aa="000"+STR(b,2)
ELSE
IF b<1000
aa="00"+STR(b,3)
ELSE
IF b<10000
aa="0"+STR(b,4)
ELSE
aa=STR(b,5)
ENDIF
ENDIF
ENDIF
ENDIF
thisform.NoPinjam.Value=RTRIM(thisform.norek.value)+aa
SELECT PINJAM
LOCATE FOR norek=TRIM(thisform.norek.Value) .and. pinjam.sisapinjam>0
IF FOUND()
36
AMIK Al Ma’soem
thisform.nopinjam.Value=pinjam.nopinjam
thisform.tglpinjam.Value=pinjam.tglpinjam
thisform.jmlpinjam.Value=pinjam.jmlpinjam
thisform.sisapinjam.Value=pinjam.sisapinjam
MESSAGEBOX("Nasabah tersebut masih memiliki sisa pinjaman...",0,"Perhatian...")
thisform.nama.SetFocus
RETURN
ELSE
thisform.aktifkan(.t.)
thisform.bunga.Value=2
thisform.BA.Value=3
thisform.jmlpinjam.setfocus
ENDIF
SELECT tmpuser
thisform.nouser.Value=tmpuser.nouser
thisform.jmlPinjam.SetFocus
RETURN
* Object BUNGA Procedure LostFocus thisform.biayaadm.Value=(thisform.ba.Value/100)*thisform.Jmlpinjam.Value
tBunga=thisform.JmlPinjam.Value*(thisform.bunga.Value/100)*thisform.tenor.Value
tpjm=thisform.JmlPinjam.Value+tbunga
thisform.sisapinjam.Value=tpjm
thisform.sisapokok.Value=thisform.JmlPinjam.Value
thisform.sisabunga.Value=tbunga
* Object JMLPINJAM Procedure LostFocus thisform.biayaadm.Value=(thisform.ba.Value/100)*thisform.Jmlpinjam.Value
tBunga=thisform.JmlPinjam.Value*(thisform.bunga.Value/100)*thisform.tenor.Value
tpjm=thisform.JmlPinjam.Value+tbunga
thisform.sisapinjam.Value=tpjm
thisform.sisapokok.Value=thisform.JmlPinjam.Value
thisform.sisabunga.Value=tbunga
* Object TENOR Procedure LostFocus IF thisform.tenor.Value>24
MESSAGEBOX("Jangka waktu Pinjaman tidak boleh melebihi 24 bulan",0,"Ubah Lama
Pinjamannya...!")
thisform.tenor.Value=0
RETURN
ENDIF
a=DAY(thisform.TglPinjam.Value)
b=month(thisform.TglPinjam.Value)
c=year(thisform.TglPinjam.Value)
LM=thisform.tenor.Value
bln1=MOD((b+LM),12)
th=INT((LM+b)/12)
IF bln1=0
bln=(b+LM)/TH
ELSE
bln=bln1
endif
37
AMIK Al Ma’soem
IF (b+LM)=(12*th)
thn=c+(th-1)
else
IF (b+LM)>12
thn=c+th
ELSE
thn=c
ENDIF
ENDIF
JT=STR(a,2)+"/"+STR(bln,2)+"/"+STR(thn,4)
thisform.Jtempo.Value=CTOD(JT)
thisform.biayaadm.Value=(thisform.ba.Value/100)*thisform.Jmlpinjam.Value
tBunga=thisform.JmlPinjam.Value*(thisform.bunga.Value/100)*thisform.tenor.Value
tpjm=thisform.JmlPinjam.Value+tbunga
thisform.sisapinjam.Value=tpjm
thisform.sisapokok.Value=thisform.JmlPinjam.Value
thisform.sisabunga.Value=tbunga
* Object BIAYAADM Procedure LostFocus thisform.JmlTerima.Value=thisform.JmlPinjam.Value-thisform.BiayaAdm.Value-;
thisform.materai.Value-thisform.asuransi.Value
* Object MATERAI Procedure LostFocus thisform.JmlTerima.Value=thisform.JmlPinjam.Value-thisform.BiayaAdm.Value-;
thisform.materai.Value-thisform.asuransi.Value
* Object ASURANSI Procedure LostFocus thisform.JmlTerima.Value=thisform.JmlPinjam.Value-thisform.BiayaAdm.Value-;
thisform.materai.Value-thisform.asuransi.Value
* Object SIMPAN Procedure Click SELECT pinjam
LOCATE FOR norek=TRIM(thisform.norek.Value)
IF FOUND()
MESSAGEBOX("Nomor pinjam tsb sudah digunakan !",0,;
"Ganti dengan nomor pinjam lain ..!")
thisform.norek.SetFocus
RETURN
ELSE
APPEND BLANK
replace norek WITH thisform.Norek.Value
replace tglpinjam WITH thisform.TglPinjam.Value
replace nopinjam WITH thisform.NoPinjam.Value
replace jmlpinjam WITH thisform.JmlPinjam.Value
replace bunga WITH thisform.bunga.Value/100
replace tenor WITH thisform.Tenor.Value
replace jtempo WITH thisform.jTempo.Value
replace sisapinjam WITH thisform.sisapinjam.Value
replace Biayaadm WITH thisform.BiayaAdm.Value
replace materai WITH thisform.materai.Value
replace asuransi WITH thisform.asuransi.Value
replace JmlTerima WITH thisform.JmlTerima.Value
38
AMIK Al Ma’soem
replace Jaminan WITH thisform.jaminan.Value
replace sisapokok WITH thisform.sisapokok.Value
replace sisabunga WITH thisform.sisabunga.Value
replace NoUser WITH thisform.NoUser.Value
SELECT pinjam
ENDIF
thisform.NOREK.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.kosongkan
thisform.baru.enabled=.t.
thisform.batal.enabled=.f.
thisform.keluar.enabled=.t.
thisform.simpan.enabled=.f.
thisform.cetak.enabled=.f.
thisform.perbaiki.enabled=.t.
thisform.baru.setfocus
thisform.Refresh
RETURN
* Object CETAK Procedure Click SELECT pinjam
SET RELATION TO NOREK INTO NASABAH
REPORT FORM d:\bpr\prg\slippjm PREVIEW FOR nopinjam=thisform.nopinjam.Value
RETURN
* Object BATAL Procedure Click thisform.NOREK.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.kosongkan
thisform.baru.enabled=.t.
thisform.batal.enabled=.f.
thisform.keluar.enabled=.t.
thisform.simpan.enabled=.f.
thisform.cetak.enabled=.f.
thisform.perbaiki.enabled=.f.
thisform.baru.setfocus
thisform.Refresh
return
* Object KELUAR Procedure Click thisform.Release
SET DELETED OFF
PACK
RETURN
* Object PERTAMA Procedure Click SELECT PINJAM
GO top
IF EOF()
MESSAGEBOX("Record tidak ada. . .",0,"Perhatian. . .!")
RETURN
39
AMIK Al Ma’soem
ENDIF
thisform.grid1.SetFocus()
thisform.Refresh()
return
* Object SEBELUMNYA Procedure Click SELECT PINJAM
SKIP -1
IF BOF()
GO TOP
ENDIF
THISFORM.grid1.SetFocus()
thisform.Refresh()
return
* Object BERIKUTNYA Procedure Click SELECT PINJAM
SKIP
IF EOF()
GO BOTTOM
ENDIF
THISFORM.grid1.SetFocus()
thisform.Refresh()
return
* Object TERAKHIR Procedure Click SELECT PINJAM
GO bottom
IF EOF()
MESSAGEBOX("Record tidak ada...",0,"Perhatian...!")
return
ENDIF
thisform.grid1.SetFocus()
thisform.Refresh()
return
* Object PERBAIKI Procedure Click SELECT pinjam
jawab=MESSAGEBOX("Mau mem perbaiki data sebelumnya ?",4+32,"Perhatian...")
IF jawab=6
replace norek WITH thisform.Norek.Value
replace tglpinjam WITH thisform.TglPinjam.Value
replace nopinjam WITH thisform.NoPinjam.Value
replace jmlpinjam WITH thisform.JmlPinjam.Value
replace bunga WITH thisform.bunga.Value/100
replace tenor WITH thisform.Tenor.Value
replace jtempo WITH thisform.jTempo.Value
replace sisapinjam WITH thisform.sisapinjam.Value
replace Biayaadm WITH thisform.BiayaAdm.Value
replace materai WITH thisform.materai.Value
replace asuransi WITH thisform.asuransi.Value
replace JmlTerima WITH thisform.JmlTerima.Value
40
AMIK Al Ma’soem
replace Jaminan WITH thisform.jaminan.Value
replace NoUser WITH thisform.NoUser.Value
ENDIF
thisform.NOREK.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.kosongkan
thisform.baru.enabled=.t.
thisform.batal.enabled=.f.
thisform.keluar.enabled=.t.
thisform.simpan.enabled=.f.
thisform.cetak.enabled=.f.
thisform.perbaiki.enabled=.f.
thisform.baru.setfocus
thisform.Refresh
RETURN
* Object GRID1 Procedure AfterRowCollChenge LPARAMETERS nColIndex
thisform.tampilkan
thisform.NOREK.enabled=.f.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.baru.enabled=.t.
thisform.batal.enabled=.f.
thisform.keluar.enabled=.t.
thisform.simpan.enabled=.f.
thisform.cetak.enabled=.f.
thisform.perbaiki.enabled=.t.
thisform.baru.setfocus
thisform.Refresh
RETURN
B. TUGAS V: Buatkan Form PINJAMAN dari Tugas III di atas.
41
AMIK Al Ma’soem
BAGIAN VI Tujuan :
1. Membuat Report Bukti Pinjaman 2. Grouping
A. BAHAN PRAKTEK VI 6.1 Membuat Report Bukti Pinjaman
42
AMIK Al Ma’soem
6.2 Membuat Report Kartu Pinjaman
6.3 Membuat Form Kartu Pinjaman
* Object FORM1 Procedure LOAD SET DATE BRITISH
SET CENTURY on
SET DEFAULT TO D:\BPR\DATA
CLOSE DATABASES
43
AMIK Al Ma’soem
CLOSE INDEXES
IF USED('nasabah')
USE IN nasabah
ENDIF
IF USED('pinjam')
USE IN pinjam
ENDIF
IF USED('angsur')
USE IN angsur
ENDIF
IF USED('tmpangsur')
USE IN tmpangsur
ENDIF
IF USED('tmpuser')
USE IN tmpuser
ENDIF
SELECT a
USE nasabah
SET ORDER TO tag norek
SELECT b
USE pinjam
SET ORDER TO nopinjam
SELECT c
USE Angsur
SET ORDER TO nopinjam
SELECT d
USE tmpAngsur
SET ORDER TO nopinjam
SELECT e
USE tmpuser
RETURN
* Object FORM1 Procedure UNLOAD CLOSE DATABASES
Return
* Object FORM1 Procedure ACTIVATE THISFORM.NOPINJAM.SETFOCUS
* Object CARI Procedure CLICK SELECT pinjam
LOCATE FOR nopinjam=TRIM(thisform.nopinjam.Value)
IF ! FOUND()
MESSAGEBOX("Nomor Pinjam tidak ditemukan...",0,"Perhatian...")
thisform.nopinjamn.setfocus
RETURN
ENDIF
thisform.norek.Value=pinjam.norek
SELECT Nasabah
LOCATE FOR norek=TRIM(thisform.norek.Value)
thisform.nama.Value=nasabah.nama
44
AMIK Al Ma’soem
SELECT tmpangsur
SET DELETED ON
DELETE ALL
APPEND FROM angsur FOR nopinjam=TRIM(thisform.nopinjam.Value)
thisform.Refresh
RETURN
* Object CETAK Procedure CLICK SELECT TMPANGSUR
SET RELATION TO NOPINJAM INTO PINJAM, NOREK INTO NASABAH
REPORT FORM D:\BPR\PRG\KARTUPINJAM PREVIEW FOR
NOPINJAM=TRIM(THISFORM.NOPINJAM.Value)
return
* Object KELUAR Procedure CLICK thisform.release
RETURN
B. TUGAS VI 1. Buatkan Laporan Pinjaman
2. Buatkan Form Laporan Pinjaman
45
AMIK Al Ma’soem
46
AMIK Al Ma’soem
BAGIAN VII Tujuan :
1. Membuat Form Transaksi Angsuran Pinjaman 2. Penggunaan File Mirror
A. BAHAN PRAKTEK VII 7.1 Form Transaksi Angsuran
* Object FORM1 Procedure LOAD SET DATE BRITISH
SET CENTURY on
SET DEFAULT TO D:\BPR\DATA
CLOSE DATABASES
CLOSE INDEXES
IF USED('nasabah')
USE IN nasabah
ENDIF
IF USED('pinjam')
USE IN pinjam
ENDIF
IF USED('angsur')
USE IN angsur
ENDIF
IF USED('tmpangsur')
USE IN tmpangsur
ENDIF
IF USED('tmpuser')
USE IN tmpuser
47
AMIK Al Ma’soem
ENDIF
SELECT a
USE nasabah
SET ORDER TO tag nama
SELECT b
USE pinjam
SET ORDER TO nopinjam
SELECT c
USE Angsur
SET ORDER TO nopinjam
SELECT d
USE tmpAngsur
SET ORDER TO nopinjam
SELECT e
USE tmpuser
RETURN
* Object FORM1 Procedure UNLOAD CLOSE INDEXES
CLOSE DATABASES
RETURN
* Object FORM1 Procedure AKTIFKAN PARAMETERS x
thisform.nopinjam.Enabled=x
thisform.tglangsur.Enabled=x
thisform.JmlBln.Enabled=x
return
* Object FORM1 Procedure KENDALI PARAMETERS z
thisform.pertama.Enabled=z
thisform.sebelumnya.Enabled=z
thisform.berikutnya.Enabled=z
thisform.terakhir.Enabled=z
return
* Object FORM1 Procedure KOSONGKAN thisform.NoPinjam.Value=""
thisform.NoAngsur.Value=""
thisform.TglPinjam.Value=""
thisform.NoRek.Value=""
thisform.Nama.Value=""
thisform.TglAngsur.Value=DATE()
thisform.TglPinjam.Value=ctod(" / / ")
thisform.JmlPinjam.Value=0
thisform.Jtempo.Value=ctod(" / / ")
thisform.lambat.Value=0
thisform.tenor.Value=0
thisform.TotPokok.Value=0
thisform.totBunga.Value=0
thisform.totAngsur.Value=""
48
AMIK Al Ma’soem
thisform.SisaPinjam.Value=0
thisform.saldoakhir.Value=0
thisform.ke.Value=0
thisform.pokok.Value=0
thisform.bunga.Value=0
thisform.denda.Value=0
thisform.JmlBln.Value=0
thisform.nouser.Value=""
thisform.Namauser.Value=""
thisform.ByrPokok.Value=0
thisform.Byrbunga.Value=0
thisform.Byrdenda.Value=0
thisform.JmlBayar.Value=0
RETURN
* Object FORM1 Procedure TAMPIL thisform.NoAngsur.Value=tmpangsur.NoAngsur
thisform.NoPinjam.Value=tmpangsur.Nopinjam
thisform.Ke.Value=tmpangsur.ke
thisform.pokok.Value=tmpangsur.pokok
thisform.bunga.Value=tmpangsur.bunga
thisform.denda.Value=tmpangsur.denda
thisform.JmlAngsur.Value=tmpangsur.JmlAngsur
thisform.TglAngsur.Value=tmpangsur.tglAngsur
thisform.JmlBln.Value=tmpangsur.JmlBln
thisform.TotPokok.Value=thisform.pokok.Value*thisform.JmlBln.Value
thisform.TotBunga.Value=thisform.bunga.Value*thisform.JmlBln.Value
thisform.TotAngsur.Value=thisform.JmlAngsur.Value*thisform.JmlBln.Value
thisform.lambat.Value=tmpangsur.lambat
thisform.nouser.Value=tmpangsur.nouser
SELECT tmpuser
LOCATE FOR Nouser=TRIM(thisform.nouser.Value)
thisform.namauser.Value=tmpuser.namauser
RETURN
* Object FORM1 Procedure TAMPILKAN SELECT pinjam
thisform.norek.Value=pinjam.norek
thisform.Jmlpinjam.Value=pinjam.Jmlpinjam
thisform.tglpinjam.Value=pinjam.tglpinjam
thisform.sisapokok.Value=pinjam.sisapokok
thisform.sisabunga.Value=pinjam.sisabunga
thisform.sisapinjam.Value=pinjam.sisapinjam
thisform.jtempo.Value=pinjam.jtempo
thisform.tenor.Value=pinjam.tenor
thisform.nouser.Value=pinjam.nouser
thisform.tgkpokok.Value=pinjam.tgkpokok
thisform.tgkbunga.Value=pinjam.tgkbunga
SELECT Nasabah
LOCATE FOR norek=thisform.norek.Value
thisform.nama.value=nasabah.nama
49
AMIK Al Ma’soem
SELECT tmpuser
LOCATE FOR nouser=thisform.nouser.Value
thisform.nama.Value=tmpuser.namauser
SELECT angsur
LOCATE FOR nopinjam=TRIM(thisform.nopinjam.Value)
IF FOUND()
SELECT tmpangsur
SET DELETED ON
DELETE ALL
APPEND FROM angsur FOR nopinjam=TRIM(thisform.nopinjam.Value )
GO bottom
thisform.ke.Value=tmpangsur.ke
thisform.pokok.Value=tmpangsur.pokok
thisform.bunga.Value=tmpangsur.bunga
thisform.denda.Value=tmpangsur.denda
thisform.jmlangsur.Value=tmpangsur.JmlAngsur
thisform.JmlBln.Value=tmpangsur.JmlBln
thisform.Totangsur.Value=tmpangsur.TotBayar
thisform.sisapinjam.Value=tmpangsur.saldo
thisform.lambat.Value=tmpangsur.lambat
GO top
thisform.Refresh ()
ELSE
thisform.ke.Value=0
thisform.pokok.Value=0
thisform.bunga.Value=0
thisform.denda.Value=0
thisform.jmlangsur.Value=0
thisform.JmlBln.Value=0
thisform.TotBayar.Value=0
thisform.Saldo.Value=0
thisform.lambat.Value=0
ENDIF
SELECT tmpangsur
GO top
REPLACE ALL nama WITH thisform.nama.value
REPLACE ALL namauser WITH thisform.namauser.value
thisform.cetak.Enabled=.t.
thisform.hapus.Enabled=.t.
thisform.perbaiki.Enabled=.t.
SELECT pinjam
RETURN
* Object FORM1 Procedure ACTIVATE SELECT tmpangsur
SET DELETED ON
DELETE ALL
thisform.grid1.SetFocus
thisform.Refresh
thisform.kosongkan
thisform.tglangsur.Value=DATE()
thisform.grid1.readonly=.t.
50
AMIK Al Ma’soem
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.simpan.Enabled=.f.
thisform.cetak.Enabled=.f.
thisform.batal.Enabled=.f.
thisform.keluar.Enabled=.t.
thisform.hapus.Enabled=.f.
thisform.tambah.setfocus
return
* Object CARINOPINJAM Procedure CLICK SELECT pinjam
LOCATE FOR nopinjam=TRIM(thisform.nopinjam.Value)
IF ! FOUND()
MESSAGEBOX("Nomor Pinjam tidak ditemukan...",0,"Perhatian...")
thisform.nopinjamn.setfocus
RETURN
ENDIF
thisform.norek.Value=pinjam.norek
thisform.Jmlpinjam.Value=pinjam.Jmlpinjam
thisform.tglpinjam.Value=pinjam.tglpinjam
thisform.sisapokok.Value=pinjam.sisapokok
thisform.sisabunga.Value=pinjam.sisabunga
thisform.sisapinjam.Value=pinjam.sisapinjam
thisform.jtempo.Value=pinjam.jtempo
thisform.tenor.Value=pinjam.tenor
thisform.nouser.Value=pinjam.nouser
thisform.tgkpokok.Value=pinjam.tgkpokok
thisform.tgkbunga.Value=pinjam.tgkbunga
vb=pinjam.bunga
vcicil=pinjam.jmlpinjam/pinjam.tenor
vbunga=pinjam.jmlpinjam*pinjam.bunga
SELECT Nasabah
LOCATE FOR norek=TRIM(thisform.norek.Value)
thisform.nama.Value=nasabah.nama
SELECT tmpuser
LOCATE FOR nouser=TRIM(thisform.nouser.Value)
thisform.namauser.Value=tmpuser.namauser
DO case
CASE MONTH(thisform.TglAngsur.Value)=1
b=31
CASE MONTH(thisform.TglAngsur.Value)=2
IF MOD(YEAR(thisform.TglAngsur.Value),4)=0
b=29
ELSE
b=28
endif
CASE MONTH(thisform.TglAngsur.Value)=3
b=31
CASE MONTH(thisform.TglAngsur.Value)=4
b=30
CASE MONTH(thisform.TglAngsur.Value)=5
b=31
CASE MONTH(thisform.TglAngsur.Value)=6
b=30
CASE MONTH(thisform.TglAngsur.Value)=7
51
AMIK Al Ma’soem
b=31
CASE MONTH(thisform.TglAngsur.Value)=8
b=31
CASE MONTH(thisform.TglAngsur.Value)=9
b=30
CASE MONTH(thisform.TglAngsur.Value)=10
b=31
CASE MONTH(thisform.TglAngsur.Value)=11
b=30
OTHERWISE
b=31
ENDCASE
SELECT tmpangsur
SET DELETED ON
DELETE ALL
APPEND FROM angsur FOR nopinjam=TRIM(thisform.nopinjam.Value)
thisform.Refresh
IF ke=0
vke=ke+1
ELSE
GO bottom
vke=ke+1
ENDIF
thisform.ke.Value=vke
IF vke=1
vtgl1=thisform.tglpinjam.Value
ELSE
LOCATE FOR tmpangsur.ke=(thisform.ke.Value-1)
x1=MONTH(tmpangsur.tglangsur)
x2=year(tmpangsur.tglangsur)
x3=DAY(thisform.jtempo.Value)+1
x4=STR(x3)+"-"+STR(x1)+"-"+STR(x2)
vtgl1=CTOD(x4)
ENDIF
vld=int((thisform.TglAngsur.Value-vtgl1)/b)
vl=(thisform.TglAngsur.Value-vtgl1)/b
tl=0
IF vl>1
tl1=INT((thisform.TglAngsur.Value-vtgl1)/30)-1
IF MOD((thisform.TglAngsur.Value-vtgl1),30)>0
tl=tl1+1
ELSE
tl=tl1
ENDIF
endif
thisform.lambat.Value=tl
vdenda=(tl*10000)
IF vld>1 .and. thisform.TglAngsur.Value>thisform.jtempo.Value
vld2=INT((thisform.TglAngsur.Value-thisform.jtempo.value)/b)
vld3=vld-vld2
ELSE
vld3=vld
ENDIF
vcicil1=vcicil*vld3
vbunga1=vbunga*vld
thisform.pokok.Value=vcicil
thisform.bunga.Value=vbunga
thisform.denda.Value=vdenda
52
AMIK Al Ma’soem
thisform.jmlangsur.Value=thisform.pokok.Value+thisform.bunga.Value+thisform.denda.Value
vakhir=thisform.sisapinjam.value-thisform.pokok.value
thisform.saldoakhir.Value=vakhir
thisform.jmlbln.setfocus
RETURN
* Object BYRPOKOK Procedure CLICK thisform.byrpokok.Value=thisform.pokok.Value+thisform.Tgkpokok.Value
thisform.JmlBayar.Value=thisform.byrpokok.Value+thisform.byrbunga.Value+thisform.byrdenda.Value
* Object BYRPOKOK Procedure LOSTFOCUS thisform.JmlBayar.Value=thisform.byrpokok.Value+thisform.byrbunga.Value+thisform.byrdenda.Value
* Object BYRBUNGA Procedure CLICK thisform.byrbunga.Value=thisform.bunga.Value+thisform.Tgkbunga.Value
thisform.JmlBayar.Value=thisform.byrpokok.Value+thisform.byrbunga.Value+thisform.byrdenda.Value
* Object BYRBUNGA Procedure LOSTFOCUS thisform.JmlBayar.Value=thisform.byrpokok.Value+thisform.byrbunga.Value+thisform.byrdenda.Value
* Object BYRDENDA Procedure CLICK thisform.byrdenda.Value=thisform.denda.Value
thisform.JmlBayar.Value=thisform.byrpokok.Value+thisform.byrbunga.Value+thisform.byrdenda.Value
* Object BYRDENDA Procedure LOSTFOCUS thisform.JmlBayar.Value=thisform.byrpokok.Value+thisform.byrbunga.Value+thisform.byrdenda.Value
* Object JMLBLN Procedure InteractiveChange thisform.totpokok.value=thisform.jmlbln.value*thisform.byrpokok.value
thisform.totBunga.value=thisform.byrBunga.value
thisform.totangsur.value=thisform.byrdenda.value+thisform.totpokok.value+thisform.totbunga.value
thisform.saldoakhir.value=thisform.sisapinjam.value-thisform.totpokok.value
thisform.nouser.Value=tmpuser.nouser
SELECT tmpuser
LOCATE FOR Nouser=TRIM(thisform.nouser.value)
thisform.namauser.Value=tmpuser.namauser
* Object SIMPAN Procedure CLICK IF EMPTY(thisform.ByrPokok.value) .or. EMPTY(thisform.Byrbunga.value)
MESSAGEBOX("Isi dulu Jumlah Bayarnya ...!",0,"Perhatian...")
thisform.ByrPokok.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.jmlbln.value)
MESSAGEBOX("Isi dulu Jumlah bulan ...!",0,"Perhatian...")
thisform.jmlbln.SetFocus
RETURN
ENDIF
vspokok=thisform.sisapokok.Value-(thisform.byrpokok.Value*thisform.JmlBln.Value)
vsbunga=thisform.sisabunga.Value-(thisform.byrbunga.Value*thisform.JmlBln.Value)
vspinjam=thisform.sisapinjam.Value-(thisform.Jmlbayar.Value*thisform.JmlBln.Value)
selpokok=(thisform.pokok.Value+thisform.tgkpokok.Value)-thisform.byrpokok.Value
53
AMIK Al Ma’soem
selbunga=(thisform.bunga.Value+thisform.tgkbunga.Value)-thisform.byrbunga.Value
SELECT angsur
APPEND BLANK
replace Noangsur WITH thisform.Noangsur.Value
replace NoPinjam WITH thisform.NoPinjam.Value
replace NOREK WITH thisform.norek.Value
replace TglAngsur WITH thisform.tglAngsur.Value
replace ke WITH thisform.ke.Value
replace pokok WITH thisform.byrpokok.Value
replace bunga WITH thisform.byrbunga.Value
replace denda WITH thisform.byrdenda.Value
replace Jmlangsur WITH thisform.Jmlbayar.Value
replace JmlBln WITH thisform.JmlBln.Value
replace TotBayar WITH thisform.Totangsur.Value
replace Lambat WITH thisform.lambat.Value
replace saldo WITH thisform.saldoakhir.Value
SELECT pinjam
LOCATE FOR nopinjam=TRIM(thisform.nopinjam.Value)
REPLACE sisapokok WITH vspokok
REPLACE sisabunga WITH vsbunga
REPLACE sisapinjam WITH vspinjam
REPLACE tgkpokok WITH selpokok
REPLACE tgkbunga WITH selbunga
thisform.tgkpokok.Value=pinjam.tgkpokok
thisform.tgkbunga.Value=pinjam.tgkbunga
SELECT tmpangsur
APPEND BLANK
replace Noangsur WITH thisform.Noangsur.Value
replace NoPinjam WITH thisform.NoPinjam.Value
replace TglAngsur WITH thisform.tglAngsur.Value
replace ke WITH thisform.ke.Value
replace pokok WITH thisform.byrpokok.Value
replace bunga WITH thisform.byrbunga.Value
replace denda WITH thisform.byrdenda.Value
replace Jmlangsur WITH thisform.JmlBayar.Value
replace JmlBln WITH thisform.JmlBln.Value
replace TotBayar WITH thisform.Totangsur.Value
replace Lambat WITH thisform.lambat.Value
replace saldo WITH thisform.saldoakhir.Value
SELECT angsur
thisform.grid1.SetFocus()
thisform.Refresh()
thisform.grid1.Enabled=.t.
thisform.aktifkan(.f.)
thisform.kendali(.t.)
thisform.cetak.Enabled=.t.
thisform.keluar.Enabled=.t.
thisform.tambah.Enabled=.t.
thisform.simpan.Enabled=.f.
RETURN
54
AMIK Al Ma’soem
* Object BARU Procedure CLICK thisform.kosongkan
thisform.tglangsur.Value=DATE()
t=DAY(DATE())
b=month(DATE())
y=year(DATE())
h=LEFT(TIME(),2)
m=SUBSTR(TIME(),4,2)
IF t<10
vt="0"+STR(t,1)
ELSE
vt=STR(t,2)
ENDIF
IF b<10
vb="0"+STR(b,1)
ELSE
vb=STR(b,2)
ENDIF
vno=vt+vb+STR(y,4)+h+m
thisform.noangsur.value=vno
thisform.grid1.enabled=.f.
thisform.aktifkan(.t.)
thisform.kendali(.f.)
thisform.tambah.Enabled=.f.
thisform.simpan.Enabled=.t.
thisform.batal.Enabled=.t.
thisform.keluar.Enabled=.f.
thisform.cetak.Enabled=.f.
thisform.nopinjam.SetFocus
return
* Object HAPUS Procedure CLICK jawab=MESSAGEBOX("anda yakin record ini akan dihapus ?",4+32,"Record ini akan dihapus !...")
IF jawab=6
SET DELETED ON
SELECT angsur
LOCATE FOR NOPINJAM=TRIM(thisform.NOPINJAM.Value) .and. ke=thisform.KE.Value
DELETE
SELECT tmpangsur
LOCATE FOR NOPINJAM=TRIM(thisform.NOPINJAM.Value).and. ke=thisform.KE.Value
DELETE
SELECT pinjam
LOCATE FOR NOPINJAM=TRIM(thisform.NOPINJAM.Value)
REPLACE SISAPOKOK WITH thisform.SISAPOKOK.Value+thisform.POKOK.Value
REPLACE SISABUNGA WITH thisform.SISABUNGA.Value+thisform.BUNGA.Value
REPLACE SISAPINJAM WITH thisform.SISAPINJAM.Value++thisform.JMLANGSUR.Value
ENDIF
SET DELETED ON
thisform.refresh
RETURN
* Object BATAL Procedure CLICK thisform.ke.enabled=.f.
thisform.kendali(.t.)
thisform.aktifkan(.f.)
thisform.tambah.enabled=.t.
55
AMIK Al Ma’soem
thisform.keluar.enabled=.t.
thisform.hapus.enabled=.f.
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
thisform.grid1.enabled=.t.
thisform.kosongkan()
thisform.tambah.setfocus()
return
* Object CETAK Procedure CLICK SELECT tmpangsur
LOCATE FOR nopinjam=thisform.nopinjam.Value .and. ke=thisform.ke.Value
SET RELATION TO NOREK INTO nasabah, nopinjam INTO pinjam
REPORT FORM d:\bpr\prg\slipsetor PREVIEW for ke=thisform.ke.Value
Return
* Object PERTAMA Procedure CLICK SELECT pinjam
GO top
IF EOF()
MESSAGEBOX("Record tidak ada. . .",0,"Perhatian. . .!")
RETURN
ENDIF
thisform.tampilkan
return
* Object SEBELUMNYA Procedure CLICK SELECT pinjam
SKIP -1
IF BOF()
GO TOP
ELSE
thisform.tampilkan
ENDIF
return
* Object BERIKUTNYA Procedure CLICK SELECT pinjam
SKIP
IF BOF()
GO TOP
ELSE
thisform.tampilkan
ENDIF
Return
* Object TERAKHIR Procedure CLICK SELECT Pinjam
GO bottom
IF EOF()
MESSAGEBOX("Record tidak ada...",0,"Perhatian...!")
56
AMIK Al Ma’soem
return
ENDIF
thisform.tampilkan
return
* Object KELUAR Procedure CLICK jawab=MESSAGEBOX("anda yakin mau keluar ?",4+32,"mau Keluar dari Entry data...")
IF jawab=6
SELECT tmpAngsur
SET DELETED off
PACK
thisform.Release
ENDIF
RETURN
B. TUGAS VII Buatkan Form Angsuran dari Perusahaan yang anda survey
57
AMIK Al Ma’soem
BAGIAN VIII Tujuan :
1. Membuat Report Bukti Angsuran dan Laporan Angsuran 2. Form Untuk MemFilter Report
A. BAHAN PRAKTEK VIII 8.1 Report Bukti Pembayaran Angsuran Nama Report : SlipAngsur
8.2 Report Bukti Pembayaran Angsuran Nama Report : SlipAngsur
58
AMIK Al Ma’soem
8.3 Form Laporan Angsuran Nama Form : LAPANGSUR
* Object FORM1 Procedure LOAD SET DATE BRITISH
SET CENTURY on
SET DEFAULT TO D:\BPR\DATA
CLOSE DATABASES
CLOSE INDEXES
IF USED('nasabah')
USE IN nasabah
ENDIF
IF USED('angsur')
USE IN angsur
ENDIF
IF USED('tmpangsur')
USE IN tmpangsur
ENDIF
SELECT a
59
AMIK Al Ma’soem
USE nasabah
SET ORDER TO tag nama
SELECT b
USE angsur
SET ORDER TO noangsur
SELECT c
USE tmpangsur
SELECT d
USE tmpuser
RETURN
* Object FORM1 Procedure UNLOAD CLOSE DATABASES
RETURN
* Object FORM1 Procedure ACTIVATE THISFORM.Tgl.DAY=DAY(DATE())
THISFORM.Tgl.MONTH=MONTH(DATE())
THISFORM.Tgl.YEAR=YEAR(DATE())
* Object CETAK Procedure CLICK
m=thisform.tgl.month
y=thisform.tgl.year
SELECT tmpangsur
DELETE ALL
SET DELETED OFF
PACK
APPEND FROM angsur FOR MONTH(tglangsur)=m .and. YEAR(tglangsur)=y
GO top
IF EOF()
MESSAGEBOX("Tidak ada data yang bisa dicetak...",0,"Perhatian...")
RETURN
ENDIF
REPORT FORM D:\BPR\PRG\LAPANGSUR PREVIEW
return
* Object KELUAR Procedure CLICK THISFORM.Release
RETURN
B. TUGAS VIII Buatkan Form dan Report Laporan Angsuran dari Kasus hasil survey.
60
AMIK Al Ma’soem
BAGIAN IX Tujuan :
1. Membuat Report Kartu Pinjaman 2. Form Untuk MemFilter Report
A. BAHAN PRAKTEK IX 9.1 Report Laporan Saldo Piutang Nama Report : Piutang
9.2 Procedure untuk menjalankan Laporan Piutang dari Menu SET DATE BRITISH
SET CENTURY on
SET DEFAULT TO D:\BPR\DATA
CLOSE DATABASES
CLOSE INDEXES
IF USED('nasabah')
USE IN nasabah
ENDIF
IF USED('pinjam')
USE IN pinjam
ENDIF
IF USED('tmppinjam')
USE IN tmppinjam
ENDIF
SELECT a
USE nasabah
SET ORDER TO tag NOREK
SELECT b
61
AMIK Al Ma’soem
USE pinjam
SET ORDER TO nopinjam
SELECT c
USE tmppinjam
SELECT d
USE tmpuser
SELECT TMPPINJAM
DELETE ALL
SET DELETED OFF
PACK
APPEND FROM PINJAM FOR SISAPINJAM>0
SET RELATION TO NOREK INTO NASABAH
GO top
IF EOF()
MESSAGEBOX("Tidak ada data yang bisa dicetak...",0,"Perhatian...")
RETURN
ENDIF
REPORT FORM D:\BPR\PRG\LAPPIUTANG PREVIEW FOR PINJAM.SISAPINJAM>0
B. TUGAS IX Buatkan Report Piutang berdasarkan data hasil survey
62
AMIK Al Ma’soem
BAGIAN X
Tujuan :
1. Membuat Program Compiler File 2. Mengcopiler file menjadi file EXE
A. BAHAN PRAKTEK X : 1. Buatkan file Program pada Page Code, sbb :
CLOSE ALL
SET TALK OFF
SET STAT OFF
SET AUTOSAVE ON
SET CENTURY ON
SET DATE BRITISH
SET DEFA TO d:\SKA\DATA
PUSH MENU _MSYSMENU
MODI WINDOWS SCREEN TITLE 'SISTEM INFORMASI SIMPAN PINJAM'
WITH _SCREEN
.VISIBLE=.T.
.WINDOWSTATE=2
.picture='d:\SKA\Gb\LATAR1.JPG'
ENDWITH
RELEASE ALL
DO d:\SKA\prg\menulogin.mpr
READ EVENTS
QUIT
2. Simpan dengan nama SKA.PRG 3. Klik kanan File SKA.PRG tersebut, kemudian pilih Set Main
4. Klik Build 5. Pilih Win32 executable / COM server (exe) 6. Pada kolom Option klik kota CheckBox Recompile All Files dan Display Errors
63
AMIK Al Ma’soem
6. Klik tombol OK
B. TUGAS X Buatkan Program Compiler untuk tugas anda seperti pada praktek ke XIII dan lakukan compiler pada tugas anda.
64
AMIK Al Ma’soem
BAGIAN XI Tujuan : Membackup File
11.1. Membuat Program Backup File PINJAMAN 1. Membuat Form BackPinjam
2. Procedure : * Object FORM1 Procedure LOAD
set defa to d:\bpr\data
close data
close index
if used("pinjam")
use in pinjam
endif
set date BRITISH
set cent on
select a
use pinjam excl
RETURN
* Object FORM1 Procedure ACTIVATE b=left(cmont(DATE()),3)
t=right(str(year(DATE()),4),2)
f="PJM"+b+t+".DBF"
thisform.NamaFile.value=f
retu
* Object FORM1 Procedure UNLOAD CLOSE DATABASES
RETURN
* Object PROSES Procedure CLICK thisform.proses.Enabled= .F.
nf=alltrim(thisform.NamaFile.value)
select PINJAM
copy to d:\backup\&nf
MESSAGEBOX("File Pinjaman Sudah di BackUP",0,"Perhatian...")
thisform.release
retu
65
AMIK Al Ma’soem
* Object KELUAR Procedure CLICK thisform.release
retu
11.2. LATIHAN Membuat Program Backup File ANGSURAN
66
AMIK Al Ma’soem
BAGIAN XII Tujuan :
1. Membuat Program Tutup Buku 2. 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 :
12.2. Membuat Program Restore File 1. Pilih prompt Restore File 2. Ganti Result submenu menjadi Procedure 3. Ketik prosedur berikut :
4. Buatkan Form RestFile sbb :
5. Procedure : * Object FORM1 Procedure LOAD
* Object FORM1 Procedure ACTIVATE
* Object FORM1 Procedure UNLOAD CLOSE DATABASES
RETURN
* Object PROSES Procedure CLICK * Object KELUAR Procedure CLICK
thisform.release
retu