function get_it1


parameter sele_criteria,mwarranty,mservice_typ

if lastkey() = 5
	if recn() = 1
		retu -1
	else
		retu
	endif
endif
if empt(item_no) and recn() > 1
	keyb '{CTRL+Q}'
	scan rest while ! empt(item_no)
		msr_no = sr_no
		scat memv blank
		gath memv
		repl sr_no with msr_no
	ends		
	retu .T.
else
	if empt(item_no) and recn() = 1
		if lastkey() = 5
			retu - 1
		else	
			do alert with '!!! ATTENTION !!!;First Item info is blank'
			retu .F.
		endif	
	endif	
endif	
private m.item,m.item_no,mrate,mbalance,mitemtype

m.item_no = tmpissue.item_no
mrate = 0
m.item = item
mitemtype = ''
mbalance = 0
IF get_it(m.item_no,m.item,mbalance,mrate,mitemtype,sele_criteria)
	KEYBOARD '{ENTER}'
ELSE 
	sele tmpissue
	RETURN 
ENDIF 
sele tmpissue
repl item with m.item ;
	item_no with m.item_no ;
	itemtype with mitemtype ;
    rate with iif(empt(rate),itemmast.rate,rate) ;
	st_rt with itemmast.st_rt ;
	cst_rt WITH itemmast.cst_rt 
    *	rate with iif(empt(rate),itemmast.rate,rate) 
do CASE  
	CASE itemtype = 'C'
		repl oil_rt with iif(mwarranty = 'Y',itemmast.rate,itemmast.salerate)
		repl spare_rt with 0
	CASE itemtype = 'L'	
		repl labour_rt with iif(empt(labour_rt),itemmast.labour_rt,labour_rt)
		if mservice_typ = 'P'
			repl labour_rt with 0
		endif	
	OTHERWISE 
		repl spare_rt with iif(inli(mwarranty,'C','D'),roun(rate*(100 + moverhead)/100,2),itemmast.salerate)
		repl labour_rt with iif(empt(labour_rt),iif(mwarranty = 'Y' or mservice_typ = 'P',0,itemmast.labour_rt),labour_rt)
		repl oil_rt with 0
ENDCASE
retu