Hello, Im attaching a part of my code that seems to function
abnormally. I initiated cursorsetprop on my POSDetail table
(optimistic table buffering). I have to add the first record BUT
before i issue a TABLEREVERT or TABLEUPDATE, I have get some records
from another table. Those records need to get checked if there's an
actual onstock. If one of those records did not have enough stock, it
will actually TABLEREVERT all the records added, so it will return to
original form as if nothing was added. For some reason, it didnt
wanna revert all the records. Records that were already added stayed
in the table as if i had initiated a tableupdate which i did not.
If i issue a CURSORGETPROP(), will that function hold true for as long
as i didnt issue a tablerevert or tableupdate? or if i move from one
table to another and do some select statements in between the
CURSORGETPROP and TABLEUPDATE/TABLEREVERT, will it lose its state?
please help me out.
thanks.
select posdetail
=CURSORSETPROP("Buffering",5,"posdetail")
APPEND BLANK
replace detailno with lnNewId
replace transactno with lcTransactno
replace productid with lcProductID
replace quantity with thisform.txtqty.value
replace discount WITH thisform.txtdiscount.value
replace itemsales with thisform.txtsales.value
REPLACE itemcost WITH lcCost
replace nettotal with lcNetCost
replace grosstotal with lcGrossCost
bChkStock = .T.
IF thisform.bokits.Value THEN
SELECT bo_kitsku,bo_sku,bo_qty,bo_display FROM bokits ;
WHERE bo_kitsku = thisform.txtskucode.Value ;
INTO CURSOR botemp
SELECT botemp
GO TOP
nId = lnNewid
SCAN WHILE NOT EOF()
IF SEEK(botemp.bo_sku,"product","skucode")
IF product.onstock < 1 or THEN
=MESSAGEBOX(ALLTRIM(product.productname)+" does not have enough
stock!",0+16)
lbChkstock = .F.
EXIT
ELSE
lcProductid = product.productid
nId = nId + 1
INSERT INTO posdetail(detailno,transactno, productid, quantity,;
mod_user,mod_date,locationid) ;
VALUES (nId,lcTransactno, lcProductID,
botemp.bo_qty*thisform.txtqty.value, ;
goprogram.cusername, DATE(), VAL(goprogram.cregion_code))
ENDIF
ENDIF
SELECT botemp
ENDSCAN
USE IN botemp
ENDIF
SELECT posdetail
IF bChkStock THEN
=TABLEUPDATE(.T.,.T.)
ELSE
=TABLEREVERT(.T.,"posdetail")
ENDIF