           SUBROUTINE (OID,GEN,STATUS,PSTYLE.OVRD,PRT.ON,DRPT,LOC.OVRD,PRT.LOC)
** Version# 60.0001[13] - 03/31/2013 - 04:08pm - TSMITH - eclipse
*** V60.0001 Change - Custom Coding . - 03/31/2013 - TSMITH - eclipse

*** Subroutine - TOE.PRINT.ORDER
*-------------------------------------------------------------------------*
*** Prints shipping and receiving transfer tickets
*-------------------------------------------------------------------------*
*** Variables:
***       OID         - Order ID                                      [In]
***       GEN         - Order Generation                              [In]
***       STATUS      - Print status determines which form will print [In]
***       PSTYLE.OVRD - Print style override                          [In]
***       PRT.ON      - Printer on flag                               [In]
***       DRPT        - Report Defaults                               [In]
***       LOC.OVRD    - Location Override, if this is set then the    (IN)
***                     location will not be changed when printing
***                     ship tickets.
***       PRT.LOC     - Location that was used for printing          [OUT]
*-------------------------------------------------------------------------*
*** Common: LED, LD, CUS, CUSS, PRD, PLNE, DRPT, PHANTOM.PROC
*-------------------------------------------------------------------------*
*** PLAIN PAPER TRANSFER non laser ***
            NO.PT = ''
            DRPT = ''
            PRT.LOC = ''
            SOE.PRINT.ORDER OID,GEN,NO.PRT,STATUS,PSTYLE.OVRD,PRT.ON,DRPT
            RETURN
*         END

         DIM PSTYL(10)

          * If this system uses Eclipse Forms Hand off Delivery
          ECLIPSE.FORMS.ENABLED ,,YES
          IF USE.ECLIPSE.FORMS$ THEN
             TOE.DELIVER.ORDER OID,GEN,STATUS,PSTYLE.OVRD,DRPT,LOC.OVRD,PRT.LOC
             RETURN
          END

          UT.OPEN.FILE "PRINT.STYLES",PSTYLFILE,ERR.MSG
          IF ERR.MSG THEN RETURN

          IF DRPT<29> THEN FAX.FLAG = YES ELSE FAX.FLAG = NO

          SV.LOC    = LOCATION
          PG.LGTH   = 60
          FPTR      = STATUS<2>
          STATUS    = STATUS<1>

          FT.LGTH   = 4
          BOD.LINES = 38
          BOT.LGTH  = 4

          MATREAD LED FROM LEDFILE,OID ELSE GOTO FINISH
          IF STATUS = '' THEN STATUS = LED(6)<1,GEN>

          *** Check to see if it's a Receiving Register, if so, check the
          *** control record for current ship branch to see if a Receiving
          *** Register should print of a PO Receiver.
          CONTROL.CHK = 'PRINT.XFER.RECVR~':LED(2)<1,GEN,2>
          IF STATUS   = 'R' THEN
             READV NADA FROM CTRBFILE,CONTROL.CHK,0 THEN
                POE.PRINT.RECVR OID,GEN,PRT.ON,'','ALL','ALL','ALL'
                RETURN
             END
          END

          IF NOT(PHANTOM.PROC) AND NOT(PRT.ON) AND NOT(JAVA.PROC$) THEN
             WINDOW 15,8,50,5
             IF DRPT<29> = '' THEN
                PRINT @(0,1):'Printing .... ':OID
             END ELSE
                PRINT @(0,1):'Faxing .... ':OID
             END
          END

          IF GEN  = 1 THEN QSIGN = -1 ELSE QSIGN = 1
          BR      = LED(2)<1,GEN,1>
          SHIP.BR = LED(2)<1,GEN,2>
          BT.CN   = LED(1)<1,GEN>
          ST.CN   = LED(5)<1,GEN>

          GET.CUS BR,BT.CN,ST.CN,QSIGN

          IF LED(8)<1,GEN> = '' THEN
             LDIDS = LED(49)
             CONVERT VM TO SVM IN LDIDS
          END ELSE
             LDIDS = LED(48)<1,GEN>
          END

          PRT.LDIDS = LDIDS
          CONVERT SVM TO AM IN PRT.LDIDS

          PRT.LOC = ''

          IF NOT(PRT.ON) THEN
             IF STATUS = 'F' AND (FPTR#'' AND FPTR# '*ANY*') THEN
                PRINTER.ON '@':FPTR,',80',RPT.DFLT=DRPT
             END ELSE
                IF STATUS # 'F' AND NOT(LOC.OVRD) THEN
                   PL.OPTS    = ''   ;* used to specify specific location
                                     ;* to be returned.
                   PL.OPTS<1> = YES  ;* get loc for shipticket branch
                   PL.OPTS<2> = YES  ;* return first match
                   PL.OPTS<4> = LED(70)<1,GEN> ;* for poss shipvia override
                   UT.GET.PTR.LOCS LED(2)<1,GEN,2>,LOCATION,PL.OPTS,ERR.MSG
                   IF LOCATION = "HERE" THEN
                      LOCATION = SV.LOC
                   END
                END
                IF LOC.OVRD THEN
                   LOCATION = LOC.OVRD
                END
                PRINTER.ON "XFER.ORDER",RPT.DFLT=DRPT
             END
          END

          PRT.LOC = LOCATION
          GOSUB INIT

*** Sort Items in location order -----------------------------------------*
          READ SORT.LOC FROM CTRBFILE,'GENRL.FORMS.SORT.LOC~':SHIP.BR ELSE
             SORT.LOC = ""
          END

          IF (SORT.LOC[1,1]='B' OR SORT.LOC[1,1]='T') AND STATUS = 'S' THEN
             SRT.LOCS  = ''
             SRT.LDIDS = ''
             LD.CT     = DCOUNT(PRT.LDIDS,AM)
             FOR J = 1 TO LD.CT
                LDID  = PRT.LDIDS<J>
                LD.GET LDID
                PN = LD(1)
                IF PN # '' AND (NUM(PN) OR PN = 'C') THEN
                   IF PN  = 'C' THEN LOC = '*' ELSE
                      LOC = LD(7)<1,GEN,1>
                      LOC = FIELD(LOC,'~',2)
                      IF LOC = '' THEN
                         PRD.LOCATION.GET PRI.LOC,PN,SHIP.BR
                         LOC = PRI.LOC
                      END
                   END
                   IF LOC = '' THEN LOC = 'ZZZ'
                   LOC := J "R%4"
                   LOCATE LOC IN SRT.LOCS BY 'AL' SETTING POS ELSE NULL
                   SRT.LOCS  = INSERT(SRT.LOCS,POS;LOC)
                   SRT.LDIDS = INSERT(SRT.LDIDS,POS;LDID)
                END
             NEXT J
             PRT.LDIDS = SRT.LDIDS
          END
          LDIDS = PRT.LDIDS
          CONVERT AM TO SVM IN LDIDS
*-------------------------------------------------------------------------*

          LDID.CT = DCOUNT(LDIDS,SVM)
          FOR LD.NO = 1 TO LDID.CT
             LDID   = LDIDS<1,1,LD.NO>
             GOSUB PRT.LINE
          NEXT LD.NO

          GOSUB PRINT.TOTE.INFO

          IF NOT(NO.TOLS) THEN
             SUBT.DESC = 'ORDER TOTAL   '
             GOSUB SUBTOTALS
             LINE.CT -= 2
          END

          RUNNING.TOTAL = COL.TOTAL<1,COL.CT>

          GOSUB ADD.FTR

          PGS = INT((BLINE + BOD.LINES-1)/BOD.LINES)

          GOSUB HEADER
          GOSUB PRTBOD

          IF PRINT.HAZ THEN
             SOE.PRINT.HAZMAT OID,GEN,DRPT
          END

          IF NOT(PRT.ON) THEN
             PRINTER.OFF
          END

          GOTO FINISH
*-------------------------------------------------------------------------*
INIT:     *
          PAGE         = 0
          SSPC         = 29
          BOD          = ''
          BLINE        = 0
          SUBT.SW      = NO
          SUBT.LINES   = 0
          IN.FOOTER    = NO
          SHP.TYP.LOC  = ''
          PRINT.HAZ  = NO
          HAZMAT.INFO = ''

          READ I.STATS FROM CTRBFILE,"INPROCESS.QUEUE~":SHIP.BR ELSE I.STATS=''
          READV PICKER FROM LEDLFILE,OID,20 ELSE PICKER = ''
          PICKER = PICKER<1,GEN>
          XPICK.RF = NO
          XRECV.RF = NO
          S.CT = DCOUNT(I.STATS,AM)
          FOR S.POS = 1 TO S.CT
             IF I.STATS<S.POS>[1,1] = "X" AND PICKER THEN XRECV.RF = YES
             IF I.STATS<S.POS>[1,1] = "T" AND PICKER THEN XPICK.RF = YES
          NEXT S.POS

          IF STATUS = '' THEN STATUS = LED(6)<1,GEN>
          INVN      = LED(8)<1,GEN>
          IF INVN   = '' THEN
             ORD.ID = OID
          END ELSE
             ORD.ID = OID:'.':INVN"R%3"
          END

          BEGIN CASE
          CASE STATUS = 'B'
             DOC.ID   = '** Transfer Quote **'
          CASE STATUS = 'F'
             DOC.ID   = '** Work Ticket **'
          CASE STATUS = 'O'
             DOC.ID   = '** Transfer **'
          CASE STATUS = 'S'
             DOC.ID   = '** Transfer Shipper **'
          CASE STATUS = 'R'
             DOC.ID   = '** Transfer Register **'
          END CASE

          OE.LOG.PRINT OID,GEN,STATUS,DOC.ID,REPRINT
          IF REPRINT THEN
             BOD.LINES -= 1
          END

          BEGIN CASE
          CASE PSTYLE.OVRD#''
             STYLE.ID = PSTYLE.OVRD
          CASE OTHERWISE
             STYLE.ID = LED(77)<1,GEN>
          END CASE

          STYLE.ID    = 'BLIND'

          GOSUB GET.PSTYLE

          COLUMN.HEADING  = "Location          Avail  Shipd   Description"
          COLUMN.HEADING2 = " Lot/Serial #---"

          CONVERT ' ' TO '-' IN COLUMN.HEADING
    *** Compile column heading line from print style record
          TOTAL.SPACES = COL.START
          FMT = "L#":COL.START
          COLUMN.HEADING = COLUMN.HEADING FMT

          FOR COL = 1 TO COL.CT
             LGTH = FIELD(COL.FRMTS<1,COL>,'#',2)+0
             FRMT = 'L#':LGTH
             IF COL=COL.CT THEN
                TOTAL.FRMT = COL.FRMTS<1,COL>
             END ELSE
                TOTAL.SPACES = TOTAL.SPACES + LGTH
             END
*            COLUMN.HEADING = COLUMN.HEADING:COL.HEADS<1,COL> FRMT
          NEXT COL

*         NO.TOLS  = (COL.BASIS<1,COL.CT>=2 AND NOT(COL.EXTDS<1,COL.CT>))
          NO.TOLS  = YES
          NET.TOLS = (COL.BASIS<1,COL.CT>=1 OR COL.BASIS<1,COL.CT>=2)

          CUS.PO   = LED(13)<1,GEN>
          WRITER   = LED(73)<1,GEN>
          SALESMAN = LED(72)<1,GEN>
          SHIP.VIA = LED(70)<1,GEN>
          ORD.DATE = LED(4)<1,GEN>
          SHP.DATE = LED(9)<1,GEN>
          PHONE.NO = CUSS(17)<1,1>
          TERMS.ID = LED(29)<1,GEN>
          READV TERMS.DESC FROM TERMSFILE,TERMS.ID,1 ELSE TERMS.DESC=''
          READV SHIPTO FROM CUSFILE,LED(5)<1,GEN>,1 ELSE SHIPTO = ''
*-------------------------------------------------------------------------*
          IF GEN = 1 THEN
             SHIPTO1  = LED(78)<1,GEN,1>
             SHIPTO2  = LED(78)<1,GEN,2>
             SHIPTO3  = TRIM(LED(78)<1,GEN,3>):" ":LED(75)<1,GEN>"L#10"
             IF SHIPTO2 = '' THEN
                SHIPTO2 = SHIPTO3
                SHIPTO3 = ''
             END
             BILLINE1 = CUS(2)<1,1>
             IF CUS(2)<1,2> = '' THEN
                BILLINE2 = CUS(3)"L#17":CUS(4)"L#4":CUS(5)"L#14"
                BILLINE3 = ''
             END ELSE
                BILLINE2 = CUS(2)<1,2>
                BILLINE3 = CUS(3)"L#17":CUS(4)"L#4":CUS(5)"L#14"
             END
          END ELSE
             BILLINE1 = LED(78)<1,GEN,1>
             BILLINE2 = LED(78)<1,GEN,2>
             BILLINE3 = TRIM(LED(78)<1,GEN,3>):" ":LED(75)<1,GEN>"L#10"
             IF BILLINE2= '' THEN
                BILLINE2= BILLINE3
                BILLINE3= ''
             END
             SHIPTO1 = CUSS(2)<1,1>
             IF CUSS(2)<1,2> = '' THEN
                SHIPTO2 = CUSS(3)"L#17":CUSS(4)"L#4":CUSS(5)"L#14"
                SHIPTO3 = ''
             END ELSE
                SHIPTO2 = CUSS(2)<1,2>
                SHIPTO3 = CUSS(3)"L#17":CUSS(4)"L#4":CUSS(5)"L#14"
             END
          END
*-------------------------------------------------------------------------*
*         SHIPTO1  = LED(78)<1,GEN,1>
*         SHIPTO2  = LED(78)<1,GEN,2>
*         SHIPTO3  = TRIM(LED(78)<1,GEN,3>):" ":LED(75)<1,GEN>"L#10"
*         IF SHIPTO2 = '' THEN
*            SHIPTO2 = SHIPTO3
*            SHIPTO3 = ''
*         END
*         IF CUS(2)<1,2> = '' THEN
*            BILLINE2 = CUS(3)"L#17":CUS(4)"L#4":CUS(5)"L#14"
*            BILLINE3 = ''
*         END ELSE
*            BILLINE2 = CUS(2)<1,2>
*            BILLINE3 = CUS(3)"L#17":CUS(4)"L#4":CUS(5)"L#14"
*         END
*-------------------------------------------------------------------------*
          GOSUB GET.TOTALS

          SHP.INST = LED(74)<1,GEN>
          IF SHP.INST#'' THEN
             BLINE += 1
             BOD<BLINE> = SPACE(SSPC):'********* Shipping Instructions **********'
             CT = DCOUNT(SHP.INST,SVM)
             FOR JJ=1 TO CT
                BLINE += 1
                BOD<BLINE> = SPACE(SSPC):'* ':SHP.INST<1,1,JJ>"L#38":' *'
             NEXT JJ
             BLINE += 1
             BOD<BLINE> = SPACE(SSPC):STR('*',42)
          END

          RETURN
*-------------------------------------------------------------------------*
GET.PSTYLE: *
    * Get Print style record
          MATREAD PSTYL FROM PSTYLFILE,STYLE.ID ELSE
             MATREAD PSTYL FROM PSTYLFILE,'DEFAULT' ELSE
                MAT PSTYL = ''
                PSTYL(3) = 69
                PSTYL(4) = 'R2#10'
                PSTYL(5) = 1
                PSTYL(6) = 1
                PSTYL(7) = 'Net Price'
             END
          END

          COL.START = PSTYL(3)
          COL.FRMTS = PSTYL(4)
          COL.BASIS = PSTYL(5)
          COL.EXTDS = PSTYL(6)
          COL.HEADS = PSTYL(7)
          ALT.DESC  = PSTYL(8)
          COL.CT    = DCOUNT(COL.BASIS,VM)
          COL.TOTAL = ''
          SUB.TOTAL = ''

          RETURN
*-------------------------------------------------------------------------*
HEADER:   *
          IF FAX.FLAG THEN
             PRINT CHAR(27):"*p0Y":
          END

          PAGE     = PAGE + 1
          LINE.CT  = PG.LGTH

          PRINT; PRINT
          PRINT SPACE(40-INT(LEN(DOC.ID)/2)):DOC.ID
          PRINT SPACE(60):ORD.ID
          PRINT SPACE(60):'Page # ':PAGE:' of ':PGS
          PRINT; PRINT

          PRINT
          IF GEN = 1 THEN
             PRINT 'Ship From:' "L#40":'Ship To:'
          END ELSE
             PRINT 'Ship To:' "L#40": 'Ship From:'
          END
          PRINT

     * Header Bill To / Ship To
          PRINT '     ':CUS(1)              "L#35":
          PRINT '     ':SHIPTO              "L#35"

          PRINT '     ':BILLINE1            "L#35":
          PRINT '     ':SHIPTO1             "L#35"

          PRINT '     ':BILLINE2            "L#35":
          PRINT '     ':SHIPTO2             "L#35"

          PRINT '     ':BILLINE3            "L#35":
          PRINT '     ':SHIPTO3             "L#35"
          PRINT

     * Header additional data Line #1

          PRINT 'Order-Date-Ship-Date':
          PRINT '--Writer--Printed-On--------Ship-Via---------Warehouse------'
          PRINT OCONV(ORD.DATE,'D2/')              "L#10":' ':
          PRINT OCONV(SHP.DATE,'D2/')              "L#10":' ':
          PRINT WRITER                              "L#7":' ':
          PRINT OCONV(TIME(),'MTS')                 "L#8":' ':
          PRINT OCONV(DATE(),'D2/')                 "L#8":' ':
          PRINT SHIP.VIA                           "L#16":' ':
          PRINT 'From: ':LED(2)<1,1,2>:' To: ':LED(2)<1,2,2>

          PRINT STR('-',80)
          PRINT
          PRINT COLUMN.HEADING
          PRINT COLUMN.HEADING2
          PRINT

          LINE.CT -= 22

          SHP.INST = LED(74)<1,GEN>

          RETURN
*-------------------------------------------------------------------------*
PRTBOD:   *
          PLINE = 1
          LINEX = 0

          LOOP
             LINEX += 1
             IF LINEX > BLINE THEN EXIT
             IF PLINE > BOD.LINES THEN GOSUB TOP; PLINE=1
             PRINT BOD<LINEX>
             PLINE += 1
          REPEAT

          FOR X = PLINE TO BOD.LINES
             PRINT
          NEXT X

          GOSUB FFEED

          RETURN
*-------------------------------------------------------------------------*
TOP:      *
          PRINT
          PRINT "     *** Continued on Next Page ***":
          GOSUB FFEED
          GOSUB HEADER

          RETURN
*-------------------------------------------------------------------------*
SUBTOTALS: *
          PRT.STR1 = SPACE(COL.START)
          PRT.STR2 = SPACE(COL.START-LEN(SUBT.DESC)):SUBT.DESC

          FOR COL = 1 TO COL.CT
             LGTH = FIELD(COL.FRMTS<1,COL>,'#',2)
             IF COL.EXTDS<1,COL> THEN
                PRT.STR1 = PRT.STR1:STR('-',LGTH)
                IF SUBT.SW THEN
                   PRT.STR2 = PRT.STR2:SUB.TOTAL<1,COL> COL.FRMTS<1,COL>
                END ELSE
                   PRT.STR2 = PRT.STR2:COL.TOTAL<1,COL> COL.FRMTS<1,COL>
                END
             END ELSE
                PRT.STR1 = PRT.STR1:SPACE(LGTH)
                PRT.STR2 = PRT.STR2:SPACE(LGTH)
             END
          NEXT COL

          BLINE     += 1
          BOD<BLINE> = PRT.STR1
          BLINE     += 1
          BOD<BLINE> = PRT.STR2

          RETURN
*-------------------------------------------------------------------------*
GET.TOTALS: *
          OE.ORDER.TOTAL OID,GEN,QSIGN,,,FREIGHT,HANDLING,TAX.AMT,FET.AMT

          FREIGHT   = OCONV(FREIGHT,'MR2')
          HANDLING  = OCONV(HANDLING,'MR2')
          TAX.AMT   = OCONV(TAX.AMT,'MR2')

          RETURN
*-------------------------------------------------------------------------*
PRINT.TOTALS: *
          IF TAX.AMT THEN
             TOTAL.COMMENT = 'Sales tax'
             TOTAL.AMT     = TAX.AMT
             GOSUB PRINT.TOTAL
             RUNNING.TOTAL += TOTAL.AMT
          END

          IF FREIGHT THEN
             TOTAL.COMMENT = 'Freight'
             TOTAL.AMT     = FREIGHT
             GOSUB PRINT.TOTAL
             RUNNING.TOTAL += TOTAL.AMT
          END

          IF HANDLING THEN
             TOTAL.COMMENT = 'Handling'
             TOTAL.AMT     = HANDLING
             GOSUB PRINT.TOTAL
             RUNNING.TOTAL += TOTAL.AMT
          END

          GOSUB PRINT.TOTAL.LINE

          IF STATUS='B' THEN
             TOTAL.COMMENT = 'Bid Total'
          END ELSE
             TOTAL.COMMENT = 'P/O Total'
          END
          TOTAL.AMT     = RUNNING.TOTAL
          GOSUB PRINT.TOTAL

          RETURN
*-------------------------------------------------------------------------*
PRINT.TOTAL: *
          PRT.STR = SPACE(TOTAL.SPACES-LEN(TOTAL.COMMENT)-13)
          PRT.STR = PRT.STR:TOTAL.COMMENT:''"L#13"
          PRT.STR = PRT.STR:TOTAL.AMT TOTAL.FRMT
          BLINE += 1
          BOD<BLINE> = PRT.STR

          RETURN
*-------------------------------------------------------------------------*
PRINT.TOTAL.LINE: *
          LGTH = FIELD(TOTAL.FRMT,"#",2)
          PRT.STR = SPACE(TOTAL.SPACES):STR('-',LGTH)
          BLINE += 1
          BOD<BLINE> = PRT.STR

          RETURN
*-------------------------------------------------------------------------*
PRT.LINE: *
          LD.GET LDID
          PN = LD(1)
          BEGIN CASE
          CASE NUM(PN)
             QS   = (SUM(LD(5)<1,GEN>) + SUM(LD(6)<1,GEN>)) * QSIGN
             IF QS # 0 THEN GOSUB PRT.PN
          CASE PN = 'C'
             OE.DESC.GET DESC,ALT.DESC,"TOE Printing"
             GOSUB PRT.XDESC
          CASE PN = 'S';  GOSUB PRT.SUBT
          END CASE

          RETURN
*-------------------------------------------------------------------------*
PRT.PN:   *
          SUBT.LINES += 1

          GET.ALL.PRD BR,PN,QSIGN,GROUP
          OE.DESC.GET DESC,ALT.DESC,"TOE Printing"

          *** Check whether the product is flagged for Serial Number
          *** Tracking at the Shipping Branch...
          PRD.BR.GET.VAL SHIP.BR,PN,25,SERIAL.TRACKING

          * If there is anything in PRD(80) we need to print the Hazardous
          * information.  PRD(80) is multivalued so converting VM to '' to
          * correctly determine if anything exists in this record.
          HAZMAT.INFO = PRD(80)
          CONVERT VM TO '' IN HAZMAT.INFO
          IF HAZMAT.INFO THEN PRINT.HAZ = YES

          IF SERIAL.TRACKING AND SERIAL.TRACKING # "N" THEN
             SN.LIST = LD(32)<1,GEN>
             IF SN.LIST # '' THEN
                SN.CT   = DCOUNT(SN.LIST,SVM)

                FOR SN  = 1 TO SN.CT
                   IF SN.LIST<1,1,SN> THEN
                      DESC<1,-1> = 'Serial#: ':SN.LIST<1,1,SN>
                   END
                NEXT SN
             END ELSE
                FOR XX = 1 TO QS
                   DESC<1,-1> = 'Serial#____________________________'
                NEXT XX
             END
          END

          IF LD(31)#'' AND PRD(86)<1,2> = '1' THEN
             KCMPS = LD(31)
             KQTYS = LD(30)
             KCMTS = LD(37)
             GET.KIT.COMPS.LOC KCMPS,KQTYS,KCMTS,45,DESC,SHIP.BR,GEN
          END

          SHP.TYPS = LD(7)<1,2>
          CT       = DCOUNT(SHP.TYPS,SVM)

          FOR JJ   = 1 TO CT
             IF FIELD(SHP.TYPS<1,1,JJ>,'~',1) = 'T' THEN
                QS         = LD(6)<1,2,JJ>
                TAG        = FIELD(SHP.TYPS<1,1,JJ>,'~',2)
                TAG        = FIELD(TAG,'^',2)
                SOID       = TRIM(TAG)
                ORD.LDID   = FIELD(TAG,'.',2)+0
                DESC<1,-1> = '<<** ':QS:' Tagged to ':SOID:' **>>'
             END
          NEXT JJ

          SHP.TYP.LOCS = LD(7)<1,GEN>
          LOC.CT   = DCOUNT(SHP.TYP.LOCS,SVM)
          FOR LOC  = 1 TO LOC.CT
             QS    = (LD(5)<1,GEN,LOC> + LD(6)<1,GEN,LOC>) * QSIGN
             IF QS = 0 THEN CONTINUE

             SHP.TYP.LOC = SHP.TYP.LOCS<1,1,LOC>
             LOCA        = FIELD(FIELD(SHP.TYP.LOC,'~',2),'|',1)
             TYPE        = FIELD(SHP.TYP.LOC,'~',1)

             IF STATUS = 'F' AND FPTR THEN
                IF LOCA = '' THEN
                   PRD.LOCATION.GET PRD.LOC,PN,SHP.BR
                END ELSE
                   PRD.LOC = LOCA
                END
                PRD.ZONE.GET ,,PRD.LOC,SHP.BR,SHP.TYP.LOC,EXCL.QUEUE
                IF NOT(EXCL.QUEUE) OR FPTR#EXCL.QUEUE<2> THEN CONTINUE
             END

             BEGIN CASE
             CASE QS < 0 AND TYPE = 'F';  LOCA = '**DEF '
             CASE QS > 0 AND TYPE = 'D';  LOCA = '**DIR '
             CASE QS < 0;                 LOCA = '**RTN '
             END CASE

             DFLT.PER.GET "T",DFLT.PER,DFLT.ALPHA
             IQ.TO.ALPHA PLNE(3),PRD(7),DFLT.ALPHA,QS,Q1,U1,Q2,U2,QS.ALPHA

             * For RF sites, print the shipped amount if applicable in the
             * shipped column since the process is automated
             SHIPPED.ALPHA = ''
             IF (QS < 0 AND XRECV.RF) OR (QS > 0 AND XPICK.RF) THEN
                SHIPPED.ALPHA = QS.ALPHA
             END

             PRT.STR  = LOCA                "L#16"
             PRT.STR := TRIM(QS.ALPHA)      "R#7"
             PRT.STR := TRIM(SHIPPED.ALPHA) "R#9 "
             PRT.STR := DESC<1,1>           "L#35"

*            OE.GET.PSTYLE OID,GEN,COL.START,COL.FRMTS,COL.BASIS,COL.EXTDS,COL.CT,QS,PRT.STR,COL.TOTAL,SUB.TOTAL

             BLINE += 1
             BOD<BLINE> = PRT.STR
             GOSUB PRT.XDESC
          NEXT LOC

*-----Double Space-----*
*         BLINE += 1
*         BOD<BLINE> = ''

          RETURN
*-------------------------------------------------------------------------*
PRT.XDESC: *
          LOT.SER = FIELD(FIELD(SHP.TYP.LOC,'~',2),'|',2)
          DESC.CT = DCOUNT(DESC,VM)

          XX = 2
          PROD.LN = YES
          IF PN = 'C' OR PN = 'S' THEN
             * Print all information if current line is not a product.
             * The first line of product description is printed elsewhere.
             XX = 1
             PROD.LN = NO
          END
          IF DESC.CT <= 1 AND PROD.LN THEN
             BLINE += 1
             BOD<BLINE> =  SPACE(1):LOT.SER 'L#15'
          END ELSE
             FOR DLN = XX TO DESC.CT
                BLINE += 1
                BOD<BLINE> =  SPACE(1):LOT.SER 'L#15':SPACE(17):DESC<1,DLN>
                LOT.SER = DELETE(LOT.SER,1,1)
             NEXT DLN
          END
          RETURN
*-------------------------------------------------------------------------*
PRT.SUBT: *
          IF NOT(NO.TOLS) AND SUBT.LINES THEN
             SUBT.SW = YES
             OE.DESC.GET DESC,ALT.DESC,"TOE Printing"
             SUBT.DESC = DESC<1,1>
             GOSUB SUBTOTALS
             DESC = DELETE(DESC,1,1)
             GOSUB PRT.XDESC
             SUBT.SW = NO
             SUB.TOTAL = ''
             SUBT.LINES   = 0
          END

          RETURN
*-------------------------------------------------------------------------*
PRINT.TOTE.INFO: *
          READ PKG.TYPES FROM CTRLFILE,'PACKAGE.TYPES' ELSE
             PKG.TYPES = ''
          END

          READ LEDL FROM LEDLFILE,OID ELSE
             LEDL = ''
          END
          PICKER.IDS = RAISE(LEDL<20,GEN>)
          TOTE.IDS   = RAISE(LEDL<21,GEN>)
          STAGE.LOCS = RAISE(LEDL<22,GEN>)
          PKG.QTYS   = RAISE(LEDL<18,GEN>)

          BEGIN CASE
          CASE TOTE.IDS
             ITEM.CNT = DCOUNT(TOTE.IDS,VM)
             ITEM.IDS = TOTE.IDS
          CASE STAGE.LOCS
             ITEM.CNT = DCOUNT(STAGE.LOCS,VM)
             ITEM.IDS = STAGE.LOCS
          CASE OTHERWISE
             ITEM.CNT = DCOUNT(PICKER.IDS,VM)
             ITEM.IDS = PICKER.IDS
          END CASE
          IF ITEM.CNT THEN
             BLINE += 1
             BOD<BLINE> = ''
             BLINE += 1
             BOD<BLINE> = ''

             FOR T = 1 TO ITEM.CNT
                NUM.ITEMS = DCOUNT(ITEM.IDS<1,T>,SVM)
                FOR N = 1 TO NUM.ITEMS
                   TOTE.ID = TOTE.IDS<1,T,N>
                   PCK.ID  = PICKER.IDS<1,T,N>
                   STG.LOC = STAGE.LOCS<1,T,N>
                   PRT.STR = " Tote: ":TOTE.ID "L#15 ":"Picker: ":PCK.ID "L#15 ":"Loc: ":STG.LOC "L#20"
                   BLINE += 1
                   BOD<BLINE> = PRT.STR
                NEXT N
             NEXT T

             BLINE += 1
             BOD<BLINE> = ''

             PKG.DATA.STR = ''
             PCNT = DCOUNT(PKG.TYPES,VM)
             FOR P = 1 TO PCNT
                PKG.DATA.STR := PKG.TYPES<1,P>:': ':PKG.QTYS<1,P> "L#5 "
             NEXT P

             PRT.STR = ' Packages:   ':PKG.DATA.STR
             BLINE += 1
             BOD<BLINE> = PRT.STR
          END
          RETURN
*-------------------------------------------------------------------------*
ADD.FTR:  *
          PGS = INT((BLINE+BOD.LINES-1)/BOD.LINES)
          LAST.PG = PGS*BOD.LINES - BLINE
          IF LAST.PG >= FT.LGTH THEN
             ADD.LINES = LAST.PG - FT.LGTH
          END ELSE
             ADD.LINES = BOD.LINES + LAST.PG - FT.LGTH
          END

          FOR X = 1 TO ADD.LINES
             BLINE += 1
             BOD<BLINE> = ''
          NEXT X

          BLINE += 1
          BOD<BLINE> = ''
          BLINE += 1
          BOD<BLINE> = 'Picked By___________________________________'

          RETURN
*-------------------------------------------------------------------------*
FFEED:    *
          IF REPRINT THEN
             PRINT SPACE(30):
             PRINT '.. Reprint .. Reprint .. Reprint .. Reprint ..':
          END

          PRINT CHAR(12):

          RETURN
*-------------------------------------------------------------------------*
FINISH:   *
          IF NOT(PHANTOM.PROC) AND NOT(PRT.ON) AND NOT(JAVA.PROC$) THEN
             WINDOW.CLOSE
          END

          LOCATION = SV.LOC
          RETURN
*-------------------------------------------------------------------------*
!TSMITH~03/31/13~16:08
