'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()

public	ptstr

global	x ChkGdsOut() ReturnToMenu() Report()


MAIN
single-step off
 	Background()

	progress(15,10," Please wait . . locating records ",0)

	file unload all

	ChkGdsOut() 				'find unprocessed GOODSOUT records

	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 ChkGdsOut()
  vloadif(dpath|"cgo1.vw")
' order change index "cgo1.idx"
 	data query execute "cgo1.dfq" index "cgo3.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' days([Date_Out])<=days(today)
' and
' days([Date_Out])<>blank
' and
' [Itemtype]<>"F"
' and
' [Document]=blank
' and
' not (deleted)
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
	if cerror
'     messboxwait(" No goods due for despatch on"&date2(ftgdate),0,0,1)
		return (2)
	end if

	order sort now dictionary "cgo2" fields "[Date_Out;Requsn_Nr;Product_MRC]" descending
	while true
		x = bpopdb("cgo1",8,"","[all_desc]","L75","[Requsn_Nr]","L0","[Date_Out]",2,1,20,79,"",0)
		if x = -1
			Background()
			if $menu="boss"
				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 if
	end while

	Report()

END FUNCTION ' ChkGdsOut()


FUNCTION Report()
' rder sort now dictionary "cgo2" fields "[Date_Out;Requsn_Nr;Product_MRC]" descending
	remove(X_path|"Xgdsout1.*") 		' message "print list of unpaid items"
     data query execute "not_del.dfq" data-file X_path|"Xgdsout1" fields "[Date_Out;Requsn_Nr;Product_MRC;Description_MRC;QuantOut;Nickname]"
     vunloadif("Xgdsout1.vws")
     _SWIP_Crystal(Xreppath|"gdsout_1","P",0,1,"")
	return (0)
END FUNCTION 'Report()

' order sort now dictionary "cgo2" fields "[Date_Out;Requsn_Nr;Product_MRC]" descending















