          SUBROUTINE (PASSER)
** Version# 50.0302[20] - 02/15/2010 - 11:13pm - SMITJR - eclipse
** Copied from BP WHSE.PICK.CONFIRM Version# 50.03 - 07/03/2007 - 09:25am - EJO - r8.0base
*** V50.0302 Change - Custom Coding CUSOTM - 02/15/2010 - SMITJR - eclipse
*** V50.03 Change - No Develop Ver Yet CUQ367 - 07/03/2007 - EJO - r8.0base
*** V50.02 Change - No Develop Ver Yet CTQ072 - 11/20/2006 - EILEENM - r8.0base
*** V50.01 Change - Add FULL Ver 53 - 03/08/2006 - EILEENM - r8.0base

*** Subroutine: WHSE.PICK.CONFIRM
*-------------------------------------------------------------------------*
*** This routine will allow users to manually change review queue
*** statuses.
*-------------------------------------------------------------------------*
*** PASSER - Not used                                             [IN]
*-------------------------------------------------------------------------*

          UT.OPEN.FILE 'MANIFESTS',MNFSTFILE,ERR.MSG,YES
          IF ERR.MSG THEN RETURN

          SCREEN
          VSCROLL.ROWS = 4
          VSCROLL.DEFINE 1,1,11,65,VSCROLL.ROWS,'WHSE.PICK.CONFIRM'
          VSCROLL.SET 1
          LAST.MODE = ''
*-------------------------------------------------------------------------*
START:    *
          CLEAR.SCREEN
          GOSUB INIT
*-------------------------------------------------------------------------*
IN.OID:   INP ID,18,1,14,'MCU'
          IF HELP AND ID='' THEN
             HIST.OPT = 1
             IF LAST.MODE = 'T' THEN
                HIST.OPT = 3
             END
             USER.VIEW.HISTORY HIST.OPT,ID
          END
          VIEW.ONLY = NO
          VONLY.MSG = ''
          IF QUIT THEN GOTO FINISH
          OID  = FIELD(ID,'.',1)
          INVN = FIELD(ID,'.',2)+0
          MATREAD LED FROM LEDFILE,OID ELSE PRINT BELL:; GOTO IN.OID
          LOCATE INVN IN LED(8)<1> SETTING GEN ELSE
             OE.SELECT.SHIPDATE OID,GEN,,NO
             IF GEN+0=0 THEN GOTO IN.OID
          END
          IF LED(6)<1,GEN> = '$' OR LED(6)<1,GEN> = 'X' OR LED(6)<1,GEN> = 'Y' THEN
             PRINT BELL:
             GOTO IN.OID
          END
          STK.BR = LED(2)<1,GEN,2>

          READ LEDL FROM LEDLFILE,OID ELSE LEDL = ''
*-------------------------------------------------------------------------*
ID.VER:  *
          READV SFLAG FROM CTRBFILE,'SERIAL.PROMPT~':STK.BR,1 ELSE
             SFLAG = ''
          END

          OE.WHQ.MODE OID,GEN,UPD.WHQ,YES

          MODE        = OID[1,1]
          LAST.MODE   = MODE

          OE.GET.QSIGN QSIGN,OID,GEN
          PRC.BR   = LED(2)<1,GEN,1>
          BR       = LED(2)<1,GEN,2>
          BT.CN    = LED(1)<1,GEN>
          ST.CN    = LED(5)<1,GEN>
          SHIP.VIA = LED(70)<1,GEN>
          READ SVIA FROM SVIAFILE,SHIP.VIA ELSE SVIA = ''
          AUTO.LOAD.MANIFEST = SVIA<9,4>
          GET.CUS BR,BT.CN,ST.CN,QSIGN
          INVN = LED(8)<1,GEN>
          IF INVN THEN
             ORN = OID:'.':INVN'R%3'
             ORDER.ID = ORN
          END ELSE
             ORN = OID
             ORDER.ID = OID:'.':LED(12)<1,GEN>'R%4'
          END

          GOSUB GET.PKG.DATA

          SLIST = ''
          GOSUB GET.SLIST

*** Need to read standard values.  Replace status variables if null.
          * Read valid inprocess status for this shipvia
          * 1st check at branch level.  If not at branch level
          * then check at shipvia level
          OE.SV.STATUS.GET LED(2)<1,GEN,2>,LED(70)<1,GEN>,STAT.STR

          STAT.CNT = DCOUNT(STAT.STR,VM)
          IF TRIM(STAT.STR<1,1>) = '' THEN
             EMSG = 'No Valid Inprocess Statuses Defined.'
             EMSG<-1> = 'Cannot Continue, <Return> '
             ERR.MESS 1,1,EMSG
IN$$2:       INP A,27,2,1
             GOTO IN.OID
          END
          BEGIN CASE
          CASE MODE = 'S' AND LED(6)<1,GEN> # 'I'
             STAT      = ''
             NEXT.STAT = STAT.STR<1,1>
          CASE MODE = 'T' AND LED(6)<1,GEN> # 'S'
             STAT      = ''
             NEXT.STAT = STAT.STR<1,1>
          CASE OTHERWISE
             IF STAT = '' THEN
                STAT = STAT.STR<1,1>
                NEXT.STAT = STAT.STR<1,2>
             END ELSE
                UC.STAT.STR = UPCASE(STAT.STR)
                LOCATE UPCASE(STAT) IN UC.STAT.STR<1> SETTING POS THEN
                   NEXT.STAT = STAT.STR<1,POS+1>
                END ELSE
                   NEXT.STAT = ''
                END
             END
             IF TRIM(NEXT.STAT) = '' AND NOT(VIEW.ONLY) THEN
                NEXT.STAT = 'CLOSE'
             END
          END CASE

          GOSUB CHECK.AUTH
          IF NOT(AUTH.OK) THEN RETURN
          GOSUB LOAD.HOTKEYS
          GOSUB DISPLAY
          IF VIEW.ONLY THEN
             IF VONLY.MSG THEN
                MESS 10,10,BELL:VONLY.MSG
                VONLY.MSG = ''
             END
             GOTO IN.OID
          END
*-------------------------------------------------------------------------*
INUSER:   INP PICKER,24,6,10,V_'INITIALS'
          IF QUIT THEN GOTO FILEIT
          ON MOVE+1 GOTO INUSER,INUSER,INUSER,INUSER
*-------------------------------------------------------------------------*
          LINE = 1; COL = 1; MOVE = 0; LASTKEY = 0; QUIT = 0
          IF DISP.HDR THEN
             COLS = 7
          END ELSE
             COLS = 5
          END
*-------------------------------------------------------------------------*
MOVENEXT: *
          IF QUIT THEN
             MOVE = 0; LASTKEY = 0
             GOTO FILEIT
          END
          LINES = DCOUNT(TLOCS,AM)
          DNOK = (LINE <= LINES)
          PARSEMOVE COL,LINE,COLS,VSCROLL.ROWS,4,DNOK,DNOK,BORDERMOVE
          IF BORDERMOVE = 2 THEN GOTO INUSER

          * Disallow pkg data if no staging location
          IF TLOCS<LINE> = '' THEN
             MOVE = 0
             COL  = 1
          END
          ON COL GOTO INSTG, INPKG, INPKG, INPKG, INPKG, INQTY, INTRKR
*-------------------------------------------------------------------------*
INSTG:    INP STAGING.LOC,1,11,12,V_'STAGING.LOC'
          IF F12 THEN GOTO FILEIT
          IF STAGING.LOC # TLOCS<LINE> THEN
             IF STAGING.LOC = '' THEN
                IF TRIM(TPKGS<LINE>,VM) # '' OR TQTYS<LINE>+0 # 0 OR TRKIDS<LINE> # '' THEN
                   PRINT BELL:
                   STAGING.LOC = TLOCS<LINE>
                   VPRINT 0,LINE,STAGING.LOC "L#12"
                   GOTO INSTG
                END
             END
             TOTES<LINE> = PICKER
             TLOCS<LINE> = STAGING.LOC
          END
          GOTO MOVENEXT
*-------------------------------------------------------------------------*
INPKG:    *
IN$$3:    INPV TEMP,13+(COL-2)*8,LINE,6,'R'
          IF F12 THEN GOTO FILEIT

          IF TEMP # TPKGS<LINE,COL-1> THEN
             TPKGS<LINE,COL-1> = TEMP
          END
          GOTO MOVENEXT
*-------------------------------------------------------------------------*
INQTY:    INPV TEMP,45,LINE,8,'R'
          IF F12 THEN GOTO FILEIT

          TQTYS<LINE>  = TEMP
          GOTO MOVENEXT
*-------------------------------------------------------------------------*
INTRKR:   INPV TEMP,55,LINE,9
          IF F12 THEN GOTO FILEIT

          TRKIDS<LINE> = TEMP
          GOTO MOVENEXT
*-------------------------------------------------------------------------*
SUBS:     *
          DRPT = ''
          ON OPTION GOTO CONFIRM, PRT.CPY, VIEW.OID, VIEW.OID, LBL.PRT, INPROC, FGHT, READY.MNFST, MNFST.COMMENTS, EDIT.MNFST, SER.NUM
*-------------------------------------------------------------------------*
CONFIRM.PACK:  *** User is confirming the order into PACKING status

          USE.PACK  = 'Y'
          PK.ENABLE = NO
          READV PMODE FROM CTRLFILE,'PACK.WHSE.CONF',1 ELSE PMODE = ''

          PACK.ENABLED STK.BR,LED(70)<1,GEN>,PK.ENABLE
          IF NOT(PK.ENABLE) THEN RETURN

          BEGIN CASE
             CASE PMODE = 'Prompt'
IN$$11:         INP.PROMPT USE.PACK,"Use Order Packing to pack this order? (Y/N) : ",'YN',1
             CASE PMODE = 'Auto Popup'
                USE.PACK = 'Y'
             CASE OTHERWISE
                RETURN
          END CASE

          IF USE.PACK THEN
             VAR    = OID
             VAR<2> = GEN
             PACK.MAINT VAR
          END

          RETURN
*-------------------------------------------------------------------------*
CONFIRM:  *
          LOG.CMT = 'IP status changed'
          LOG.CMT = LOG.CMT:' from ':STAT:' to ':NEXT.STAT:' by ':PICKER
          OE.ADD.COMMENT OID,GEN,LOG.CMT

          IF NEXT.STAT = 'SIGNATURE' THEN
             ** Start Signature Capture application
             EPAD.APP.START OID,GEN

             ** Advance immediately to next status.
             STAT = NEXT.STAT
             LOCATE NEXT.STAT IN STAT.STR<1> SETTING POS ELSE NULL
             NEXT.STAT = STAT.STR<1,POS+1>
             IF TRIM(NEXT.STAT) = '' THEN NEXT.STAT = 'CLOSE'
             GOSUB DISPLAY
             GOTO CONFIRM
          END

          GOSUB UPD.PKG.DATA
          IF NEXT.STAT # 'CLOSE' AND NEXT.STAT # 'SIG-CLOSE' THEN
             IF NEXT.STAT[1,4] = 'PICK' THEN
                PRVW<10> = PICKER
                * add log info
                LPOS = DCOUNT(PRVW<22>,VM)+1
                PRVW<22,LPOS,1> = "TOE.PH.PRINT.BATCH"
                PRVW<22,LPOS,2> = DATE()
                PRVW<22,LPOS,3> = INT(TIME())
                PRVW<22,LPOS,4> = "Updated picker "
                OE.LOCK.LED OID,LOCK.MSG,YES
                IF NOT(LOCK.MSG) THEN
                   MAT OLED = MAT LED
                   LED(66)<1,GEN> = PICKER
                   UPDATE.LEDGER OID,GEN
                   OE.UNLOCK.LED OID
                END
             END
             IF NEXT.STAT = 'PACKING' THEN
                GOSUB CONFIRM.PACK
             END
             GOSUB UPD.PRVW
             OE.ORDER.STATUS.UPD OID,GEN,NEXT.STAT,ERR.MSG
             STAT = NEXT.STAT
             LOCATE STAT IN STAT.STR<1> SETTING POS ELSE NULL
             NEXT.STAT = STAT.STR<1,POS+1>
             IF TRIM(NEXT.STAT) = '' THEN NEXT.STAT = 'CLOSE'

             PRINT @(24,7):STAT      "L#13"
             PRINT @(52,7):NEXT.STAT "L#13"

             VAR = ''
             MSG = 'Order# ':OID:' Status Confirmed to ':STAT:'.'
             MSG<-1> = 'Next Status ':NEXT.STAT:'.  <Return> '
             MSG = MSG:BELL
IN$$1:       INP.PROMPT VAR,MSG
             IF NEXT.STAT = 'MANIFEST' AND AUTO.LOAD.MANIFEST THEN
                READ PRVW FROM PRVWFILE,RVW.ID ELSE PRVW = ''
                OLD.PRVW = PRVW
                GOTO CONFIRM; * Confirm directly to MANIFEST
             END

          END ELSE
             * Close from PRINT.REVIEW file if closed
             GOSUB UPD.PRVW; * Update PRINT.REVIEW record with pkg data
             SN.AUTO.CLOSE = YES
             GOSUB SER.NUM
             SN.AUTO.CLOSE = NO
             CASH.RQ = SVIA<5>
             IF MODE = 'S' AND CASH.RQ = 'P' THEN
                GOSUB CHECK.CASH; * Check for cash required
             END
             DONE = NO
             LOOP UNTIL DONE DO
                ANS = ''
IN$$8:          INP.PROMPT ANS,"Do you want to print a ship ticket now? (Y/N) : ",'MCU',1
                IF F12 OR ANS = 'Y' OR ANS = 'N' THEN
                   DONE = YES
                END
             REPEAT

             * If aborting out of print then abort out of close also.
             IF F12 THEN
                RETURN
             END

             IF ANS = 'Y' THEN
                BEGIN CASE
                CASE MODE = 'S'
                   NUM.PGS = ''
                   SOE.PRINT.ORDER OID,GEN,NUM.PGS,'O'
                CASE MODE = 'T'
                   TOE.PRINT.ORDER OID,GEN,,'O'
                END CASE
             END
             *
             IF NEXT.STAT = 'SIG-CLOSE' THEN
                EPAD.APP.START OID,GEN
             END
             * Close out print.review record
             DELETE PRVWFILE,RVW.ID

          END


          IF TTY.RELOG% THEN RELOG.NOW = YES; RETURN TO FINISH

          RETURN TO START
*-------------------------------------------------------------------------*
GET.PKG.DATA:*** Get packing data

          *** Read values from PRINT.REVIEW file if record exists
          RVW.ID = OID:'.':LED(12)<1,GEN>"R%4"
          READ PRVW FROM PRVWFILE,RVW.ID THEN
             GOSUB SET.VONLY
             STAT    = PRVW<1>
             PICKER  = PRVW<10>
             TOTES   = RAISE(RAISE(PRVW<11>))
             TLOCS   = RAISE(RAISE(PRVW<13>))
             TPKGS   = RAISE(RAISE(PRVW<14>))
             TRKIDS  = RAISE(RAISE(PRVW<20>))
             TQTYS   = RAISE(RAISE(PRVW<21>))

             IF TLOCS  = '' THEN
                TOTES  = RAISE(RAISE(LEDL<21,GEN>))
                TLOCS  = RAISE(RAISE(LEDL<22,GEN>))
                TPKGS  = RAISE(RAISE(LEDL<35,GEN>))
                TRKIDS = RAISE(RAISE(LEDL<40,GEN>))
                TQTYS  = RAISE(RAISE(LEDL<41,GEN>))
             END
          END ELSE
             VIEW.ONLY = YES
             IF INVN THEN
                PRVW = 'CLOSED'
             END ELSE
                PRVW = ''
             END
             STAT    = PRVW<1>
             PICKER  = ''
             TOTES   = ''
             TLOCS   = ''
             TPKGS   = ''
             TRKIDS  = ''
             TQTYS   = ''
          END
          OLD.PRVW = PRVW

          IF TRIM(PICKER) = '' THEN
             PICKER = USER.ID
          END

          RETURN
*-------------------------------------------------------------------------*
UPD.PKG.DATA:
          PRVW<11> = LOWER(LOWER(TOTES))
          PRVW<13> = LOWER(LOWER(TLOCS)) ;*
          PRVW<14> = LOWER(LOWER(TPKGS))
          PRVW<20> = LOWER(LOWER(TRKIDS))
          PRVW<21> = LOWER(LOWER(TQTYS))
          * add log info
          LPOS = DCOUNT(PRVW<22>,VM)+1
          PRVW<22,LPOS,1> = "WHSE.PICK.CONFIRM"
          PRVW<22,LPOS,2> = DATE()
          PRVW<22,LPOS,3> = INT(TIME())
          PRVW<22,LPOS,4> = "Package Data Updated "

          RETURN
*-------------------------------------------------------------------------*
PRT.CPY:  *
          ACTION.OK = NO
          IF MODE = 'S' OR MODE = 'T' THEN
             PRMPT    = 'Reprint a Pick/Ship Ticket'
             KEY.REQD = 'SOE.REPRINT.SHIP.TICK'
             OE.GET.AUTH OID,PRMPT,KEY.REQD,ACTION.OK,GEN
          END
          IF ACTION.OK THEN
             GOSUB UPD.PKG.DATA
             GOSUB UPD.PRVW
             BEGIN CASE
             CASE MODE = 'S'
                SOE.PRINT.ORDER OID,GEN,,'T'
             CASE MODE = 'T'
                TOE.PRINT.ORDER OID,GEN,,'T'
             END CASE
          END

          RETURN
*-------------------------------------------------------------------------*
VIEW.OID: VONLY = (OPTION=3)
          OE.EXEC MODE,1,OID,GEN,VONLY
          MATREAD LED FROM LEDFILE,OID ELSE PRINT BELL:; GOTO IN.OID
          IF OPTION = 4 THEN
             SLIST = ''
             GOSUB GET.SLIST
             GOSUB LOAD.HOTKEYS
          END

          RETURN
*-------------------------------------------------------------------------*
LBL.PRT:  * Print shipping labels

          LDIDS      = RAISE(LED(48)<1,GEN>)
          LD.CT      = DCOUNT(LDIDS,AM)
          LDID       = LDIDS<1,1>
          ORIG.LDID  = LDID
          TOT.CNT    = SUMMATION(TPKGS)
          UD.DVR.DOC.PRINT.WHSE ,LD.CT,OID,GEN,ORIG.LDID,TOTAL.PKG.CNT=TOT.CNT
          OID = FIELD(OID,'.',1)

          RETURN
*-------------------------------------------------------------------------*
INPROC:   WHSE.QUEUE.EDIT OID:'.':LED(12)<1,GEN>

          RETURN
*-------------------------------------------------------------------------*
FGHT:     * Freight hotkey
          SV.VIEW.ONLY = VIEW.ONLY
          IF NOT(VIEW.ONLY) THEN
             OE.LOCK.LED OID,LOCK.MSG,YES
             IF LOCK.MSG THEN
                VIEW.ONLY = YES
             END
          END
          MAT OLED = MAT LED
          GET.CUS PRC.BR,BT.CN,ST.CN,QSIGN
          SOE.FGHT.CALC OID,GEN,QSIGN,GEN,VIEW.ONLY
          IF NOT(VIEW.ONLY) THEN
             GEN.MVT = GEN
             OE.TAX.CLEAR OID,GEN.MVT
             OE.TAX.CALC  OID,GEN.MVT,QSIGN
             UPDATE.LEDGER OID,GEN.MVT
             OE.UNLOCK.LED OID
          END
          VIEW.ONLY = SV.VIEW.ONLY

          RETURN
*-------------------------------------------------------------------------*
READY.MNFST:
          CHK.TOTE = YES
          GOSUB CHK.INPROCESS
          IF NOT(ORD.OPEN) THEN
             SOE.MANIFEST.READY ORN,GEN,PRVW,ERR.FLG
             * Re-read manifest info and display appropriate hotkeys
             IF NOT(ERR.FLG) OR ERR.FLG = 2 THEN
                LOG.CMT = 'IP status changed'
                LOG.CMT = LOG.CMT:' from ':STAT:' to ':NEXT.STAT:' by ':PICKER
                IF NOT(ERR.FLG) THEN
                   OE.ADD.COMMENT OID,GEN,LOG.CMT
                END

                * Change review status to MANIFEST *
                STAT = 'MANIFEST'
                GOSUB UPD.PRVW
                OE.ORDER.STATUS.UPD OID,GEN,STAT,ERR.MSG
                READ PRVW FROM PRVWFILE,RVW.ID ELSE PRVW = ''
                LOCATE STAT IN STAT.STR<1> SETTING POS ELSE NULL
                NEXT.STAT = STAT.STR<1,POS+1>
                IF TRIM(NEXT.STAT) = '' THEN NEXT.STAT = 'CLOSE'
                PRINT @(24,7):STAT      "L#13"
                PRINT @(52,7):NEXT.STAT "L#13"
             END
             GOSUB LOAD.HOTKEYS
             GOSUB DISPLAY
          END ELSE
             GOSUB DISP.INP.ERR
          END

          RETURN
*-------------------------------------------------------------------------*
MNFST.COMMENTS:

          IF MNFST # '' THEN
             VIEW.ONLY = NO
             IF MNFST<7> THEN
                VIEW.ONLY = YES
             END ELSE
                CHECK.KEY 'SOE.MANIFEST.EDIT',EDIT.OK, EDIT.LVL
                IF NOT(EDIT.OK) THEN
                  VIEW.ONLY = YES
                END
             END

             DONE = NO
             DCNT = DCOUNT(MNFST<10>,@VM)
             FOR C = 1 TO DCNT UNTIL DONE
                SCNT = DCOUNT(MNFST<15,C>,@SVM)
                FOR S = 1 TO SCNT UNTIL DONE
                   IF MNFST<15,C,S> = ORDER.ID THEN
                      DONE = YES
                      C.POS = C
                      S.POS = S
                   END
                NEXT S
             NEXT C
             DATA = RAISE(RAISE(MNFST<16,C.POS,S.POS>))
             OLD.DATA = DATA
             LOG.INFO = C.POS:VM:MNFST<48,C.POS>;* stop number, stop id
             SOE.MANIFEST.COMMENTS 1,DATA,MNFST.VIEW.ONLY,MANIFEST.ID,LOG.INFO
             IF DATA # OLD.DATA THEN
                MANIFEST.CHANGED = YES
             END
             DATA = LOWER(LOWER(DATA))
             MNFST<16,C.POS,S.POS> = DATA
          END

          RETURN
*-------------------------------------------------------------------------*
EDIT.MNFST:

          IF MANIFEST.CHANGED THEN
             GOSUB UPD.MANIFEST
          END

          SOE.MANIFEST.QUEUE MANIFEST.ID

          * Reread manifest record in case changes made  *
          MATREAD LED FROM LEDFILE,OID ELSE PRINT BELL:; GOTO IN.OID
          SLIST = ''
          GOSUB GET.SLIST
          GOSUB LOAD.HOTKEYS
          GOSUB DISPLAY

          RETURN
*-------------------------------------------------------------------------*
SER.NUM:  * Serial number hot key and auto close.
          IF SLIST THEN
             IF SN.AUTO.CLOSE THEN
                UPD.SERS.OK = NO
                GOSUB UPD.SERS
                IF UPD.SERS.OK THEN
                  ANS = ''
IN$$10:           INP.PROMPT ANS,'Enter Serial Numbers Now (Y/N) : ','YN',1
                  IF ANS THEN GOSUB UPD.SERS
                END
             END ELSE
                UPD.SERS.OK = YES
                GOSUB UPD.SERS
             END
          END

          RETURN
*-------------------------------------------------------------------------*
UPD.SERS: * Check and update serial numbers.

          OE.LOCK.LED OID,LOCK.MSG
          IF NOT(LOCK.MSG) THEN
             LDIDS = SLIST
             LD.CT = DCOUNT(SLIST,AM)
             FOR LDN = 1 TO LD.CT
                LDID = LDIDS<LDN>
                LD.GET LDID
                *** Get the product information
                OE.GET.QSIGN QSIGN,OID,GEN
                GET.ALL.PRD LED(2)<1,GEN,2>,LD(1),QSIGN
                MAT OLD.LD = MAT LD
                MAT OLED   = MAT LED
                SER.NUM    = PRD.BR(25)
                IF NOT(UPD.SERS.OK) THEN
                  NEED.CHECK = NO
                  OE.SERIAL.CHECK OID,GEN,LDID,SER.NUM,1,NO,YES,NEED.CHECK
                  IF NEED.CHECK THEN
                     UPD.SERS.OK = YES
                     EXIT
                  END
                END ELSE
                  OE.SERIAL.CHECK OID,GEN,LDID,SER.NUM,1,VIEW.ONLY,NO,YES
                END
             NEXT LDN
             UPDATE.LEDGER OID,GEN
             OE.UNLOCK.LED OID
          END

          RETURN
*-------------------------------------------------------------------------*
GET.SLIST: * Build list of serialized LDIDS for serial# entry
          LDIDS= RAISE(LED(48)<1,GEN>)
          LCNT = DCOUNT(LDIDS,VM)
          FOR L = 1 TO LCNT
             LDID = LDIDS<1,L>
             LD.GET LDID
             IF LD(1) AND NUM(LD(1)) THEN
                PN = LD(1)
                GET.PRD.BR LED(2)<1,GEN,2>,PN
                QSHP = SUM(LD(5)<1,GEN>) + SUM(LD(6)<1,GEN>)
                GOSUB CHK.SER
             END
          NEXT L

          RETURN
*-------------------------------------------------------------------------*
LOAD.HOTKEYS: *
          MENU.CLEAR
          IF VIEW.ONLY THEN
             MENU.LOAD                   ;*<Confirm>
             MENU.LOAD                   ;*<RePrint>
          END ELSE
             MENU.LOAD  2,16, 7,1,'C'    ;* Confirm
             MENU.LOAD 12,16, 7,3,'P'    ;* RePrint
          END
          MENU.LOAD 22,16, 4,1,'V'       ;* View

          IF VIEW.ONLY THEN
             MENU.LOAD                   ;*<Edit>
             MENU.LOAD                   ;*<Label>
             IF VONLY.MSG THEN
                MENU.LOAD 54,16,10,1,'I' ;* In Process
             END ELSE
                MENU.LOAD                ;*<In Process>
             END
             MENU.LOAD                   ;*<Freight>
             MENU.LOAD                   ;*<Ready to Mnfst>
             MENU.LOAD                   ;*<Mfst Comments>
             MENU.LOAD                   ;*<Edit Mnfst>
             MENU.LOAD                   ;*<Serial Numbers>
          END ELSE
             MENU.LOAD 29,16, 4,1,'E'    ;* Edit
             MENU.LOAD 36,16, 5,1,'L'    ;* Label
             IF UPD.WHQ THEN
                MENU.LOAD 54,16,10,1,'I' ;* In Process
             END ELSE
                MENU.LOAD                ;*<In Process>
             END
             MENU.LOAD 44,16,7,1,'F'     ;* Freight
             GOSUB CHK.MANIFEST
             * Load Ready to Mnfst Key only if manifest is enabled
             * and the order is not currently on a manifest
             IF MNFSTG AND NOT(ORD.ON.MANIFEST) THEN
                MENU.LOAD  2,18,14,1,'R' ;* Ready to Mnfst
             END ELSE
                MENU.LOAD                ;*<Ready to Mnfst>
             END
             * Load Mnfst Comments key
             * if order is currently on a manifest
             IF ORD.ON.MANIFEST THEN
                MENU.LOAD 19,18,14,1,'M' ;* Mnfst Comments
                MENU.LOAD 36,18,10,2,'D' ;* EDit Mnfst
             END ELSE
                MENU.LOAD                ;*<Mfst Comments>
                MENU.LOAD                ;*<Edit Mnfst>
             END
             IF SLIST THEN
                MENU.LOAD 49,18,14,1,'S' ;* Serial Numbers
             END ELSE
                MENU.LOAD                ;*<Serial Numbers>
             END
          END

          RETURN
*-------------------------------------------------------------------------*
CHECK.AUTH: *
          AUTH.OK = YES
          IF MODE='T' THEN
             LOCATE LED(2)<1,GEN,1> IN SECURITY<9> SETTING POS ELSE
                LOCATE LED(2)<1,GEN+1,1> IN SECURITY<9> SETTING POS ELSE
                    MESS 10,10,BELL:'Not Authorized for Branch # ':LED(2)<1,GEN,1>:' or ':LED(2)<1,GEN+1,1>
                   AUTH.OK = NO
                END
             END
          END ELSE
             LOCATE LED(2)<1,GEN,1> IN SECURITY<9> SETTING POS ELSE
                LOCATE LED(2)<1,GEN,2> IN SECURITY<9> SETTING POS ELSE
                   MESS 10,10,BELL:'Not Authorized for Branch # ':LED(2)<1,GEN,1>
                   AUTH.OK = NO
                END
             END
          END

          RETURN
*-------------------------------------------------------------------------*
CHK.MANIFEST:
          MNFSTG           = YES
          ORD.ON.MANIFEST  = NO
          MNFST            = ''
          MANIFEST.CHANGED = NO
          MNFST.VIEW.ONLY  = NO

          OLD.MNSFT = ''

          READV MNFST.IDS FROM LEDLFILE,OID,17 ELSE MNFST.IDS = ''
          MANIFEST.ID = MNFST.IDS<1,GEN>
          IF MANIFEST.ID THEN
             READ MNFST FROM MNFSTFILE,MANIFEST.ID THEN
                ORD.ON.MANIFEST = YES
                OLD.MNFST       = MNFST
             END
          END

          IF MNFST<7> OR NOT(MNFSTG) THEN
             MNFST.VIEW.ONLY = YES; * Closed mnfst is view.only
          END ELSE
             CHECK.KEY 'SOE.MANIFEST.EDIT',EDIT.OK, EDIT.LVL
             IF NOT(EDIT.OK) THEN
                MNFST.VIEW.ONLY = YES
             END
          END
          IF VIEW.ONLY THEN MNFSTG = NO

          RETURN
*-------------------------------------------------------------------------*
CHK.INPROCESS:

          GID = LED(12)<1,GEN>
          ORD.ID = OID:'.':GID
          SEL.LN = 'SELECT WHSE.QUEUE WITH &INDEX&.ORDERID "':ORD.ID:'~P"'
          IF CHK.TOTE THEN
             SEL.LN := ' AND WITHOUT TOTE.ID'
          END
          CLEARSELECT
          EXECUTE SEL.LN CAPTURING MSG
          READLIST TST ELSE TST = ''
          ORD.OPEN = (TST#'')

          RETURN
*-------------------------------------------------------------------------*
DISP.INP.ERR:
          P.MSG = 'There are still inprocess quantities for this order, <Return> '
          RESP = ''
IN$$5:    INP.PROMPT RESP,P.MSG,,1

          RETURN
*-------------------------------------------------------------------------*
UPD.MANIFEST:

          UPDATE.RECORD 'MANIFESTS',MNFSTFILE,MANIFEST.ID,OLD.MNFST,MNFST,UPD.ERR,CHNG
          RELEASE MNFSTFILE,MANIFEST.ID
          IF UPD.ERR THEN
             P.MSG = 'Manifest Comments updated by another user while editing, <Return> '
             RESP = ''
IN$$6:       INP.PROMPT RESP,P.MSG,,1
             RETURN TO ID.VER
          END

          RETURN
*-------------------------------------------------------------------------*
INIT:     *
          PICKER    = USER.ID
          ID        = '' ; *of the order
          STAT      = '' ; *review queue status
          NEXT.STAT = '' ; *next status in pre-defined sequence
          STAT.STR  = '' ; *captured to determine next status step
          TLOCS     = '' ; *Staging locations from PRINT.REVIEW
          TPKGS     = '' ; *PKG Data from PRINT.REVIEW
          DRPT      = '' ; *global
          TEMP      = '' ; *vscroll input variable
          TLOCS     = '' ; *temporary array from vscroll area input
          TPKGS     = '' ; *ditto
          TQTYS     = '' ; *package line quantities
          TRKIDS    = ''
          PKG.DATA  = ''
          ORD.ON.MANIFEST= ''

          * Serial number auto close flag used during serial number check
          * and prompting.
          SN.AUTO.CLOSE = NO
          SLIST = ''

          GET.TTY TTY.BR%,,,TTY.SHIPVIA%,TTY.RELOG%

          *** Column headings 2-5 above the vscroll region
          READV PACKAGES FROM CTRLFILE,'PACKAGE.TYPES',1 ELSE
             PACKAGES = ''
          END

          *** If the Warehouse Confirmation Picking Queue has the serial
          *** number/tracking number logic turned on, get the assigned colu
          *** column titles
          READV COL.TITLES FROM CTRLFILE,'WHSE.PKG.TRACKING.TITLES',1 ELSE
             COL.TITLES = ''
          END

          *** Check to see which view customer will see.
          READV DISP.HDR FROM CTRLFILE,'WHSE.PICK.COL',1 ELSE DISP.HDR = ''

          *** Print the column headers
          COL.CNT = DCOUNT(COL.TITLES,VM)
          IF COL.CNT > 2 THEN COL.CNT = 2
          PKG.CNT = DCOUNT(PACKAGES,VM)
          IF PKG.CNT > 4 THEN PKG.CNT = 4
          FOR PP = 1 TO PKG.CNT
             COL.HDR = '# ':PACKAGES<1,PP>
             ST.POS = 14 + (PP-1)*8
             PRINT @(ST.POS,9):COL.HDR"L#7"
          NEXT PP

          IF DISP.HDR THEN
             FOR CT = 1 TO COL.CNT
                COL.HDR = TRIM(COL.TITLES<1,CT>)
                ST.POS = 47 + (CT-1)*10
                PRINT @(ST.POS,9):COL.HDR"L#8"
             NEXT CT
          END

          RETURN
*-------------------------------------------------------------------------*
SET.VONLY:*** Set view only flag and message.
          *** Display in view only mode if there are default
          *** in-process statues and the order is in-process.

          DFLT.STATS = ''
          READ TERR FROM TERRFILE,STK.BR ELSE TERR = ''
          LOCATE LED(70)<1,GEN> IN TERR<18> SETTING DPOS THEN
             DFLT.STATS = RAISE(TERR<23,DPOS>)
          END
          IF DFLT.STATS<1,1> = '' THEN RETURN

          CHK.TOTE = NO
          GOSUB CHK.INPROCESS
          IF ORD.OPEN THEN
             VIEW.ONLY = YES
             VONLY.MSG = 'Order is in process. View Only.'
          END

          RETURN
*-------------------------------------------------------------------------*
CHK.SER: *** Check serial
*** Auto assign serial numbers from PROD.DYNAM File - No Defective or R.
*** Prompt for serial entry if not 'A' and they have the flag set to 'Y'

          IF NOT(LD(31)) THEN; *Check if this is a kit
             SER.KIT = NO
             SERL    = PRD.BR(25)
             GOSUB CHK.ONES
          END ELSE
             SER.KIT = YES
             GOSUB CHK.SKIT
          END

          RETURN
*-------------------------------------------------------------------------*
CHK.ONES: *** Check one of the products for serial tracking.
          BEGIN CASE
          *** No serial entry on this product don't bother with it...
          CASE SERL = 'N' OR NOT(SERL)
             NULL
          *** Auto assign "A" and "D" type serial numbers to this order...
          CASE (SERL='A' OR SERL='D') AND MODE='S' AND QSHP<0
             *** Auto assign "A" & "D" type serial numbers to this order
             IF SER.KIT THEN
                ** save data
                MATBUILD SV.PRD  FROM PRD.BR
                MATBUILD SV.PRDD FROM PRDD.BR

                PRD.BR.GET  STK.BR,KPN
                PRDD.BR.GET STK.BR,KPN

                OE.SERIAL.AUTO.ASSIGN KPN,STK.BR,GEN,KN,KQTY

                MATPARSE PRD.BR  FROM SV.PRD
                MATPARSE PRDD.BR FROM SV.PRDD

                IF DCOUNT(LD(83)<1,GEN,KN>,SSVM) # KQTY THEN
                   LOCATE LDID IN SLIST SETTING NADA ELSE
                      SLIST<-1> = LDID
                   END
                END
             END ELSE
                KPN = LD(1)
                MAT OLD.LD = MAT LD

                OE.SERIAL.AUTO.ASSIGN KPN,STK.BR,GEN,,QSHP
                *** Serial numbers still needed so prompt
                IF DCOUNT(LD(32)<1,GEN>,SVM) # ABS(QSHP) THEN
                   LOCATE LDID IN SLIST SETTING NADA ELSE
                      SLIST<-1> = LDID
                   END
                END
             END
          CASE SFLAG AND SERL = 'I'
             LOCATE LDID IN SLIST SETTING NADA ELSE
                SLIST<-1> = LDID
             END
          *** For POs that don't match prompt on anything
          *** except "O" and "R" types
          CASE SFLAG AND SERL#'O' AND SERL#'R' AND MODE='P'
             LOCATE LDID IN SLIST SETTING NADA ELSE
                SLIST<-1> = LDID
             END
          *** On "O" Types we only care that this product
          *** is going out and only
          CASE SFLAG AND MODE='S' AND (QSHP<0 OR RET.SER.ENTRY$) AND SERL='O'
             LOCATE LDID IN SLIST SETTING NADA ELSE
                SLIST<-1> = LDID
             END
          *** On "R" types we also need to prompt on return sales orders...
          CASE SFLAG AND MODE='S' AND SERL='R'
             LOCATE LDID IN SLIST SETTING NADA ELSE
                SLIST<-1> = LDID
             END
          END CASE

          RETURN
*-------------------------------------------------------------------------*
CHK.SKIT: *** Check kit comps to see if they're serialized
          LOCATE LDID IN SLIST SETTING LD.SPOS THEN RETURN
          IF LD(31) = '' THEN RETURN
          MAT OLD.LD = MAT LD
          KCT = DCOUNT(LD(31)<1>,VM)
          FOR KN = 1 TO KCT
             KPN = LD(31)<1,KN>
             KQTY= ABS(LD(30)<1,KN>*QSHP)
             PRD.BR.GET.VAL STK.BR,KPN,25,SERL
             GOSUB CHK.ONES
          NEXT KN

          RETURN
*-------------------------------------------------------------------------*
DISPLAY:
          IF VIEW.ONLY THEN
             PRINT @(2,0):BLINK$:'View Only':NORM$
          END ELSE
             PRINT @(2,0):'อออออออออ'
          END
          PRINT @(18,1):ORN                         "L#14"
          PRINT @(18,2):CUS(1)                      "L#35"
          PRINT @(18,3):OCONV(LED(9)<1,GEN>,'D2/')  "L#10"
          PRINT @(18,4):SHIP.VIA                    "L#30"
          PRINT @(24,6):USER.ID                     "L#12"
          IF ORD.ON.MANIFEST THEN
             PRINT @(38,6):'Manifest#   : ':MANIFEST.ID "L#12"
          END
          PRINT @(24,7):STAT                        "L#13"
          PRINT @(52,7):NEXT.STAT                   "L#13"

          VCLR 1
          LINES = DCOUNT(TLOCS,AM)
          FOR LINE = 1 TO LINES
             VPRINT 0,LINE,TLOCS<LINE>              "L#12"
             FOR PK = 1 TO 4
                ST.POS = 13 + (PK-1)*8
                VPRINT ST.POS,LINE,TPKGS<LINE,PK>   "R#6"
             NEXT PK

             IF DISP.HDR THEN
                VPRINT 45,LINE,TQTYS<LINE>          "L#8"
                VPRINT 55,LINE,TRKIDS<LINE>         "L#9"
             END
          NEXT LINE
          LINE = 1

          RETURN
*-------------------------------------------------------------------------*
UPD.PRVW: * Update print.review record
          PRVW<12> = '@@@'; * Need to set pick group for correct capture
                            * of pkg qtys in LEDGER.LOG record

          UPDATE.RECORD 'PRINT.REVIEW',PRVWFILE,RVW.ID,OLD.PRVW,PRVW,UPD.ERR
          RELEASE PRVWFILE,RVW.ID

          IF UPD.ERR THEN
             MESS 15,1,BELL:'Item updated by another user while editing'
             READ PRVW FROM PRVWFILE,RVW.ID ELSE
                PRVW = 'CLOSED'
                VIEW.ONLY = YES
             END
          END ELSE
             OLD.PRVW = PRVW
          END
          GOSUB UPD.LEDL

          RETURN
*-------------------------------------------------------------------------*
UPD.LEDL: * Update LEDGER.LOG record with staging/pkg info
          READU LEDL FROM LEDLFILE,OID ELSE LEDL = ''
          P.CT = DCOUNT(PRVW<12>,VM)
          FOR P = 1 TO P.CT
             LPCKS    = ''
             LTOTES   = ''
             LSTGS    = ''
             LPKGS    = ''
             LEDL28   = ''
             LEDL29   = ''
             LOCQTYS  = ''
             LTRKRS   = ''

             PCK.IDS  = PRVW<10,P>; * Picker IDs
             TOTE.IDS = PRVW<11,P>; * Tote#s
             STG.IDS  = PRVW<13,P>; * Staging locations
             PKG.IDS  = PRVW<14,P>; * Package Qtys
             PRVW15   = PRVW<15,P>
             PRVW16   = PRVW<16,P>
             TRK.IDS  = PRVW<20,P>
             LQTYS    = PRVW<21,P>

             STG.CNT = DCOUNT(STG.IDS,SVM)
             FOR T = 1 TO STG.CNT
                PCK.ID  = PCK.IDS<1,1,T>
                TOTE.ID = TOTE.IDS<1,1,T>
                STG.ID  = STG.IDS<1,1,T>
                PKG.ID  = PKG.IDS<1,1,T>
                P15     = PRVW15<1,1,T>
                P16     = PRVW16<1,1,T>
                TRKR.ID = TRK.IDS<1,1,T>
                LOC.QTY = LQTYS<1,1,T>

                LOCATE STG.ID IN LSTGS<1,1> SETTING POS THEN
                   LPCKS<1,1,-1>  = PCK.ID
                   LTOTES<1,1,-1> = TOTE.ID
                   LSTGS<1,1,-1>  = STG.ID
                   LPKGS<1,1,-1>  = PKG.ID
                   LEDL28<1,1,-1> = P15
                   LEDL29<1,1,-1> = P16
                   LTRKRS<1,1,-1> = TRKR.ID
                   LOCQTYS<1,1,-1>= LOC.QTY
                END ELSE
                   LPCKS<1,1,POS>  = PCK.ID
                   LTOTES<1,1,POS> = TOTE.ID
                   LSTGS<1,1,POS>  = STG.ID
                   LPKGS<1,1,POS>  = PKG.ID
                   LEDL28<1,1,POS> = P15
                   LEDL29<1,1,POS> = P16
                   LTRKRS<1,1,POS> = TRKR.ID
                   LOCQTYS<1,1,POS>= LOC.QTY
                END
             NEXT T

             LEDL<20,GEN> = LPCKS
             LEDL<21,GEN> = LTOTES
             LEDL<22,GEN> = LSTGS
             LEDL<35,GEN> = LPKGS
             LEDL<28,GEN> = LEDL28
             LEDL<29,GEN> = LEDL29
             LEDL<40,GEN> = LTRKRS
             LEDL<41,GEN> = LOCQTYS

          NEXT P

          * Update total pkg qtys
          LEDL<18,GEN> = ''
          PKG.DATA = RAISE(RAISE(LEDL<35,GEN>))
          P.CT = DCOUNT(PKG.DATA,AM)
          FOR P = 1 TO P.CT
             FOR J = 1 TO PKG.CNT
               IF PKG.DATA<P,J>#'' THEN LEDL<18,GEN,J> += PKG.DATA<P,J>
             NEXT J
          NEXT P

          WRITE LEDL ON LEDLFILE,OID

          RETURN
*-------------------------------------------------------------------------*
CHECK.CASH: *
     * Check that Cash Required is fulfilled of sales orders
          CHECK.REQD = YES
          SV.GEN     = GEN
          SOE.CALC.CASH OID,GEN,AMT.DUE
          OE.ORDER.TOTAL OID,GEN,QSIGN,TOT.AMT,SUB.TOL,,,TAX.TOL
          IF (AMT.DUE#0 AND TOT.AMT#0) THEN
             IF AMT.DUE < 0 THEN
                SOE.CREDIT.CHECK LED(5)<1,GEN>,,COD,,,,,OID,GEN
                IF NOT(COD) THEN RETURN
             END
             IF CHECK.REQD THEN
                OE.LOCK.LED OID,LOCK.MSG,YES
                IF NOT(LOCK.MSG) THEN
                   OE.TOTALS OID,GEN,GEN,   NO,      'Done',   CHECK.REQD,,,,YES
                   UPDATE.LEDGER OID,GEN
                   OE.UNLOCK.LED OID
                END ELSE
                   OE.GET.LOCKED.USER OID,USER
                   MSG = 'Order ':OID:' is being edited by ':USER
                   MSG<-1> = 'Cash Required on this order, <Return> '
                   ANS = ''
IN$$4:             INP.PROMPT ANS,MSG
                END
             END
          END
          GEN = SV.GEN

          RETURN
*-------------------------------------------------------------------------*
FILEIT: *
          IF F12 THEN
             CONFIRM.ABORT SURE
             IF NOT(SURE) THEN GOTO INUSER
          END ELSE
             IF MANIFEST.CHANGED THEN
                GOSUB UPD.MANIFEST
             END
             GOSUB UPD.PKG.DATA
             GOSUB UPD.PRVW
          END

          IF TTY.RELOG% THEN RELOG.NOW = YES ELSE GOTO START
*-------------------------------------------------------------------------*
FINISH:
          WINDOW.CLOSE

          RETURN
*-------------------------------------------------------------------------*
!SMITJR~02/15/10~23:13
