           SUBROUTINE (OID,GEN,NUM.PGS,STATUS,PSTYLE.OVRD,PRT.ON,DRPT,DOC.ID,LOC.OVRD)
** Version# 15.0331[49] - 04/20/2010 - 10:47pm - SMITJR - eclipse
*** V15.0331 Change - Custom Coding . - 04/20/2010 - SMITJR - eclipse
*** V15.033 Change - Custom Coding CZV696 - 02/17/2010 - JONW - UPGRADE
*** V15.032 Change - Custom Coding FORMS.MOD - 11/13/2008 - ROYO - eclipse
*** V15.031 Change - Custom Coding FORMS.MOD - 11/13/2008 - ROYO - eclipse
** Copied from BP SOE.PRINT.ORDER Version# 158 - 02/20/2007 - 01:47pm - RYANB - main

*** Subroutine: SOE.PRINT.ORDER
*-------------------------------------------------------------------------*
*** Prints ship tickets, acks, bids, pick tickets, work tickets.
*** All subroutines that need to print invoices, bids, ship tickets, pick
*** tickets and acks should call this subroutine.
*** This subroutine will then either print the form call the appropriate
*** subroutine to print the form requested.
*** Uses page 1 of n logic.
*-------------------------------------------------------------------------*
*** Variables:
***       OID         - Order ID                                      [In]
***       GEN         - Order generation                              [In]
***       NUM.PGS     - Number of pages printed or faxed              (Out)
***       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.
*-------------------------------------------------------------------------*
*** Common: LED, LD, PRD, PRD.BR, CUS, and CUSS are read but not written.
***         JAVA.PROC$, INVOICE.COPY.CT$, and PHANTOM.PROC are used but
***         not written.
*-------------------------------------------------------------------------*

          FPTR = STATUS<2>
          STATUS = STATUS<1>

          *** Read control file to detrmine if using a laser or dot matrix
          *** printer for Pick Tickets, Ship Tickets, and Acknowledgements
          *** If set to 'None', do not print the form.

          *** Open PRINTER.LOCS file to see if a branch is specified for
          *** the location of the user printing the form
          UT.OPEN.FILE "PRINTER.LOCS",PTLOCFILE,ERR.MSG
          IF NOT(ERR.MSG) THEN
             READV USR.BR FROM PTLOCFILE,LOCATION,3 ELSE USR.BR = ''
          END ELSE USR.BR = ''

          *** If this file does not exist for some odd reason, then use
          *** the shipping branch on the order to determine the branch
          *** to user for the form options control file.
          IF USR.BR = '' THEN
             READV USR.BR FROM LEDFILE,OID,2 ELSE USR.BR = ''
             USR.BR = USR.BR<1,GEN,2>
          END
          *** As long as the branch is not blank, read the control file
          IF USR.BR # '' THEN
             READ FORM.OPT FROM CTRBFILE,'FORMS.PRT.TYP~':USR.BR ELSE FORM.OPT = ''
             *** NOTE the order of the attributes in FORM.OPT:
             *** FORM.OPT<1> = Acknowledgement setting
             *** FORM.OPT<2> = Pick Ticket setting
             *** FORM.OPT<3> = Ship Ticket setting
             *** FORM.OPT<4> = Transfer setting
             *** FORM.OPT<5> = Work Ticket setting
             *** Notice that they are in alphabetical order
          END ELSE
             FORM.OPT = ''
          END

          *** If they are not printing a Pick Ticket or Ship Ticket (by
          *** setting the control optiopn to 'None' then an it will abide
          *** by the rules set forth for the acknowledgement.
          IF FORM.OPT<3> = 'None' AND STATUS = 'O' THEN STATUS = 'A'
          IF FORM.OPT<2> = 'None' AND STATUS = 'T' THEN STATUS = 'A'
          READV ORD.TYPE FROM LEDFILE,OID,30 ELSE ORD.TYPE = ''

          *** CUSTOM - Use old dot-matrix forms for branches
          *** that aren't using laser forms.
          BEGIN CASE
          CASE STATUS = 'A'
             FORM.TYPE = FORM.OPT<1>
          CASE STATUS = 'T'
             FORM.TYPE = FORM.OPT<2>
          CASE STATUS = 'O'
             FORM.TYPE = FORM.OPT<3>
          CASE OID[1,1] = 'T'
             FORM.TYPE = FORM.OPT<4>
          CASE STATUS = 'F'
             FORM.TYPE = FORM.OPT<5>
          CASE STATUS = 'I'
             IF USR.BR = 'M1' THEN
                FORM.TYPE = 'Laser'
             END ELSE
                SOE.PRINT.INVOICE.OLD OID,GEN,PSTYLE.OVRD,PRT.ON,DRPT,NUM.PGS
                RETURN
             END
          CASE OTHERWISE
             READV LSR.BRS FROM CTRLFILE, 'LASER.BRS', 1 ELSE LSR.BRS = ''
             LOCATE USR.BR IN LSR.BRS<1> SETTING X THEN
                FORM.TYPE = 'Laser'
             END ELSE
                FORM.TYPE = 'Dot Matrix'
             END
          END CASE

          IF FORM.TYPE = 'Dot Matrix' THEN
             *** Use pre-Rel8 dot matrix forms.
             STATUS = STATUS:AM:FPTR
             SOE.PRINT.ORDER.OLD OID,GEN,NUM.PGS,STATUS,PSTYLE.OVRD,PRT.ON,DRPT,DOC.ID,LOC.OVRD
             RETURN
          END

          BEGIN CASE
          CASE STATUS = 'I' AND ORD.TYPE = 'CINV'
             *** consolidated invoices are handled differently.
             SOE.PRINT.CONS.INVOICE OID,GEN,PSTYLE.OVRD,PRT.ON,DRPT,NUM.PGS
             RETURN
          CASE STATUS = 'I'
             SOE.PRINT.INVOICE OID,GEN,PSTYLE.OVRD,PRT.ON,DRPT,NUM.PGS

             *** Check to see if they have set the control record
             *** to print MSDS sheets following the invoice.
             READ PRT.MSDS FROM CTRLFILE,'PRINT.MSDS.INVOICE' ELSE
                PRT.MSDS = ''
             END
             *** print MSDS if PRT.MSDS
             IF PRT.MSDS THEN
                SOE.PRINT.MSDS OID,GEN,,,,DRPT,PRT.ON,DOC.ID
             END
             RETURN
          CASE STATUS = 'B'
             SOE.PRINT.BID OID,GEN,,STATUS,PSTYLE.OVRD,PRT.ON,DRPT
             RETURN
          CASE STATUS = 'O'
             *** Determine if serial numbers required and, if so, whether
             *** they exist and, if not, whether user is authorized to
             *** print ship tickets without required serial numbers
             SOE.PRINT.SHIP.AUTH OID,GEN,PRT.SHP.OK
             IF PRT.SHP.OK THEN
                IF FORM.OPT<3> = 'Laser' THEN
                   *** Calls Laser Ship Ticket routine
                   SOE.PRINT.SHIP OID,GEN,,STATUS,PSTYLE.OVRD,PRT.ON,DRPT,LOC.OVRD
                   NUM.PGS = ''
                   RETURN
                END
             END ELSE
                *** Not authorized to print ship ticket
                NUM.PGS = 0
                RETURN
             END
          CASE STATUS = 'F'
             STATUS = STATUS:AM:FPTR
             IF FORM.OPT<5> = 'Laser' THEN
                SOE.PRINT.WORK OID,GEN,,STATUS,PSTYLE.OVRD,PRT.ON,DRPT
             END ELSE
                SOE.PRINT.WORK.DOT.MATRIX OID,GEN,,STATUS,PSTYLE.OVRD,PRT.ON,DRPT,DOC.ID
             END
             RETURN
          CASE STATUS = 'T'
                SHIP.BR = LED(2)<1,GEN,2>
                IF FORM.OPT<2> = 'Laser' THEN
                IF SHIP.BR='5' THEN
                SOE.PRINT.PICK.APEX OID,GEN,,STATUS,PSTYLE.OVRD,PRT.ON,DRPT,LOC.OVRD
                * Calls Laser Pick Ticket routine
                RETURN
                END ELSE
                IF SHIP.BR#'5' THEN
                SOE.PRINT.PICK OID,GEN,,STATUS,PSTYLE.OVRD,PRT.ON,DRPT,LOC.OVRD
                RETURN
                END
                END
             END
          CASE OTHERWISE
             *** If no statuses/control records match, then print an ack.
             IF FORM.OPT<1> = 'Laser' THEN
                * Calls Laser Acknowledgement routine
                SOE.PRINT.ACK OID,GEN,,STATUS,PSTYLE.OVRD,PRT.ON,DRPT
                RETURN
             END
          END CASE
          DKIT.LDS = ''
          DIM PSTYL(10)

          BEGIN CASE
          CASE STATUS = 'T'    ;* Pick Ticket Print
             AT.ID = 'T013'
             GOSUB ACT.TRIG
          CASE STATUS = 'O'
             AT.ID = 'T026'    ;* Ship Ticket Print
             GOSUB ACT.TRIG
          END CASE

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

          SV.LOC   = LOCATION
          PG.LGTH  = 60
          FT.LGTH  = 0

          IF OID[1,1] = 'T' THEN XFER.FLAG = YES ELSE XFER.FLAG = NO

          BOD.LINES = 38

          IF DRPT<29> THEN BOD.LINES -= 1

          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):'Faxing .... ':OID
             END ELSE
                PRINT @(0,1):'Printing .... ':OID
             END
          END

          MATREAD LED FROM LEDFILE,OID ELSE GOTO FINISH

*LOT
          IF LED(98)<1,GEN> AND STATUS # 'T' THEN
             LOT.FLAG = YES
          END ELSE
             LOT.FLAG = NO
          END

          OE.GET.QSIGN QSIGN,OID,GEN
          BR            = LED(2)<1,GEN,1>
          SHIP.BR       = LED(2)<1,GEN,2>
          READV BR.EN FROM TERRFILE,BR,4 ELSE BR.EN = ''
          READ CUS.BR FROM CUSFILE,BR.EN ELSE CUS.BR = ''
          PRC.PHONES    = CUS.BR<17>
          PRC.BR.PHONES = PRC.PHONES<1,1>
          IF PRC.PHONES<1,2> THEN
             PRC.BR.PHONES := ' Fax ':PRC.PHONES<1,2>
          END

          IF STATUS # 'B' THEN
             READV BR.EN FROM TERRFILE,SHIP.BR,4 ELSE BR.EN = ''
             READ CUS.BR FROM CUSFILE,BR.EN ELSE CUS.BR = ''
          END

          BR.ADDR = CUS.BR<1>
          IF CUS.BR<2,1> THEN BR.ADDR<-1> = CUS.BR<2,1>
          IF CUS.BR<2,2> THEN BR.ADDR<-1> = CUS.BR<2,2>
          BR.ADDR<-1> = CUS.BR<3>:' ':CUS.BR<4>:' ':CUS.BR<5>

          CONTACTS = RAISE(OCONV(CUS.BR<16>,"MCU"))
          FINDSTR "FAX" IN CONTACTS SETTING PPOS ELSE PPOS = 0

          IF PPOS THEN
             IF CUS.BR<17,PPOS> # '' THEN
                FAX.PHONE = '  Fax ':CUS.BR<17,PPOS>
             END ELSE FAX.PHONE = ''
          END ELSE FAX.PHONE = ''

          BR.ADDR<-1> = CUS.BR<17,1>:FAX.PHONE
          BT.CN   = LED(1)<1,GEN>
          ST.CN   = LED(5)<1,GEN>
          GET.CUS BR,BT.CN,ST.CN,QSIGN
          INVN    = LED(8)<1,GEN> + 0

          IF INVN = 0 THEN
             PRT.LDIDS = LED(49)
             CONVERT VM TO AM IN PRT.LDIDS
          END ELSE
             PRT.LDIDS = LED(48)<1,GEN>
             CONVERT SVM TO AM IN PRT.LDIDS
          END

          IF NOT(PRT.ON) THEN
             IF STATUS = 'B' THEN
                PRINTER.ON "BID",RPT.DFLT=DRPT
             END ELSE
                IF STATUS = 'O' OR STATUS = 'T' 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 "SALES.ORDER",RPT.DFLT=DRPT
             END
          END

          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] = 'P') AND (STATUS = 'T'OR STATUS = 'O') 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
*-------------------------------------------------------------------------*

          LDID.CT = DCOUNT(PRT.LDIDS,AM)
          FOR LD.NO = 1 TO LDID.CT
             LDID   = PRT.LDIDS<LD.NO>
             IF ALL.GENS THEN
                NUM.GENS = DCOUNT(LED(1)<1>,VM)
                FOR GX = 1 TO NUM.GENS
                   GEN.LDIDS = RAISE(RAISE(LED(48)<1,GX>))
                   GSTAT     = LED(6)<1,GX>
                   *** Add ldid unless it is a direct or cancelled
                   IF GSTAT # 'X' AND GSTAT # 'Y' AND GSTAT#'B' THEN
                      LOCATE LDID IN PRINT.LDIDS SETTING LPOS ELSE
                         *** Add LDID if another gen hasn't already
                         PRINT.LDIDS<-1> = LDID
                         GOSUB PRT.LINE
                      END
                   END
                NEXT GX
             END ELSE
                GOSUB PRT.LINE
             END
          NEXT LD.NO

          GOSUB PRINT.TOTE.INFO

          IF NOT(NO.TOLS) THEN
             SUBT.DESC = 'SUBTOTAL   '
             GOSUB SUBTOTALS
          END

          RUNNING.TOTAL = COL.TOTAL<1,COL.CT,1>
          IF NOT(NO.TOLS) THEN
             GOSUB PRINT.TOTALS
             IF STATUS = 'B' THEN
                BLINE        += 1
                TOTAL.COMMENT = 'TAXES NOT INCLUDED'
                PRT.STR       = SPACE(TOTAL.SPACES-LEN(TOTAL.COMMENT)-13)
                PRT.STR       = PRT.STR:TOTAL.COMMENT
                BOD<BLINE>    = PRT.STR
             END
          END

          *** If they are using Credit Card check order to print receipt
          *** Check if site is authorized
          UT.SEC3 9,AUTH.OK,,NO
          CC.AMT = OCONV(TOTAL,'MR2')
          IF AUTH.OK THEN GOSUB CHKCC
          GOSUB ADD.FTR

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

          IF DKIT.LDS # '' AND (STATUS = 'T' OR STATUS = 'O') THEN
             SOE.PRINT.DKITS OID,GEN,DKIT.LDS
          END

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

          IF NOT(REPRINT) AND (STATUS = 'T' OR STATUS = 'O') THEN
             GET.USER.DOCS OID,GEN,QSIGN,USER.DOCS
             IF USER.DOCS # '' THEN
                L.CT = DCOUNT(USER.DOCS,VM)
                FOR L = 1 TO L.CT
                   UD.DOC.PRINT OID,GEN,,USER.DOCS<1,L>
                NEXT L
             END
          END

          GOTO FINISH
*-------------------------------------------------------------------------*
ACT.TRIG: *** Calls ACTIVITY.TRIGGER to see if trigger is setup for this
          *** entity and performs the appropriate response activity if
          *** it is.

          * Don't call the trigger if we are coming in from a VSIFax email
          IF DRPT<27> = 'HOLD' THEN RETURN

          AT.DATA    = ''
          AT.DATA<2> = LED(5)<1,GEN>:VM:LED(1)<1,GEN>
          AT.DATA<3> = LED(2)<1,GEN,2>
          AT.DATA<4> = OID
          AT.DATA<5> = GEN
          AT.DATA<7> = LED(6)<1,GEN>

          DOCS.PRDCD = ''
          ACTIVITY.TRIGGER AT.ID,AT.DATA,DOCS.PRDCD

          RETURN
*-------------------------------------------------------------------------*
INIT:     *
          PAGE    = 0
          BO.CT   = 0
          LINE.CT = 0

          ALL.GENS = ''
          FRST.PRT.FL = ''

          UT.OPEN.COMMON.FILE 'CONTACT',CHNDL
          IF CHNDL THEN
             CFILE = FILES(CHNDL)
          END ELSE
             FILE.ERR = YES
          END

* Prepass for subtotal pricing detail Y/N
          NO.PRICING  = ''
*         IF STATUS = 'B' THEN
             FRST.DET   = 1
             LD.CT = DCOUNT(PRT.LDIDS,AM)
             FOR LD.NO = 1 TO LD.CT
                LDID  = PRT.LDIDS<LD.NO>
                LD.GET LDID
                IF LD(1) = 'S' THEN
                   IF LD(21) = '' THEN
* NO PRICING
                      FOR DL = FRST.DET TO LD.NO
                         NO.PRICING<DL> = YES
                      NEXT DL
                   END
                   FRST.DET = LD.NO + 1
                END
             NEXT LD.NO
*         END

          INV.AMT    = LED(15)<1,GEN>
          BOD        = ''
          BLINE      = 0
          PRINT.PICK = NO
          CASH.SALE  = NO

          BEGIN CASE
          CASE STATUS = 'B';                                 SSPC = 14
          CASE STATUS = 'T' OR XFER.FLAG OR STATUS = 'O';    SSPC = 25
          CASE OTHERWISE;                                    SSPC = 22
          END CASE

          BEGIN CASE
          CASE XFER.FLAG
             FT.LGTH  += 2
             ORD.ID  = OID:'.':INVN"R%3"
             BEGIN CASE
             CASE STATUS='B'
                DOC.ID = 'Transfer Quote'
             CASE STATUS = 'R'
                DOC.ID = 'Transfer Register'
             CASE OTHERWISE
                STATUS = 'S'
                DOC.ID = 'Transfer Shipper'
             END CASE
             DOC.TYPE = LED(6)<1,GEN>
          CASE STATUS = 'T'
             FT.LGTH  += 10
             INVN    = LED(8)<1,GEN>
             ORD.ID  = OID:'.':INVN"R%3"
             DOC.ID    = 'Pick Ticket'
             DOC.TYPE = 'T'
          CASE STATUS = 'O'
             FT.LGTH  += 10
             INVN    = LED(8)<1,GEN>
             ORD.ID  = OID:'.':INVN"R%3"
             DOC.ID    = 'Ship Ticket'
             DOC.TYPE = 'O'
          CASE STATUS = 'B'
             FT.LGTH  += 5
             DOC.ID   = 'Quotation'
             ORD.ID   = OID
             DOC.TYPE = 'B'
          CASE STATUS = 'F'
             DOC.ID = 'Routing Copy'
          CASE OTHERWISE
             IF INV.AMT <= 0 THEN
                DOC.ID   = 'Acknowledgement'
                *** Check if user has the control record set to enable
                *** printing all gens on the acknowledgement
                READ ALL.FRST.PRT FROM CTRLFILE,'FRST.PRT.ALL.GENS' ELSE ALL.FRST.PRT = ''
                *** If control record is set to 'Y' then set the
                *** FRST.PRT.FL to yes.  If flag is set, then all gens
                *** will be displayed on the first print.
                IF ALL.FRST.PRT THEN FRST.PRT.FL = YES ELSE FRST.PRT.FL = NO
                *** Check if this is the First Print, if this is the first
                *** print in the acknowledgement, display all gens.
                *** If not the first print, display the gen specific one.
                IF FRST.PRT.FL THEN
                   READV PRT.HIST FROM LEDLFILE,OID,1 ELSE PRT.HIST = ''
                   PRT.HIST = RAISE(PRT.HIST)
                   LOCATE 'S' IN PRT.HIST SETTING ACK.POS ELSE ACK.POS = ''
                   IF ACK.POS THEN FRST.PRT.FL = NO
                END

                IF FRST.PRT.FL = YES THEN
                   ALL.GENS = YES
                   PRINT.LDIDS = ''
                END ELSE
                   ALL.GENS = ''
                END
             END ELSE
                DOC.ID   = 'Return Goods Acknowledgement'
             END
             ORD.ID   = OID
             DOC.TYPE = 'S'
          END CASE

          SOE.CREDIT.CHECK ST.CN,,COD,PRT.MSG,NO.SHIP,,,OID,GEN
          IF COD THEN
             COD.MSG = '** C.O.D. ** C.O.D. ** C.O.D. **'
          END ELSE
             COD.MSG = ''
          END

          IF DRPT<27> ='HOLD' THEN  ;* Override printer error if hold/email
             OE.LOG.PRINT OID,GEN,DOC.TYPE:VM:1,DOC.ID,REPRINT
          END ELSE
             OE.LOG.PRINT OID,GEN,DOC.TYPE,DOC.ID,REPRINT
          END

          IF REPRINT THEN
             BOD.LINES -= 1
          END

   * Get Print style record
          BEGIN CASE
          CASE PSTYLE.OVRD#''
             STYLE.ID = PSTYLE.OVRD
          CASE LED(77)<1,GEN>
             STYLE.ID = LED(77)<1,GEN>
          CASE OTHERWISE
             STYLE.ID = 'NET'
          END CASE

          GOSUB GET.PSTYLE

          BEGIN CASE
          CASE STATUS = 'B'
             COLUMN.HEADING = 'Quote Qty     Product Description '
          CASE STATUS = 'T' OR XFER.FLAG OR STATUS = 'O'
             COLUMN.HEADING  = "  Ordered   Shipped      "
             COLUMN.HEADING := "Product Description "
          CASE OTHERWISE
             COLUMN.HEADING = "  Ordered             Product Description"
          END CASE

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

          GOSUB GET.TOTALS

          PRINT.CREDIT.MSG = (PRT.MSG AND (STATUS = 'T' OR STATUS = 'O'))

          IF PRINT.CREDIT.MSG THEN
             FT.LGTH  += 3
          END

          CUS.PO     = LED(13)<1,GEN>
          REL.NO     = LED(65)<1,GEN>
          FRGHT.ALLW = LED(69)<1,GEN,1>

          IF FRGHT.ALLW THEN
             FRGT = 'Yes'
          END ELSE
             FRGT = 'No'
          END

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

          ORD.BY   =  LED(68)<1,GEN>
          CONTACT.DISP = ORD.BY
          *** See if Ordered By is free form entry or a contact rec
          IF  ORD.BY[1,1] = '#' THEN
             *** Get the contact name to display Ordered By
             IF ORD.BY[1,1] = '#' THEN
                ORD.REC = ORD.BY[2,99]
                READ CREC FROM CFILE,ORD.REC ELSE CREC = ''
                IF CREC # '' THEN
                   CONTACT.DISP  = TRIM(CREC<1>):' ':TRIM(CREC<3>):' '
                   CONTACT.DISP = OCONV(CONTACT.DISP,'MCT')
                END
             END
          END

*         READV ORD.BY FROM INIFILE,ORD.BY,3 ELSE NULL
          SHIP.VIA = LED(70)<1,GEN>
          ORD.DATE = LED(4)<1,GEN>
          SHP.DATE = LED(9)<1,GEN>
          REQ.DATE = OCONV(LED(10)<1,GEN> ,'D2/')
          EXP.DATE = LED(31)<1,GEN>
          PHONE.NO = CUS(17)<1,1>
          TERMS.ID = LED(29)<1,GEN>
          READV TERMS.DESC FROM TERMSFILE,TERMS.ID,1 ELSE TERMS.DESC=''

*B2B
          SHIP.ADDR = LED(78)<1,GEN,6>
          IF NOT(SHIP.ADDR) THEN SHIP.ADDR = CUSS(1)
          SHIP.ADDR<-1> = LED(78)<1,GEN,1>
          SHIP.ADDR<-1> = LED(78)<1,GEN,2>
          SHIP.ADDR<-1> = TRIM(LED(78)<1,GEN,3>):" ":LED(75)<1,GEN>"L#10"

          BEGIN CASE
          CASE CUSS(97)
* USE SHIP TO FOR BILLING ADDRESS
             BILL.ADDR = SHIP.ADDR<1>
             IF CUSS(2)<1,1> # '' THEN BILL.ADDR<-1> = CUSS(2)<1,1>
             IF CUSS(2)<1,2> # '' THEN BILL.ADDR<-1> = CUSS(2)<1,2>
             BILL.ADDR<-1> = TRIM(CUSS(3)):', ':CUSS(4)"L#4":CUSS(5)"L#14"
          CASE CUSS(91)<1,1>
* USE ALTERNATE SHIPTO IN SHIPTO RECORD
             BILL.ADDR = CUSS(91)<1,1>
             IF CUSS(92)<1,1> # '' THEN BILL.ADDR<-1> = CUSS(92)<1,1>
             IF CUSS(92)<1,2> # '' THEN BILL.ADDR<-1> = CUSS(92)<1,2>
             BILL.ADDR<-1> = TRIM(CUSS(93)):', ':CUSS(94)"L#4":CUSS(95)"L#14"
          CASE CUS(91)<1,1>
* USE BILL TO ALTERNATE ADDRESS
             BILL.ADDR = CUS(91)<1,1>
             IF CUS(92)<1,1> # '' THEN BILL.ADDR<-1> = CUS(92)<1,1>
             IF CUS(92)<1,2> # '' THEN BILL.ADDR<-1> = CUS(92)<1,2>
             BILL.ADDR<-1> = TRIM(CUS(93)):', ':CUS(94)"L#4":CUS(95)"L#14"
          CASE OTHERWISE
* USE BILLTO NORMAL METHOD
             BILL.ADDR = CUS(1)
             IF CUS(2)<1,1> # '' THEN BILL.ADDR<-1> = CUS(2)<1,1>
             IF CUS(2)<1,2> # '' THEN BILL.ADDR<-1> = CUS(2)<1,2>
             BILL.ADDR<-1> = TRIM(CUS(3)):', ':CUS(4)"L#4":CUS(5)"L#14"
          END CASE

          IF STATUS = 'B' THEN SHP.INST = '' ELSE
             SHP.INST = LED(74)<1,GEN>
          END

          BO.FLAG = YES

          SHIP.INST = SHP.INST<1,1,1>
          SHIP.INST = UPCASE(SHIP.INST)
          IF SHIP.INST = "!NOBO" THEN
             BO.FLAG = NO
             SHP.INST    = DELETE(SHP.INST,1,1,1)
          END

          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

          IF XFER.FLAG THEN
             WHSE.MSG = 'From ':SHIP.BR "L#4 ":'To ':LED(2)<1,GEN+1,2> "L#4"
          END ELSE
             WHSE.MSG = 'Shp ':SHIP.BR  "L#4 ":'Prc ':BR              "L#4"
          END

          IF STATUS # 'B' THEN ORD.MSG = 'ORDER' ELSE ORD.MSG = 'QUOTE'

          IF LED(61)<1,GEN> THEN
             TAX.MSG = 'N'
          END ELSE
             TAX.MSG = 'Y'
          END


          PRT.TIME =  TIMEDATE()
          BO.PNS = ''

          IF STATUS = "T" OR XFER.FLAG THEN
             STG.LOCS  = ''
             READV STG.DATA FROM LEDLFILE,OID,22 ELSE STG.DATA=''
             STG.DATA  = STG.DATA<1,GEN>
             MORE.DATA = YES

             LOOP WHILE MORE.DATA
                REMOVE STG FROM STG.DATA SETTING MORE.DATA
                LOCATE STG IN STG.LOCS SETTING POS ELSE
                   STG.LOCS = INSERT(STG.LOCS,POS;STG)
                END
             REPEAT

             CONVERT AM TO ',' IN STG.LOCS
             FOLD STG.LOCS,30,P.STG.LOCS,S.CT
             IF S.CT > 3 THEN S.CT = 3
             FT.LGTH  += 1
          END

          US.FUNDS = LED(92)<1,GEN,2>
          IF US.FUNDS # '' AND NOT(NUM(US.FUNDS)) THEN US.FUNDS = ''
          READ CTRL.FTR FROM CTRLFILE, 'SOE.FOOTER.MSG' ELSE CTRL.FTR = ''

          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 = ''
          SUBT.SW = NO

          RETURN
*-------------------------------------------------------------------------*
HEADER:   *
          PAGE     = PAGE + 1

          PRINT ("** ":OCONV(DOC.ID,"MCU"):" **") "R#75"
          PRINT SPACE(4): BR.ADDR<1>'L#40':

          IF STATUS = 'B' THEN
             PRINT 'Quote #: ':ORD.ID             'L#16'
          END ELSE
             PRINT 'Order #: ':ORD.ID             'L#16'
          END

          PRINT SPACE(4): BR.ADDR<2>              'L#40':
          PRINT 'P/O #  : ':CUS.PO                'L#20'
          PRINT SPACE(4): BR.ADDR<3>              'L#40':
          PRINT 'Printed: ':PRT.TIME:' ':TIME.ZONE$
          PRINT SPACE(4): BR.ADDR<4>              'L#40':
          PRINT 'Page # : ':PAGE:' of ':PGS
          PRINT SPACE(4): BR.ADDR<5>
          PRINT

     * Header Bill To / Ship To
          IF STATUS = 'B' THEN
             PRINT 'Quote To:'                    "L#40":
          END ELSE
             IF XFER.FLAG THEN
                PRINT 'Transfer From:'            "L#40":
             END ELSE
                PRINT 'Sold To:'                  "L#40":
             END
          END

          IF XFER.FLAG THEN
             PRINT 'Transfer To:'
          END ELSE
             PRINT 'Ship To:'
          END

          FOR JJ = 1 TO 4
             PRINT SPACE(4): BILL.ADDR<JJ>'L#40': SHIP.ADDR<JJ>'L#35'
          NEXT JJ

          PRINT COD.MSG "L#50"
          PRINT STR('_',80)
     * Header additional data Line #1
          IF STATUS = 'B' THEN
             PRINT 'Quoted for'                   "L#20 ":
             PRINT 'Quote Date'                   "L#10 ":
             PRINT 'Expr Date'                    "L#10 ":
          END ELSE
             PRINT 'Ordered by'                   "L#20 ":
             PRINT 'Order Date'                   "L#10 ":
             PRINT 'Ship Date'                    "L#10 ":
          END

          PRINT 'Ship Via'                        "L#19 ":
          PRINT 'Warehouse'
          PRINT  CONTACT.DISP                     "L#20 ":
          IF STATUS = 'B' THEN
             PRINT OCONV(SHP.DATE,'D2/')          "L#10":' ':
             PRINT OCONV(EXP.DATE,'D2/')          "L#10":' ':
          END ELSE
             PRINT OCONV(ORD.DATE,'D2/')          "L#10":' ':
             PRINT OCONV(SHP.DATE,'D2/')          "L#10":' ':
          END
          PRINT SHIP.VIA                          "L#19":' ':
          PRINT WHSE.MSG
          PRINT STR('_',80)
          PRINT 'Writer'                          "L#20 ":
          PRINT 'Salesperson'                     "L#21 ":
          PRINT 'Release #'                       "L#19 ":
          PRINT 'Freight Allowed'
          PRINT WRITER                            "L#20":' ':
          PRINT SALESMAN                          "L#21":' ':
          PRINT REL.NO                            'L#19 ':
          PRINT FRGT
          PRINT STR('_',80)

          PRINT COLUMN.HEADING
          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 "     *** Continued on Next Page ***"
          GOSUB FFEED
          GOSUB HEADER

          RETURN
*-------------------------------------------------------------------------*
* NEW SUBTOTALS LOGIC 02/10/00 - FROM SG PLUMBING
*-------------------------------------------------------------------------*
SUBTOTALS: *
          PRT.STR1 = SPACE(COL.START)
          PRT.STR2 = SPACE(COL.START-LEN(SUBT.DESC)):SUBT.DESC

          *** Now find the exchange rate for the GN passed in.
          IF LED(92)<1,GEN,2> THEN
             XRATE = OCONV(LED(92)<1,GEN,2>,'MR4')
          END ELSE
             XRATE = 1
          END

          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:(OCONV(LD(8)<1,GEN>/XRATE,'MR2')*QSIGN) COL.FRMTS<1,COL>
                END ELSE
                   PRT.STR2 = PRT.STR2:COL.TOTAL<1,COL> COL.FRMTS<1,COL>
                END
             END ELSE
                IF COL = 2 THEN
                   PRT.STR1 = PRT.STR1:STR('-',LGTH)
                   PRT.STR2 = PRT.STR2:(OCONV(LD(8)<1,GEN>/XRATE,'MR2')*QSIGN) COL.FRMTS<1,COL>
                END ELSE
                   PRT.STR1 = PRT.STR1:SPACE(LGTH)
                   PRT.STR2 = PRT.STR2:SPACE(LGTH)
                END
             END
          NEXT COL

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

          RETURN
*-------------------------------------------------------------------------*
GET.TOTALS: *
          SOE.CALC.CASH OID,GEN,AMT.DUE,AMT.PAID,CASH.DISC
          * Get WOE.DISC for Web orders
          SOE.CALC.DISC OID,GEN,,,WOE.DISC
          OE.ORDER.TOTAL OID,GEN,QSIGN,TOTAL,SUB.TOL,FREIGHT,HANDLING,TAX.AMT,FET.AMT
          IF STATUS = 'B' THEN CASH.DISC = 0
          FREIGHT   = OCONV(FREIGHT,'MR2')
          HANDLING  = OCONV(HANDLING,'MR2')
          TAX.AMT   = OCONV(TAX.AMT,'MR2')
          CASH.DISC = OCONV(CASH.DISC,'MR2')

  * Find service Charges , put in OE.ORDER.TOTAL when possible
          LOCATE 'SC' IN LED(24)<1,GEN> SETTING POS THEN
             SERV.CHRG = -OCONV(LED(26)<1,GEN,POS>,'MR2')
          END ELSE
             SERV.CHRG = 0
          END

          RETURN
*-------------------------------------------------------------------------*
PRINT.TOTALS: *
          IF STATUS # 'B' AND 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

          IF SERV.CHRG THEN
             TOTAL.COMMENT = 'Service Charge'
             TOTAL.AMT     = SERV.CHRG
             GOSUB PRINT.TOTAL
             RUNNING.TOTAL += TOTAL.AMT
          END


          * If there is a web order discount then display the web
          * order discount and add  to Running Total.
          IF DOC.TYPE = 'S' THEN
             IF WOE.DISC THEN
                   TOTAL.COMMENT = 'Web Order Discount'
                   TOTAL.AMT = OCONV(WOE.DISC,'MR2')
                   GOSUB PRINT.TOTAL
                   RUNNING.TOTAL += TOTAL.AMT
                   WOE.DISC = 0
             END
          END

          GOSUB PRINT.TOTAL.LINE

          IF STATUS = 'B' THEN
             TOTAL.COMMENT = 'Quote Total'
          END ELSE
             TOTAL.COMMENT = 'Total Amount'
          END

          TOTAL.AMT     = RUNNING.TOTAL
          GOSUB PRINT.TOTAL

          PRINT.AMT.DUE = NO

          IF AMT.PAID THEN
             PRINT.AMT.DUE = YES
             IF LED(8)<1,GEN> = '' THEN
                TOTAL.COMMENT = 'Less cash paid'
                IF US.FUNDS THEN
                   AMT.PAID = ICONV(AMT.PAID/OCONV(US.FUNDS,'MR4'),"MR0")
                END
                TOTAL.AMT  = OCONV(AMT.PAID,'MR2')
                GOSUB PRINT.TOTAL
                RUNNING.TOTAL = RUNNING.TOTAL + TOTAL.AMT
             END ELSE
                AR.ID = OID:'.':LED(8)<1,GEN>"R%3"
                SOE.PAYMENTS.DISC AR.ID,PAY.IDS,PAY.DTS,PAY.AMTS,DISC.TAKEN
                IF DISC.TAKEN THEN
                   TOTAL.COMMENT = 'Less discount taken'
                   IF US.FUNDS THEN
                      DISC.TAKEN = ICONV(DISC.TAKEN/OCONV(US.FUNDS,'MR4'),"MR0")
                   END
                   TOTAL.AMT     = OCONV(DISC.TAKEN,"MR2")
                   CASH.DISC     = 0
                   GOSUB PRINT.TOTAL
                   RUNNING.TOTAL = RUNNING.TOTAL + TOTAL.AMT
                END

                PCT = DCOUNT(PAY.IDS,VM)
                FOR PYN = 1 TO PCT
                   PAY.ID  = PAY.IDS<1,PYN>
                   PAY.DT  = PAY.DTS<1,PYN>
                   PAY.AMT = PAY.AMTS<1,PYN>

                   IF PAY.DT = DATE() THEN
                      TOTAL.COMMENT = 'Amount paid today - Payment # ':PAY.ID"L#12"
                   END ELSE
                      TOTAL.COMMENT = 'Prior Deposit on ':OCONV(PAY.DT,'D2/')"L#8" :' - Payment # ':PAY.ID"L#12"
                   END

                   IF US.FUNDS THEN
                      PAY.AMT =ICONV(PAY.AMT/OCONV(US.FUNDS,'MR4'),"MR0")
                   END
                   TOTAL.AMT = OCONV(PAY.AMT,"MR2")
                   GOSUB PRINT.TOTAL
                   RUNNING.TOTAL = RUNNING.TOTAL + TOTAL.AMT
                NEXT PYN
             END
          END

          IF PRINT.AMT.DUE THEN
             GOSUB PRINT.TOTAL.LINE
             TOTAL.COMMENT = '** AMOUNT DUE **'
             TOTAL.AMT     = RUNNING.TOTAL
             GOSUB PRINT.TOTAL
          END

          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)
             * If this is the first print of an acknowledgement and we
             * should be printing all gens then we need to loop through
             * all the gens on the order.
             IF FRST.PRT.FL THEN
                QS = 0
                GEN.CT = DCOUNT(LED(1)<1>,VM)
                *** Loop through each gen to get correct LDIDS
                FOR GX = 1 TO GEN.CT
                   GEN.LDIDS = RAISE(RAISE(LED(48)<1,GX>))
                   GSTAT     = LED(6)<1,GX>
                   IF GSTAT # 'X' AND GSTAT # 'Y' AND GSTAT # 'B' THEN
                      QS += (SUM(LD(5)<1,GX>) + SUM(LD(6)<1,GX>)) * QSIGN
                   END
                NEXT GX
             END ELSE
                QS = (SUM(LD(5)<1,GEN>) + SUM(LD(6)<1,GEN>)) * QSIGN
             END
             IF QS # 0 THEN GOSUB PRT.PN
          CASE PN='C'
             OE.DESC.GET DESC,ALT.DESC,"SOE Printing"
             GOSUB PRT.XDESC
             IF REM(BLINE,BOD.LINES) AND ((STATUS = 'T' OR STATUS = 'O') OR XFER.FLAG) THEN
                BLINE += 1
                BOD<BLINE> = ''
             END
*LOT
          CASE PN = 'S'
             IF NOT(LOT.FLAG) THEN
                SUBT.SW   = YES
                GOSUB PRT.SUBT
                SUBT.SW   = NO
                SUB.TOTAL = ''
             END
          END CASE

          RETURN
*-------------------------------------------------------------------------*
PRT.PN:   *
          TOT.QS       = QS
          LINE.CT     += 1

          *** Load our Product/Pricing arrays...
          GET.ALL.PRD BR,PN,QSIGN,GROUP

          *** If this is the First Print, display all gens, if not, display
          *** the gen that was specified by user
          IF FRST.PRT.FL THEN
             *** Build location list for all gens without duplicates
             SHP.TYP.LOCS = ''
             GEN.CT = DCOUNT(LED(1)<1>,VM)
             FOR GX = 1 TO GEN.CT
                GSTAT = LED(6)<1,GX>
                IF GSTAT # 'X' AND GSTAT # 'Y' AND GSTAT # 'B' THEN
                   LCT = DCOUNT(LD(7)<1,GX>,SVM)
                   FOR LX = 1 TO LCT
                      TLOC = LD(7)<1,GX,LX>
                      LOCATE TLOC IN SHP.TYP.LOCS<1,1> SETTING FOUND ELSE
                         SHP.TYP.LOCS<1,1,-1> = TLOC
                      END
                   NEXT LX
                END
             NEXT GX
          END ELSE
             SHP.TYP.LOCS = LD(7)<1,GEN>
          END

          LOC.CT       = DCOUNT(SHP.TYP.LOCS,SVM)
          LN.MSG       = LINE.CT
          PRT.OK       = NO
          IF STATUS    = 'B' THEN LOC.CT = 1

          GOSUB CHK.DKIT

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

          FOR LOC = 1 TO LOC.CT
             SHP.TYP.LOC = SHP.TYP.LOCS<1,1,LOC>
             IF STATUS # 'B' THEN
                *** If this is the First Print, get sum for all gens, if
                *** not, sum for the gen user specified
                IF FRST.PRT.FL THEN
                   QS = 0
                   *** Loop through gens finding any with this location
                   FOR GX = 1 TO GEN.CT
                      GSTAT = LED(6)<1,GX>
                      IF GSTAT # 'X' AND GSTAT # 'Y' AND GSTAT # 'B' THEN
                         *** Add the qty for this location on this gen
                         LOCATE SHP.TYP.LOC IN LD(7)<1,GX> SETTING LPOS THEN
                            QS += ((LD(5)<1,GX,LPOS>) + (LD(6)<1,GX,LPOS>))*QSIGN
                         END
                      END
                   NEXT GX
                END ELSE
                   QS = ((LD(5)<1,GEN,LOC> + LD(6)<1,GEN,LOC>)) * QSIGN
                END
             END

             IF QS = 0 THEN GOTO NO.PTR

             OE.DESC.GET DESC,ALT.DESC,"SOE Printing"
             IF DKIT AND (STATUS = 'T' OR STATUS = 'O') THEN
                DESC = INSERT(DESC,1,1;'*** Dynamic Kit ***')
             END
             IF LD(36)<1,GEN,1> # '' THEN DESC<1,-1> = LD(36)<1,GEN,1>

*** Serial Number logic...
             *** As long as our product is flagged for Serial Number
             *** Tracking, but not as 'N' - None...
             IF SERIAL.TRACKING AND SERIAL.TRACKING # 'N' THEN
                *** Check whether Serial Numbers have already been
                *** entered...
                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
                   *** Display a place for someone to write in the Serial
                   *** Numbers on the Ticket...
                   FOR XX = 1 TO ABS(QS)
                      DESC<1,-1> = 'Serial#____________________________'
                   NEXT XX
                END
             END

*----Kits
             BEGIN CASE
             CASE CUS(74) = "Yes"
                IF LD(31) # '' THEN
                   KCMPS = LD(31)
                   KQTYS = LD(30)
                   KCMTS = LD(37)
                   GET.KIT.COMPS.LOC.ALT KCMPS,KQTYS,KCMTS,45,DESC,SHIP.BR,ALT.DESC,GEN,QS
                END
             CASE CUS(74) = "Default" OR CUS(74) = ''
                IF LD(31) # '' AND LD(38)<1,2> = '1' THEN
                   KCMPS = LD(31)
                   KQTYS = LD(30)
                   KCMTS = LD(37)
                   GET.KIT.COMPS.LOC.ALT KCMPS,KQTYS,KCMTS,45,DESC,SHIP.BR,ALT.DESC,GEN,QS
                END
             CASE OTHERWISE
             END CASE

             IF XFER.FLAG THEN
                QOPEN = TOT.QS
                DQS   = QS
             END ELSE
                IF NOT(LED(8)<1,GEN>) THEN
                   QOPEN = TOT.QS
                   DQS   = ''
                END ELSE
                   OE.CALC.QOPEN OID,QSIGN,QOPEN
                   IF LED(8)<1,GEN> THEN QOPEN += -(SUM(LD(5)<1,GEN>) + SUM(LD(6)<1,GEN>))
                   DQS = QS
                END
             END

             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 STATUS = 'T' OR STATUS = 'O' THEN
                IF LOCA  = '' THEN
                   PRD.LOCATION.GET PRD.LOC,PN,SHIP.BR
                END ELSE
                   PRD.LOC = LOCA
                END

                PRD.ZONE.GET ,,PRD.LOC,SHIP.BR,SHP.TYP.LOC,EXCL.QUEUE,,WRK.TKT

                IF WRK.TKT THEN GOTO NO.PTR

                PRT.OK = YES
             END

             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
*LOT
             IF LOT.FLAG THEN
                DQS   = 1
                QS    = 1
                QOPEN = 1
             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

             IQ.TO.ALPHA PLNE(3),PRD(7),LD(23),QOPEN,Q1,U1,Q2,U2,QO.ALPHA

             BEGIN CASE
             CASE STATUS = 'T' OR XFER.FLAG OR STATUS = 'O'
                IQ.TO.ALPHA PLNE(3),PRD(7),LD(23),DQS,Q1,U1,Q2,U2,DQS.ALPHA
                PRT.STR  = TRIM(QO.ALPHA)          "R#9":' '
                PRT.STR := TRIM(DQS.ALPHA)         "R#9":' ____ '
                PRT.STR := DESC<1,1>               "L#35"
                DESC<1,-1> = 'Loc: ':LOCA'L#18':' Pn: ':PN "L#6"
                *** Add any xdock comments to the description
                IF LD(129)<1,GEN> THEN
                   XDCT = DCOUNT(LD(129)<1,GEN>,SVM)
                   FOR XD = 1 TO XDCT
                      DESC<1,-1> = LD(129)<1,GEN,XD>
                   NEXT XD
                END
             CASE STATUS = 'B'
                PRT.STR = TRIM(QO.ALPHA)                  "R#9":SPACE(5)
                PRT.STR = PRT.STR:DESC<1,1>               "L#38"
             CASE OTHERWISE
                PRT.STR =TRIM(QO.ALPHA)                   "R#9":SPACE(13)
                PRT.STR = PRT.STR:DESC<1,1>               "L#38"
             END CASE

             SAVE.LINE = PRT.STR

*LOT
             IF LOT.FLAG THEN
                PRT.STR  := SPACE(6)
                FORMS.GET.LOT.PRC "ACK",LDID,GEN,'',UNT.PRC
                PRT.STR := UNT.PRC "R3#11"
                PRT.STR := UNT.PRC "R2#10"
                COL.TOTAL<1,COL.CT> += UNT.PRC
             END ELSE
                OE.GET.PSTYLE OID,GEN,COL.START,COL.FRMTS,COL.BASIS,COL.EXTDS,COL.CT,QS,PRT.STR,COL.TOTAL,SUB.TOTAL
             END

             IF NO.PRICING<LD.NO> THEN PRT.STR = SAVE.LINE
             PG.LINE = REM(BLINE,BOD.LINES)

             BLINE     += 1
             BOD<BLINE> = PRT.STR
             DESC       = DELETE(DESC,1,1)
             GOSUB PRT.XDESC

NO.PTR:   NEXT LOC

          IF REM(BLINE,BOD.LINES) AND (STATUS = "T"  OR XFER.FLAG) THEN
             BLINE += 1
             BOD<BLINE> = ''
          END
*LOT
          IF LOT.FLAG THEN
             OE.LOT.PRINT.SETUP OID,GEN,'S','A',BLINE,SSPC,BOD,,'',LDID
          END

          RETURN
*-------------------------------------------------------------------------*
CHK.DKIT: *** Check if this is a dynamic kit
          IF TRIM(LD(71)<1,GEN>,SVM) # '' THEN DKIT= YES ELSE DKIT = NO
          IF DKIT THEN DKIT.LDS<-1> = LDID
          RETURN
*-------------------------------------------------------------------------*
PRT.XDESC: *
          DESC.CT = DCOUNT(DESC,VM)
          FOR DLN = 1 TO DESC.CT
             PRT.STR = SPACE(SSPC):DESC<1,DLN>
             IF TRIM(PRT.STR) THEN
                BLINE += 1
                BOD<BLINE> = PRT.STR
             END
          NEXT DLN

          RETURN
*-------------------------------------------------------------------------*
PRT.SUBT: *
          IF NOT(NO.TOLS) THEN
             SUBT.SW   = YES
             OE.DESC.GET DESC,ALT.DESC,"SOE Printing"
             SUBT.DESC = DESC<1,1>
             GOSUB SUBTOTALS
             DESC      = DELETE(DESC,1,1)
             GOSUB PRT.XDESC

*            IF STATUS = "T" OR XFER.FLAG THEN
*               BLINE += 1
*               BOD<BLINE> = ''
*            END

             SUBT.SW   = NO
             SUB.TOTAL = ''
          END

          RETURN
*-------------------------------------------------------------------------*
PRT.OS:   *
* ORDER SUMMARY
          GN.CT     = DCOUNT(LED(6),VM)
          OS.MSG    = ''
          PAYMENTS  = 0
          PAID.BY   = ''
          SALES     = 0
          SHIP.CT   = 0

          FOR GN = 1 TO GN.CT
             STAT   = LED(6)<1,GN>
             IF STAT # 'X' AND STAT # 'Y' THEN
                IF STAT = '$' THEN
                   PAYMENTS -= SUM(LED(45)<1,GN>)
                   GOSUB ADD.PAYMT
                END ELSE
                   SHIP.CT  += 1
                   OE.ORDER.TOTAL OID,GN,QSIGN,GEN.TOTAL
                   SALES    += GEN.TOTAL
                END
             END
          NEXT GN

          IF PAYMENTS # 0 THEN
             BAL.AMT     = SALES + PAYMENTS
             IF SHIP.CT > 1 OR ICONV(RUNNING.TOTAL,"MR2") # BAL.AMT THEN
                OS.MSG = STR("*",10):' ORDER SUMMARY ':STR("*",10)
                OS.MSG<1,-1> = 'Total Sales for Order'"R#21":OCONV(SALES,"MR2") "R#14"
                OS.MSG<1,-1> = 'Payments to Date'"R#21":OCONV(PAYMENTS,"MR2") "R#14"
                OS.MSG<1,-1> = SPACE(23):STR('-',12)
                OS.MSG<1,-1> = 'Balance' "R#21":OCONV(BAL.AMT,"MR2") "R#14"
                OS.MSG<1,-1> = STR("*",35)
             END

             IF OS.MSG THEN
                DESC = OS.MSG
                GOSUB PRT.XDESC
             END

             IF PAID.BY THEN
                DESC = PAID.BY
                GOSUB PRT.XDESC
             END
          END

          RETURN
*-------------------------------------------------------------------------*
ADD.PAYMT: *
          PINVN    = LED(8)<1,GN> + 0
          PAY.ID   = OID:'.':PINVN"R%3"
          READ TST FROM ARFILE,PAY.ID ELSE TST = ''
          PAY.DT   = OCONV(TST<3,1>,"D2/")

          IF LED(45)<1,GN,1> THEN
             PAID.BY<1,-1> = PAY.DT:OCONV(LED(45)<1,GN,1>,"MR2") "R#12" :' Cash'
          END

          IF LED(45)<1,GN,2> THEN
             PAID.BY<1,-1> = PAY.DT:OCONV(LED(45)<1,GN,2>,"MR2") "R#12" :' Check# ':LED(46)<1,GN,2>
          END

          IF LED(45)<1,GN,3> THEN
             PAID.BY<1,-1> = PAY.DT:OCONV(LED(45)<1,GN,3>,"MR2") "R#12":' Credit Card ': OCONV(LED(46)<1,GN,3>,"MCA")
          END

          RETURN
*-------------------------------------------------------------------------*
PRT.BO:   *
          GN.CT    = DCOUNT(LED(12),VM)
          BO.CT    = 0
          BO.PNS   = ''
          BO.QTYS  = ''
          BO.LDS   = ''
          XBO.CT   = 0
          XBO.PNS  = ''
          XBO.QTYS = ''
          XBO.LDS  = ''

          FOR GN = 1 TO GN.CT
             STAT   = LED(6)<1,GN,1>
             IF GN # GEN AND LED(8)<1,GN> = '' AND STAT # '$' AND STAT # 'B' AND STAT # 'Y' THEN
                LDIDS = LED(48)<1,GN>
                LD.CT = DCOUNT(LDIDS,SVM)
                FOR LLN = 1 TO LD.CT
                   LDID  = LDIDS<1,1,LLN>
                   LD.GET LDID
                   QTY   = -(SUM(LD(5)<1,GN>) + SUM(LD(6)<1,GN>))
                   IF NUM(LDID) AND LDID#'' AND QTY THEN
                      PN = LD(1)
                      IF STAT # 'X' THEN
                         LOCATE PN IN BO.PNS SETTING PLOC ELSE
                            BO.CT        += 1
                 *          IF BO.CT > 5 THEN GOTO BO.EXIT
                            PLOC          = BO.CT
                            BO.PNS<PLOC>  = PN
                            BO.LDS<PLOC>  = LDID
                         END
                         BO.QTYS<PLOC>   += QTY
                      END ELSE
                         LOCATE PN IN XBO.PNS SETTING PLOC ELSE
                            XBO.CT       += 1
                            PLOC = XBO.CT
                            XBO.PNS<PLOC> = PN
                            XBO.LDS<PLOC> = LDID
                         END
                         XBO.QTYS<PLOC>  += QTY
                      END
                   END
                NEXT LLN
             END
          NEXT GN

BO.EXIT:  IF BO.CT THEN
       *     IF BO.CT > 5 THEN
       *        BLINE += 1
       *        BOD<BLINE> = ''
       *        PRT.STR = "** Future shipments pending."
       *        BLINE += 1
       *        BOD<BLINE> = PRT.STR
       *     END ELSE
                BLINE += 1
                BOD<BLINE> = ''
                PRT.STR = "** The following are scheduled for future shipment:"
                BLINE += 1
                BOD<BLINE> = PRT.STR

                FOR B = 1 TO BO.CT
                   PN   = BO.PNS<B>
                   LDID = BO.LDS<B>
                   LD.GET LDID
                   GET.ALL.PRD BR,PN,QSIGN,GROUP
                   IF PRD(15) = '' THEN UMTBL = PLNE(3) ELSE UMTBL = PRD(15)
                   IQ.TO.ALPHA UMTBL,PRD(7),LD(23),BO.QTYS<B>,Q1,U1,Q2,U2,QO.ALPHA
                  OE.DESC.GET DESC,ALT.DESC,"SOE Printing"
                   PRT.STR    = TRIM(QO.ALPHA)               "R#8"
                   PRT.STR    = PRT.STR:"B/O"                "R#8":'      '
                   PRT.STR    = PRT.STR:DESC<1,1>            "L#35"
                   BLINE     += 1
                   BOD<BLINE> = PRT.STR
                   DESC       = DELETE(DESC,1,1)
                   GOSUB PRT.XDESC
                NEXT B
       *     END
          END

          IF XBO.CT THEN
             BLINE += 1
             BOD<BLINE> = ''
             PRT.STR = "** The following items have been cancelled. **"
             BLINE += 1
             BOD<BLINE> = PRT.STR

             FOR B = 1 TO XBO.CT
                PN   = XBO.PNS<B>
                LDID = XBO.LDS<B>
                LD.GET LDID
                GET.ALL.PRD BR,PN,QSIGN,GROUP
                IF PRD(15) = '' THEN UMTBL = PLNE(3) ELSE UMTBL = PRD(15)
                IQ.TO.ALPHA UMTBL,PRD(7),LD(23),XBO.QTYS<B>,Q1,U1,Q2,U2,QO.ALPHA
                OE.DESC.GET DESC,ALT.DESC,"SOE Printing"
                PRT.STR    = TRIM(QO.ALPHA)                  "R#8"
                PRT.STR    = PRT.STR:"Cancel"                "R#8":'      '
                PRT.STR    = PRT.STR:DESC<1,1>               "L#35"
                BLINE     += 1
                BOD<BLINE> = PRT.STR
                DESC       = DELETE(DESC,1,1)
                GOSUB PRT.XDESC
             NEXT B
          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:  *
          IF (STATUS = 'T' OR STATUS = 'O') AND BO.FLAG THEN GOSUB PRT.BO
*         IF NOT(NO.TOLS) AND STATUS # "B" THEN GOSUB PRT.OS
          IF FT.LGTH = 0 THEN RETURN
          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

          IF PRINT.CREDIT.MSG THEN
             BLINE += 1
             BOD<BLINE> = STR('+ ',35)
             BLINE += 1
             BOD<BLINE> = '+   Thank You For Your Business __________'
             BLINE += 1
             BOD<BLINE> = STR('+ ',35)
          END

          IF STATUS = 'B' THEN
             BLINE += 1
             BOD<BLINE> = ''
             BLINE += 1
             BOD<BLINE> =  SPACE(23):'T H I S  I S  A  Q U O T A T I O N '
             BLINE += 1
             BOD<BLINE> =  SPACE(21):'Prices are firm for 30 days, subject to'
             BLINE += 1
             BOD<BLINE> =  SPACE(23):'change without notice after 30 days.'
             BLINE += 1
             BOD<BLINE> =  SPACE(20):'A P P L I C A B L E  T A X E S  E X T R A !'
          END ELSE
             IF XFER.FLAG OR STATUS = 'T' OR STATUS = 'O' THEN
                BLINE += 1
                BOD<BLINE> = 'Filled by__________________   Checked by__________________   Pieces___________'

                IF NOT(XFER.FLAG) THEN
                   BLINE += 1
                   BOD<BLINE> = ''
                   BLINE += 1
                   BOD<BLINE> = "Customer Signature: _________________________________     Date: ___/___/___ "
                   BLINE += 1
                   BOD<BLINE> = ''
                   BLINE += 1

                   READV SERV.RATE FROM CTRLFILE,'DEFAULT.SERVICE.CHG.PCT',1 ELSE SERV.RATE = '150'

                   SERV.RATE = OCONV(SERV.RATE,'MR2')
                   SERV1     = FIELD(SERV.RATE,'.',1)-0
                   SERV2     = FIELD(SERV.RATE,'.',2)-0
                   IF SERV2  = 0 THEN SERV.RATE = SERV1

                   *** Have to concatenate overdue msg w/CTRL.FTR because
                   *** we only have limited lines to work with.
                   SOE.FTR = 'Overdue accounts will be charged ':SERV.RATE:'% per month finance charge. ':CTRL.FTR
                   OLD.STR = SOE.FTR
                   FOLD.STRING OLD.STR,80,SOE.FTR

                   IF SOE.FTR # '' THEN
                      FTR.MAX = DCOUNT(SOE.FTR,VM)
                      *** Limit footer to 6 lines so it doesn't go beyond
                      *** the page.
                      IF STATUS = "T" THEN
                         IF FTR.MAX > 6 THEN FTR.MAX = 6
                      END ELSE
                         *** Ship orders get 1 less footer line in the
                         *** INIT: subr setup of variable FT.LGTH. So less
                         *** here.
                         IF FTR.MAX > 5 THEN FTR.MAX = 5
                      END
                      FOR FTR.CT = 1 TO FTR.MAX
                         BLINE += 1
                         BOD<BLINE> = SOE.FTR<1,FTR.CT>
                      NEXT FTR.CT
                   END
                END
             END
          END

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

          PRINT CHAR(12):

          RETURN
*-------------------------------------------------------------------------*
CHKCC:    * Check for Credit Card information

          *** Get any Payments that apply to this order...
          SOE.FORMS.GET.CC.INFO OID,GEN,CC.AMT,PAYMENT.IDS

          IF PAYMENT.IDS THEN
             *** Open Credit Card Payment file
             UT.OPEN.FILE "CC.PAYMENTS",CCPFILE,ERR.MSG
             IF ERR.MSG THEN RETURN

             PAYMENT.CT = DCOUNT(PAYMENT.IDS,VM)

             FOR PC = 1 TO PAYMENT.CT
                READ CC FROM CCPFILE,PAYMENT.IDS<1,PC> ELSE CC = ''
                IF CC THEN GOSUB PRTCC
             NEXT PC
          END

          RETURN
*-------------------------------------------------------------------------*
PRTCC:    * Print Credit Card Information
          AUTHDT = OCONV(CC<2>, 'D4/')        ;* Date of Authorization
          AUTH   = CC<3>                      ;* Auth Code
          CHGAMT = OCONV(CC<6>,'MR2')         ;* Amount Charged
          BBATCH = CC<12>                     ;* Banks Batch Reference
          TERMID = CC<15>                     ;* Terminal ID
          MRCHID = CC<16>                     ;* Merchant ID
          REF    = CC<17>                     ;* Item Number
          SWIPE  = CC<20>                     ;* Swipe info

*** Break out swiped data
          IF SWIPE THEN
             CREDIT.CARD.READ.SWIPE SWIPE,TRACK1,TRACK2,CCARD.NO,EXP.DT,CNAME,ERR.MSG
          END ELSE
             CCARD.NO   = CC<4,1>
             EXP.DT     = CC<4,2>
             CNAME      = CC<32>                     ;* Credit Card Holder
          END

          CREDIT.CARD.GET.DEFINE CCARD.NO,TYPE

*** Mask card with X's - only display last 4 numbers
          CCARD.NO  = STR('X',LEN(CCARD.NO)-4):RIGHT(CCARD.NO,4)

*** Print the Credit Card Information on same page, need 13 lines
*** Calculate the number of lines left on page

          LNSLEFT = BOD.LINES - MOD(BLINE, BOD.LINES)
          IF LNSLEFT < 13 THEN
             FOR FILL = 1 TO LNSLEFT
                BLINE += 1
                BOD<BLINE> = ''
             NEXT FILL
          END
          LN = BLINE

          BOD<LN+1>  = ' '
          BOD<LN+2>  = '    *********************** Credit Card Information ************************'
          BOD<LN+3>  = '    *'                            "L#75":'*'
          BOD<LN+4>  = '    * Merchant ID# : ':MRCHID     "L#20"
          BOD<LN+4> := ' Time':TIME.ZONE$:'/Date: ':TIMEDATE()          "L#22":'*'
          BOD<LN+5>  = '    * Card Number  : ':CCARD.NO   "L#20"
          BOD<LN+5> := ' Card Type: ':TYPE                "L#6"
          BOD<LN+6>  = '    * Card Holder  : ':CNAME      "L#20"
          BOD<LN+6> := ' Auth Code: ':AUTH                "L#22":'*'
          BOD<LN+7>  = '    * Charge Amount: $':CHGAMT    "L#19"
          BOD<LN+7> := ' Charge Date: ':AUTHDT            "L#20":'*'
          BOD<LN+8>  = '    *'                            "L#75":'*'
          BOD<LN+9>  = '    *'                            "L#75":'*'
          BOD<LN+10> = '    * Signature    : ':STR('_',34)"L#54":'*'
          BOD<LN+11> = '    *'                            "L#75":'*'
          BOD<LN+12> = '    * I agree to pay above total amount according to card issuer agreement.*'
          BOD<LN+13> = '    *':STR('*', 71)

          BLINE += 13

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

          LOCATION = SV.LOC

          RETURN
*-------------------------------------------------------------------------*
!SMITJR~04/20/10~22:47
