'STKLIST - produces list of Stock Carpets for SWIP on-screen view


external  dpath sch scw Background() vloadif() remove() PrintReport()
external  fentrybox() chkdate() messbox() progress() vunloadif()
external  messboxwait() makeidx() addidxrec() popuplist() X_path _SWIP_Crystal() Xreppath

public    ptstr sum_date ptval $wiptitle #length

global    WIP_Date() x ReturnToMenu() Stk_Bals() #total



MAIN
single-step off
	Background()
  	file unload all

	WIP_Date()

	Stk_Bals()

	ReturnToMenu()

END MAIN


FUNCTION ReturnToMenu()
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
  file unload all
'   transfer cpath|"pm_menu.psl" in-memory
END FUNCTION 'ReturnToMenu()


FUNCTION WIP_Date()
	sum_date=today
END FUNCTION 'WIP_Date()


FUNCTION Stk_Bals()
'ALL undeleted records in STK_CARP.DB with positive [PhysicalBalance]

	while true
    		x = fentrybox(" Enter minimum length required ",5,"*5{[1234567890.]}","")
    		if x = -1
      		continue while
    		end if
	     #length = val(ptstr)
     	exit while
  	end while
	
  	progress(15,10," Please wait .... searching stock list ",0)
  	vloadif(dpath|"WIP_1.vw")
  	data query execute "WIP3.dfq" index "wip0.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'  [Balance]>#length and not (deleted)
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  	if cerror
    		messboxwait(" No Stock Carpets held ",0,0,1)
    		return (1)
  	end if

	data query execute "liststck.dfq" index "wip1.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' [Item_Type]="C" or [Item_Type]="S" or [Item_Type]="V"
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  	if cerror
    		messboxwait(" No Stock Carpets held ",0,0,1)
    		return (1)
  	end if

'      order sort now dictionary "wip_1a.idx" fields "[Item_Type;Product_MRC;Description_MRC;DateRecd]" ascending
     order sort now dictionary "wip_1a.idx" fields "[Balance]" ascending
     remove("WIPstk_c.*")

	vunloadif("X_stk_c.*")
	x=remove(X_path|"X_stk_c.*")
'     	data query execute "not_del.dfq" Smart4 X_path|"X_stk_c" fields "[Product_MRC|Balance]"
    	data query execute "not_del.dfq" Smart4 X_path|"X_stk_c" fields \
"[Product_MRC;Description_MRC;Unit_Cost;PhysicalBalance;Balance_Value;Product_Code;RollNr;Width;DateRecd;DaysDateRecd;Item_Type;Location;ChckMeas;BAR;Balance]"
	_SWIP_Crystal(Xreppath|"XstkcptL","S",0,1,"")

END FUNCTION ' Stk_Bals()

