COMPILE FUNCTION Comm_Company2(Instruction, Parm1)

/*
	Commuter module for COMPANY2 window
	
	002/29/2004 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, SetInitDirOptions
DECLARE SUBROUTINE ErrMsg, Send_Message, Make.List,Set_Property, Send_Event
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Center_Window, Popup, Fieldcount
DECLARE FUNCTION Collect.Ixvals

EQU CRLF$	TO \0D0A\

$INSERT APPCOLORS
$INSERT POPUP_EQUATES



ErrTitle = 'Error in Comm_Company2'
ErrorMsg = ''

Result = ''

BEGIN CASE
	CASE Instruction = 'Create' 			; GOSUB Create
	CASE Instruction = 'Refresh'			; GOSUB Refresh
	CASE Instruction = 'LUComp_No'			; GOSUB LUComp_No
	CASE 1
		ErrorMsg = 'Unknown Instruction passed to routine.'
		ErrMsg(ErrorMsg)
END CASE

RETURN Result



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

SetInitDirOptions('-R-SD')
InitDir "R:\InboundCofA\*."
SubDirectories = @FM:DirList()

Set_Property(@WINDOW:'.COA_FOLDER','LIST',SubDirectories)

GOSUB Refresh


RETURN


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

RETURN

* * * * * * *
LUComp_No:
* * * * * * *

CompKeys = Collect.IXVals('COA', 'COMP_NO')

CONVERT @FM TO @VM IN CompKeys

PopOver = ''
PopOver<PDISPLAY$> = CompKeys

CompanyKey = Popup(@WINDOW,PopOver,'COMPANY_COA')
IF CompanyKey NE '' THEN
	Set_Property(@WINDOW:'.CO_NO','DEFPROP',CompanyKey)
	Send_Event(@WINDOW,'READ')
END
RETURN





