You are on page 1of 2

cursorsetprop("buffering",5,"CurTBeli")

SELECT CurTBeli
SCAN
if ! dele() AND ! EMPTY(KODE)
a=thisformset.form1.txtfak.Value
b=thisformset.form1.txttgl.Value
c=CurTBeli.Kode
d=CurTBeli.Hbeli
e=CurTBeli.Qty
f=CurTBeli.Disc
f1=CurTBeli.Disc1
f2=CurTBeli.Disc2
f3=CurTBeli.Disc3
g=CurTBeli.nourut
h=CurTBeli.nourutpo
i=CurTBeli.stockpk
j=CurTBeli.faktor
k=CurTBeli.unitpk
oNettosat=CurTBeli.nilnetto
oPpnsat=CurTBeli.nilpajak
l=oNettosat+oPpnsat
m=CurTBeli.qty1
n=CurTBeli.qty*CurTBeli.faktor
o=CurTBeli.sn
p=CurTBeli.nourut1
SqlExec(Koneksi,"Select * from kBarangDetail where faktur=?a and kode=?c an
d stockpk=?i and pk1=?p","tmpkBarangDetail")
IF reccount("tmpkBarangDetail")<1
strSQL="INSERT INTO kBarangDetail (Faktur,Kode,Harga,Qtyin,Disc,Disc1,Di
sc2,Disc3,pk,pkpo,stockpk,faktor,unitpk,netto,tipe,qty1,Qtydin,Qtyout,Qtydout,sn
,qtysisa,pk1,adjust) VALUES (?a,?c,?d,?e,?f,?f1,?f2,?f3,?g,?h,?i,?j,?k,?l,'B',?m
,?n,0,0,?o,?n,?p,?n)"
IF SQLEXEC(koneksi,strSQL)<=0 then
MESSAGEBOX("Query INSERT kBarangDetail Gagal dieksekusi",0+64,"In
formasi")
RETURN
ENDIF
ELSE
strSQL="UPDATE kBarangDetail SET qtysisa=qtysisa+?n,qtyin=?e,Qtydin=?n,h
arga=?d,disc=?f,disc1=?f1,disc2=?f2,disc3=?f3,faktor=?j,unitpk=?k,netto=?l,qty1=
?m,sn=?o where faktur=?a and kode=?c and stockpk=?i and pk1=?p"
IF SQLEXEC(koneksi,strSQL)<=0 then
MESSAGEBOX("Query UPDATE kBarangDetail Gagal dieksekusi",0+64,"Info")
RETURN
ENDIF
ENDIF
ENDIF
SELECT CurTBeli
ENDSCAN
*** proses simpan:
begin transaction
oklanjut = tableupdate(.T.,.T.,"tb1") and tableupdate(.T.,.T.,"tb2") and tableup
date(.T.,.T.,"tb3")
if oklanjut
flush

end transaction
else
rollback
tablerevert("CurTBeli")
endif
messagebox(iif(oklanjut,"ok","gagal")) && sewaktu terjadi error apabila dilanjut
kan maka messagebox tetap ok bukan gagal

You might also like