COMPILE FUNCTION Comm_Dialog_Change_Log(Method, Parm1)

/*
	Commuter module for Dialog_Change_Log window.
	
	07/13/2005 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Set_Status, ErrMsg
DECLARE SUBROUTINE obj_Appwindow, Start_Window, Msg, Send_Event, Btree.Extract
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Popup

EQU CRLF$	TO \0D0A\

$INSERT POPUP_EQUATES

ErrTitle = 'Error in Comm_Dialog_Change_Log'
ErrorMsg = ''

Result = ''

BEGIN CASE
	CASE Method = 'Create'			; GOSUB Create
	CASE Method = 'RecentChanges'	; GOSUB RecentChanges
	
	
	CASE 1
		ErrMsg(ErrTitle:@SVM:'Unknown method ':QUOTE(Method):' passed to routine.')
		
END CASE


RETURN Result


* * * * * * *
Create:
* * * * * * *

obj_AppWindow('Create')

Send_Event(@WINDOW:'.ORDER_CHANGES','CLICK')

RETURN


* * * * * * *
RecentChanges:
* * * * * * * 

OPEN 'DICT.ORDER_CHANGE' TO DictVar ELSE
	Errmsg('Unable to open "DICT.ORDER_CHANGE" for index lookup')
	RETURN
END

SearchString = 'TS_DT':@VM:'>=':OCONV(Date()-90,'D4/'):@FM

option = ''
flag = ''

Btree.Extract(SearchString, 'ORDER_CHANGE', DictVar, OCKeys, option, flag)
IF Get_Status(errCode) THEN
	ErrMsg(errCode)
	RETURN
END

IF OCKeys = '' THEN RETURN
	
OCKeys := @VM
CONVERT @VM TO @RM IN OCKeys
CALL V119('S','','D','R',OCKeys,'')
IF Get_Status(errCode) THEN DEBUG
CONVERT @RM TO @VM IN OCKeys
OCKeys[-1,1] = ''					;* Strip trailing delimiter

TypeOver = ''
TypeOver<PDISPLAY$> = OCkeys

OrderNo = Popup(@WINDOW,TypeOver,'ORDER_CHANGE_LOG')

IF OrderNo NE '' THEN
	obj_Appwindow('ViewRelated','ORDER2':@RM:OrderNo)
END



RETURN




