COMPILE FUNCTION Comm_Dialog_Hold(Method, Parm1, Parm2)

/*
	Commuter module for Dialog_Hold window.
	
	06/09/2004 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Set_Status, ErrMsg
DECLARE SUBROUTINE obj_Appwindow, Start_Window, Msg
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Popup, Send_Message

EQU CRLF$	TO \0D0A\

$INSERT POPUP_EQUATES
$INSERT APPCOLORS


ErrTitle = 'Error in Comm_Dialog_Hold'
ErrorMsg = ''

Result = ''

BEGIN CASE
	CASE Method = 'Create'			; GOSUB Create
	CASE Method = 'OK'				; GOSUB OK
	CASE Method = 'Cancel'			; GOSUB Cancel
	CASE Method = 'Close'			; GOSUB Close
	CASE Method = 'Refresh'			; GOSUB Refresh
	CASE Method = 'LU_UserID'		; GOSUB LU_UserID
	CASE Method = 'UserIDLF'		; GOSUB UserIDLF
	CASE 1
		ErrMsg(ErrTitle:@SVM:'Unknown method ':QUOTE(Method):' passed to routine.')
		
END CASE


RETURN Result


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

obj_AppWindow('Create')

Transition	= Parm1<1>
TableName	= Parm1<2>
HoldType	= Parm1<3>

IF HoldType = '' THEN HoldType = 'HOLD'

BEGIN CASE
	CASE Transition = 'ON' AND HoldType = 'HOLD'
		Set_Property(@WINDOW:'.WINDOW_LABEL_FIX','TEXT','Hold On')
		WinText = 'Hold Change'
		
	CASE Transition = 'OFF' AND HoldType = 'HOLD'
		Set_Property(@WINDOW:'.WINDOW_LABEL_FIX','TEXT','Hold Off')
		WinText = 'Hold Change'
		
	CASE Transition = 'ON' AND HoldType = 'SHOLD'
		Set_Property(@WINDOW:'.WINDOW_LABEL_FIX','TEXT','Ship Hold On')
		WinText = 'Ship Hold Change'
		
	CASE Transition = 'OFF' AND HoldType = 'SHOLD'
		Set_Property(@WINDOW:'.WINDOW_LABEL_FIX','TEXT','Ship Hold Off')
		WinText = 'Ship Hold Change'
		
	CASE Transition = 'ESC'
		Set_Property(@WINDOW:'.WINDOW_LABEL_FIX','TEXT','Start Escalation')
		WinText = TableName:' Escalation Change'
	
	CASE Transition = 'D-ESC'
		Set_Property(@WINDOW:'.WINDOW_LABEL_FIX','TEXT','Stop Escalation')
		WinText = TableName:' Escalation Change'
END CASE

Set_Property(@WINDOW,'TEXT',WinText)	; * Window title in top bar

UserName = OCONV(@USER4,'[XLATE_CONV,LSL_USERS*FIRST_LAST]')

Set_Property(@WINDOW:'.USER_ID','DEFPROP',@USER4)
Set_Property(@WINDOW:'.USER_NAME','DEFPROP',UserName)
Set_Property(@WINDOW:'.REASON','FOCUS',1)

RETURN



* * * * * * *
LU_UserID:
* * * * * * *

TypeOver = ''
TypeOver<PSELECT$>	= 1
TypeOver<PDISPLAY$>	= 'BY LAST_FIRST'

UserID = Popup(@WINDOW,TypeOver,'SHOW_USERS')

IF UserID NE '' THEN
	Set_Property(@WINDOW:'.USER_ID','DEFPROP',UserID)
END ELSE
	RETURN
END


* * * * * * *
UserIDLF:
* * * * * * *

UserID = Get_Property(@WINDOW:'.USER_ID','DEFPROP')

UserName = OCONV(UserID,'[XLATE_CONV,LSL_USERS*FIRST_LAST]')
Set_Property(@WINDOW:'.USER_NAME','DEFPROP',UserName)

RETURN



* * * * * * *
Refresh:
* * * * * * *


RETURN


* * * * * * *
Close:
* * * * * * *



* * * * * * *
Cancel:
* * * * * * *

End_Dialog(@WINDOW,'Cancel')

RETURN


* * * * * * *
OK:
* * * * * * *

UserID = Get_Property(@WINDOW:'.USER_ID','DEFPROP')
Reason = Get_Property(@WINDOW:'.REASON','DEFPROP')
Extended = Get_Property(@WINDOW:'.HOLD_EXTENDED','CHECK')

Result = UserID:@FM:Reason:@FM:Extended

End_Dialog(@WINDOW,Result)

RETURN


