          PH.ARGS DRPT,BR,BTCH,SEL.STATS,SDATE,EDATE,SEL.IDS,VIEW,FITEM
** Version# 6.0001[7] - 10/08/2013 - 04:25pm - TSMITH - eclipse
*** V6.0001 Change - Custom Coding . - 10/08/2013 - TSMITH - eclipse
*** SUBROUTINE: SOE.PHR.INVOICE.PREVIEW
*-------------------------------------------------------------------------*
*** Builds the Invoice Preview Queue Printable report.
*-------------------------------------------------------------------------*
*** BR - List of branches to build the report                         [IN]
*** BTCH - Batch Number                                               [IN]
*** SEL.STATS - Selection statuses                                    [IN]
*** SDATE - Start Date                                                [IN]
*** EDATE - End Date                                                  [IN]
*** SEL.IDS - Selected IDS                                            [IN]
*** VIEW - View                                                       [IN]
*** FITEM - Filter Items
*-------------------------------------------------------------------------*

          CONVERT VM TO ' ' IN SEL.STATS

          BR.DISP = BR
          CONVERT VM TO ',' IN BR.DISP
          NAME = ''

          TITLE    = 'Invoice Preview Queue: ':OCONV(DATE(),'D2/')
          HDR      = 'Invoice Preview Queue Branch: ':BR.DISP:' on ':OCONV(DATE(),'D2/'):'             Page : ^#####'
          IF BTCH THEN
             HDR<1,2> = "Batch: ":BTCH "L#25":"  "
          END
          IF SEL.STATS THEN
             HDR<1,2> = "Prt Stats: ":SEL.STATS "L#10":"  "
          END
          IF SDATE THEN
             HDR<1,2> = HDR<1,2>:"Starting  ":OCONV(SDATE,"D2/"):"  "
          END
          IF EDATE THEN
             HDR<1,2> = HDR<1,2>:"Ending ":OCONV(EDATE,"D2/")
          END

          BEGIN CASE
          CASE VIEW = 1
             DT.DESC = "ShipDate"
          CASE VIEW = 2
             DT.DESC = "ProcDate"
          CASE VIEW = 3
             DT.DESC = "InvStCde"
          END CASE

          HDR<1,3> = 'Order#         ':DT.DESC:'  Stat Prt Customer':SPACE(23):'Ship Via':SPACE(8):'Writer'
          HDR<1,4> = '-------------- --------  ---- --- ':STR('-',30):' ':STR('-',15):' ':STR('-',6)
          PRINTER.ON 100,TITLE,DOC.ID,HDR,,RPT.DFLT=DRPT

          FILTER.PRINT 'S',FITEM
          ID.CT = DCOUNT(SEL.IDS,VM)
          FOR LN = 1 TO ID.CT
             ID  = SEL.IDS<1,LN>
             GOSUB READ.IT
             PRINT OID                               "L#14 ":

             *** Print the view they are in: Invoice Date, Process Date,
             *** or Invoice Status Code
             BEGIN CASE
             CASE VIEW = 1
                PRINT OCONV(LED(9)<1,GEN>,'D2/')     "L#8" :'  ':
             CASE VIEW = 2
                PRINT OCONV(LED(27)<1,GEN,2>,'D2/')  "L#8" :'  ':
             CASE VIEW = 3
                PRINT '  ':INV.STAT                  "L#6" :'  ':
             END CASE

             PRINT LED(6)<1,GEN>                     "L#5" :
             PRINT PRT.STAT<1,GEN>                   "L#4" :
             PRINT NAME                              "L#30 ":
             PRINT LED(70)<1,GEN>                    "L#15 ":
             PRINT LED(73)<1,GEN>                    "L#7"
          NEXT LN
          PRINTER.OFF DOC.ID

          RETURN
*-------------------------------------------------------------------------*
READ.IT:  *** Read invoice information to be printed
          OID = FIELD(ID,'.',1)
          GID = FIELD(ID,'.',3)+0
          MATREAD LED FROM LEDFILE,OID ELSE MAT LED = ''
          MAT OLED = MAT LED
          READV PRT.STAT FROM LEDLFILE,OID,9 ELSE PRT.STAT = ''
          LOCATE GID IN LED(12)<1> SETTING GEN ELSE RETURN
          READV NAME FROM CUSFILE,LED(5)<1,GEN>,1 ELSE NAME = ''
          IF LED(8)<1,GEN>#'' THEN OID = OID:'.':LED(8)<1,GEN>"R%3"

          AR.ID = FIELD(ID,'.',1,2)
          READV INV.STAT FROM ARFILE,AR.ID,27 ELSE INV.STAT = ''

          RETURN
!TSMITH~10/08/13~16:25
