SCRIPT FORM T_JUAL/KASIR PADA PEMBROGRAMAN FOXPRO
Script untuk Form T_jual/Kasir.
1. Buatlah tabel bayangan t_jual2.dbf. isinya sama persis dengan t_jual
2. Panggil dari menu dengan perintah:
Select K
Use t_jual2
Form1 - active
WITH thisform
SELECT H && t_jual
Go Bottom
If eof()
mnom=1000000001
Else
mnom=val(right(nofaktur,9))+1000000001
Endif
cnom=alltrim(right(str(mnom),9))
.txtnofaktur.value=cnom
.txttanggal.value=DATE()
.txtkasir.value=”Agung”
.txtkdbrg.SetFocus
.refresh
ENDWITH
txtKdbrg-KeyPress:
LPARAMETERS nKeyCode, nShiftAltCtrl
WITH thisform
IF nkeycode=13
SELECT D && t_barang
GO top
if .not. seek(ALLTRIM(thisform.txtkdbrg.value))
pesan=messagebox("Kode Barang Tidak Ditemukan !!!",0+16,"Peringatan !")
.txtkdbrg.setfocus
return
endif
if empty(thisform.txtkdbrg.value)
thisform.daftar.setfocus
else
SELECT K && t_jual_2
APPEND BLANK
replace nofaktur WITH .txtNofaktur.value
replace tanggal WITH .txttanggal.value
replace kdbrg WITH d->kdbrg
replace nmbrg WITH d->nmbrg
replace satuan WITH d->satuan
replace hrgsat WITH d->hrgecer
replace kasir WITH mmpakai
.refresh
.grid1.column5.text1.value=1
replace subtotal WITH hrgsat * .grid1.column5.text1.value
endif
ENDIF
endwith
Grid1.column5.Header1.text1-KeyPress:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nkeycode=13
SELECT K && t_jual_2
WITH thisform
replace subtotal WITH hrgsat * .grid1.column5.text1.value
SUM ALL subtotal TO .txttot.value
SUM ALL subtotal TO .txttot1.value
.txtkdbrg.value=""
.txtkdbrg.setfocus
.Refresh
endwith
endif
Bayar - Click:
IF thisform.txttot.value=0
MESSAGEBOX("Tidak ada transaksi, cek kembali!",16,"Peringatan !")
RETURN
endif
thisform.txtbayar.setfocus
thisform.Refresh
txtbayar – InteractiveChange:
WITH thisform
.txtkembali.value= .txtbayar.value - .txttot.value
mTOT= .txttot.value
mBYR= .txtbayar.value
mKBL= .txtkembali.value
endwith
Cetak – Click:
WITH thisform
select I && t_jual_2
IF thisform.txtkembali.value<0
MESSAGEBOX("Pembayaran kurang, cek kembali!",16,"Peringatan !")
thisform.txtbayar.SetFocus
return
endif
* Simpan ke tabel jual
SELECT H && t_jual
GO top
append from t_jual_2
select I && t_jual_2
go top
do while .not.eof()
select I && t_jual_2
if delete()
skip
if eof()
exit
endif
endif
sele D && t_barang
locate for kdbrg=I->kdbrg
if .not. found()
skip
else
repl jmlstok with jmlstok-I->jml
endif
sele I
skip
enddo
* Cetak nota
select I && t_jual_2
REPORT FORM r_nota_A4 preview
ZAP
thisform.kosong
thisform.txtkdbrg.setfocus
thisform.refresh
endwith
SEMOGA BERMANFAAT
DATAKULIAH_PEMRORGAMAN_MANAJEMENINFORMATIKA
0 Komentar