          SUBROUTINE (MAT OE.VARS,MAT PAF.DATA,MAT OE.SFLAGS,SUBS.XREF,ADD.LINES,ACTIONS,ABORTED,RESPS,CUSTOM.XREF)
** Version# 53.0001[4] - 04/24/2013 - 10:27am - TSMITH - eclipse
*** V53.0001 Change - Custom Coding CUSTOM - 04/24/2013 - TSMITH - eclipse

*** Subroutine - OE.ACTION.DISPLAY
*-------------------------------------------------------------------------*
*** This the OE version of ACTION.DISPLAY, and actually calls
*** ACTION.DISPLAY.  However, this routine looks at each action first and
*** decides if it needs to handle it or if ACTION.DISAPLAY can handle it.
*** This routine was intended to be called from OE.
*-------------------------------------------------------------------------*
*** OE.VARS     - OID, GEN, etc... (see CC OE.EQUATES)             [IN]
*** PAF.DATA    - Contains flags dealing with Pass-Along-Freight   [IN/OUT]
*** OE.SFLAGS   - Order Entry screen display flags.                [IN/OUT]
*** SUBS.XREF   - This is an AM list of LDID for whome substitues  [IN]
***             - have already been opened.
*** ADD.LINES   - This is an array of line items that need to be   (IN/OUT)
***             - added to the order.
*** ACTIONS     - AM List of interactions needed to be performed.  [IN]
*** ABORTED     - Boolean, true if any action was set for ABORT.OK (OUT)
***             - and failed.
*** RESPS       - The responces array                              (IN/OUT)
*** CUSTOM.XREF - This is an AM list of LDID that can be use       (IN/OUT)
***               for any custom programming that would require
***               it.. for example... the Laminate custom mod
***               so that we can keep track of when we automatically
***               pop up the laminate screen.
*-------------------------------------------------------------------------*
*** Common Variables:
*-------------------------------------------------------------------------*
          $INCLUDE CC OE.EQUATES

          PRC.BR   = LED(2)<1,GEN%,1>
          STK.BR   = LED(2)<1,GEN%,2>
          PN       = LD(1)
          IS.PN    = (NUM(LD(1)) AND LD(1) # '')
          QO       = LD(4) * QSIGN%
          ABORTED  = NO

          LOOP
             *** The action is saved before calling ACTIONS.POP in case
             *** we don't know how to handle it and must pass it to
             *** ACTION.DISPLAY.
             ACTION = ACTIONS<1>
             ACTION.POP ACTIONS,TYPE,ACT.ID,ABORT.OK,TEXT,SOUND,DATA

             BEGIN CASE
             CASE TYPE = 'TRIGGER';           GOSUB TRIGGER
             CASE TYPE = 'SERIAL';            GOSUB SERIAL
             CASE TYPE = 'DETAIL.LOT';        GOSUB DETAIL.LOT
             CASE TYPE = 'QUICK.PRICE';       GOSUB QUICK.PRICE
             CASE TYPE = 'SPLIT.LOCS';        GOSUB SPLIT.LOCS
             CASE TYPE = 'SUBS.ENTRY';        GOSUB SUBS.ENTRY
             CASE TYPE = 'CHECK.SCHEDULE';    GOSUB CHECK.SCHEDULE
             CASE TYPE = 'SCHEDULE';          GOSUB SCHEDULE
             CASE TYPE = 'LOT.BILL';          GOSUB LOT.BILL
             CASE TYPE = 'OE.TAG.CHECK';      GOSUB TAG.CHECK
             CASE TYPE = 'DUP.ORDER';         GOSUB DUP.ORDER
             CASE TYPE = 'SHOW.POE.HEADER';   GOSUB POE.HEADER
             CASE TYPE = 'AUTO.SHOW.AVAIL';   GOSUB AUTO.SHOW.AVAIL
             CASE TYPE = 'CUS.PN.NEW';        GOSUB CUS.PN.NEW
             CASE TYPE = 'VAL.SEL.UM';        GOSUB VAL.SEL.UM
             CASE TYPE = 'PAF';               GOSUB PAF
             CASE TYPE = 'PROFIT.WHEEL';      GOSUB PROFIT.WHEEL
             CASE TYPE = 'OE.DROP.POINT';     GOSUB DROP.POINT
             CASE TYPE = 'PLNE.DT.MNT';       GOSUB PLNE.DT.MNT
             CASE TYPE = 'OE.MULTI.BOX';      GOSUB MULTI.BOX
             CASE TYPE = 'SOE.RETURN.CHECK';  GOSUB RETURN.CHECK
             CASE TYPE = 'DUTY.INFO';         GOSUB DUTY.INFO
             CASE TYPE = 'PIL.AUTH';          GOSUB PIL.AUTH
             CASE TYPE = 'OE.AUTH.CERT';      GOSUB OE.AUTH.CERT
             CASE TYPE = 'CUSTOM.MOD'  ;      GOSUB CUSTOM.ENTRY
             CASE TYPE = 'ADD.LI';            GOSUB ADD.LI
             CASE TYPE = 'PROD.WIZ';          GOSUB PROD.WIZ
             CASE TYPE = 'POLE.DISP';         GOSUB POLE.DISP
             CASE TYPE = 'LOT.NEW.GEN';       GOSUB LOT.NEW.GEN
             CASE TYPE = 'DEL.LI';            GOSUB DEL.LI
             CASE TYPE = 'CHNG.QO';           GOSUB CHNG.QO
             CASE TYPE = 'SPLIT.QTY';         GOSUB SPLIT.QTY
             CASE TYPE = 'RELATED.ITEM.RETURN' GOSUB PARENT.RETURN
             CASE TYPE = 'POE.MATRIX';        GOSUB POE.MATRIX

             CASE ACT.ID = 'QBREAKS' AND NOT(NEW.ITEM%)
                * Don't let qbreaks show if we're not in a new.ldid.
                NULL
             CASE OTHERWISE
                * Check to see if we have a simpled message
                GOSUB CHECK.MESS
                ACTIONS = INSERT(ACTIONS,1;ACTION)
                ACTION.DISPLAY ACTIONS,ABORTED,RESPS,YES
             END CASE

             WHILE ACTIONS # '' AND NOT(ABORTED)
          REPEAT

          RETURN
*-------------------------------------------------------------------------*
CHECK.MESS: *** Check to see if the current action is a MESSAGE to be
          *** displayed. If it is, we need to move the input to the top
          *** of the Order Entry screen by default.

          * See if we are working with a message
          IF (TYPE # "MESSAGE") THEN RETURN

          * Get the Y-Component location
          LOCY = DATA<1,3,2>

          * If the Y-Component location is not set, default the location
          * of the message to Line 2 at the top of the Order Entry Screen.
          * This will help to avoid conflicts with the VSCROLL region.
          IF (LOCY = "") THEN
             DATA<1,3,2> = 2
             ACTION      = FIELD(ACTION,VM,1,6)
             ACTION      = ACTION:VM:DATA
          END

          RETURN
*-------------------------------------------------------------------------*
TRIGGER:  *** This will open up the triggers prompt.

          TNUM = DATA<1,1>
          OE.TRIGGERS TNUM,OID%,GEN%,NEW.ITEM%,LDID%,VIEW.ONLY%

          RETURN
*-------------------------------------------------------------------------*
SERIAL:   *** A serial action is added the actions queue when a line item
          *** requires the entry of serial numbers (it is a serial number
          *** product and doesn't have enouph serial numbers).

          IF NEW.ITEM% THEN
             *** For a new line item, ask the user if they want to open
             *** serial number entry, otherwise just open it.
             ANS = 'Y'
IN.SERL:     INP.PROMPT ANS,'%68','YN',1
             IF NOT(ANS) THEN RETURN
          END

          PRD.BR.GET.VAL STK.BR,PN,25,SERL
          OE.SERIAL.CHECK OID%,GEN%,LDID%,SERL,YES,VIEW.ONLY%

          RETURN
*-------------------------------------------------------------------------*
SPLIT.LOCS:*** This will open the split locations window.
          OE.SPLT.LOC.CHK OID%,GEN%,UPDATED
          IF UPDATED THEN
             UPDATE.LEDGER.DET OID%,LDID%,QSIGN%
          END
          RETURN
*-------------------------------------------------------------------------*
CUSTOM.ENTRY: *** check for any custom mods that might require the
          *** a window to be opened automatically or for information
          *** to be entered.

          UD.OE.HOTKEY MAT OE.VARS,ADD.LINES,CUSTOM.XREF,DATA

          RETURN
*-------------------------------------------------------------------------*
SUBS.ENTRY:*** This will open the substitutes screen.

          * No substitute window for returns
          IF MODE% = 'S' AND QO < 0 + 0 THEN RETURN

          FORCE.OPEN   = DATA<1,1>
          RELATED.ONLY = DATA<1,2>

          IF NOT(FORCE.OPEN) THEN
             LOCATE LDID% IN SUBS.XREF SETTING NOTHING THEN
                *** Only automatically open the substitutes screen once for
                *** any line item per order session.
                RETURN
             END
          END

          *** Add this line item to the list so that subs isn't opened
          *** twice for this line.
          UT.UNION.LIST.AL SUBS.XREF,LDID%

          *** No subs for a "LotItem"
          IF PRD(3) = '9' THEN RETURN

          *** No subs for a blank line or a comment.
          IF LD(1) = '' OR NOT(NUM(LD(1))) THEN RETURN

          *** If PO side of direct locked for editing, do not allow
          *** entry to subs screen
          IF OE.LOCKED.DIR$ THEN RETURN

          OE.RECV.GEN.ONLY OID%,GEN%,RECV.GEN.ONLY
          IF RECV.GEN.ONLY THEN RETURN

          *** If this line item has already been invoice on at least one
          *** other gen, don't let the user enter subs for it.
          CT = DCOUNT(LED(9),VM)
          FOR G = 1 TO CT
             SQTY = SUM(LD(5)<1,G>) + SUM(LD(6)<1,G>)
             INVN = LED(8)<1,G>
             IF G#GEN% AND SQTY#0 AND INVN#'' THEN
                MESS 5,3,'%72':AM:OID%:'.':INVN"R%3"
                RETURN
             END
          NEXT G

          OLD.PN = LD(1)
          OE.RELATED.PRODUCT MAT OE.VARS,ADD.LINES,RELATED.ONLY

          RETURN
*-------------------------------------------------------------------------*
CHECK.SCHEDULE:*** This will automatically open the schedule screen only
               *** if the user has turned on the schedle hotkey.

          IF SCHED.ACTIVE% # 1 THEN RETURN

*-------------------------------------------------------------------------*
SCHEDULE: *** This opens the line item scheduling screen.

          IF LD(1) = '' OR NOT(NUM(LD(1))) THEN PRINT BELL:; RETURN
          IF PRD(3) = '9'                  THEN PRINT BELL:; RETURN

          OE.RECV.GEN.ONLY OID%,GEN%,RECV.GEN.ONLY
          IF RECV.GEN.ONLY THEN RETURN

          *** Save off qtys in case there is a qty change on the
          *** scheduling screen and we need to prompt user to recalc
          *** pass along freight
          PAF.SHP.LD5 = SUM(LD(5)<1,GEN%>)
          PAF.SHP.LD6 = SUM(LD(6)<1,GEN%>)

          IF SCHED.ACTIVE% = 2 THEN
             *** SCHED.ACTIVE% is set to 2 as a flag meaning that the
             *** scheduling screen needs to be opened right away, and
             *** is only valid for one time through.
             SCHED.ACTIVE% = YES
          END

          OE.GET.KEYS OID%,GEN%,NEW.ORDER%,VIEW.ONLY%,,QTY.KEY
          OE.QTY.CHNG.OK OID%,GEN%,QTY.KEY,VIEW.ONLY%,QTY.CHNG.OK

          *** Set view only flag temporarily to yes for when the PO side
          *** of the direct is locked for editing
          IF OE.LOCKED.DIR$ THEN
             SV.VIEW.ONLY = VIEW.ONLY%
             VIEW.ONLY%   = YES
          END

          REDISP = NO
          OE.SCHEDULE.ITEM MAT OE.VARS,REDISP,QTY.CHNG.OK,ADD.LINES

          *** Reset to saved view only setting
          IF OE.LOCKED.DIR$ THEN
             VIEW.ONLY% = SV.VIEW.ONLY
          END

          IF REDISP THEN
             *** This is putting a flag in the RESPS array so that OE
             *** knows it has to redisplay all the line items.
             LOCATE 'REDISP.LI' IN RESPS<1> SETTING NOTHING ELSE
                RESPS<1,-1> = 'REDISP.LI'
             END
          END

          OE.CALC.QOPEN OID%,QSIGN%,QOPEN,GEN%
          IF QO # QOPEN THEN
             IF QOPEN = 0 THEN
                DEL.ABT   = NO
                DEL.FLAG  = NO
                DEL.ACTS  = ''
                DEL.RESPS = ''

                LOOP
                   OE.SUBS.DEL.LINE MAT OE.VARS,DEL.OK,DEL.FLAG,DEL.ACTS,DEL.RESPS
                   IF DEL.FLAG THEN
                      OE.ACTION.DISPLAY MAT OE.VARS,MAT PAF.DATA,MAT OE.SFLAGS,SUBS.XREF,,DEL.ACTS,DEL.ABT,DEL.RESPS
                   END
                   WHILE DEL.FLAG AND NOT(DEL.ABT)
                REPEAT
             END ELSE
                QO = QOPEN
                OE.PRICE.ITEM OID%,GEN%,LDID%,LD(1),QO,QSIGN%,,LOG.MV%,REDISP

                IF REDISP THEN
                   *** This is done twice because OE.PRICE.ITEM right set
                   *** REDISP to NO.
                   LOCATE 'REDISP.LI' IN RESPS<1> SETTING NOTHING ELSE
                      RESPS<1,-1> = 'REDISP.LI'
                   END
                END

             END
          END

          IF MODE% = 'S' THEN
             *** Let OE know that it should re-check the credit
             LOCATE 'CHECK.CREDIT' IN RESPS<1> SETTING NOTHING ELSE
                RESPS<1,-1> = 'CHECK.CREDIT'
             END
          END

          *** Re-set values to compare with saved to see if there was any
          *** qty change on scheduling screen
          PAF.ASHP.LD5 = SUM(LD(5)<1,GEN%>)
          PAF.ASHP.LD6 = SUM(LD(6)<1,GEN%>)

          *** If any qtys have been changed or qty types (tags) have been
          *** changed, prompt user to recalc pass along freight
          IF (PAF.SHP.LD5#PAF.ASHP.LD5) OR (PAF.SHP.LD6#PAF.ASHP.LD6) THEN
             GOSUB PAF
          END

          RETURN
*-------------------------------------------------------------------------*
LOT.BILL: *** This opens the lot billing status screen.

          SAVE.GEN = GEN%

          * This next block of code will set the current gen to be the
          * first gen that the lot billing line item is on.  This is
          * necissary because gen that is being displayed on the order
          * may not be the gen that the line item was added to.  This
          * is a problem because:
          * 1) Each lot billing gen can have only one product
          * 2) UPDATE.LEDGER only updates ENTITY.DYNAM for the product
          *    that is on the GEN passed into UPDATE.LEDGER.
          * 3) The new line item might have been added to a gen that is
          *    not GEN% (which comes from the gen currently being
          *    displayed in the body of the order).
          *
          * This code will change the gen to a gen that has the lit billing
          * item on it so that UPDATE.LEDGER will updated correctly.
          *
          * Note: It is safe to use the first gen found for the lot billing
          * item because UPDATE.LEDGER will update ENTITY.DYNAM for every
          * gen that the lot billing line item is on.
          LOCATE LDID% IN LED(98)<1> SETTING LI.GEN THEN
             * LI.GEN will be the first gen that this lot item is on.
             GEN% = LI.GEN
          END

          OE.LOT.BILL.STATUS OID%,GEN%,LDID%,QSIGN%,VIEW.ONLY%
          OE.LI.UPDATE MAT OE.VARS

          GEN% = SAVE.GEN

          RETURN
*-------------------------------------------------------------------------*
TAG.CHECK:*** This prompts the user, making sure that they have the
          *** required tag & direct authorizations.

          OE.TAG.DISP ACT.ID,DATA,RESPS

          RETURN
*-------------------------------------------------------------------------*
DETAIL.LOT:*** This opens the detail lot assignment screen.
          SV.QUIT = QUIT
          OE.ASSIGN.LOT OID%,GEN%,LDID%
          QUIT    = SV.QUIT

          RETURN
*-------------------------------------------------------------------------*
QUICK.PRICE:*** This will allow the user to quickly price the current line
            *** item by pulling the price from a past sale of the same
            *** product.

          IF QO < 0               THEN RETURN ;* No Returns
          IF PRD(3) = '9'         THEN RETURN ;* No LotItems
          IF NOT(IS.PN)           THEN RETURN ;* No Comments/Subtotals
          IF LED(110)<1,1> = 'S'  THEN RETURN ;* No Consignment

          SOE.SELECT.PRICING OID%,GEN%,LDID%,QSIGN%,VIEW.ONLY%

          *** Disabale UET so Price Changes are not logged...
          SV1          = UET.ENABLED$
          SV2          = ABC.ENABLED$
          UET.ENABLED$ = ''
          ABC.ENABLED$ = ''
          OE.LI.UPDATE MAT OE.VARS
          UET.ENABLED$ = SV1
          ABC.ENABLED$ = SV2

          RETURN
*-------------------------------------------------------------------------*
DUP.ORDER:*** This opens up the duplicate order authorization screen and
          *** adds wether or not the user finds an authorization to the
          *** responces array.

          OID      = DATA<1,1>
          GEN      = DATA<1,2>
          OID.LIST = RAISE(DATA<1,3>)
          GEN.LIST = RAISE(DATA<1,4>)

          SOE.AUTH.DUP.ORDER GEN,OID.LIST,GEN.LIST,DUP.OK

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS> = ACT.ID
          RESPS<2,RESP.POS> = DUP.OK

          IF ABORT.OK THEN
             ABORTED = NOT(DUP.OK)
          END
          RETURN
*-------------------------------------------------------------------------*
PARENT.RETURN:
          PN   = DATA<1,1>
          RQTY = DATA<1,2>
          IF RQTY+0 = 0 THEN RQTY = 1
          PNS  = ''
          QTYS = ''
          READV REL.ITEM FROM PRDFILE,PN,143 ELSE REL.ITEM = ''
          CT = DCOUNT(REL.ITEM,VM)
          FOR I = 1 TO CT
             PNS<I>  = REL.ITEM<1,I,1>
             QTYS<I> = REL.ITEM<1,I,2> * RQTY
          NEXT I

          TAG.ITEM.SELECTION PNS,QTYS,PN

          RESP.POS = DCOUNT(RESPS<1>,VM)+1
          RESPS<1,RESP.POS>   = ACT.ID
          RESPS<2,RESP.POS,1> = LOWER(LOWER(LOWER(PNS)))
          RESPS<2,RESP.POS,2> = LOWER(LOWER(LOWER(QTYS)))

          RETURN
*-------------------------------------------------------------------------*
POE.MATRIX: *** This will open the POE Matrix Cell selection screen.

          IQTY     = DATA<1,1>
          BT.CN    = LED(1)<1,GEN%>
          ST.CN    = LED(5)<1,GEN%>
          PRC.DATE = LED(22)<1,GEN%>
          ACTION.CODE = 0

          * Open the screen.
          POE.SELECT.COST.MATRIX OID%,GEN%,BT.CN,ST.CN,PN,PRC.BR,IQTY,PRC.DATE,IQPRC,PRC.DATA,ACTION.CODE

          * Note: ACTION.CODE returns '1' if user made a selection.
          * If user selected a matrix other than the standard pricing,
          * add the selected IQPRC and PRC.DATA to responses array.
          * OE.PRICE.ITEM will use when pricing the item.
          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS>   = ACT.ID
          IF ACTION.CODE THEN
             RESPS<2,RESP.POS,1> = IQPRC
             RESPS<2,RESP.POS,2> = LOWER(PRC.DATA)
          END

          RETURN
*-------------------------------------------------------------------------*
POE.HEADER:*** This opens the poe header.

          DGEN    = DATA<1,1>
          NEW.GEN = DATA<1,2>

          MATBUILD SV.CUS  FROM CUS
          MATBUILD SV.CUSS FROM CUSS
          MATBUILD SV.LD FROM LD
          MATBUILD SV.OLD FROM OLD.LD
          POE.HEADER OID%,DGEN,LOG.MV%,YES,,'Body',,POST.ENTRY%
          MATPARSE CUS  FROM SV.CUS
          MATPARSE CUSS FROM SV.CUSS
          MATPARSE LD FROM SV.LD
          MATPARSE OLD.LD FROM SV.OLD
          GET.ALL.PRD PRC.BR,LD(1),QSIGN%
          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS>   = ACT.ID
          RESPS<2,RESP.POS>   = DGEN
          RESPS<2,RESP.POS,2> = NEW.GEN

          RETURN
*-------------------------------------------------------------------------*
AUTO.SHOW.AVAIL:*** Show the inventory at other branches

          PN     = DATA<1,1>
          STK.BR = DATA<1,2>

          AUTO.SHOW.AVAIL PN,STK.BR,QSIGN%,OID%,LDID%

          RETURN
*-------------------------------------------------------------------------*
CUS.PN.NEW:*** This opens the customer defined part number entry screen.

          OE.CUS.PN.ENTRY OID%,LDID%,LED(5)<1,GEN%>,LED(1)<1,GEN%>,CUSS(66),CUS.PN,CUS.LOC

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS> = ACT.ID
          RESPS<2,RESP.POS,1> = CUS.PN
          RESPS<2,RESP.POS,2> = CUS.LOC

          RETURN
*-------------------------------------------------------------------------*
VAL.SEL.UM:*** This validates the quantity entered by the user with ums

          DATA = RAISE(RAISE(DATA))
          MODE = DATA<1>
          UTBL = DATA<2>
          UQTY = DATA<3>
          Q1   = DATA<4>
          U1   = DATA<5>
          Q2   = DATA<6>
          U2   = DATA<7>

          VALIDATE.SELL.UM MODE,UTBL,UQTY,Q1,U1,Q2,U2,,,QS

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS>   = ACT.ID
          RESPS<2,RESP.POS>   = QS
          RESPS<2,RESP.POS,2> = Q1
          RESPS<2,RESP.POS,3> = U1
          RESPS<2,RESP.POS,4> = Q2
          RESPS<2,RESP.POS,5> = U2
          RESPS<2,RESP.POS,6> = ERR

          RETURN
*-------------------------------------------------------------------------*
PAF:      *** This opens the pass-along-frieght prompt.

          IF SHOULD.PROMPT.PAF% AND NOT(HAVE.PROMPTED.PAF%) THEN
             OE.PROMPT.PAF MAT OE.VARS, MAT PAF.DATA
          END

          RETURN
*-------------------------------------------------------------------------*
PROFIT.WHEEL:*** This opens the profit wheel screen to allow the user to
             *** choose a price/gp for a line item.

          * Determine the products sales um
          PRD.UM.PER = 0
          PRD.UM     = ''
          DFLT.PER.GET 'S',PRD.UM.PER,PRD.UM

          IF PRD.UM.PER < 1 THEN
             * Cannot continue if product does not have a per qty
             ERR.MESS 2,3,'Product is Missing Default Per Qty',YES
             ABORTED = YES
             RETURN
          END

          TCOST     = LD(10)<1,GEN%>
          QTY       = LD(4) * QSIGN%
          PRICE     = ICONV(DATA<1,1>,'MR3')

          OE.VE.PROFIT.WHEEL QTY,TCOST,PRICE

          IF F12 THEN ABORTED = YES

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS> = ACT.ID
          RESPS<2,RESP.POS> = PRICE

          RETURN
*-------------------------------------------------------------------------*
DROP.POINT:*** This routine lets the user know that theya can't delete a
           *** line item because of a drop point.  Also, it allows the
           *** user to enter drop point maint (if they want).

          TGN    = DATA<1,1>
          ANS    = ''
          MSG.ID = '%118':AM:LED(2)<1,TGN,2>

IN.DP:    INP.PROMPT ANS,MSG.ID,,1

          IF UPCASE(ANS) = 'E' THEN
             OE.DROP.POINT.MAINT OID%,TGN,VIEW.ONLY%
          END

          RETURN
*-------------------------------------------------------------------------*
PLNE.DT.MNT:*** This opens the price line dates screen to allow the user
            *** to edit/add effective dates.

          PLINE.DATE.MAINT DATA<1,1>

          RETURN
*-------------------------------------------------------------------------*
MULTI.BOX:***

          OE.MULTI.BOX OID,LDID,GEN

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS> = ACT.ID

          RETURN
*-------------------------------------------------------------------------*
RETURN.CHECK:*** This calls SOE.RETURN.CHECK so that the user can fill out
             *** the warrenty information for the return line item.

          LOCATE 'PIL.RET.TYP' IN RESPS<1> SETTING RESP.POS THEN
             *** This action is thrown from OE.PIL.CHECK.BODY (it is the
             *** menu table where the user selects the return type).
             RET.TYP = RESPS<2,RESP.POS>[1,1]
          END ELSE
             RET.TYP = ''
          END


          CN = LED(1)<1,GEN%>
          PLUMB =  TRANS('CUSTOMER',CN,210,'X')
          BR1.OH = TRANS('PROD.DYNAM',PN:"*1",1,'X') * -1
          BR2.OH = TRANS('PROD.DYNAM',PN:"*2",1,'X') * -1
          IF PN = '93733' THEN
          IF PLUMB="Yes" THEN
          ERR.MESS 8,10,"Customer no longer eligible for this promotion"
          END ELSE
          ERR.MESS 9,10,BR1.OH:' orders left in Greensboro. ':BR2.OH:' orders left in Winston.'
          WRITEV 'Yes' ON CUSFILE,CN,210
          END
          END






          *Yeah, this is no more than a hack that circumvents the problem
          *with out re-entrant architecture. In OE.CHECK.PIL.BODY, the
          *response is set so that this baby knows how to avoid poping
          *up the SOE return check
          NO.SOE.VERF = NO
          LOCATE 'NO.SOE.VERF.DISPLAY'IN RESPS<1> SETTING RPOS THEN
             NO.SOE.VERF = RESPS<2,RPOS>
             RESPS = DELETE(RESPS,1,RPOS)
             RESPS = DELETE(RESPS,2,RPOS)
          END
          IF NO.SOE.VERF THEN RETURN
             IF PN = '93733' THEN RETURN
          SOE.RETURN.CHECK OID%,GEN%,LDID%,1,REDISP,,RET.TYP

          *** Have to check for missing info only on gens where there are
          *** qtys...
          DEL.RETURN = NO
          RR.CT      = DCOUNT(LED(12),VM)
          FOR RR     = 1 TO RR.CT
             S5.CT   = DCOUNT(LD(5)<1,RR>,SVM)
             S6.CT   = DCOUNT(LD(6)<1,RR>,SVM)
             IF S5.CT > S6.CT THEN SS.CT = S5.CT ELSE SS.CT = S6.CT
             FOR SS  = 1 TO SS.CT
                IF (LD(5)<1,RR,SS>+LD(6)<1,RR,SS>+0) = 0 THEN CONTINUE
                IF FIELD(LD(7)<1,RR,SS>,'~',1) = '' THEN
                   DEL.RETURN = YES
                   EXIT
                END
             NEXT SS
             IF DEL.RETURN THEN EXIT
          NEXT RR

          IF DEL.RETURN THEN
             OE.DELETE.LINE MAT OE.VARS,YES
          END ELSE
             *** Disabale UET so Price Changes are not logged...
             SV  = UET.ENABLED$
             SV2 = ABC.ENABLED$
             UET.ENABLED$ = ''
             ABC.ENABLED$ = ''
             OE.LI.UPDATE MAT OE.VARS
             UET.ENABLED$ = SV
             ABC.ENABLED$ = SV2
          END

          IF REDISP THEN
             *** This flag lets OE know that it has to redisplay the order
             *** because SOE.RETURN.CHECK effected more than just the
             *** current line item.
             LOCATE 'REDISP.LI' IN RESPS<1> SETTING NOTHING ELSE
                RESPS<1,-1> = 'REDISP.LI'
             END
          END

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS> = ACT.ID

          RETURN
*-------------------------------------------------------------------------*
DUTY.INFO:*** This checks to see if the duty screen should be opened.
          IF NOT(IS.PN) THEN RETURN

          * Only call this routine if activated from the duty hotkey
          IF NOT(DATA<1,1>) THEN RETURN

          * If this is not set, system will set it to LD(77)
          DINFO = LD(77)<1,GEN%>
          OE.CUSTOMS.INFO OID%,GEN%,LDID%,LOG.MV%,QSIGN%,VIEW.ONLY%,DINFO

          * Redisplay to respect the change in line item freight if any
          LOCATE 'REDISP.LI' IN RESPS<1> SETTING NOTHING ELSE
             RESPS<1,-1> = 'REDISP.LI'
          END
          RETURN
*-------------------------------------------------------------------------*
PIL.AUTH: *** This will prompt the user letting them know that they might
          *** be adversly effecting their inventory levels and allowing
          *** them to stop.

          PIL.OID   = DATA<1,1>
          PIL.GEN   = DATA<1,2>
          PIL.PN    = DATA<1,3>
          ADDL.INFO = RAISE(RAISE(DATA<1,4>))
          PIL.OK    = DATA<1,5>
          GET.QTY   = DATA<1,6>
          CHK.AUTH  = YES

          LOCATE 'PIL.RET.TYP' IN RESPS<1> SETTING RESP.POS THEN
             * If return, don't check PIL authorization if not into stock.
             IF RESPS<2,RESP.POS>[1,1] # 'S' THEN CHK.AUTH = NO
          END

          IF CHK.AUTH THEN
             OE.AUTH.PIL PIL.OID,PIL.GEN,PIL.PN,ADDL.INFO,PIL.OK,GET.QTY
          END ELSE
             PIL.OK = YES
          END

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS>   = ACT.ID
          RESPS<2,RESP.POS,1> = GET.QTY
          RESPS<2,RESP.POS,2> = PIL.OK
          IF NOT(PIL.OK) THEN
             LDID%   = ''
             ABORTED = YES
          END

          RETURN
*-------------------------------------------------------------------------*
OE.AUTH.CERT:*** This will make sure that the required product
             *** certifications have authorized purchasers, or that the
             *** user has the authority to continue w/o authorized
             *** purchasors.

          CERT.REQS = RAISE(RAISE(DATA<1,1>))
          CERT.INFO = RAISE(RAISE(DATA<1,2>))

          OE.AUTH.CERT OID%,CERT.OK,CERT.REQS,CERT.INFO

          IF ABORT.OK THEN
             ABORTED = NOT(CERT.OK)
          END

          RESP.POS = DCOUNT(RESPS<1>,VM) + 1
          RESPS<1,RESP.POS>   = ACT.ID
          RESPS<2,RESP.POS,1> = CERT.OK

          RETURN
*-------------------------------------------------------------------------*
ADD.LI:   *** Add a line item to the ADD.LINES array.

          ADD.PN     = DATA<1,1>
          ADD.QO     = DATA<1,2>
          ADD.LRGST  = DATA<1,3>
          ADD.ALLOC  = DATA<1,4>
          ADD.INS    = DATA<1,5>
          ADD.LNUM   = DATA<1,6>
          PRC.OVRD   = DATA<1,7>
          CST.OVRD   = DATA<1,8>
          ADDL.DATA  = DATA<1,9>
          INIT.LDID  = DATA<1,10>
          SKIP.DUP   = DATA<1,11>

          OE.ADD.LINES ADD.LINES,ADD.PN,ADD.QO,ADD.LRGST,ADD.ALLOC,ADD.INS,ADD.LNUM,PRC.OVRD,CST.OVRD,ADDL.DATA,INIT.LDID,SKIP.DUP

          RETURN
*-------------------------------------------------------------------------*
PROD.WIZ: ***
          SUB.ID         = DATA<1,1>
          ADDL.DATA      = OID%
          ADDL.DATA<1,2> = GEN%
          ADDL.DATA<1,3> = LDID%
          ADDL.DATA<1,4> = QSIGN%
          CALL @SUB.ID(SUBR.RESULT,PN,ADDL.DATA)
          IF NOT(SUBR.RESULT) THEN
             OE.DELETE.LINE MAT OE.VARS,YES
          END ELSE
             ADD.LINES = ADDL.DATA
          END
          RETURN
*-------------------------------------------------------------------------*
POLE.DISP: *** Show line item info on the pole display

          FORMAT    = 'L'   ;* Format first line left justified
          FORMAT<2> = 'R'   ;* Format second line right justified
          POLE.DISP.PRINT RAISE(DATA),FORMAT

          RETURN
*-------------------------------------------------------------------------*
LOT.NEW.GEN: *** Create a new gen for the current (lot item) line item.

          OE.LOT.CREATE.GEN OID%,GEN%,LDID%,QSIGN%

          RETURN
*-------------------------------------------------------------------------*
DEL.LI:  *** Delete line from order
          SV.LDID = LDID%

          LDID% = DATA; * ldid that we want to delete from the order
          * Make sure we have the correct ld array before attempting to
          * delete the line
          LD.GET LDID%
          MAT OLD.LD = MAT LD

          OE.DELETE.LINE MAT OE.VARS,YES
          * Reset the ldid and ld array
          LDID% = SV.LDID
          LD.GET LDID%
          MAT OLD.LD = MAT LD

          RETURN
*-------------------------------------------------------------------------*
CHNG.QO:  *** Change order quantity for product

          INIT.LDID  = DATA<1,1>; * ldid to change qty for
          ADD.QO     = DATA<1,2>; * order qty to change to
          ADD.PN     = DATA<1,3>; * product number

          OE.ADD.LINES ADD.LINES,ADD.PN,ADD.QO,,,,,,,,INIT.LDID

          RETURN
*-------------------------------------------------------------------------*
SPLIT.QTY: *** Allow the user to split the quantity

          * Strip out the information necessary to display a prompt on
          * the screen.
          TXT  = DATA<1,1>     ;* Text to display
          VERF = RAISE(RAISE(DATA<1,2>))   ;* Verification
          CONV = DATA<1,3>     ;* Conversion
          LGTH = DATA<1,4>     ;* Length
          DFLT = DATA<1,5>     ;* Default Answer
          MTX  = DATA<1,6>     ;* Saved Matrix Data

          * Prompt the user to see if they wish to use split quantity
          * pricing.
          VAR = DFLT
IN$$1:    INP.PROMPT VAR,TXT,CONV,LGTH,VERF

          * Check the responses array
          RESP.POS = DCOUNT(RESPS<1>,VM) + 1

          * Enter the action of the answer in the responses array, as well
          * as the matrix information that has been parsed out of the
          * matrix array (MTX).
          RESPS<1,RESP.POS>   = ACT.ID
          RESPS<2,RESP.POS,1> = VAR
          RESPS<2,RESP.POS,2> = MTX

          RETURN
!TSMITH~04/24/13~10:27
