'OLDGDOUT - to list and action records in the GOODSOUT file which have not been booked out

external	dpath vloadif() messboxwait() messbox() sch scw userid cpath bpopdb() Background()
external  _SWIP_Crystal() Xreppath remove() X_path vunloadif() $menu progress() fgp bgp

public	ptstr

global	x ChkGdsOut() Report()


MAIN
single-step off
 	Background()

 	progress(15,10," Please wait . . locating records ",0)

	file unload all

	ChkGdsOut() 				'find unprocessed GOODSOUT records

	Background()

END MAIN


FUNCTION ChkGdsOut()
local y2
	vloadif(dpath|"cgo1.vw")						' order change index "cgo3.idx"
   	data query execute "cgo2.dfq" index "cgo3.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' days([Date_Out])<days(today)
' and
' days([Date_Out])<>blank
' and
' [Itemtype]<>"F"
' and
' [Itemtype]<>"O"
' and
' [Document]=blank
' and
' not (deleted)
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
	if cerror
        	messboxwait(" All GOODSOUT records processed correctly ",0,0,1)
		return (2)
	end if
	order sort now dictionary "cgo2" fields "[Date_Out;Requsn_Nr;Product_MRC]" descending
' 	while true
'           y2 = format("{Esc} to exit","M77")
'           screen print 23 12 fgp bgp y2
' 		x = bpopdb("cgo1",8,"","[all_desc]","L75","[Requsn_Nr]","L0","[Date_Out]",3,12,22,88,"",0)
' 		if x = -1
' 			Background()
' 			messbox(" Print list of GOODSOUT items not processed? (y/n) ",1,1,1)
' 			if ptstr == "n"
' 				return (-1)
' 			else				'
' 				exit while
' 			end if
' 		end if
' 	end while

	Report()

END FUNCTION ' ChkGdsOut()


FUNCTION Report()
	remove(X_path|"Xgdsout1.*") 		' message "print list of unpaid items"

     data query execute "not_del.dfq" Smart4 X_path|"Xgdsout1" fields "[Date_Out;Requsn_Nr;Product_MRC;Description_MRC;QuantOut;Nickname]"

     vunloadif("Xgdsout1.vws")

     _SWIP_Crystal(Xreppath|"gdsout_1","S",0,1,"")

	return (0)
END FUNCTION 'Report()


