          SUBROUTINE (OID,GEN,LOG.MV,NEW.ORDER,REDISP,ESC.PATH,VIEW.ONLY,POST.ENTRY)
** Version# 69 - 02/08/2010 - 11:42am - BABS - main

*** Subroutine : POE.HEADER
*-------------------------------------------------------------------------*
*** OID       - The Current order ID                               [IN]
*** GEN       - The current generation/shipment being edited.      [IN]
*** LOG.MV    - VM Separated list of changed generations          [IN/OUT]
*** NEW.ORDER - Yes/No flag for whether this order is brand new    [IN]
*** REDISP    - After completion of this screen, is redisplay reqd (OUT)
*** ESC.PATH  - Word for the user to see the screen returning to on exit
***           - from this window                                   (IN)
*** VIEW.ONLY - Yes/No flag as to if the user can edit the order   [IN]
*** POST.ENTRY- Yes/No flag to say the user's using post order entry (IN)
*-------------------------------------------------------------------------*
*** Common : LED, CUS, CUSS
*-------------------------------------------------------------------------*
          $INCLUDE CC CBTST.EQUATES
          DIM CBTST.VARS(6)
          WINDOW 0,1,,,9,'POE.HEADER'
          PRINT @(67,18):'Esc-':ESC.PATH"L#8":

          * If we are not using Eclipse Forms, put the Print Style
          * input back on the screen.
          IF NOT(USE.ECLIPSE.FORMS$) THEN
             PRINT @(38,11):"Print Style     : "
          END

          GOSUB INIT
          GOSUB DISPLAY
          ATB.NUM   = ''
          ATB.DESCS = ''
          ATB.KEYS  = ''
          ATB.VALUE = ''

          * Check to see if we are entering with the ability to edit
          * the Header Screen in a Closed G/L Period. If so, check for
          * a lock on LEDGER. If there is one, default to View Only.
          OE.HEADER.UPD.VIEW.ONLY OID,,1,VIEW.ONLY

          BEGIN CASE
          CASE VIEW.ONLY = 2
             PRINT @(2,0):BLINK$:"Closed Period":NORM$:"ÍRemit To"
          CASE VIEW.ONLY
             PRINT @(2,0):BLINK$:"View Only":NORM$
             GOTO IN.SHP.INST
          END CASE

          BT.CN = LED(1)<1,GEN>
          ST.CN = LED(5)<1,GEN>
          IF LED(33)<1,GEN> THEN
             REMINDER.VIEW BT.CN,,11,80,23
             IF ST.CN # BT.CN THEN
                REMINDER.VIEW ST.CN,,11,80,23
             END
          END ELSE
             REMINDER.VIEW BT.CN,,5,80,23
             IF ST.CN # BT.CN THEN
                REMINDER.VIEW ST.CN,,5,80,23
             END
          END

          IF (VIEW.ONLY = 2) THEN
             GOTO IN.WITH
          END

          GOSUB CHK.WI
          GOSUB CHK.ID
          GOSUB CHK.FTERM
*-------------------------------------------------------------------------*
EDIT:     *
*-------------------------------------------------------------------------*
IN.BRCH:  LOCATE LED(2)<1,GEN,1> IN SECURITY<9> SETTING POS THEN
IN$$2:       INP.BR 18,7,4,BR,NAME,,'11'
             IF LED(2)<1,GEN,1>#BR THEN
                IF BR = '' OR (UPCASE(BR) = 'ALL') THEN
                   PRINT BELL
                   BR = LED(2)<1,GEN,1>
                   PRINT @(18,7):BR"L#4"
                   GOTO IN.BRCH
                END
                CRTL.ID = 'HEADER.BRANCH.COPY'
                READ COPY.BR FROM CTRLFILE,CRTL.ID ELSE COPY.BR = ''

                ***Displays prompt asking for where branch changes
                ***should be copied too.
                IF COPY.BR    = 'T' THEN
                   COPY.BR    = 'P'
                   COPY.LIST  = 'P - Price':VM:'A - All'
                   MSG = 'Copy Branch Change To: '
COPY.PRMT:         INP.PROMPT COPY.BR,MSG,'MCU',1,'D:':COPY.LIST
                   IF COPY.BR = '' THEN GOTO COPY.PRMT
                END

                KEY    = 'UPD.BRANCH'
                VALUE  = BR
                REDISP = YES
                ATB = 2
                ATB.DESC = 'Branch #'
                COPY.IT = NO
                GOSUB UPDATE
             END
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.ODATE,IN.ODATE,INADR3,IN.PO,IN.ODATE,IN.ODATE
*-------------------------------------------------------------------------*
IN.ODATE: INP B,18,8,10,'D4/'
          IF CHANGED THEN
             KEY       = 'UPD.ORDER.DATE'
             VALUE     = B
             ATB      = 4
             ATB.DESC = 'Date Ordered'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.ODATE,IN.ODATE,IN.BRCH,IN.TERMS,IN.WRTR,IN.WRTR
*-------------------------------------------------------------------------*
IN.WRTR:  CHECK.KEY 'POE.WRITER.EDIT',EDIT.OK
          IF EDIT.OK OR LED(73)<1,GEN>=USER.ID THEN
IN$$3:       INP B,18,9,10,'MCU',V_'INITIALS'
             IF CHANGED THEN
                KEY       = 'UPD.WRITER'
                VALUE     = B
                ATB      = 73
                ATB.DESC = 'Written By'
                GOSUB CHK.COPY.MODE
                GOSUB UPDATE
             END
          END ELSE IF MOVE=0 OR MOVE=1 THEN MOVE = 5

          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.WRTR,IN.WRTR,IN.ODATE,IN.FRT,IN.SRC,IN.SRC
*-------------------------------------------------------------------------*
IN.SRC:   INP B,18,10,20
          IF CHANGED THEN
             KEY      = 'UPD.ORDER.ID'
             VALUE    = B
             ATB      = 13
             ATB.DESC = 'Order ID'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.SRC,IN.SRC,IN.WRTR,IN.PHN,INJNAME,INJNAME
*-------------------------------------------------------------------------*
INJNAME:  INP JID,18,11,20,'TJOB.QUOTE;X;1;1',V_'S:VERF.LOT.ID,New'
          IF CHANGED THEN
             IF OCONV(JID,'MCU')='NEW' THEN
                QN = 'NEW'
                LOT.QUOTE.MAINT QN
                JID = QN
             END
             KEY      = 'UPD.JOB.NAME'
             VALUE    = JID
             ATB      = 95
             ATB.DESC = 'Job Bid Name'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END
          *** If not valid lot ID then when user F12's from field, delete
          *** invalid entry
          IF LED(95)<1,GEN> = '' THEN PRINT @(18,11):''   "L#20"

          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INJNAME,INJNAME,IN.SRC,IN.STYLE,IN.SHP.INST,IN.PO
*-------------------------------------------------------------------------*
IN.PO:    INP B,56,6,1,'YN'
          IF CHANGED THEN
             KEY       = 'UPD.PO'
             VALUE     = B
             ATB       = 67
             ATB.DESC  = 'Confirming P/O'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.PO,IN.BRCH,INADR3,IN.PO,IN.WITH,IN.WITH
*-------------------------------------------------------------------------*
IN.WITH:  INP B,56,7,20
          IF CHANGED THEN
             KEY      = 'UPD.ORDER.WITH'
             VALUE    = B
             ATB      = 68
             ATB.DESC = 'Ordered With'
             IF NOT(VIEW.ONLY) THEN
                GOSUB CHK.COPY.MODE
             END ELSE
                COPY.IT = NO
             END
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          IF (VIEW.ONLY = 2) THEN
             ON MOVE+1 GOTO IN.WITH,IN.WITH,IN.WITH,IN.WITH,IN.PHN,IN.PHN
          END ELSE
             ON MOVE+1 GOTO IN.WITH,IN.BRCH,IN.PO,IN.WITH,IN.TERMS
          END
*-------------------------------------------------------------------------*
IN.TERMS: INP B,56,8,12,'MCU',V_"S:VERF.INP.PTERMS"
          IF CHANGED THEN
             KEY      = 'UPD.PAYMENT.TERMS'
             VALUE    = B
             ATB      = 29
             ATB.DESC = 'Payment Terms'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.TERMS,IN.ODATE,IN.WITH,IN.TERMS,IN.FRT
*-------------------------------------------------------------------------*
IN.FRT:   INP B,56,9,23,V_"D:":FREIGHT.TERMS
          IF CHANGED THEN
             KEY      = 'UPD.FREIGHT.ALLOWED'
             VALUE    = B
             ATB      = 69
             ATB.DESC = 'Freight'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO IN.FRT, IN.WRTR, IN.TERMS, IN.FRT, IN.PHN
*-------------------------------------------------------------------------*
IN.PHN:   INP PHN,56,10,20
          IF CHANGED THEN
             KEY      = 'UPD.PHONE.NUMBER'
             VALUE    = PHN
             ATB      = 71
             ATB.DESC = 'Phone Number'
             IF NOT(VIEW.ONLY) THEN
                GOSUB CHK.COPY.MODE
             END ELSE
                COPY.IT = NO
             END
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          IF (VIEW.ONLY = 2) THEN
             ON MOVE+1 GOTO IN.PHN,IN.PHN,IN.WITH,IN.PHN,IN.STYLE,IN.STYLE
          END ELSE
             ON MOVE+1 GOTO IN.PHN,IN.SRC,IN.FRT,IN.PHN
          END
*-------------------------------------------------------------------------*
IN.STYLE: *** Input for the Print Style
          * If Eclipse Forms are enabled, we are not going to hit the
          * Print Style input. This logic will allow us to skip over it
          * and proceed to the next field gracefully.
          IF USE.ECLIPSE.FORMS$ THEN
             BEGIN CASE
             CASE (MOVE = 4); GOTO IN.OTHER.INST
             CASE (MOVE = 5); GOTO IN.OTHER.INST
             CASE OTHERWISE;  GOTO IN.PHN
             END CASE
          END
IN.STYL:  INP PSTYL,56,11,10,V_'PRINT.STYLES',H_"POE.HEADER~IN.STYLE"
          IF CHANGED THEN
             KEY      = 'UPD.PRINT.STYLE'
             VALUE    = PSTYL
             ATB      = 77
             ATB.DESC = 'Print Style'
             IF NOT(VIEW.ONLY) THEN
                GOSUB CHK.COPY.MODE
             END ELSE
                COPY.IT = NO
             END
             GOSUB UPDATE
          END

          IF QUIT THEN GOTO FILEIT
          IF (VIEW.ONLY = 2) THEN
             ON MOVE+1 GOTO IN.STYLE,IN.STYLE,IN.PHN,IN.STYLE,IN.OTHER.INST,IN.OTHER.INST
          END ELSE
             ON MOVE+1 GOTO IN.STYLE,IN.STYLE,IN.PHN,IN.STYLE,IN.OTHER.INST,IN.OTHER.INST
          END
*-------------------------------------------------------------------------*
IN.SHP.INST: *
          *** Need to reset the WP.INFO variable because otherwise it is
          *** still using the input from the previous word processing
          *** space.  We save and restore just to be safe.
          SV.WP.INFO = WP.INFO$
          WP.INFO$   = ''

          NEW.INST = LED(74)<1,GEN>
          CONVERT SVM TO VM IN NEW.INST
          OLD.INST = NEW.INST

IN$$4:    INPWP NEW.INST,1,13,38,4,99,'0110'
          GOSUB UPD.INST

          *** Restore your word processing info just to be safe.
          WP.INFO$ = SV.WP.INFO

          IF QUIT THEN
             IF (NOT(VIEW.ONLY) OR VIEW.ONLY = 2) THEN
                GOTO FILEIT
             END ELSE
                GOTO FINISH
             END
          END

          BEGIN CASE
          CASE NOT(VIEW.ONLY)
             ON MOVE+1 GOTO IN.SHP.INST,IN.SHP.INST,IN.SRC,IN.OTHER.INST,IN.SHP.INST,IN.SHP.INST
          CASE VIEW.ONLY = 2
             ON MOVE+1 GOTO IN.SHP.INST,IN.SHP.INST,IN.STYLE,IN.OTHER.INST,IN.SHP.INST,IN.SHP.INST
          CASE OTHERWISE
             ON MOVE+1 GOTO IN.SHP.INST,IN.SHP.INST,IN.SHP.INST,IN.OTHER.INST,IN.SHP.INST,IN.OTHER.INST
          END CASE
*-------------------------------------------------------------------------*
UPD.INST:*** If update is okay and instructions changed then update.

          IF (NOT(VIEW.ONLY) OR (VIEW.ONLY = 2)) THEN
             IF NEW.INST # OLD.INST THEN
                KEY      = 'UPD.SHIP.INSTRUCTIONS'
                VALUE    = LOWER(NEW.INST)
                ATB      = 74
                ATB.DESC = 'Vendor Instructions'
                IF NOT(VIEW.ONLY) THEN
                   GOSUB CHK.COPY.MODE
                END ELSE
                   COPY.IT = NO
                END
                GOSUB UPDATE
             END
          END

          RETURN
*-------------------------------------------------------------------------*
IN.OTHER.INST: *
          *** Need to reset the WP.INFO variable because otherwise it is
          *** still using the input from the previous word processing
          *** space.  We save and restore just to be safe.
          SV.WP.INFO = WP.INFO$
          WP.INFO$   = ''

          NEW.NOTE = LED(80)<1,GEN>
          CONVERT SVM TO VM IN NEW.NOTE
          OLD.NOTE = NEW.NOTE

IN$$5:    INPWP NEW.NOTE,40,13,38,4,99,'1100'
          GOSUB UPD.NOTE

          *** Restore your word processing info just to be safe.
          WP.INFO$ = SV.WP.INFO

          IF QUIT THEN
             IF (NOT(VIEW.ONLY) OR VIEW.ONLY = 2) THEN
                GOTO FILEIT
             END ELSE
                GOTO FINISH
             END
          END

          BEGIN CASE
          CASE NOT(VIEW.ONLY)
             ON MOVE+1 GOTO IN.OTHER.INST,IN.SHP.INST,IN.STYLE,IN.OTHER.INST,IN.OTHER.INST,IN.OTHER.INST
          CASE VIEW.ONLY = 2
             ON MOVE+1 GOTO IN.OTHER.INST,IN.SHP.INST,IN.STYLE,IN.OTHER.INST,IN.OTHER.INST,IN.OTHER.INST
          CASE OTHERWISE
             ON MOVE+1 GOTO IN.OTHER.INST,IN.SHP.INST,IN.OTHER.INST,IN.OTHER.INST,IN.OTHER.INST,IN.OTHER.INST
          END CASE
*-------------------------------------------------------------------------*
UPD.NOTE:*** If internal note changed then update.

          IF NEW.NOTE # OLD.NOTE THEN
             LOOP
                KEY      = 'UPD.NOTES'
                ATB      = 80
                ATB.DESC = 'Internal Notes'
                VALUE    = LOWER(NEW.NOTE)
                IF NOT(VIEW.ONLY) THEN
                   GOSUB CHK.COPY.MODE
                END ELSE
                   COPY.IT = NO
                END
                GOSUB UPDATE

                IF VALUE = '' THEN
                   ANS = NO
                END ELSE
                   ANS = 'N'
LOCK.INP:          INP.PROMPT ANS,VALUE,'YN',1
                END
             WHILE ANS DO REPEAT
          END

          RETURN
*-------------------------------------------------------------------------*
INIT:     QSIGN       = 1
          REDISP      = NO
          VIEW.ONLY   = VIEW.ONLY<1,1>
          COPY.BR     = ''
          UPD.DATA    = OID
          UPD.DATA<2> = GEN
          UPD.DATA<3> = VIEW.ONLY
          UPD.DATA<4> = LOG.MV

          POE.HEADER.UPD UPD.DATA,"INIT",,YES,,NEW.ORDER,POST.ENTRY,,

          NOTES.EDIT.OK = UPD.DATA<5>

          VERF.COPY = NO
          MENU.LOAD  2,18, 4,1,'A'
          MENU.LOAD  9,18, 7,1,'C'
          MENU.LOAD 19,18, 7,1,'S'
          MENU.LOAD 29,18, 5,1,'I'
          MENU.LOAD 37,18, 5,1,'N'
          MENU.LOAD 45,18,13,3,'P'

          *** figure out what the default setting should be for the copy
          *** changes function.
          READ COPY.CHGS FROM CTRLFILE,'OE.COPY.CHNGS' ELSE COPY.CHGS = ''
          IF COPY.CHGS THEN
             PRINT @(59,18): COPY.CHGS
             COPY.OPT = COPY.CHGS
          END ELSE
             PRINT @(59,18): 'Off'
             COPY.OPT = 'Off'
          END

          *** See if Ordered With/Order ID are req'd.
          NWIB = CUSS(45)<1,1>
          WI.CHK = (NWIB = 'W' OR NWIB = 'B')
          ID.CHK = (NWIB = 'I' OR NWIB = 'B')

          * Save initial vendor instructions and notes to check if they
          * changed and update prior to using the instr or note hotkeys.
          NEW.INST = LED(74)<1,GEN>
          CONVERT SVM TO VM IN NEW.INST
          OLD.INST = NEW.INST

          NEW.NOTE = LED(80)<1,GEN>
          CONVERT SVM TO VM IN NEW.NOTE
          OLD.NOTE = NEW.NOTE

          RETURN
*-------------------------------------------------------------------------*
UPDATE:   *
          UPD.DATA<10> = FREIGHT.TERMS
          UPD.DATA<11> = COPY.BR
          POE.HEADER.UPD UPD.DATA,KEY,VALUE,NO,ERR.MSG,NEW.ORDER,POST.ENTRY,COPY.IT,USING.FTERMS,,,UPD.ERR.MSG

          IF ERR.MSG THEN
             ERR.MESS 2,2,ERR.MSG
IN$$1:       INP ,2,2
          END

          IF (UPD.ERR.MSG # "") THEN
IN$$8:       INP.PROMPT ,UPD.ERR.MSG,,0
          END

          GOSUB DISPLAY

          RETURN
*-------------------------------------------------------------------------*
DISPLAY:  *** Display all of the POE Header information
          OE.DISP.BT.ST GEN

          *** Determine whether they're using specific freight terms or
          *** only using freight allowed logic
          READV FREIGHT.TERMS FROM CTRLFILE,"VENDOR.FREIGHT.TERMS",1 THEN
             USING.FTERMS  = YES
          END ELSE
             USING.FTERMS  = NO
             FREIGHT.TERMS = "Prepaid":VM:"Allowed"
          END

          IF USING.FTERMS THEN
             DISP.FREIGHT = LED(69)<1,GEN,1>
          END ELSE
             DISP.FREIGHT = FREIGHT.TERMS<1,(LED(69)<1,GEN,1>+1)>
          END

          BR          = LED(2)<1,GEN,1>
          ORN         = UPD.DATA<6>
          BR.DESC     = UPD.DATA<7>
          JOB.NAME    = UPD.DATA<8>
          TERMS.DESC  = UPD.DATA<9>


          PRINT @(18, 6):ORN                                 "L#14"
          PRINT @(18, 7):BR"L#4":'-':BR.DESC                 "L#15"
          PRINT @(18, 8):OCONV(LED(4)<1,GEN>,'D4/')          "L#10"
          PRINT @(18, 9):LED(73)<1,GEN>                      "L#10"
          PRINT @(18,10):LED(13)<1,GEN>                      "L#20"
          PRINT @(18,11):JOB.NAME                            "L#20"
          PRINT @(56, 6):YN[LED(67)<1,GEN>+1,1]              "L#1"
          PRINT @(56, 7):LED(68)<1,GEN>                      "L#20"
          PRINT @(56, 8):LED(29)<1,GEN>                      "L#12"
          PRINT @(68, 8):TERMS.DESC                          "L#10"
          PRINT @(56, 9):DISP.FREIGHT                        "L#23"
          PRINT @(56,10):LED(71)<1,GEN,1>                    "L#20"

          * If we are using Eclipse Forms, we will not print the
          * Print Style. If they are disabled, go ahead and print it
          * out.
          IF NOT(USE.ECLIPSE.FORMS$) THEN
             PRINT @(56,11):LED(77)<1,GEN>                   "L#10"
          END

          IF NOT(LED(73)<1,GEN>) AND LED(30)<1,GEN> = 'EDI' THEN
             MESS 1,6,BELL:'Written by field is not set'
          END

PRT.CMTS: SHP.INST = LED(74)<1,GEN>
          JID      = LED(95)<1,GEN>
          CT = DCOUNT(SHP.INST,SVM)
          IF CT<4 THEN CT=4
          IF CT>4 THEN CT=4; PRINT @(33,17):'More'
          FOR J=1 TO CT
             PRINT @(1,12+J):SHP.INST<1,1,J>                    "L#38"
          NEXT J

          OTHER.INST = LED(80)<1,GEN>
          CT = DCOUNT(OTHER.INST,SVM)
          IF CT>4 THEN PRINT @(70,17):'More'
          FOR J = 1 TO 4
             PRINT @(40,12+J):OTHER.INST<1,1,J>                 "L#38"
          NEXT J
          RETURN
*-------------------------------------------------------------------------*
CHNG.BT:  * Change the ShipFrom/RemitTo.

          MESS 30,5,'Enter new Pay/Ship From or press <ESC> to Exit'
          PRINT @(41,1):''"L#35"

          PREV.BT = LED(1)<1,GEN>
          PREV.ST = LED(5)<1,GEN>
          BR      = LED(2)<1,GEN,1>

          POE.SELECT.VEN BR,BT.CN,ST.CN
          IF QUIT THEN GOTO ABORT.CHNG
          IF PREV.BT # BT.CN OR PREV.ST # ST.CN THEN
             MSGS    = ""
             RESPS   = ""
             REENTRY = NO
             AUD.CLSD.GNS            = ''
             ORDER.INFO              = ""
             ORDER.INFO<CBTST.OID%>  = OID
             ORDER.INFO<CBTST.GEN%>  = GEN
             ORDER.INFO<CBTST.BR%>   = BR
             ORDER.INFO<CBTST.BTCN%> = BT.CN
             ORDER.INFO<CBTST.STCN%> = ST.CN
             ORDER.INFO<CBTST.QSIGN%>= QSIGN
             * This section will ask user all relevant questions about
             * changing the bill to or the ship to on this order
             LOOP
                OE.CHG.BT.ST.CHK ORDER.INFO,LOG.MV,IDS.TO.CHNG,MSGS,RESPS,REENTRY,,AUD.CLSD.GNS
                IF MSGS THEN
                   ACTION.DISPLAY MSGS,ABORTED,RESPS
                END
                WHILE REENTRY AND NOT(ABORTED)
             REPEAT
             CHNG.ERR = ABORTED

             IF NOT(ABORTED) THEN
                * Update the bill to/ship to information
                OE.CHG.BT.ST.UPD ORDER.INFO,LOG.MV,IDS.TO.CHNG,MSGS,RESPS,AUD.CLSD.GNS
             END ELSE
                GOTO ABORT.CHNG
             END
          END

          *** See if Ordered With/Order ID are req'd.
          NWIB = CUSS(45)<1,1>
          WI.CHK = (NWIB = 'W' OR NWIB = 'B')
          ID.CHK = (NWIB = 'I' OR NWIB = 'B')

          LED(78)<1,GEN,6> = ''

          GOSUB DISPLAY
          REDISP = YES

*-------------------------------------------------------------------------*
INADR1:   INP B,41,2,35
          IF CHANGED THEN
             KEY      = 'UPD.ADDR1'
             VALUE    = B
             ATB.DESC = 'Address'
             ATB      = 78
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INADR1,INADR1,CHNG.BT,INADR1,INADR2,INADR2
*-------------------------------------------------------------------------*
INADR2:   INP B,41,3,35
          IF CHANGED THEN
             KEY      = 'UPD.ADDR2'
             VALUE    = B
             ATB      = 78
             ATB.DESC = 'Address'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INADR2,INADR2,INADR1,INADR2,INADR3,INADR3
*-------------------------------------------------------------------------*
INADR3:   INP SRCH.ID,41,4,16,'MCU'
          IF SRCH.ID = '' THEN GOTO INADR3
          IF CHANGED THEN
             SV.SRCH.ID = SRCH.ID
             ZIP.CODE.GET SRCH.ID,CITY,ST,ZIP,TAXJUR
             IF SRCH.ID = '' THEN GOTO INADR3
             LED(78)<1,GEN,3> = CITY[1,22]:','
             LED(78)<1,GEN,3> = LED(78)<1,GEN,3> "L#23 ":ST "L#3"
             LED(78)<1,GEN,4> = CITY
             LED(78)<1,GEN,5> = ST
             LED(75)<1,GEN>   = ZIP
             OE.GET.TAXJUR OID,GEN
             GOSUB DISPLAY
          END
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INADR3,INADR3,INADR2,INADR3,IN.PO,IN.PO
*-------------------------------------------------------------------------*
ABORT.CHNG:  * Undo the possible changes made in Poe.Select.Ven
          BT.CN = PREV.BT
          ST.CN = PREV.ST
          * Need to re-read CUS and CUSS because the "old" values get
          * clobbered in OE.CHANGE.BT.ST.
          GET.CUS BR,BT.CN,ST.CN,QSIGN
          LED(78)<1,GEN,6> = ''
          OE.DISP.BT.ST GEN
          GOTO INADR1
*-------------------------------------------------------------------------*
SUBS:     ON OPTION GOTO ADDL,CHANGE.LOG,SHIP.TO,INSTR,NOTES,COPY.TOGGLE
*-------------------------------------------------------------------------*
SHIP.TO: *
          CHG.SHIP.TO GEN
          RETURN
*-------------------------------------------------------------------------*
BODY:     IF VIEW.ONLY THEN RETURN
          MOVE = 2
          RETURN TO FILEIT
*-------------------------------------------------------------------------*
ADDL:     * POE header additional info
          TMP.ADDR.INFO = LED(78)
          POE.HEADER.ADDL.KEYS OID,GEN,VIEW.ONLY
          IF TMP.ADDR.INFO<1,1,1> # LED(78)<1,GEN,1> THEN
             ATB.DESC = 'Address'
             ATB   = 78
             KEY   = 'UPD.ADDR1'
             VALUE = LED(78)<1,GEN,1>
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END
          IF TMP.ADDR.INFO<1,1,2> #LED(78)<1,GEN,2> THEN
             ATB.DESC = 'Address'
             ATB   = 78
             KEY   = 'UPD.ADDR2'
             VALUE = LED(78)<1,GEN,2>
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END
          IF TMP.ADDR.INFO<1,1,7> # LED(78)<1,GEN,7> THEN
             ATB.DESC = 'Address'
             ATB   = 78
             KEY   = 'UPD.ADDLADD'
             VALUE = LED(78)<1,GEN,7>
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END
          IF TMP.ADDR.INFO<1,GEN,6> # LED(78)<1,GEN,6>  THEN
             *** check to see if they changed the name
             ATB.DESC = 'Name'
             ATB      = 78
             VALUE    = LED(78)<1,GEN,6>
             KEY      = 'UPD.NAME'
             GOSUB CHK.COPY.MODE
             GOSUB UPDATE
          END
          OE.DISP.BT.ST GEN
          REDISP = YES
          RETURN
*-------------------------------------------------------------------------*
CHANGE.LOG: *
          OE.VIEW.COMMENTS OID,GEN
          RETURN
*-------------------------------------------------------------------------*
INSTR:    *** Input instructions

          * Update instructions and/or notes if changed prior to
          * adding an instruction from the hotkey.
          GOSUB UPD.INST
          GOSUB UPD.NOTE

          NEW.INST = LED(74)<1,GEN>
          CONVERT SVM TO VM IN NEW.INST
          OLD.INST = NEW.INST

          ENTITY.STD.CMTS.DISP 'V',74,GEN,ABRT

          IF ABRT THEN
             RETURN
          END ELSE
             NEW.INST = LED(74)<1,GEN>
             CONVERT SVM TO VM IN NEW.INST
             GOSUB UPD.INST
             GOSUB PRT.CMTS
             RETURN TO IN.SHP.INST
          END
*-------------------------------------------------------------------------*
NOTES:    *** Input notes

          * Update instructions and/or notes if changed prior to
          * adding a note from the hotkey.
          GOSUB UPD.INST
          GOSUB UPD.NOTE

          NEW.NOTE = LED(80)<1,GEN>
          CONVERT SVM TO VM IN NEW.NOTE
          OLD.NOTE = NEW.NOTE

          ENTITY.STD.CMTS.DISP 'V',80,GEN,ABRT

          IF ABRT THEN
             RETURN
          END ELSE
             NEW.NOTE = LED(80)<1,GEN>
             CONVERT SVM TO VM IN NEW.NOTE
             GOSUB UPD.NOTE
             GOSUB PRT.CMTS
             RETURN TO IN.OTHER.INST
          END
*-------------------------------------------------------------------------*
COPY.TOGGLE: *** toggle between the three options for copying changes to
             *** all gens

          OPT.LIST = 'On':VM:'Off':VM:'Prompt'
IN.OPT:   INP COPY.OPT,59,18,6,V_'D:':OPT.LIST
          RETURN
*-------------------------------------------------------------------------*
CHK.COPY.MODE: *** figures out what copy mode we are in and copys
               *** to all gens accordingly.
          BEGIN CASE
          CASE COPY.OPT = 'On'
             COPY.IT = YES
          CASE COPY.OPT = 'Prompt'
             COPY.IT = NO
             LOCATE ATB.DESC IN ATB.DESCS SETTING POS THEN
                LOCATE KEY IN ATB.KEYS<POS> SETTING KPOS THEN
                   ATB.VALUE<POS,KPOS> = VALUE
                END ELSE
                   ATB.KEYS <POS,-1>   = KEY
                   ATB.VALUE<POS,-1>   = VALUE
                END
             END ELSE
                ATB.NUM  <POS>   = ATB
                ATB.DESCS<POS>   = ATB.DESC
                ATB.KEYS <POS>   = KEY
                ATB.VALUE<POS>   = VALUE
             END
          CASE OTHERWISE
             COPY.IT = NO
          END CASE
          RETURN
*-------------------------------------------------------------------------*
CHK.WI:   *** Check to see if the Ordered With is req'd.
          STAT = LED(6)<1,GEN>
          IF STAT # 'B' AND STAT # 'X' AND LED(68)<1,GEN> = '' THEN
             IF WI.CHK THEN
                ERR.MESS 40,9,BELL:'Ordered With is Required'
                RETURN TO IN.WITH
             END
          END

          RETURN
*-------------------------------------------------------------------------*
CHK.ID:   *** Check to see if the Order id is req'd.
          STAT = LED(6)<1,GEN>
          IF STAT # 'B' AND STAT # 'X' AND LED(13)<1,GEN> = '' THEN
             IF ID.CHK THEN
                ERR.MESS 40,9,BELL:'Order ID is Required'
                RETURN TO IN.SRC
             END
          END

          RETURN
*-------------------------------------------------------------------------*
CHK.FTERM:   *** Verify that valid freight terms code was entered
          IF USING.FTERMS AND LED(69)<1,GEN,1>='' THEN
             ERR.MESS 38,7,BELL:'Freight Terms Are Required'
             RETURN TO IN.FRT
          END

          IF USING.FTERMS THEN
             *** If Freight terms changed then log it.
             IF OLED(69)<1,GEN,1> # LED(69)<1,GEN,1> THEN
                CMNT  = 'Changed Freight Terms from '
                CMNT := OLED(69)<1,GEN,1>:' to ':LED(69)<1,GEN,1>
                OE.ADD.COMMENT OID,GEN,CMNT
             END
          END
          RETURN
*-------------------------------------------------------------------------*
PROMPT.COPY.MODE: *** checks to see if we are in copy mode and if we are
                  *** then we will display the screen and allow users
                  *** to choose which items to copy over to all gens

          IF OID[1,1] = 'S' THEN
             GEN.CT = 0
          END ELSE
             GEN.CT = DCOUNT(LED(9),VM)
          END
          IF GEN.CT>1 AND COPY.OPT = 'Prompt' AND ATB.NUM THEN
             CPY.CHNGS = ''
             MATBUILD LED.REC FROM LED
             OE.HEADER.COPY.CHANGES ATB.NUM,ATB.DESCS,LED.REC,GEN,CPY.CHNGS
             ATB.CNT = DCOUNT(ATB.NUM,AM)
             FOR ATB = 1 TO ATB.CNT
                IF CPY.CHNGS<ATB> THEN
                   KEY.CNT = DCOUNT(ATB.KEYS,VM)
                   FOR KK = 1 TO KEY.CNT
                      KEY   = ATB.KEYS<ATB,KK>
                      VALUE = ATB.VALUE<ATB,KK>
                      COPY.IT = YES
                      GOSUB UPDATE
                   NEXT KK
                END
             NEXT ATB
          END

          RETURN
*-------------------------------------------------------------------------*
FILEIT:   *
          IF NOT(VIEW.ONLY) THEN
             GOSUB CHK.WI
             GOSUB CHK.ID
             GOSUB CHK.FTERM
             GOSUB PROMPT.COPY.MODE
          END
          IF F12 THEN
             IF (VIEW.ONLY = 2) THEN
                MAT LED = MAT OLED
                GOTO FINISH
             END ELSE
                QUIT = NO; F12 = NO
                PRINT BELL:; GOTO EDIT
             END
          END

          BEGIN CASE

          * VIEW.ONLY = 2 means we are in a Closed G/L Period but a
          * special update is allowed
          CASE (VIEW.ONLY = 2)

             * Attempt to update the order
             OE.HEADER.UPD.VIEW.ONLY OID,GEN,2,VIEW.ONLY,ERR.MSG

             * Display any errors encountered
             IF (ERR.MSG # "") THEN
IN$$6:          INP.PROMPT ,ERR.MSG,,0
             END
             GOTO FINISH

          CASE NOT(VIEW.ONLY)
             GEN.MV2 = GEN
             UPDATE.LEDGER OID,GEN.MV2
          END CASE
*-------------------------------------------------------------------------*
FINISH:   WINDOW.CLOSE
          RETURN
*-------------------------------------------------------------------------*
!BABS~02/08/10~11:42
