'DLYGOODS - Daily Goods Received report

external   vkeybox() sch scw progress() messbox() vloadif() cpath PrintReport()
external   vunloadif() dpath fentrybox() chkdate() remove() greeting
external   messboxwait()	Background()
external   X_path _SWIP_Crystal() Xreppath

public     ptstr choice sum_date

global     x DailyGoods() ReturnToMenu() repdef p2 p3 p4 p5 p6 p1


MAIN
single-step off

	Background()

	DailyGoods()

	ReturnToMenu()

END MAIN


FUNCTION DailyGoods()
	vloadif(dpath|"dlygoods.vw")
  	order change physical

  	while true
    		x = fentrybox(" Confirm Date for Goods Received Report ",10,"##\/##\/####",today)
    		if x = 0
      		sum_date = ptstr
      		if chkdate(sum_date,1) = -1
        			messbox(" Incorrect date - re-enter ",0,0,1)
        			continue while
      		end if
      		exit while
    		end if
  	end while

  	progress(15,10," Please wait ... preparing report ",0)
' message "sum_date) is:"&date2(sum_date)
  	data query execute "dlygoods.dfq" index "goods.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' ³ [Date_Received] = days(sum_date)
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  	if cerror
    		messboxwait(" No Goods Received for"&date2(sum_date)|" ",0,0,1)
    		return (0)
  	end if
  	order sort execute dictionary "dlygoods.dfs" index "dlygoods.idx"

	vunloadif("X_dlygds.vws")
  	remove(X_path|"X_dlygds.*")
 	data query execute "not_del.dfq" Smart4 X_path|"X_dlygds" fields\
"[Date_Received;Branch;JobNr;Product_MRC;Carpet_Color;Length_Received;Width_Received;Backing;viewdesc]"

	_SWIP_Crystal(Xreppath|"Xdlygds1","P",0,1,"")

END FUNCTION ' DailyGoods()


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()

