COMPILE FUNCTION Comm_Coa_Coc(Instruction, Parm1) /* Commuter module for Coa_Coc window 03/03/2004 - John C. Henry, J.C. Henry & Co., Inc. */ DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, Center_Window DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, Btree.Extract, obj_AppWindow DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Center_Window, Popup, Collect.Ixvals DECLARE FUNCTION Send_Message $INSERT POPUP_EQUATES EQU CRLF$ TO \0D0A\ EQU LTGREY$ TO 229 + (229*256) + (229*65536) ;* JCH standard colors for edittable backgrounds EQU GREY$ TO 192 + (192*256) + (192*65536) EQU GREEN$ TO 192 + (220*256) + (192*65536) EQU RED$ TO 255 + (128*256) + (128*65536) EQU BLUE$ TO 128 + (255*256) + (255*65536) EQU WHITE$ TO 255 + (255*256) + (255*65536) EQU YELLOW$ TO 255 + (255*256) + (202*65536) EQU LTBLUE$ TO 128 + (255*256) + (255*65536) EQU PURPLE$ TO 225 + (181*256) + (255*65536) ErrTitle = 'Error in Comm_Coa_Coc' ErrorMsg = '' Result = '' BEGIN CASE CASE Instruction = 'Create' ; GOSUB Create CASE Instruction = 'Refresh' ; GOSUB Refresh CASE Instruction = 'LUCompNo' ; GOSUB LUCompNo CASE Instruction = 'LotDC' ; GOSUB LotDC CASE 1 ErrorMsg = 'Unknown Instruction passed to routine.' ErrMsg(ErrorMsg) END CASE RETURN Result * * * * * * * Create: * * * * * * * Center_Window(@WINDOW) IF Parm1 NE '' THEN obj_AppWindow('LoadFormKeys',@WINDOW:@RM:Parm1) END GOSUB Refresh RETURN * * * * * * * Refresh: * * * * * * * RETURN * * * * * * * LUCompNo: * * * * * * * CompanyKeys = Collect.IXVals('COA_COC', 'COMP_NO') CONVERT @FM TO @VM IN CompanyKeys OverRide = '' OverRide = 'K' OverRide = CompanyKeys CompanyKey = Popup(@WINDOW,OverRide,'COMPANY2') IF CompanyKey = '' THEN RETURN OPEN 'DICT.COA_COC' TO DictVar THEN TableName = 'COA_COC' Flag = '' Option = '' Search = 'COMP_NO':@VM:CompanyKey:@FM Btree.Extract(Search, TableName, DictVar, CoaCocKeys, Option, Flag) IF Get_Status(errCode) THEN ErrMsg(errCode) RETURN END OverRide = '' OverRide = 'K' OverRide = CoaCocKeys CoaCocKey = Popup(@WINDOW,OverRide,'COA_COC') obj_AppWindow('LoadFormKeys',@WINDOW:@RM:CoaCocKey) END ;* End of DICT.COA_COC open RETURN * * * * * * LotDC: * * * * * * LotList = Get_Property(@WINDOW:'.VEND_LOT_NO','LIST') CurrPos = Get_Property(@WINDOW:'.VEND_LOT_NO','SELPOS') CurrCol = CurrPos<1> CurrRow = CurrPos<2> LotNo = LotList IF LotNo NE '' THEN xlFileName = Get_Property(@WINDOW:'.XLFILENAME','TEXT') Path = Get_Property(@WINDOW:'.PATH','TEXT') TestWacker = xlFileName[1,'_'] IF LEN(TestWacker) = 6 AND NUM(TestWacker) THEN WackerNo = TestWacker END ELSE WackerNo = '' END Frame = Get_Property(@WINDOW, "MDIFRAME") Code = '' Code<-1> = 'Set objExcel = CreateObject("excel.Application")' Code<-1> = 'objExcel.WindowState = 3' Code<-1> = 'objExcel.Visible = True' Code<-1> = 'Path = ':QUOTE(Path:xlFileName) Code<-1> = 'objExcel.Workbooks.Open Path' Code<-1> = 'objExcel.Sheets("':WackerNo:'_L").Select' hScript = Frame:'.SCRIPTCONTROL' swap @tm with crlf$ in Code swap @fm with crlf$ in Code script = 'function main(argstring)' script := crlf$:'' script := crlf$:'result = 0' script := crlf$:code script := crlf$:'main = result' script := crlf$:'' script := crlf$:'end function' language = 'VbScript' strResult = Send_Message( hScript, 'Reset') Set_Property( hScript ,'Language',language) strResult = Send_Message( hScript, 'AddCode', script ) strResult = Send_Message( hScript, 'Run', "main","" ) END RETURN