COMPILE FUNCTION Comm_Dialog_Open_Quotes(Method, Parm1) /* Commuter module for Dialog_Open_Quotes window. 01/07/2005 - John C. Henry, J.C. Henry & Co., Inc. */ DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, ErrMsg DECLARE SUBROUTINE obj_Appwindow, Start_Window, Btree.Extract, Msg, Send_Message DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Send_Message, Popup, Collect.IXVals, Msg EQU CRLF$ TO \0D0A\ EQU COL$CUST_NO TO 1 ;* Customer edit table column equates EQU COL$CUST_NAME TO 2 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) EQU DTS_MULTIROW$ TO 512 EQU DTS_LARGEDATA$ TO 4096 $INSERT ORDER_EQU $INSERT PS_EQUATES $INSERT POPUP_EQUATES $INSERT MSG_EQUATES ErrTitle = 'Error in Comm_Dialog_Open_Quotes' ErrorMsg = '' Result = '' BEGIN CASE CASE Method = 'Create' ; GOSUB Create CASE Method = 'ItemDC' ; GOSUB ItemDC CASE 1 ErrMsg(ErrTitle:@SVM:'Unknown method ':QUOTE(Method):' passed to routine.') END CASE RETURN Result * * * * * * * Create: * * * * * * * obj_AppWindow('Create') CustNo = Parm1 CustNo = '6622' IF CustNo = '' THEN RETURN OPEN 'DICT.QUOTE' TO DictVar ELSE ErrMsg('Unable to open DICT.QUOTE in COMM_DIALOG_OPEN_QUOTES!') RETURN END SearchString = 'CUST_NO':@VM:CustNo:@FM SearchString := 'STATUS':@VM:'O':@FM Option = '' Flag = '' Set_Status(0) Btree.Extract(SearchString, 'QUOTE' ,DictVar, OpenQuotes, Option, Flag) IF Get_Status(errCode) THEN ErrMsg(errCode) IF OpenQuotes = '' THEN ErrMsg('No open quotes on file for customer ':CustNo:'.') RETURN END QuoteList = '' FOR I = 1 TO COUNT(OpenQuotes,@VM) + (OpenQuotes NE '') QuoteDetKeys = XLATE('QUOTE',OpenQuotes<1,I>,35,'X') QuoteList<-1> = '1-1: ':OpenQuotes<1,I> CustPartNos = '' FOR J = 1 TO COUNT(QuoteDetKeys,@VM) + (QuoteDetKeys NE '') QuoteDetKey = QuoteDetKeys<1,J> ItemNo = FIELD(QuoteDetKey,'*',2) QuoteDetRec = XLATE('QUOTE_DET',QuoteDetKey,'','X') CustPartNos = QuoteDetRec<12> ProcSteps = QuoteDetRec<8> ProcPSNs = QuoteDetRec<9> ProcDescs = QuoteDetRec<10> DetString = '' FOR K = 1 TO COUNT(ProcSteps,@VM) + (ProcSteps NE '') DetString<1,-1> = 'Step ':ProcSteps<1,K>:' PSN: ':ProcPSNs<1,K>:' ':ProcDescs<1,K> NEXT K SWAP @VM WITH ', ' IN DetString QuoteList<-1> = '2-2: Item ':ItemNo:': ':DetString NEXT J IF CustPartNos = '' THEN CustPartNos = XLATE('QUOTE',OpenQuotes<1,I>,'CUST_PART_NUMS','X') END FOR L = 1 TO COUNT(CustPartNos,@VM) + (CustPartNos NE '') QuoteList<-1> = '3-3: Cust Part No: ':CustPartNos<1,L> NEXT L NEXT I Set_Property(@WINDOW:'.OPEN_QUOTES','LIST_EX',QuoteList) Send_Message(@WINDOW:'.OPEN_QUOTES','EXPAND',0,3) RETURN * * * * * * * ItemDC: * * * * * * * RETURN ReturnCtrl = Parm1[1,@RM] IF ReturnCtrl = '' THEN ReturnCtrl = Get_Property(@WINDOW,'FOCUS') DateSelected = Dialog_Box('POPUP_YEAR',@WINDOW) RetVal = OCONV(DateSelected, 'D4/') IF RetVal NE '' THEN obj_Appwindow('LUValReturn',RetVal:@RM:ReturnCtrl) END RETURN * * * * * * * Cancel: * * * * * * * RETURN