Pembuatan Form Untuk Aplikasi..
Pembuatan Form Untuk Aplikasi..
3) Kemudian aktifkan jendela Form Designer dengen mengklik satu kali pada judul
atas jendela tersebut, selanjutnya simpan form dengan memilih menu File, Save
dan ketikan nama form pada save form as dengan nama petugas
4) Setelah menyimpan form, tinggal menambah object-object yang diperlukan dalam
pembuatan form pengolahan data perugas. Object yang diperlukan adalah object
Label, Text Box, Command Button dan Control Grid.
Label
Text Box
Command Botton
Grid
Gambar 4.2 Tampilan designer Form
A. PROPERTIS OBJECT
Nama
Object
Form
Label1
Label2
Label3
Label4
Text1
Text2
Text3
Text4
Text5
Propertis
Nilai
Caption
Name
Auto Center
MDIForm
ShowWindows
Windowstate
Caption
Caption
Caption
Caption
Name
Maxlength
Name
Maxlength
Name
Maxlength
Name
PassworChar
Maxlength
Name
Maxlength
20
Command1
Name
Baru
Caption
\<Baru
Command2
Name
Simpan
Caption
\<Simpan
Command3
Name
Batal
Caption
\<Batal
Command4
Name
Rubah
Caption
\<Rubah
Command5
Name
Hapus
Caption
\<Hapus
Command6
Name
Atas
Caption
|<
Cammand7
Name
Mundur
Caption
<
Command8
Name
Maju
Caption
>
Command9
Name
Bawah
Caption
>|
Command10
Name
Cari
Caption
\<Cari
Grid1
Name
Grid1
ReadOnly
.T.
RecordSource
Petugas
Setelah Design Form selesai kemudian kita tinggal menuliskan code program sebagai
berikut :
B. PENULISAN CODE PROGRAM
1)
2) Aktifkan Tombol Baru dengan cara mengklik kemudian pada propertiesnya pilih
Click Event kemudian klik dua kali sehingga tampil jendela penulisan code
program kemudin tuliskan Code Program Tombol baru Clik di bawah ini:
posisi=recno()
thisform.txtnmptgs.enabled=.t.
thisform.txtjabatan.enabled=.t.
thisform.txtsandi.enabled=.t.
thisform.txtkdptgs.value=" "
thisform. txtnmptgs.value=" "
thisform.txtjabatan.value=" "
thisform. txtsandi.value=" "
thisform.baru.enabled=.f.
thisform.rubah.enabled=.f.
thisform.hapus.enabled=.f.
thisform.cari.enabled=.f.
thisform.keluar.enabled=.f.
thisform.maju.enabled=.f.
thisform.mundur.enabled=.f.
thisform. txtnmptgs.setfocus()
endif
4) Untuk Tombol Batal Clik Tuliskan Code program Dibawah ini :
posisi=recno()
thisform.txtnmptgs.enabled=.t.
thisform.txtjabatan.enabled=.t.
thisform.txtsandi.enabled=.t.
thisform.txtkdptgs.value=" "
thisform. txtnmptgs.value=" "
thisform.txtjabatan.value=" "
thisform. txtsandi.value=" "
thisform.baru.enabled=.f.
thisform.rubah.enabled=.f.
thisform.hapus.enabled=.f.
thisform.cari.enabled=.f.
thisform.keluar.enabled=.f.
thisform.maju.enabled=.f.
thisform.mundur.enabled=.f.
thisform. txtnmptgs.setfocus()
else
skip -1
endif
thisform.txtkdptgs.value=kdptgs
thisform.txtnmptgs.value=nmptgs
thisform.txtjabatan.value=jabatan
thisform.txtsandi.value=sandi
10) Untuk Tombol Bawah Clik Tuliskan Code program Dibawah ini :
select petugas
goto bottom
thisform.txtkdptgs.value=kdptgs
thisform.txtnmptgs.value=nmptgs
thisform.txtjabatan.value=jabatan
thisform.txtsandi.value=sandi
11) Untuk Tombol Keluar Clik Tuliskan Code program Dibawah ini
select petugas
set filter to
if delete()
pack
endif
thisform.release()
2. FORM ENTRY SUPPLER
Untuk memulai membuat Form Supplaer langkah yang dilakukan sama seperti
membuat Form petugas. Desainglah form hingga seperti gambar dibawah ini :
A. PROPERTI OBJECT
Nama
Object
Form
Label1
Label2
Label3
Label4
Text1
Text2
Text3
Text4
Text5
Command1
Command2
Command3
Command4
Command5
Command6
Cammand7
Command8
Command9
Command10
Grid1
Propertis
Nilai
Caption
Name
Auto Center
MDIForm
ShowWindows
Windowstate
Caption
Caption
Caption
Caption
Name
Maxlength
Name
Maxlength
Name
Maxlength
Name
PassworChar
Maxlength
Name
Maxlength
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
ReadOnly
RecordSource
.T.
Supplier
B. METHODE (PROSEDURE)
Methode (procedure) digunakan untuk mempermudah dalam penulisan code program,
agar tidak terjadi penulisan code secara berulang ulang
Langkah-langkah dalam membuat procedure yaitu
1) Pilih Menu Form kemudian plih Submenu Methode kemudian akan tampil
windows New Methode seperti gambar dibawah ini
2) Prosedure Hidupisian
thisform.txtnmsup.enabled=.t.
thisform.txtalamat.enabled=.t.
thisform.txttlp.enabled=.t.
3) Prosedure Matitombol
thisform.baru.enabled=.f.
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
thisform.rubah.enabled=.f.
thisform.hapus.enabled=.f.
thisform.cari.enabled=.f.
thisform.keluar.enabled=.f.
thisform.maju.enabled=.f.
thisform.mundur.enabled=.f.
4) Prosedure Hidupl
thisform.baru.enabled=.t.
thisform.simpan.enabled=.t.
thisform.batal.enabled=.t.
thisform.rubah.enabled=.t.
thisform.hapus.enabled=.t.
thisform.cari.enabled=.t.
thisform.keluar.enabled=.t.
thisform.maju.enabled=.t.
thisform.mundur.enabled=.t.
5) Prosedure Bersihisian
thisform.txtkdsup.value=" "
thisform. txtnmsup.value=" "
thisform.txtalamat.value=" "
thisform. txttlp.value=" "
6) Prosedure ambildata
select suplier
thisform.txtkdsup.value=kdsup
thisform.txtnmsup.value=nmsup
thisform.txtalamat.value=alamat
thisform.txttlp.value=telp
7) Prosedure No
select suplier
set order to kdsup
goto bottom
if kdsup=space(9)
mkdptgs="SPL-00001"
else
mno=val(right(kdsup,5))+1
do case
case mno<10
mkdptgs="SPL-0000"+ltrim(str(mno))
case mno<100
mkdptgs="SPL-000"+ltrim(str(mno))
case mno<1000
mkdptgs="SPL-00"+ltrim(str(mno))
case mno<10000
mkdptgs="SPL-0"+ltrim(str(mno))
case mno<100000
mkdptgs="SPL-"+ltrim(str(mno))
endcase
endif
thisform.tXTKDsup.value=mkdptgs
8) Prosedure Simpandata
replace Kdsup with thisform.txtkdsup.value
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
set delete on
thisform.matiisian()
thisform. grid1.refresh()
endif
select suplier
goto top
thisform.ambildata()
pack
endif
thisform.release()
Label1
Label2
Text1
Text2
Text5
Propertis
Nilai
Caption
Name
Auto Center
MDIForm
ShowWindows
Windowstate
Caption
Caption
Name
Maxlength
Name
Maxlength
Name
Maxlength
Command1
Command2
Command3
Command4
Command5
Command6
Cammand7
Command8
Command9
Command10
Grid1
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
ReadOnly
RecordSource
Baru
\<Baru
Simpan
\<Simpan
Batal
\<Batal
Rubah
\<Rubah
Hapus
\<Hapus
Atas
|<
Mundur
<
Maju
>
Bawah
>|
Cari
\<Cari
Grid1
.T.
jenis
2) Prosedure Hidupisian
thisform.txtkodejns.enabled=.t.
thisform.txtjenis.enabled=.t.
3) Prosedure Matitombol
thisform.baru.enabled=.f.
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
thisform.rubah.enabled=.f.
thisform.hapus.enabled=.f.
thisform.cari.enabled=.f.
thisform.keluar.enabled=.f.
thisform.maju.enabled=.f.
thisform.mundur.enabled=.f.
4) Prosedure Hiduptombol
thisform.baru.enabled=.t.
thisform.simpan.enabled=.t.
thisform.batal.enabled=.t.
thisform.rubah.enabled=.t.
thisform.hapus.enabled=.t.
thisform.cari.enabled=.t.
thisform.keluar.enabled=.t.
thisform.maju.enabled=.t.
thisform.mundur.enabled=.t.
5) Prosedure Bersihlayar
thisform.txtkodejns.value=" "
thisform. txtjenis.value=" "
6) Prosedure ambildata
thisform.txtkodejns.value=kdjns
thisform.txtjenis.value=jenis
7) Prosedure No
select jenis
set order to kdjns
goto bottom
if kdJNs=space(9)
mkdjns="KYP-00001"
else
mno=val(right(kdjns,5))+1
do case
case mno<10
mkdjns="KYP-0000"+ltrim(str(mno))
case mno<100
mkdjns="KYP-000"+ltrim(str(mno))
case mno<1000
mkdjns="KYP-00"+ltrim(str(mno))
case mno<10000
mkdjns="KYP-0"+ltrim(str(mno))
case mno<100000
mkdjns="KYP-"+ltrim(str(mno))
endcase
endif
thisform.tXTKODEJNS.value=mkdjns
8) Prosedure Simpandata
replace Kdjns with thisform.txtkodejns.value
replace jenis with thisform.txtjenis.value
else
thisform.bersihlayar()
thisform.matitombol()
thisform.baru.enabled=.t.
thisform.keluar.enabled=.t.
endif
thisform.matiisian()
thisform.txtcari.visible=.f.
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
else
thisform.bersihlayar()
thisform.matiisian()
thisform.baru.enabled=.t.
thisform.keluar.enabled=.t.
endif
thisform.matiisian()
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
thisform.txtcari.visible=.f.
Label1
Label2
Label3
Label4
Label5
Label6
Label7
Text1
Text2
Combo1
Text3
Propertis
Nilai
Caption
Name
Auto Center
MDIForm
ShowWindows
Windowstate
Caption
Caption
Caption
Caption
Caption
Caption
Caption
Name
Maxlength
Name
Maxlength
Name
RowSource
Name
Text4
Text5
Text6
Command1
Cammand2
Command3
Command4
Command5
Command6
Command7
Command7
Command8
Command9
Command10
Grid1
Name
Name
Name
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
ReadOnly
RecordSource
txthrgbeli
Txtjumlah
txtstokmin
Baru
\<Baru
Simpan
\<Simpan
Batal
\<Batal
Hapus
\<Hapus
Rubah
\<Rubah
Atas
|<
Mundur
<
Maju
>
Bawah
>|
Cari
\<Cari
Keluar
\<keluar
Grid1
.T.
barang
2) Prosedure Hidupisian
thisform.txtkodebrg.enabled=.t.
thisform.txtnama.enabled=.t.
thisform.txtkdjns.enabled=.t.
thisform.txtjumlah.enabled=.t.
thisform.txthrgjual.enabled=.t.
thisform.txthrgbeli.enabled=.t.
thisform.txtstokmin.enabled=.t.
3) Prosedure Matitombol
thisform.baru.enabled=.f.
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
thisform.rubah.enabled=.f.
thisform.hapus.enabled=.f.
thisform.cari.enabled=.f.
thisform.keluar.enabled=.f.
thisform.maju.enabled=.f.
thisform.mundur.enabled=.f.
4) Prosedure Hiduptombol
thisform.baru.enabled=.t.
thisform.simpan.enabled=.t.
thisform.batal.enabled=.t.
thisform.rubah.enabled=.t.
thisform.hapus.enabled=.t.
thisform.cari.enabled=.t.
thisform.keluar.enabled=.t.
thisform.maju.enabled=.t.
thisform.mundur.enabled=.t.
5) Prosedure Bersihlayar
thisform.txtkodebrg.value=" "
thisform.txtkdjns.value=" "
thisform.txtnama.value=" "
thisform.txtkdjns.value=" "
thisform.txtjumlah.value=0
thisform.txthrgjual.value=0
thisform.txthrgbeli.value=0
thisform.txtstokmin.value=0
6) Prosedure ambildata
select barang
thisform.txtkdkodebrg.value=kodebrg
thisform.txtnama.value=barang
thisform.txtkdjns.value=kdjns
thisform.txtjumlah.value=jmlstok
thisform.txthrgjual.value=hrgjual
thisform.txthrgbeli.value=hrgbeli
thisform.txtstokmin.value=stokmin
7) Prosedure No
select barang
set order to kodebrg
goto bottom
if kodebrg=space(9)
mkodebrg="KY-000001"
else
mno=val(right(kodebrg,6))+1
do case
case mno<10
mkodebrg="KY-00000"+ltrim(str(mno))
case mno<100
mkodebrg="KY-0000"+ltrim(str(mno))
case mno<1000
mkodebrg="KY-000"+ltrim(str(mno))
case mno<10000
mkodebrg="KY-00"+ltrim(str(mno))
case mno<100000
mkodebrg="KY-0"+ltrim(str(mno))
case mno<1000000
mkodebrg="KY-"+ltrim(str(mno))
endcase
endif
thisform.tXTKodebrg.value=mkodebrg
8) Prosedure Simpandata
replace Kodebrg with thisform.txtkodebrg.value
replace barang with thisform.txtnama.value
replace Kdjns with thisform.txtkdjns.value
replace hrgjual with thisform.txthrgjual.value
replace hrgbeli with thisform.txthrgbeli.value
replace jmlstok with thisform.txtstokmin.value
replace stokmin with thisform.txtstokmin.value
Thisform.no()
thisform. txtkodebrg.setfocus()
thisform.txtcari.visible=.t.
thisform.txtcari.setfocus()
A. PROPERTI OBJECT
Nama
Object
Form
Label1
Label2
Label3
Label4
Text1
Text2
Combo1
Combo2
Text4
Text3
Text5
Command1
Command2
Command3
Command4
Command5
Command6
Cammand7
Command8
Command9
Propertis
Nilai
Caption
Name
Auto Center
MDIForm
ShowWindows
Windowstate
Caption
Caption
Caption
Caption
Name
Maxlength
Name
Maxlength
Name
Name
Name
Name
Name
Maxlength
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Command10
Grid1
Name
Caption
Name
ReadOnly
RecordSource
Cari
\<Cari
Grid1
.T.
rincimsk
2) Prosedure Hidupisian
thisform.txttglmsk.enabled=.t.
thisform.txtkdptgs.enabled=.t.
thisform.txtnmptgs.enabled=.t.
thisform.txtkdsup.enabled=.t.
thisform.txtnmsup.enabled=.t.
3) Prosedure Matitombol
thisform.baru.enabled=.f.
thisform.simpan.enabled=.f.
thisform.batal.enabled=.f.
thisform.rubah.enabled=.f.
thisform.hapus.enabled=.f.
thisform.cari.enabled=.f.
thisform.keluar.enabled=.f.
thisform.maju.enabled=.f.
thisform.mundur.enabled=.f.
4) Prosedure Hiduptombol
thisform.baru.enabled=.t.
thisform.simpan.enabled=.t.
thisform.batal.enabled=.t.
thisform.rubah.enabled=.t.
thisform.hapus.enabled=.t.
thisform.cari.enabled=.t.
thisform.keluar.enabled=.t.
thisform.maju.enabled=.t.
thisform.mundur.enabled=.t.
5) Prosedure Bersihlayar
thisform.txtnonmsk.value=" "
thisform. txttglmsk.value=ctod("../../..")
thisform.txtkdptgs.value=" "
thisform. txtnmptgs.value=" "
thisform.txtkdsup.value=" "
thisform.txtnmsup.value=" "
6) Prosedure ambildata
select petugas
set filter to
set order to kdptgs
mkdptgs=thisform.txtkdptgs.value
seek mkdptgs
if found()
thisform.txtnmptgs.value=nmptgs
else
thisform.txtnmptgs.value=""
endif
select suplier
set filter to
set order to kdsup
mkdsup=thisform.txtkdsup.value
seek mkdsup
if found()
thisform.txtnmsup.value=nmsup
else
thisform.txtnmsup.value=""
endif
select masuk
thisform.txtnonmsk.value=nonmsk
thisform.txttglmsk.value=tglmsk
thisform.txtkdptgs.value=kdPTGS
thisform.txtkdsup.value=kdsup
7) Prosedure No
select masuk
set order to nonmsk
goto bottom
if nonmsk=space(10)
mnonmsk="MSK-000001"
else
mno=val(right(nonmsk,6))+1
do case
case mno<10
mnonmsk="MSK-00000"+ltrim(str(mno))
case mno<100
mnonmsk="MSK-0000"+ltrim(str(mno))
case mno<1000
mnonmsk="msk-000"+ltrim(str(mno))
case mno<10000
mnonmsk="MSK-00"+ltrim(str(mno))
case mno<100000
mnonmsk="MSK-0"+ltrim(str(mno))
case mno<1000000
mnonmsk="MSK-"+ltrim(str(mno))
endcase
endif
thisform.tXTnonmsk.value=mnonmsk
8) Prosedure Simpandata
replace nonmsk with thisform.txtnonmsk.value
replace kdptgs with thisform.txtkdptgs.value
thisform.batal.enabled=.f.
set delete on
thisform.matiisian()
thisform. grid1.refresh()
endif
qbersih=2
mnonmsk=thisform.txtnonmsk.value
mtglmsk=thisform.txttglmsk.value
mkdptgs=thisform.txtkdptgs.value
mkdsup=thisform.txtkdsup.value
if empty(mnonmsk).or. empty(mtglmsk)
messagebox("data harus diisi !",0+64,"info")
else
do form rincimasuk
endif
thisform.ambildata()
select masuk
delete all for nonmsk=cek
select rincimsk
endif
thisform.bersihlayar()
if .not. eof
skip
if eof()
goto bottom
endif
else
goto bottom
endif
thisform.grid1.refresh()
thisform.grid1.setfocus()
thisform.grid2.refresh()
thisform.ambildata()
thisform.release()
Propertis
Nilai
Caption
Name
Auto Center
MDIForm
ShowWindows
Windowstate
Label1
Combo1
Label3
Label4
Text1
Combo1
Text2
Text3
Text4
Text5
Command1
Command2
Command3
Command4
Command5
Command6
Cammand7
Command8
Command9
Command10
Grid1
Caption
Caption
Caption
Caption
Name
Maxlength
Name
Name
Maxlength
Name
Maxlength
Name
Name
Maxlength
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
Caption
Name
ReadOnly
RecordSource
No Nota Masuk
Kode Barang
Harga
Jumlah
txtnonmsk
10
TxtKdbrg
Txthrgmsk
10
Txtjumlah
10
Txtnmbarang
Txtcari
10
Baru
\<Baru
Simpan
\<Simpan
Batal
\<Batal
Rubah
\<Rubah
Hapus
\<Hapus
Atas
|<
Mundur
<
Maju
>
Bawah
>|
Cari
\<Cari
Grid1
.T.
rincimsk
3) Prosedure Ok Clik
balik=1
mkdbrg=thisform.txtkdbrg.value
mnonmsk=thisform.txtnonmsk.value
mjmlmsk=thisform.txtjmlmsk.value
mhrgmsk=thisform.txthrgmsk.value
select barang
set filter to
seek mkodebrg
if found()
replace jmlstok with jmlstok + mjmlmsk
replace hrgjual with mhrgmsk
endif
select rincimsk
set filter to
set order to nonmsk
locate for nonmsk=mnonmsk .and. kodebrg=mkdbrg
if found()
replace nonmsk with mnonmsk
replace jmlmsk with mjmlmsk
replace kodebrg with mkdbrg
replace hrgmsk with mhrgmsk
else
append blank
replace nonmsk with mnonmsk
replace jmlmsk with mjmlmsk
replace kodebrg with mkdbrg
replace hrgmsk with mhrgmsk
endif
thisform.txthrgmsk.value=0
thisform.txtjmlmsk.value=0
thisform.txtkdbrg.value=""
thisform.txtkdbrg.setfocus()
mkdbrg=thisform.txtkdbrg.value
select barang
set filter to
set order to kodebrg
seek mkdbrg
if found()
thisform.txtnmbarang.value=nmbarang
thisform.txthrgmsk.value=hrgbeli
else
thisform.txtnmbarang.value=""
thisform.txthrgmsk.value=0
endif