          SUBROUTINE (OID,DOC.IDS,FORM.IDS,LOCATIONS,FAX.INFO,ACTION.ONLY)
** Version# 28.0002[11] - 11/25/2013 - 01:40pm - TSMITH - eclipse
*** V28.0002 Change - Custom Coding . - 11/25/2013 - TSMITH - eclipse
*** V28.0001 Change - Custom Coding . - 10/29/2013 - TSMITH - eclipse

*** Subroutine - TOE.PRINT.DOCS
*-------------------------------------------------------------------------*
*** Prints the Transfer Shipping Doc
*-------------------------------------------------------------------------*
*** OID - Order ID                                                [IN]
*** DOC.IDS     - The document #'s of the printed items           (IN/OUT)
*** FORM.IDS    - The forms requested to print the documents on   (IN/OUT)
*** LOCATIONS   - The location to print each job                  (OUT)
*** FAX.INFO    - Used from Solar to pass the fax information so  (IN)
***               can just be set using that information and
*** ACTION.ONLY - A variable that restricts what delivery         (IN)
***               mechanism is used in this routine. Solar uses
***               this routine by calling it multiple times,
***               seperately to print, email, and fax. Only do the
***               action (PRINT,EMAIL,FAX) if this option is specified
*-------------------------------------------------------------------------*
          PRINT.ONLY = NO
          FAX.ONLY = NO
          PRT.LOC  = ''

          IF (JAVA.PROC$) THEN
             BEGIN CASE
             CASE ACTION.ONLY = "PRINT"
                PRINT.ONLY = YES
             CASE ACTION.ONLY = "FAX"
                FAX.ONLY = YES
             END CASE
          END

          MODE = OID[1,1]

          DFLT.PRT.STATS = ''
          IF HAJOCA.SITE$ THEN
             READ DFLT.PRT.STATS FROM CTRLFILE,'STATUS.PRINT.DFLTS' ELSE
                DFLT.PRT.STATS = ''
             END
          END

          READV PRT.STATS FROM LEDLFILE,OID,9 ELSE PRT.STATS = ''
          GEN.CT = DCOUNT(LED(9),VM)

          FOR GEN = 1 TO GEN.CT
             PSTAT  = PRT.STATS<1,GEN>
             IF (PRINT.ONLY AND PSTAT # 'Y') OR (FAX.ONLY AND PSTAT # 'F') THEN
                GOTO NO.PRT
             END
             CHK.BR = LED(2)<1,GEN,2>
             * Allow print of Routing Copy
             SHP.BR       = LED(2)<1,GEN,2>
             ORD.STAT     = LED(6)<1,GEN>
             READ BR.REC FROM TERRFILE,SHP.BR THEN
                LOCATE LED(70)<1,GEN> IN BR.REC<18> SETTING SV.POS THEN
                   ** IF routing copy flag and status = Shipped Transfer
                   ** Print a routing copy
                   IF BR.REC<22,SV.POS> AND ORD.STAT = 'S' THEN
                      READV PRT.LOG FROM LEDLFILE,OID,1 ELSE PRT.LOG = ''

                      REPRINT = NO
                      LOCATE 'F' IN PRT.LOG<1,GEN> SETTING POS THEN
                         REPRINT = YES
                      END

                      IF NOT(REPRINT) THEN
                         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
                            READV FORM.OPT FROM CTRBFILE,'FORMS.PRT.TYP~':USR.BR,5 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 FORM.OPT = 'Laser' THEN
                            STATUS = 'F'
                            SOE.PRINT.ORDER OID,GEN,,STATUS
                            GOSUB ADD.DOC.INFO
                         END ELSE
                            STATUS = 'F'
                            SOE.PRINT.WORK.DOT.MATRIX OID,GEN,,STATUS
                            GOSUB ADD.DOC.INFO
                         END
                      END
                   END
                END
             END

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

             IF UPD.WHQ THEN
                SOE.CHECK.INPROCESS NO.PRT,OID,LED(12)<1,GEN>
                IF NO.PRT THEN
                   TMP = 'PICKING'
                   TMP<2> = LED(2)<1,GEN,2>
                   TMP<3> = DATE()
                   TMP<4> = INT(TIME())
                   * add log info
                   LPOS = DCOUNT(TMP<22>,VM)+1
                   TMP<22,LPOS,1> = "RF.STAGE"
                   TMP<22,LPOS,2> = DATE()
                   TMP<22,LPOS,3> = INT(TIME())
                   TMP<22,LPOS,4> = "Items in process"
                   TMP.ID  = OID:'.':LED(12)<1,GEN>'R%4'
                   READV TMP.TST FROM PRVWFILE,TMP.ID,1 ELSE
                      WRITE TMP ON PRVWFILE,TMP.ID
                   END

                END
             END ELSE
                NO.PRT = NO
             END

             BEGIN CASE
             CASE NO.PRT
             CASE PSTAT = 'F'
                DRPT = ''
                IF NOT(JAVA.PROC$) THEN
                   FAX.DATA.GET DRPT,LED(5)<1,GEN>,LED(2)<1,GEN,1>,OID,GEN
                   IF F12 OR DRPT<29,1>='' THEN GOTO NO.PRT
                   FAX.DATA     = DRPT<29>
                END ELSE
                   FAX.DATA     = FAX.INFO<GEN>
                END
                FAX.PHONES   = RAISE(RAISE(FAX.DATA<1,1>))
                FAX.CONTACTS = RAISE(RAISE(FAX.DATA<1,3>))
                FAX.CT = DCOUNT(FAX.PHONES,AM)

                FORM.BR     = LED(2)<1,GEN,2>
                SOLAR.TITLE = "Transfer Order Entry - ":OID
                ECLIPSE.FORMS.ENABLED FORM.BR,SOLAR.TITLE
                FOR FAX.EX = 1 TO FAX.CT
                   FAX.DATA<1,1> = FAX.PHONES<FAX.EX>
                   FAX.DATA<1,3> = FAX.CONTACTS<FAX.EX>
                   DRPT<29> = FAX.DATA
                   TOE.PRINT.ORDER OID,GEN,,,,DRPT=DRPT
                NEXT FAX.EX
                GOSUB GET.PRT.STAT
                OE.UPD.PRINT.STAT OID,GEN,NEW.PRT.STAT
 CASE PSTAT = 'Y'
                FORM.BR     = LED(2)<1,GEN,2>
                SOLAR.TITLE = "Transfer Order Entry - ":OID
                ECLIPSE.FORMS.ENABLED FORM.BR,SOLAR.TITLE
                DRPT = ''
                GOSUB GET.PRT.STAT
                IF OID = 'T1005193]' THEN
                LOCATION = 'BR1.OFFICE'
                PRT.LOC = 'BR1.OFFICE'
                END ELSE
                BT.CN = LED(1)<1,GEN>
                IF BT.CN = '1' THEN
                PRT.LOC = 'PHAN-WH'
                LOCATIONS = 'PHAN-WH'
                END ELSE
                IF BT.CN = '2' THEN
                PRT.LOC = 'GPS2'
                LOCATIONS = 'GPS2'
                END ELSE
                IF BT.CN = '5564' THEN
                PRT.LOC = 'BR5.COUNTER'
                LOCATIONS = 'BR5.COUNTER'
                END ELSE
                PRT.LOC = ''
                END
                END
                END
                END
                TOE.PRINT.ORDER.LASER OID,GEN,"S",,,DRPT,,PRT.LOC
                IF JAVA.PROC$ THEN
                   FORM.IDS<-1>  = JAVA.PASSER$<JP.FORM$>
                   DOC.IDS<-1>   = JAVA.PASSER$<JP.DOC.ID$>
                   LOCATIONS<-1> = LOCATION
                END
                GOSUB ADD.DOC.INFO
                OE.UPD.PRINT.STAT OID,GEN,NEW.PRT.STAT
                RCV.BR = LED(5)<1,GEN>
                IF RCV.BR # '2' THEN
                TOE.PRINT.ORDER.SHIP OID,GEN,"R",,,DRPT,,PRT.LOC
                END
                IF RCV.BR = '2' THEN
                MSG = 'Aight look alive motherfucker! ':OID:' has printed and is on the way!'
                SEND.MESSAGE 'Phantom','JOET',MSG
                END
                IF JAVA.PROC$ THEN
                   FORM.IDS<-1>  = JAVA.PASSER$<JP.FORM$>
                   DOC.IDS<-1>   = JAVA.PASSER$<JP.DOC.ID$>
                   LOCATIONS<-1> = LOCATION
                END
                *GOSUB ADD.DOC.INFO
                *OE.UPD.PRINT.STAT OID,GEN,NEW.PRT.STAT
             END CASE
NO.PRT:   NEXT GEN

          RETURN
*-------------------------------------------------------------------------*
GET.PRT.STAT:*** Done for Hajoca so that the print status stays on Hold
             *** after the shipped transfer is printed. If the transfer
             *** has been transmitted and is being reprinted the print
             *** status should go back to N and not revert to the default.

          NEW.PRT.STAT = 'N'

          IF HAJOCA.SITE$ AND MODE = 'T' THEN
             STAT = LED(6)<1,GEN>
             BEGIN CASE
                CASE STAT = 'S'
                   NEW.PRT.STAT = DFLT.PRT.STATS<1,1,15>
                CASE STAT = 'R'
                   NEW.PRT.STAT = DFLT.PRT.STATS<1,1,16>
                CASE STAT = 'O'
                   NEW.PRT.STAT = DFLT.PRT.STATS<1,1,14>
                CASE OTHERWISE
                    NEW.PRT.STAT = 'N'
             END CASE
             HAJO.XMIT.CHECK OID:'.':LED(8)<1,GEN>"R%3",TST
             IF TST THEN
                NEW.PRT.STAT = 'N'
             END
          END

          RETURN
*-------------------------------------------------------------------------*
ADD.DOC.INFO: *** Add the document information for Solar
          INS.POS   = DCOUNT(DOC.IDS,AM) + 1
          DOC.IDS   = INSERT(DOC.IDS,INS.POS;JAVA.PASSER$<JP.DOC.ID$>)
          FORM.IDS  = INSERT(FORM.IDS,INS.POS;JAVA.PASSER$<JP.FORM$>)
          LOCATIONS = INSERT(LOCATIONS,INS.POS;PRT.LOC)

          RETURN
*-------------------------------------------------------------------------*
!TSMITH~11/25/13~13:40
