function chk_qty

IF qty < 0
	IF gcnegative_flg = "Y"
		PRIVATE lnresp
		lnresp = 0
		DO alert with "Negative Qty. Found Are you Sure ?",1,"\<No;\<Yes",lnresp
		IF lnresp = 1
			RETURN .F.
		ENDIF 		
	ELSE
		REPLACE qty WITH 0
		DO err_msg WITH " NEGATIVE/ZERO STOCK FOUND FOR THIS ITEM SO MATERIAL ISSUE CAN'T ALLOWED" + CHR(13) + CHR(13) + 'PLEASE CONTACT YOUR ADMINISTRATOR'
*!*			RETURN .F.
	ENDIF 				
ENDIF 
IF qty > itemmast.balance
	IF gcnegative_flg = "Y"
		IF noyes('Stock Of Item is ' + ltrim(str(itemmast.balance)) + ';Issued Quantity is ' + ltrim(str(qty)) + CHR(13) + 'Are you sure ?') = 'NO'
			RETURN .F.
		ENDIF
	ELSE
		REPLACE qty WITH 0
		DO err_msg WITH " NEGATIVE/ZERO STOCK FOUND FOR THIS ITEM SO MATERIAL ISSUE CAN'T ALLOWED" + CHR(13) + CHR(13) + 'PLEASE CONTACT YOUR ADMINISTRATOR'
*!*			RETURN .F.
	ENDIF 				
ENDIF
IF qty = 0
	do alert with '!!! ATTENTION !!!;Zero Quantity Found !!!'
ENDIF