          SUBROUTINE (OID,INIT.GEN,STATUS,PSTYLE.OVRD,DRPT,PRT.ON)
** Version# 0.0408 - 02/17/2010 - 11:35am - JONW - UPGRADE
*** V0.0408 Change - Custom Coding CZV696 - 02/17/2010 - JONW - UPGRADE
*** V0.0407 Change - Custom Coding CWR572 - 04/09/2008 - BILLB - eclipse
*** V0.0406 Change - Custom Coding HDB282 - 10/16/2007 - HEATHERY - UPGRADE
*** V0.0405 Change - Add FULL Ver 1 - 08/23/2005 - HAZELTON - eclipse
*** V0.0404 Change - Custom Coding CRX856 - 08/16/2004 - JONW - UPGRADE
*** V0.0403 Change - Custom Coding DGP702 - 09/24/2003 - STEVES - eclipse
*** V0.0402 Change - Custom Coding DEF106 - 08/29/2002 - SHELLYF - eclipse
*** V0.0401 Change - Custom Coding BCL412 - 08/07/2002 - JONW - UPGRADE
*** V0.04 - 03/24/1999 - 06:14pm - NELSONC - UPGRADE

*** Subroutine - POE.PRINT.ORDER
*-------------------------------------------------------------------------*
*** Prints Purchase Orders.
*** If it is printing a receiving ticket, the defaults for the particular
*** branch are gotten from the CTRBFILE under PO.RECVR.DFLTS.
*-------------------------------------------------------------------------*
***Parameters:
***        OID         Order ID                                       [In]
***        INIT.GEN    Order generation                               [In]
***        STATUS      Order Type                                     [In]
***        PSTYLE.OVRD Print style override                           [In]
***        DRPT        Report Defaults                                [In]
***        PRT.ON      Printer on flag                                [In]
*-------------------------------------------------------------------------*
*** Common: LED, LD, CUSS, PRD, DRPT, PHANTOM.PROC, JAVA.PROC$, OID.LGTH$
*-------------------------------------------------------------------------*

          GEN = INIT.GEN

          MATREAD LED FROM LEDFILE,OID ELSE GOTO FINISH

          IF STATUS = '' THEN STATUS = LED(6)<1,GEN>

          IF STATUS = 'Y' THEN
             CALL DOE.PRINT.ORDER(OID,GEN,STATUS,PSTYLE.OVRD,DRPT,PRT.ON)
             RETURN
          END

          DIM PSTYL(10)

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

          PG.LGTH = 66

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

          MATREAD LED FROM LEDFILE,OID ELSE GOTO FINISH

          OE.GET.QSIGN QSIGN,OID,GEN
          BR = LED(2)<1,GEN,1>
          SHP.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 NOT(PRT.ON) THEN
             PRINTER.ON "PURCH.ORDER",RPT.DFLT=DRPT
          END

          GOSUB INIT
          GOSUB HEADER

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

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

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

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

          GOSUB FOOTER

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

          GOTO FINISH
*-------------------------------------------------------------------------*
INIT:     *
          SSPC      = 22
          PAGE      = 0
          IN.FOOTER = NO

          * Get price branch specific nonstock comment
          READV NCMT FROM CTRBFILE,"NONSTOCK.COMMENT~":BR,1 ELSE NCMT=""

          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

      ** Default Print Style to Blind for PO's **
          STYLE.ID = LED(77)<1,GEN>

          IF STYLE.ID = '' THEN STYLE.ID = 'BLIND'

          BEGIN CASE
          CASE STATUS='B'
             DOC.ID = 'Request for Quote'
          CASE STATUS = 'O' OR STATUS = 'V'
             BO = NO
             GN.CT = DCOUNT(LED(12),VM)
             FOR J = 1 TO GN.CT
                IF LED(8)<1,J> AND LED(6)<1,J>#'X' THEN BO=YES; EXIT
             NEXT J
             IF BO THEN
                DOC.ID = '** Purchase BackOrder **'
             END ELSE
                DOC.ID = '** Purchase Order **'
             END
          CASE STATUS = 'R'
             DOC.ID = '** Receiving Register **'
          CASE STATUS = 'Y'
             DOC.ID   = '** Direct P/O **'
             STYLE.ID = 'DIR'
          END CASE

          OE.LOG.PRINT OID,GEN,STATUS,DOC.ID,REPRINT

          BEGIN CASE
          CASE PSTYLE.OVRD#''
             STYLE.ID = PSTYLE.OVRD
          END CASE

          GOSUB GET.PSTYLE

          IF STATUS = 'R' THEN
             COLUMN.HEADING = "Ln     Recv'd         Description"
          END ELSE
             COLUMN.HEADING = "Ln    Qty-Ord         Description"
          END

    * 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>))
          NET.TOLS = (COL.BASIS<1,COL.CT>=1 OR COL.BASIS<1,COL.CT>=2)

          GOSUB GET.TOTALS

          WRITER = LED(73)<1,GEN>
          READV WNAME FROM INIFILE,WRITER,3 ELSE WNAME=WRITER

          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 = LED(71)<1,GEN>
          FAX.NO   = CUSS(17)<1,2>
          TERMS.ID = LED(29)<1,GEN>
          SHP.INST = LED(74)<1,GEN>
          CONFIRM  = LED(67)<1,GEN>
          ORD.WITH = LED(68)<1,GEN>
          FRT.FLAG = LED(69)<1,INIT.GEN,1>

          READ CTRL.DATA FROM CTRLFILE,'VENDOR.FREIGHT.TERMS' ELSE CTRL.DATA = ""
          IF CTRL.DATA = '' THEN
             IF FRT.FLAG THEN FRT.MSG = "**Fght Allowed**" ELSE FRT.MSG = "**Prepay & Charge**"
          END ELSE
             FRT.MSG = FRT.FLAG
          END

          ORDER.ID = LED(13)<1,GEN>
          READV TERMS.DESC FROM TERMSFILE,TERMS.ID,1 ELSE TERMS.DESC=''
*B2B
          VADDR = LED(78)<1,INIT.GEN,6>
          IF NOT(VADDR) THEN VADDR = CUSS(1)
          IF LED(78)<1,INIT.GEN,1> THEN VADDR<-1> = LED(78)<1,INIT.GEN,1>
          IF LED(78)<1,INIT.GEN,2> THEN VADDR<-1> = LED(78)<1,INIT.GEN,2>
          VADDR<-1> = TRIM(LED(78)<1,INIT.GEN,3>):" ":LED(75)<1,INIT.GEN,1>  "L#12"

          IF LED(33)<1,GEN> THEN
             DIR.SHIP = YES
             LOCATE LED(33)<1,GEN> IN LED(12)<1> SETTING GEN ELSE GEN = 1
             READV SHIP.ADDR FROM CUSFILE,LED(5)<1,GEN>,1 ELSE SHIP.ADDR = ''
             IF LED(78)<1,GEN,1> # '' THEN SHIP.ADDR<-1> = LED(78)<1,GEN,1>
             IF LED(78)<1,GEN,2> # '' THEN SHIP.ADDR<-1> = LED(78)<1,GEN,2>
             SHIP.ADDR<-1> = TRIM(LED(78)<1,GEN,3>):" ":LED(75)<1,GEN>"L#10"
          END ELSE
             DIR.SHIP = NO
             GET.BR.ADDR LED(2)<1,GEN,2>,BR.ADDR
             SHIP.ADDR = BR.ADDR<1>
             IF TRIM(BR.ADDR<2,1>) # '' THEN SHIP.ADDR<-1> = BR.ADDR<2,1>
             IF TRIM(BR.ADDR<2,2>) # '' THEN SHIP.ADDR<-1> = BR.ADDR<2,2>
             SHIP.ADDR<-1> = TRIM(BR.ADDR<3>):", ":BR.ADDR<4>:" ":BR.ADDR<5>
          END
*LOT
          IF LED(98)<1,GEN> THEN LOT.FLAG = YES ELSE LOT.FLAG = NO

          * Both GENs must be passed to OE.GET.PSTYLE for Direct POs
          GNS = GEN
          IF INIT.GEN # GEN THEN GNS<1,2> = INIT.GEN

          CUS.PO = LED(13)<1,GEN>
          OE.GET.WEIGHT OID,GEN,TOL.PCS,TOL.WGHT,TOL.LOAD

          IF STATUS = "Y" THEN
             TOTL.PCS = ABS(TOL.PCS)
          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:   *
          PAGE = PAGE + 1
          LINE.CT = PG.LGTH

          BILL.ADDR     = 'MURRAY SUPPLY COMPANY'
          BILL.ADDR<-1> = 'PO BOX 15023'
          BILL.ADDR<-1> = 'WINSTON-SALEM, NC 27113'

          PRINT SPACE(40-INT(LEN(DOC.ID)/2)):DOC.ID

          PRINT 'Bill   ':BILL.ADDR<1>'L#52':'P/O#: ':ORD.ID
          PRINT '  To : ':BILL.ADDR<2>'L#52':'Page #':PAGE"R#3"
          PRINT SPACE(7): BILL.ADDR<3>'L#52'

          IF CONFIRM THEN
             PRINT SPACE(7):BILL.ADDR<4>'L#52':"** CONFIRMING P.O. **"
          END ELSE
             PRINT SPACE(7):BILL.ADDR<4>'L#52'
          END

          PRINT

     * Header Bill To / Ship To
          PRINT 'Vendor : ':VADDR<1>"L#32":'Ship   ':SHIP.ADDR<1>"L#32"
          PRINT '         ':VADDR<2>"L#32":'  To : ':SHIP.ADDR<2>"L#32"
          PRINT '         ':VADDR<3>"L#32":'       ':SHIP.ADDR<3>"L#32"
          PRINT '         ':VADDR<4>"L#32":'       ':SHIP.ADDR<4>"L#32"

          PRINT ; PRINT

     * Header additional data Line #1
          PRINT 'Ord-Date--Purchaser----------Ord-With--Terms-------------------Ship-Via-------Wh'

          PRINT OCONV(ORD.DATE,'D2/')      "L#9":' ':
          PRINT WNAME                      "L#17":' ':
          PRINT ORD.WITH                   "L#9":' ':
          PRINT TERMS.DESC                 "L#23":' ':
          PRINT SHIP.VIA                   "L#14":' ':
          PRINT SHP.BR                     "L#2"

     * Header additional data Line #2
          PRINT 'Order-Id.------Totl-Pcs-Wgt-------Load------Freight-Terms---------Fax-No.-------'

          PRINT ORDER.ID                   "L#14":' ':
          PRINT TOL.PCS                    "L#8":' ':
          PRINT OCONV(TOL.WGHT,'MR4')      "L1#9":' ':
          PRINT OCONV(TOL.LOAD,'MR4')      "L1#9":' ':
          PRINT FRT.MSG                    "L#21":' ':
          PRINT FAX.NO                     "L#14"

          PRINT STR('-',80)

          PRINT ; PRINT

     * Column Headings
          PRINT COLUMN.HEADING

          LINE.CT -= 20

     * Shipping Instructions
          IF SHP.INST#'' AND PAGE=1 THEN
             GOSUB SUBT.ONE
             PRINT SPACE(SSPC):'********* Shipping Instructions **********'
             CT = DCOUNT(SHP.INST,SVM)
             FOR Z=1 TO CT
                GOSUB SUBT.ONE
                PRINT SPACE(SSPC):'* ':SHP.INST<1,1,Z>"L#38":' *'
             NEXT Z
             GOSUB SUBT.ONE
             PRINT SPACE(SSPC):STR('*',42)
          END

          BO.HEADING = NO

          RETURN
*-------------------------------------------------------------------------*
SUBTOTALS: *
          IF NOT(NO.TOLS) THEN
             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)
                   PRT.STR2 = PRT.STR2:COL.TOTAL<1,COL> COL.FRMTS<1,COL>
                END ELSE
                   PRT.STR1 = PRT.STR1:SPACE(LGTH)
                   PRT.STR2 = PRT.STR2:SPACE(LGTH)
                END
             NEXT COL

             PRINT PRT.STR1
             PRINT PRT.STR2
          END

          RETURN
*-------------------------------------------------------------------------*
GET.TOTALS: *
          OE.ORDER.TOTAL OID,GEN,QSIGN,,,FREIGHT,HANDLING,TAX.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: *
          GOSUB SUBT.ONE
          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
          PRINT PRT.STR

          RETURN
*-------------------------------------------------------------------------*
PRINT.TOTAL.LINE: *
          GOSUB SUBT.ONE
          LGTH = FIELD(TOTAL.FRMT,"#",2)
          PRT.STR = SPACE(TOTAL.SPACES):STR('-',LGTH)
          PRINT 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,"POE Printing"
             GOSUB PRT.XDESC
          CASE PN='S'
             GOSUB PRT.SUBT
          END CASE

          RETURN
*-------------------------------------------------------------------------*
PRT.PN:   *
          GET.ALL.PRD BR,PN,QSIGN,GROUP
          OE.DESC.GET DESC,ALT.DESC,"POE Printing"

          IF DIR.SHIP THEN
             OE.CUS.PN.CMT.GET LED(1)<1,INIT.GEN>,LED(5)<1,INIT.GEN>,CUSS(66),PN,CMT
             IF CMT<1> THEN DESC<1,-1> = 'Your # ':CMT<1>
             IF CMT<2> THEN DESC<1,-1> = 'Your Location : ':CMT<2>
             *** Remove the Standard Non_Stock Comment Line if one Exists*
             IF TRIM(NCMT) # "" THEN
                LOCATE NCMT IN DESC<1> SETTING NPOS THEN
                   DESC = DELETE(DESC,1,NPOS)
                END
             END
          END

          IF QS=0 THEN GOTO NO.PTR
*LOT
          IF LOT.FLAG THEN
             QS    = 1
             QOPEN = 1
             IF LD(91)<1,GEN> THEN HOLD.FOR.VENDOR = YES
          END

          IF STATUS = "R" THEN
             SHP.TYP.LOCS = LD(7)<1,GEN>
             LOC.CT  = DCOUNT(SHP.TYP.LOCS,SVM)
             FOR LOC = 1 TO LOC.CT
                SHP.TYP.LOC = SHP.TYP.LOCS<1,1,LOC>
                LOCA    = FIELD(FIELD(SHP.TYP.LOC,'~',2),'^',1)
                TYPE    = FIELD(SHP.TYP.LOC,'~',1)
                IF LOCA = 'WHSE' THEN PRINT.PICK = YES
                IF TYPE = 'T' THEN
                   TAG = FIELD(SHP.TYP.LOC,'^',2)
                   TAG = FIELD(TAG,'.',1)
                   DESC<1,-1> = '<<** ':QS:' Tagged to ':TAG[1,OID.LGTH$]:' **>>'
                END
             NEXT LOC
          END

          LD.STR  = LD.NO:')'  "L#5"

          PRT.STR = LD.STR     "L#5"
          IQ.TO.ALPHA PLNE(3),PRD(7),LD(23),QS,Q1,U1,Q2,U2,QS.ALPHA
          QS.ALPHA = TRIM(QS.ALPHA)
          PRT.STR = PRT.STR:QS.ALPHA "R#8":' '
          PRT.STR = PRT.STR:'' "L#7":' '
          PRT.STR = PRT.STR:DESC<1,1>"L#35"

          GOSUB SUBT.ONE
*LOT
          IF LOT.FLAG THEN
             ORD.STAT1 = LED(6)<1,GEN,1>
             PRT.STR  := SPACE(12)
             IF ORD.STAT1 = "I" THEN
                PRT.STR := OCONV(LD(10)<1,GEN>,'MR9')"R3#10"
                PRT.STR := OCONV(LD(10)<1,GEN>,'MR9')"R2#10"
                COL.TOTAL<1,COL.CT> += OCONV(LD(10)<1,GEN>,'MR9')
             END ELSE
                PRT.STR := OCONV(LD(67)<1,2>,'MR9')     "R3#10"
                PRT.STR := OCONV(LD(67)<1,2>,'MR9')     "R2#10"
                COL.TOTAL<1,COL.CT> += OCONV(LD(67)<1,2>,'MR9')
             END
          END ELSE
             OE.GET.PSTYLE OID,GNS,COL.START,COL.FRMTS,COL.BASIS,COL.EXTDS,COL.CT,QS,PRT.STR,COL.TOTAL,SUB.TOTAL
          END

          PRINT PRT.STR
          DESC = DELETE(DESC,1,1)
          GOSUB PRT.XDESC
*LOT
          IF LOT.FLAG THEN
             GOSUB LOT.SUB
          END

NO.PTR:   RETURN
*-------------------------------------------------------------------------*
PRT.XDESC: *
          DESC.CT = DCOUNT(DESC,VM)
          FOR DLN = 1 TO DESC.CT
             GOSUB SUBT.ONE
             PRINT SPACE(SSPC):DESC<1,DLN>"L#35"
          NEXT DLN

          RETURN
*-------------------------------------------------------------------------*
PRT.SUBT: *
          IF NOT(NO.TOLS) THEN
             OE.DESC.GET DESC,ALT.DESC,"POE Printing"
             SUBT.DESC = DESC<1,1>
             GOSUB SUBTOTALS
             DESC = DELETE(DESC,1,1)
             LINE.CT -= 2
             GOSUB PRT.XDESC
          END

          RETURN
*-------------------------------------------------------------------------*
PRT.BO:   *
          GN.CT  = DCOUNT(LED(12),VM)

          FOR GN = 1 TO GN.CT
             BO.HEADING = NO
             STAT   = LED(6)<1,GN,1>
             IF LED(8)<1,GN>='' AND STAT#'X' AND STAT#'$' AND STAT#'Y' THEN
                LDIDS = LED(49)
                LD.CT = DCOUNT(LDIDS,VM)
                FOR LLN = 1 TO LD.CT
                   LDID  = LDIDS<1,LLN>
                   LD.GET LDID
                   QTY   = (SUM(LD(5)<1,GN>) + SUM(LD(6)<1,GN>)) * QSIGN
                   PN    = LD(1)
                   IF NOT(NUM(PN)) OR QTY THEN
                      GET.ALL.PRD BR,PN,QSIGN,GROUP
                      OE.DESC.GET DESC,ALT.DESC,"POE Printing"
                      IF NOT(BO.HEADING) THEN
                         GOSUB SUBT.ONE
                         PRINT
                         BEGIN CASE
                         CASE STAT = 'B'
                            HD = '** The following items are undecided **'
                         CASE STAT = 'A'
                            HD = '** The following will be shipped as soon as available **'
                         CASE OTHERWISE
                            HD = '** The following are scheduled for shipment on ':OCONV(LED(9)<1,GN>,'D2/'):' **'
                         END CASE
                         GOSUB SUBT.ONE
                         PRINT SPACE(40-LEN(HD)/2):HD
                         BO.HEADING = YES
                      END
                      IF NUM(PN) THEN
                         GOSUB SUBT.ONE
                         PRINT SPACE(15):QTY"R#3":' ':DESC<1,1>"L#20":' ':DESC<1,2>"L#35"
                         DESC = DELETE(DESC,1,1)
                         DESC = DELETE(DESC,1,1)
                      END
                      GOSUB PRT.XDESC
                   END
                NEXT LLN
             END
          NEXT GN

          RETURN
*-------------------------------------------------------------------------*
SUBT.ONE: *
          IF LINE.CT<16 THEN
             IF NOT(IN.FOOTER) AND PN#'S' AND NOT(NO.TOLS) THEN
                SUBT.DESC = 'Subtotal Thru Page # ':PAGE:' ---- '
                GOSUB SUBTOTALS
                LINE.CT -= 2
             END
             GOSUB FFEED
             GOSUB HEADER
          END

          LINE.CT -= 1

          RETURN
*-------------------------------------------------------------------------*
FOOTER:   *
          IN.FOOTER = YES
          IF NOT(NO.TOLS) THEN GOSUB PRINT.TOTALS

          IF STATUS = 'R' THEN GOSUB PRT.BO

          GOSUB FFEED

          RETURN
*-------------------------------------------------------------------------*
FFEED:    *
          LN.CT = LINE.CT - 12
          FOR LN = 1 TO LN.CT
             PRINT
             LINE.CT -= 1
          NEXT LN

          IF REPRINT THEN
             PRINT SPACE(35):'.. Reprint .. Reprint .. Reprint .. Reprint ..'
          END ELSE
             PRINT
          END

          LINE.CT -= 1
          LN.CT = LINE.CT - 8

          FOR Z = 1 TO LN.CT
             PRINT
             LINE.CT -= 1
          NEXT Z

          PRINT 'Purchasing Agent Signature________________________________'
          PRINT CHAR(12):

          LINE.CT = 0

          RETURN
*-------------------------------------------------------------------------*
LOT.SUB:  *LOT
          PARTS.CT = DCOUNT(LD(59),VM)

          ORD.STAT1 = LED(6)<1,GEN,1>
          IF ORD.STAT1 # "D" THEN
             TOTAL.PARTS.SHP = 0
             FOR CT = 1 TO PARTS.CT
                TOTAL.PARTS.SHP += LD(61)<1,CT,GEN>
             NEXT CT
          END ELSE
             TOTAL.PARTS.SHP = 1
          END

          IF TOTAL.PARTS.SHP = 0 THEN
             PRINT
             GOSUB SUBT.ONE
             PRT.STR = SPACE(SSPC):"This specific Lot Shipment has no"
             GOSUB SUBT.ONE
             PRINT PRT.STR
             PRT.STR = SPACE(SSPC):"related material detail defined."
             GOSUB SUBT.ONE
             PRINT PRT.STR
             RETURN
          END

          IF PARTS.CT THEN
             GOSUB SUBT.ONE
             PRINT
             GOSUB SUBT.ONE
             PRT.STR = SPACE(SSPC):"This Lot Consists of the following:"
             PRINT PRT.STR
             GOSUB SUBT.ONE
             IF ORD.STAT1 # "D" THEN
                PRT.STR = SPACE(SSPC):"Shp Qty  Description"
             END ELSE
                PRT.STR = SPACE(SSPC):"Ord Qty  Description"
             END
             PRINT PRT.STR
             GOSUB SUBT.ONE
             PRT.STR = SPACE(SSPC):"------- ---------------------------"
             PRINT PRT.STR
          END

          FOR CT = 1 TO PARTS.CT
             PARTS.NUM = LD(59)<1,CT>
             PARTS.ORD = LD(60)<1,CT>
             PARTS.SHP = LD(61)<1,CT,GEN>
             PARTS.CST = OCONV(LD(63)<1,CT>,'MR3')
             PARTS.EXT = PARTS.CST * PARTS.ORD

             IF ORD.STAT1 # "D" THEN
                IF NOT(PARTS.SHP) THEN GOTO NO.PARTS
             END

             IF PARTS.NUM[1,1] = "/" THEN
                PN = PARTS.NUM[2,LEN(PARTS.NUM)-1]
                MATREAD PRD FROM PRDFILE,PN ELSE RETURN
                DESC = PRD(1)
                FOLD.STRING DESC,27,NEWSTRING,VCT
                DESC = NEWSTRING
             END ELSE
                PARTS.NUM = RAISE(PARTS.NUM)
                DESC = PARTS.NUM
                FOLD.STRING DESC,27,NEWSTRING,VCT
                DESC = NEWSTRING
             END

             PRT.STR  = SPACE(SSPC)
             IF ORD.STAT1 # "D" THEN
                IF PARTS.SHP THEN
                   PRT.STR := PARTS.SHP "R#7 "
                END ELSE
                   GOTO NO.PARTS
                END
             END ELSE
                IF PARTS.ORD THEN
                   PRT.STR := PARTS.ORD "R#7 "
                END ELSE
                   GOTO NO.PARTS
                END
             END
             PRT.STR := DESC<1,1> "L#35"

             GOSUB SUBT.ONE
             PRINT PRT.STR
             DESC = DELETE(DESC,1,1)

             OE.CUS.PN.CMT.GET LED(1)<1,GEN>,LED(5)<1,GEN>,CUSS(66),PARTS.NUM,CMT
             IF CMT<1> THEN
                DESC<1,-1> = '    Your PN: ':CMT<1> "L#15"
             END

             SAV.SSPC = SSPC
             SSPC    += 8        ;* INV
             GOSUB PRT.XDESC
             SSPC = SAV.SSPC

NO.PARTS: *
          NEXT CT

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

          RETURN
*-------------------------------------------------------------------------*
!JONW~02/17/10~11:35
