Minggu, 05 Desember 2010

listing foxpro

Listning Program Form About
Timer1
Timer
local mulai
mulai=0
if mulai
mulai=thisform.label14.height
else
mulai=mulai+40
endif
if thisform.label14.fontsize>20
thisform.label14.fontsize=10
else
thisform.label14.fontsize=thisform.label14.fontsize+1
endif

Timer2 Timer
if thisform.label15.visible=.t. then
thisform.label15.visible=.f.
else
if thisform.label15.visible=.f. then
thisform.label15.visible=.t.
endif
endif

Command1 Click
thisform.Release

Listning Program Form Anggota
Form1 aktif
thisform.txtnm_anggota.Enabled= .T.
thisform.optjns_kelamin.Enabled= .T.
thisform.ealamat.Enabled= .T.
thisform.txtno_telp.Enabled= .T.
thisform.txttgl_gabung.Enabled= .T.

Form1 nonaktif
thisform.txtnm_anggota.Enabled= .F.
thisform.optjns_kelamin.Enabled= .F.
thisform.ealamat.Enabled= .F.
thisform.txtno_telp.Enabled= .F.
thisform.txttgl_gabung.Enabled= .F.

Form1 bersih
thisform.txtkd_anggota.Value=""
thisform.txtnm_anggota.Value=""
thisform.optjns_kelamin.Value=0
thisform.ealamat.Value=""
thisform.txtno_telp.Value=""
thisform.txttgl_gabung.Value={}

Form1 Load
SET DEFAULT TO c:\pagi\11.5A.12.C\Sewa
USE master_anggota
SET ORDER TO tag kd_anggota
PUBLIC isi,lcgambar
SET DATE ITALIAN

Form1 Activate
thisform.nonaktif
thisform.bersih
thisform.txtkd_anggota.Enabled= .F.
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.AutoCenter= .T.
thisform.Caption="Form Anggota Rental"+SPACE(100)

Form1 simpan
replace kd_anggota WITH thisform.txtkd_anggota.Value
replace nm_anggota WITH thisform.txtnm_anggota.Value
IF thisform.optjns_kelamin.opl.Value=1 then
thisform.optjns_kelamin.opp.Value=0
replace jns_kelamin WITH thisform.optjns_kelamin.opl.Caption
ELSE
IF thisform.optjns_kelamin.opp.Value=1 then
thisform.optjns_kelamin.opl.Value=0
replace jns_kelamin WITH thisform.optjns_kelamin.opp.Caption
ENDIF
ENDIF
replace alamat WITH thisform.ealamat.Value
replace no_telp WITH thisform.txtno_telp.Value
replace tgl_gabung WITH thisform.txttgl_gabung.Value
thisform.grid1.Refresh

Form1 tampil
thisform.txtkd_anggota.Value=master_anggota.kd_anggota
thisform.txtnm_anggota.Value=master_anggota.nm_anggota
IF master_anggota.jns_kelamin="Laki-laki" then
thisform.optjns_kelamin.opl.Value=1
thisform.optjns_kelamin.opp.Value=0
ELSE
IF master_anggota.jns_kelamin="Perempuan" then
thisform.optjns_kelamin.opl.Value=0
thisform.optjns_kelamin.opp.Value=1
ENDIF
endif
thisform.ealamat.Value=master_anggota.alamat
thisform.txtno_telp.Value=master_anggota.no_telp
thisform.txttgl_gabung.Value=master_anggota.tgl_gabung

cmdfind Click
SET ORDER TO tag kd_anggota
IF SEEK(ALLTRIM(thisform.txtcari.Value))
thisform.tampil
thisform.cmdedit.Enabled= .T.
thisform.cmddelete.Enabled= .T.
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdadd.Enabled= .T.
ELSE
MESSAGEBOX("Data Tidak Ada!!!",64,"INFO")
thisform.txtcari.SetFocus
ENDIF
thisform.txtcari.Value=""
thisform.Refresh

cmdadd Click
isi=.t.
thisform.aktif
thisform.bersih
GO bottom
urut=INT(VAL(RIGHT(master_anggota.kd_anggota,4))+1)
urut= REPLICATE("0",+4-LEN(LTRIM(STR(urut))))+LTRIM(STR(urut))
thisform.txtkd_anggota.Value="P"+urut
thisform.cmdsave.Enabled= .T.
thisform.cmdcancel.Enabled= .T.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .F.
thisform.txtkd_anggota.Enabled= .T.
thisform.txtnm_anggota.SetFocus
thisform.Refresh

cmdcancel Click
thisform.bersih
thisform.nonaktif
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.Refresh

cmdedit Click
isi=.f.
thisform.aktif
thisform.cmdsave.Enabled= .T.
thisform.cmdcancel.Enabled= .T.
thisform.cmddelete.Enabled= .F.

cmddelete Click
hapus=MESSAGEBOX("Data Anggota dengan Kode Anggota" + thisform.txtkd_anggota.Value+"ingin dihapus?",36,"INFO")
IF hapus=6 then
DELETE
PACK
ENDIF
thisform.bersih
thisform.cmddelete.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmdadd.Enabled= .T.

cmdclose Click
keluar=MESSAGEBOX("Yakin Mau Keluar Dari Form Input Data Anggota?",36,"INFO")
IF keluar=6 then
thisform.Release
ENDIF

cmdtop Click
GO top
thisform.tampil
thisform.Refresh

cmdback Click
skip-1
IF BOF()
MESSAGEBOX("Sudah Diawal Record!!!",16,"INFO")
GO top
ENDIF
thisform.tampil
thisform.Refresh

cmdnext Click
SKIP
IF EOF()
MESSAGEBOX("Sudah Diakhir Recor!!!",16,"INFO")
GO bottom
ENDIF
thisform.tampil
thisform.Refresh

cmdlast Click
GO bottom
thisform.tampil
thisform.Refresh

cmdsave Click
if EMPTY(thisform.txtnm_anggota.Value)
MESSAGEBOX("Nama Anggota Harus Diisi!!!",48,"PESAN")
thisform.txtnm_anggota.SetFocus
RETURN
ENDIF
if thisform.optjns_kelamin.Value=0
MESSAGEBOX("Jenis Kelamin Harus Dipilih!!!",48,"PESAN")
RETURN
ENDIF
if EMPTY(thisform.ealamat.Value)
MESSAGEBOX("Alamat Anggota Harus Diisi!!!",48,"PESAN")
thisform.ealamat.SetFocus
RETURN
ENDIF
if EMPTY(thisform.txtno_telp.Value)
MESSAGEBOX("No Telepon Anggota Harus Diisi!!!",48,"PESAN")
thisform.txtno_telp.SetFocus
RETURN
ENDIF
if EMPTY(thisform.txttgl_gabung.Value)
MESSAGEBOX("Tanggal Gabung Anggota Harus Diisi!!!",48,"PESAN")
thisform.txttgl_gabung.SetFocus
RETURN
ENDIF
IF isi=.t. THEN
APPEND BLANK
thisform.simpan
MESSAGEBOX("Data Telah Tersimpan Dalam Database",64,"INFO")
ELSE
IF isi=.f. THEN
thisform.simpan
MESSAGEBOX("Data Telah Terupdate Dalam Database",64,"INFO")
ENDIF
ENDIF
thisform.nonaktif
thisform.bersih
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.grid1.Refresh

Listning Program Form Cetak Kartu Anggota
Form1 Load
SET DEFAULT TO c:\pagi\11.5a.12.c\sewa
USE master_anggota
SET ORDER TO tag kd_anggota

cbokd_anggota Click
thisform.txtnm_anggota.Value=master_anggota.nm_anggota
thisform.Refresh

cbokd_anggota LostFocus
thisform.txtnm_anggota.Value=master_anggota.nm_anggota
thisform.cmdcetak.SetFocus
thisform.Refresh

cmdcetak Click
SET DEFAULT TO c:\pagi\11.5a.12.c\sewa
SELECT master_anggota
IF thisform.optcetak.option1.Value=1
REPORT FORM c:\pagi\11.5a.12.c\sewa\cetak_kartu_anggota.frx PREVIEW
ELSE
REPORT FORM c:\pagi\11.5a.12.c\sewa\cetak_kartu_anggota.frx TO PRINTER prompt
ENDIF

cmdkeluar Click
thisform.Release

Timer1 Timer
local mulai
mulai=0
if mulai
mulai=thisform.label2.height
else
mulai=mulai+40
endif
if thisform.label2.fontsize>20
thisform.label2.fontsize=10
else
thisform.label2.fontsize=thisform.label2.fontsize+1
endif

Timer2 Timer
if thisform.label3.visible=.t. then
thisform.label3.visible=.f.
else
if thisform.label3.visible=.f. then
thisform.label3.visible=.t.
endif
endif

Listning Program Form Cetak Transaksi Sewa
Form1 Load
SET DEFAULT TO c:\pagi\11.5A.12.C\sewa
USE transaksi_sewa
SET ORDER TO tag no_sewa

Timer1 Timer
local mulai
mulai=0
if mulai
mulai=thisform.label2.height
else
mulai=mulai+40
endif
if thisform.label2.fontsize>20
thisform.label2.fontsize=10
else
thisform.label2.fontsize=thisform.label2.fontsize+1
endif

Timer2 Timer
if thisform.label3.visible=.t. then
thisform.label3.visible=.f.
else
if thisform.label3.visible=.f. then
thisform.label3.visible=.t.
endif
endif

cbono_sewa Click
thisform.txttgl_sewa.Value=transaksi_sewa.tgl_sewa
thisform.Refresh

cbono_sewa LostFocus
thisform.Txttgl_sewa.Value=transaksi_sewa.tgl_sewa
thisform.cmdcetak.SetFocus
thisform.Refresh

cmdcetak Click
SET DEFAULT TO c:\pagi\11.5A.12.C\sewa
SELECT transaksi_sewa
IF thisform.optcetak.optlayar.Value=1
REPORT FORM c:\pagi\11.5a.12.c\sewa\cetak_transaksi_sewa.frx PREVIEW
ELSE
REPORT FORM c:\pagi\11.5a.12.c\sewa\cetak_transaksi_sewa.frx TO PRINTER prompt
ENDIF

cmdkeluar Click
thisform.Release

Listning Program dvd
Timer1 Timer
local mulai
mulai=0
if mulai
mulai=thisform.label1.height
else
mulai=mulai+40
endif
if thisform.label1.fontsize>20
thisform.label1.fontsize=10
else
thisform.label1.fontsize=thisform.label2.fontsize+1
endif

Timer2 Timer
if thisform.label11.visible=.t. then
thisform.label11.visible=.f.
else
if thisform.label11.visible=.f. then
thisform.label11.visible=.t.
endif
endif

Form1 aktif
thisform.txtjdl_film.Enabled= .T.
thisform.cjns_film.Enabled= .T.
thisform.txthrg_sewa.Enabled= .T.
thisform.txtstok.Enabled= .T.

Form1 nonaktif
thisform.txtjdl_film.Enabled= .F.
thisform.cjns_film.Enabled= .F.
thisform.txthrg_sewa.Enabled= .F.
thisform.txtstok.Enabled= .F.

Form1 bersih
thisform.txtkd_dvd.Value=""
thisform.txtjdl_film.Value=""
thisform.cjns_film.Value=""
thisform.txthrg_sewa.Value=0
thisform.txtstok.Value=0

Form1 Load
SET DEFAULT to c:\pagi\11.5A.12.C\sewa
USE master_dvd
SET ORDER TO tag kd_dvd
PUBLIC no
PUBLIC isi
SET DATE ITALIAN

Form1 Activate
thisform.nonaktif
thisform.bersih
thisform.txtkd_dvd.Enabled= .F.
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.AutoCenter= .T.
thisform.Caption="Form Data DVD"+ SPACE(100)

Form1 simpan
replace kd_dvd WITH thisform.txtkd_dvd.Value
replace jdl_film WITH thisform.txtjdl_film.Value
replace jns_film WITH thisform.cjns_film.Value
replace hrg_sewa WITH thisform.txthrg_sewa.Value
replace stok WITH thisform.txtstok.Value
thisform.grid1.Refresh

Form1 tampil
thisform.txtkd_dvd.Value=master_dvd.kd_dvd
thisform.txtjdl_film.Value=master_dvd.jdl_film
thisform.cjns_film.Value=master_dvd.jns_film
thisform.txthrg_sewa.Value=master_dvd.hrg_sewa
thisform.txtstok.Value=master_dvd.stok

Form1 urut
no=INT(VAL(RIGHT(master_dvd.kd_dvd,4))+1)
no=REPLICATE("0",+4-LEN(LTRIM(STR(no))))+LTRIM(STR(no))

cmdfind Click
SET ORDER TO tag kd_dvd
IF SEEK(ALLTRIM(thisform.txtcari.Value))
thisform.tampil
thisform.cmdedit.Enabled= .T.
thisform.cmddelete.Enabled= .T.
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdadd.Enabled= .T.
ELSE
MESSAGEBOX("Data Tida Ada!!!",64,"INFO")
thisform.txtcari.SetFocus
ENDIF
thisform.txtcari.Value=""
thisform.Refresh

cmdadd Click
isi=.t.
thisform.aktif
thisform.bersih
thisform.cmdcancel.Enabled= .T.
thisform.cmdsave.Enabled= .T.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .F.
thisform.cjns_film.SetFocus

cmdcancel Click
thisform.bersih
thisform.nonaktif
thisform.cmdcancel.Enabled= .F.
thisform.cmdsave.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.Refresh

cmdedit Click
isi=.f.
thisform.aktif
thisform.cjns_film.Enabled= .F.
thisform.cmdcancel.Enabled= .T.
thisform.cmdsave.Enabled= .T.
thisform.cmddelete.Enabled= .F.

cmddelete Click
hapus=MESSAGEBOX("Data Mau Dihapus???",36,"INFO")
IF hapus=6 then
DELETE
PACK
ENDIF
thisform.bersih
thisform.cmddelete.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmdadd.Enabled= .T.

cmdclose Click
keluar=MESSAGEBOX("Yakin Mau Keluar Dari Form Data DVD???",36,"INFO")
IF keluar=6 then
thisform.Release
ENDIF

cmdtop Click
GO top
thisform.tampil
thisform.Refresh

cmdback Click
skip-1
IF BOF()
MESSAGEBOX("Sudah Diawal Record!!!",16,"INFO")
GO top
ENDIF
thisform.tampil
thisform.Refresh

cmdnext Click
SKIP
IF EOF()
MESSAGEBOX("Sudah Diakhir Recor!!!",16,"INFO")
GO bottom
ENDIF
thisform.tampil
thisform.Refresh

cmdlast Click
GO bottom
thisform.tampil
thisform.Refresh

cmdsave Click
if EMPTY(thisform.cjns_film.Value)
MESSAGEBOX("Jenis Film Harus Dipilih!!!",48,"WARNING")
thisform.cjns_film.SetFocus
RETURN
ENDIF
if EMPTY(thisform.txtjdl_film.Value)
MESSAGEBOX("Judul Film Harus Diisi!!!",48,"WARNING")
thisform.txtjdl_film.SetFocus
RETURN
ENDIF
if EMPTY(thisform.txthrg_sewa.Value)
MESSAGEBOX("Harga Sewa Harus Diisi!!!",48,"WARNING")
thisform.txthrg_sewa.SetFocus
RETURN
ENDIF
if EMPTY(thisform.txtstok.Value)
MESSAGEBOX("Stok Film Harus Diisi!!!",48,"WARNING")
thisform.txtstok.SetFocus
RETURN
ENDIF
IF isi=.t. then
APPEND BLANK
thisform.simpan
MESSAGEBOX("Data Telah Tersimpan",64,"INFO")
ELSE
IF isi=.f. then
thisform.simpan
MESSAGEBOX("Data Telah Terupdate",64,"INFO")
ENDIF
ENDIF
thisform.nonaktif
thisform.bersih
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .F.
thisform.cmdedit.Enabled= .F.
thisform.cmddelete.Enabled= .F.
thisform.cmdadd.Enabled= .T.
thisform.grid1.Refresh

cjns_film Click
IF thisform.cjns_film.Value="Action" then
SEEK ALLTRIM("A")
thisform.urut
thisform.txtkd_dvd.Value="A"+no
ELSE
IF thisform.cjns_film.Value="Drama" then
SEEK ALLTRIM("D")
thisform.urut
thisform.txtkd_dvd.Value="D"+no
ELSE
IF thisform.cjns_film.Value="Horor" then
SEEK ALLTRIM("H")
thisform.urut
thisform.txtkd_dvd.Value="H"+no
ELSE
IF thisform.cjns_film.Value="Kartun" then
SEEK ALLTRIM("K")
thisform.urut
thisform.txtkd_dvd.Value="K"+no
ELSE
IF thisform.cjns_film.Value="Komedi" then
SEEK ALLTRIM("F")
thisform.urut
thisform.txtkd_dvd.Value="F"+no
ELSE
IF thisform.cjns_film.Value="Religi" then
SEEK ALLTRIM("R")
thisform.urut
thisform.txtkd_dvd.Value="R"+no
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF

Listning Program Form Login
Form1 Activate
thisform.txtID.Value=""
thisform.txtpaSSWORD.Value=""

Form1 Load
SET DEFAULT TO c:\pagi\11.5a.12.c\sewa
USE user
SET ORDER TO tag id

Timer1 Timer
LOCAL x
x=thisform.proseS.value
IF x
thisform.proSES.value=1+thisform.proSES.value
ELSE
MESSAGEBOX("YupZZ Username & Password Anda Benar")
thisform.timer1.Enabled= .F.
THISFORM.Release
DO FORM "c:\pagi\11.5a.12.a\sewa\menu_utama.scx"
ENDIF

Timer2 Timer
local mulai
mulai=0
if mulai
mulai=thisform.label3.height
else
mulai=mulai+40
endif
if thisform.label3.fontsize>20
thisform.label3.fontsize=10
else
thisform.label3.fontsize=thisform.label3.fontsize+1
endif

Timer3 Timer
if thisform.label4.visible=.t. then
thisform.label4.visible=.f.
else
if thisform.label4.visible=.f. then
thisform.label4.visible=.t.
endif
endif

txtid LostFocus
SET ORDER TO tag id
IF SEEK(ALLTRIM(thisform.txtiD.Value))then
IF ALLTRIM(thisform.txtiD.Value)=ALLTRIM(user.id)then
thisform.txtid.BackColor=RGB(0,255,255)
thisform.txtpASSWORD.SetFocus
ELSE
thisform.txtiD.BackColor=RGB(0,255,0)
ENDIF
RETURN
ENDIF

txtpassword LostFocus
SET ORDER TO tag id
IF SEEK(ALLTRIM(thisform.txtiD.Value))then
IF ALLTRIM(thisform.txtiD.Value)=ALLTRIM(user.id)and ALLTRIM(thisform.txtpASSWORD.Value)=ALLTRIM(user.password)then
thisform.txtpASSWORD.BackColor=RGB(0,255,255)
thisform.timer1.Enabled= .T.
ELSE
MESSAGEBOX("Maaf Username dan Password Anda salah",16,"INFO")
thisform.Activate
ENDIF
RETURN
ENDIF

Listning Program Form Transaksi
Timer1 Timer
thisform.txtjam.Value=TIME()

Timer2 Timer
LOCAL MULAI
MULAI=0
IF MULAI
MULAI=THISFORM.LABEL1.Height
ELSE
MULAI=MULAI+40
ENDIF
IF THISFORM.LABEL1.FontSize>20
THISFORM.LABEL1.FontSize=10
ELSE
THISFORM.LABEL1.FontSize=THISFORM.LABEL1.FONTSIZE+1
ENDIF

Timer3 Timer
if thisform.label2.visible=.t. then
thisform.label2.visible=.f.
else
if thisform.label2.visible=.f. then
thisform.label2.visible=.t.
endif
endif

Form1 aktif
thisform.txtno_sewa.Enabled= .T.
thisform.olesewa.Enabled= .T.
thisform.txttgl_kembali.Enabled= .T.
thisform.ckd_anggota.Enabled= .T.
thisform.txtnm_anggota.Enabled= .T.
thisform.ealamat.Enabled= .T.
thisform.ckd_dvd.Enabled= .T.
thisform.txtjdl_film.Enabled= .T.
thisform.txthrg_sewa.Enabled= .T.
thisform.txtqty.Enabled= .T.
THISFORM.txtstok.Enabled= .T.
thisform.txtbayar.Enabled= .T.
thisform.txttotal.Enabled= .T.
thisform.txtuang_bayar.Enabled= .T.
thisform.txtuang_kembali.Enabled= .T.

Form1 nonaktif
thisform.txtno_sewa.Enabled= .F.
thisform.olesewa.Enabled= .F.
thisform.txttgl_kembali.Enabled= .F.
thisform.ckd_anggota.Enabled= .F.
thisform.txtnm_anggota.Enabled= .F.
thisform.ealamat.Enabled= .F.
thisform.ckd_dvd.Enabled= .F.
thisform.txtjdl_film.Enabled= .F.
thisform.txthrg_sewa.Enabled= .F.
thisform.txtqty.Enabled= .F.
THISFORM.txtstok.Enabled= .F.
thisform.txtbayar.Enabled= .F.
thisform.txttotal.Enabled= .F.
thisform.txtuang_bayar.Enabled= .F.
thisform.txtuang_kembali.Enabled= .F.

Form1 bersih
thisform.txtno_sewa.Value=""
thisform.ckd_anggota.Value=""
thisform.txttgl_kembali.Value={}
thisform.txtnm_anggota.Value=""
thisform.ealamat.Value=""
thisform.ckd_dvd.Value=""
thisform.txtjdl_film.Value=""
thisform.txthrg_sewa.Value=0
thisform.txtqty.Value=0
THISFORM.txtstok.Value=0
thisform.txtbayar.Value=0
thisform.txttotal.Value=0
thisform.txtuang_bayar.Value=0
thisform.txtuang_kembali.Value=0

Form1 Load
SET DATE ITALIAN
SET DEFAULT TO c:\pagi\11.5A.12.C\sewa
CLOSE ALL
SELECT 1
USE master_anggota
SET ORDER TO tag kd_anggota
SELECT 2
USE master_dvd
SET ORDER TO tag kd_dvd
SELECT 3
USE transaksi_sewa
SET ORDER TO tag no_sewa
SELECT 4
USE sementara.dbf
SELECT 5
USE detail_transaksi_sewa
SET RELATION TO kd_dvd INTO master_dvd
SET RELATION TO no_sewa INTO transaksi_sewa additive
SELECT 3
SET RELATION TO kd_anggota INTO master_anggota additive
SELECT 4
USE sementara
SELECT 4
DELETE ALL
PACK
PUBLIC URUT
PUBLIC isi
isi=.t.

Form1 Activate
SELECT 4
DELETE ALL
PACK
thisform.olesewa._Value=_diarydate
thisform.cmdsave.Enabled= .F.
thisform.cmdcancel.Enabled= .T.
thisform.cmdlagi.Enabled= .F.
thisform.nonaktif
thisform.griddetail_sewa
thisform.bersih
THISFORM.URut
thisform.Refresh
PUBLIC isi
isi=.t.

Form1 griddetailsewa
thisform.grid1.RecordSource="sementara"
thisform.grid1.Column1.controlsource="kd_dvd"
thisform.grid1.Column2.controlsource="jdl_film"
thisform.grid1.Column3.controlsource="hrg_sewa"
thisform.grid1.Column4.controlsource="qty"
thisform.grid1.Column5.controlsource="bayar"
thisform.grid1.column1.width=100
thisform.grid1.column2.width=200
thisform.grid1.column3.width=100
thisform.grid1.column4.width=100
thisform.grid1.column5.width=100
thisform.grid1.column1.header1.alignment=2
thisform.grid1.column2.header1.alignment=2
thisform.grid1.column3.header1.alignment=2
thisform.grid1.column4.header1.alignment=2
thisform.grid1.column5.header1.alignment=2
thisform.grid1.column1.header1.caption="Kode DVD"
thisform.grid1.column2.header1.caption="Judul Film"
thisform.grid1.column3.header1.caption="Harga Sewa"
thisform.grid1.column4.header1.caption="Qty"
thisform.grid1.column5.header1.caption="Harga Bayar"
GO top
thisform.grid1.Refresh
thisform.Refresh

Form hitung
PUBLIC mtotal
mtotal=0
GO top
skip-1
DO WHILE .not. EOF()
mtotal=mtotal+bayar
SKIP
ENDDO
thisform.txttotal.Value=mtotal
SELECT 4
replace total WITH thisform.txttotal.Value

Form1 urut
THISFORM.Refresh
SELECT 3
GO BOTTOM
urut=INT(VAL(RIGHT(transaksi_sewa.no_sewa,4))+1)
urut= REPLICATE("0",+4-LEN(LTRIM(STR(urut))))+LTRIM(STR(urut))
bulan=LTRIM(REPLICATE("0",+2-LEN(LTRIM(STR(MONTH(DATE()))))))+LTRIM(STR(MONTH(DATE())))
tahun=LTRIM(RIGHT(STR(YEAR(DATE())),2))
thisform.txtno_sewa.Value="TS"+tahun+bulan+urut

cmdlagi Click
SELECT 4
APPEND BLANK
replace no_sewa WITH thisform.txtno_sewa.Value
replace kd_dvd WITH thisform.ckd_dvd.Value
replace jdl_film WITH thisform.txtjdl_film.Value
replace hrg_sewa WITH thisform.txthrg_sewa.Value
replace bayar WITH thisform.txtbayar.Value
replace qty WITH thisform.txtqty.Value
replace kd_anggota WITH thisform.ckd_anggota.Value
replace nm_anggota WITH thisform.txtnm_anggota.Value
replace total WITH thisform.txtbantuan.Value+thisform.txtbayar.Value
thisform.Refresh
thisform.ckd_dvd.Value=""
thisform.txtjdl_film.Value=""
thisform.txthrg_sewa.Value=0
thisform.txtstok.Value=0
thisform.txtqty.Value=0
thisform.txtbayar.Value=0
thisform.txtqty.Enabled= .F.
thisform.cmdlagi.Enabled= .T.
thisform.cmdsave.Enabled= .T.
thisform.txtuang_bayar.Enabled= .T.
thisform.txtuang_kembali.Enabled= .F.
thisform.hitung
thisform.txtuang_bayar.SetFocus
thisform.Refresh

cmdadd Click
thisform.urut
thisform.aktif
thisform.cmdcancel.Enabled= .T.
thisform.ckd_anggota.SetFocus
thisform.Refresh

cmdcancel Click
thisform.bersih
SELECT 4
DELETE ALL
PACK
thisform.nonaktif
thisform.txtno_sewa.Enabled= .T.
thisform.griddetail_sewa
thisform.txtno_sewa.Value=""
thisform.ckd_anggota.Value=""
thisform.txtnm_anggota.Value=""
thisform.txtno_sewa.SetFocus
thisform.cmdcancel.Enabled= .T.
thisform.cmdsave.Enabled= .F.
thisform.cmdlagi.Enabled= .F.
thisform.cmdadd.Visible= .T.

ckd_anggota Click
thisform.txtnm_anggota.Value=master_anggota.nm_anggota
thisform.ealamat.Value=master_anggota.alamat
thisform.ckd_anggota.Enabled= .T.
thisform.ckd_anggota.SetFocus
thisform.cmdsave.Enabled= .T.

ckd_dvd Click
thisform.txtjdl_film.Value=master_dvd.jdl_film
thisform.txthrg_sewa.Value=master_dvd.hrg_sewa
thisform.txtstok.Value=master_dvd.stok
thisform.txtqty.Enabled= .T.
thisform.txtqty.SetFocus
thisform.cmdlagi.Enabled= .T.

cmdclose Click
keluar=MESSAGEBOX("Ingin keluar FORM TRANSAKSI SEWA DVD???",36,"INFO")
IF keluar=6 then
thisform.Release
ENDIF

txtqty LostFocus
vqty=thisform.txtqty.Value
vharga=thisform.txthrg_sewa.Value
thisform.txtbayar.Value=vqty*vharga
thisform.cmdlagi.Enabled= .T.
thisform.cmdsave.Enabled= .T.
thisform.txtstok.Value=thisform.txtstok.Value-thisform.txtqty.Value
thisform.txtbantuan.Value=sementara.total

txtbayar InteractiveChange
thisform.txtuang_kembali.Value=thisform.txtuang_bayar.Value-thisform.txttotal.Value

cmdsave Click
SELECT 4
IF RECCOUNT()<=0 then
MESSAGEBOX("Data DVD harus diisi !!!",0,"PESAN")
thisform.ckd_dvd.SetFocus
RETURN
ELSE
SELECT 3
APPEND BLANK
replace no_sewa WITH thisform.txtno_sewa.Value
replace tgl_sewa WITH thisform.olesewa._Value
replace tgl_kembali WITH thisform.txttgl_kembali.Value
replace kd_anggota WITH thisform.ckd_anggota.Value
SELECT 4
GO top
DO WHILE .not. EOF()
SELECT 5
APPEND BLANK
replace no_sewa WITH sementara.no_sewa
replace kd_dvd WITH sementara.kd_dvd
replace qty WITH sementara.qty
replace bayar with sementara.bayar
SELECT 4
SKIP
ENDDO
DELETE ALL
PACK
thisform.bersih
thisform.ckd_anggota.Enabled= .T.
thisform.ckd_dvd.Enabled= .F.
thisform.txtqty.Enabled= .F.
thisform.ckd_dvd.SetFocus
thisform.cmdcancel.Enabled= .F.
thisform.cmdsave.Enabled= .F.
thisform.nonaktif
thisform.bersih
thisform.cmdsave.SetFocus
thisform.Refresh
ENDIF
thisform.griddetail_sewa

Listning Program1.prg
SET TALK OFF
SET DELETED ON
SET DATE ITALIAN
SET CENTURY ON
SET SAFETY OFF
SET STATUS OFF
SET STATUS BAR ON
SET SYSMENU OFF
DO FORM C:\pagi\11.5a.12.c\sewa\frm_login.scx
READ events

Listning Program Menu Utama
Form1 Load
SET DEFAULT TO c:\pagi\11.5a.12.c\sewa

Form1 Activate
CLOSE all

Form1 Destroy
CLEAR EVENTS

Form1 Init
DO menu1.mpr WITH this,.t.