PRIVATE LDJV_DT,LWJV_WIN
LWJV_WIN = SYS(2015)
STORE {  /  /  } TO LDJV_DT
DEFINE WINDOW (LWJV_WIN) FROM 15,15 TO 17,80 DOUBLE FONT 'TIMES NEW ROMAN',12 STYLE "B" COLOR RGB(203,52,64,234,234,219)
ACTIVATE WINDOW (LWJV_WIN) 
@ 0,1 SAY 'STOCK JV DATE :' GET LDJV_DT VALID VALIDDT(LDJV_DT) PICT '@E'
READ MODAL
RELEASE WINDOWS (LWJV_WIN)

DO RECALSTK

IF ! USEDBF(YEAR_PATH,'STK_JV','','',.F.,.T.,.F.,MPROG_PATH + '\YEARSTRU\',.T.)
	DO ERR_BEEP
	DO ALERT WITH '!!! ERROR !!!;THERE WAS PROBLEM IN OPENING STOCK JV FILE;CONTACT YOU SYSTEM ADMINISTRATOR/VENDOR;PROCESS WAS TERMINATED'
	DO CLS_MENU
	RETU
ENDIF

SELECT GODOWN_I
IF FLOCK('STK_JV')
	PRIVATE LCJV_NO
	LCJV_NO = ' '
	= NEXTCNO('STK_JV','STK_JVNO','STK_JVNO',LCJV_NO,'JV',.T.)	
	SCAN FOR BALANCE < 0
		   INSERT INTO STK_JV(STK_JVNO, STK_JVDT, ITEM_NO, QTY, REMARK, GODOWN_NO);
				VALUES ;
			(LCJV_NO, LDJV_DT, GODOWN_I.ITEM_NO, - GODOWN_I.BALANCE,;
			'JV PASSES TO ADJUST STOCK AS PER PHYSICAL STOCK', GODOWN_I.GODOWN_NO)
		SELECT GODOWN_I
	ENDSCAN 
	UNLOCK IN STK_JV	
ENDIF 
USE IN STK_JV