          SUBROUTINE (PASSER)
** Version# 17.0002[1] - 02/03/2012 - 09:34am - TSMITH - eclipse
** Copied from BP SOE.DVR.OPEN.ORDERS Version# 17 - 04/05/2007 - 05:37pm - BABS - r8.0base

*** Phantom: SOE.PHR.OPEN.ORDERS
*-------------------------------------------------------------------------*
*** This report returns information on open sales orders.
*-------------------------------------------------------------------------*
*** Parameters:
*** All inputs to determine which data to select.
***   BRCHS      -  Branch, territory, all
***   SD         -  Start Date
***   ED         -  End Date
***   TYPE       -  Date Type: Ship Date, Order Date
***   DET        -  Unused?
***   SORT       -  Sort By: Customer, Order#, Date, Writer
***   CN         -  Select specific Customer (optional)
***   BIDS       -  Bids: Include, Exclude, Only
***   WRI        -  Select specific Writer (optional)
***   PL         -  Select Price Line (optional)
***   FRMT       -  Report Format: Internal, External
***   FITEM      -  Items from additional Select (alt-O)
***   COST.TYPE  -  Cost Type: Generic, Goods Sold, None (1,2,'')
*-------------------------------------------------------------------------*
*** Common Var: DRPT - Not modified.
*-------------------------------------------------------------------------*
          SCREEN

          MFIELD = NO
          GOSUB LOAD.HKEYS

          FITEM = ''
          BR    = ''
          BRCHS = ''
          SD    = ''
          ED    = ''
          DET   = 'S'
          SORT  = 'C'
          TYPE  = 'S'
          CN    = ''
          PL    = ''
          DRPT$ = 'Open Sales Order Report'
          DTYP  = 'Ship Date'
          BIDS  = 'Exclude'
          WRI   = ''
          FRMT  = 'Internal'

          SEL.LIST      = 'Price Line'
          SEL.VALD      = 'PRICE.LINE'
          SEL.CONV      = ''
          FCODE         = ''
          SLCT          = ''
          SLIST         = ''
          PL.LIST       = ''
          PN.LIST       = ''

          SEL.LIST<1,2> = 'Product'
          SEL.VALD<2>   = 'S:VERF.PRD.ID'
          SEL.CONV<1,2> = 'TPRODUCT;X;1;1'
          FCODE<1,2>    = 'PNLIST'
*-------------------------------------------------------------------------*
INBR:     INP.BR 15,3,10,BR,NAME,BRCHS,1,NO
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INBR,INBR,INBR,INBR,INSD,INSD
*-------------------------------------------------------------------------*
INSD:     INP SD,15,4,10,'VD4/'
          IF F12 THEN GOTO FINISH
          IF ED = '' THEN
             ED = SD
             PRINT @(15,5):OCONV(ED,'D4/')
          END
          ON MOVE+1 GOTO INSD,INSD,INBR,INSD,INED,INED
*-------------------------------------------------------------------------*
INED:     INP ED,15,5,10,'VD4/'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INED,INED,INSD,INED,INDTYP,INDTYP
*-------------------------------------------------------------------------*
INDTYP:   INP DTYP,15,6,10,V_'D:Ship Date':VM:'Order Date'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INDTYP,INDTYP,INED,INDTYP,INSORT,INSORT
*-------------------------------------------------------------------------*
INSORT:   INP SORT,15,7,10,V_'D:Customer':VM:'Order#':VM:'Date':VM:'Writer'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INSORT,INSORT,INDTYP,INSORT,INCN,INCN
*-------------------------------------------------------------------------*
INCN:     INP CN,15,8,20,'TENTITY;X;9;9',V_'S:VERF.CUS.ID'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INCN,INCN,INSORT,INCN,INWRI,INWRI
*-------------------------------------------------------------------------*
INWRI:    INP WRI,15,9,10,"MCU",V_'INITIALS'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INWRI,INWRI,INCN,INWRI,INBIDS,INBIDS
*-------------------------------------------------------------------------*
INBIDS:   INP BIDS,15,10,10,V_'D:Exclude':VM:'Include':VM:'Only'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INBIDS,INBIDS,INWRI,INBIDS
*-------------------------------------------------------------------------*
          *** Select Input...
INSLCT:   MFIELD = NO
          *** Go activate the Multi Hotkey...
          GOSUB LOAD.HKEYS

IN$$3:    INP SLCT,15,11,20,V_'D:':SEL.LIST,H_'SOE.DVR.OPEN.ORDERS~INSLCT'

          PRINT @(2,12):SLCT "L#11"

          IF F12 THEN GOTO FINISH

          IF CHANGED THEN
             SLIST = ''
             PRINT @(15,12):SPACE(20)
          END

          SMV = 0
          IF SLCT THEN
             LOCATE SLCT IN SEL.LIST<1> SETTING SMV ELSE GOTO INSLCT
          END

          ON MOVE+1 GOTO INSLCT,INSLCT,INBIDS,INSLCT,INSLIST,INSLIST
*-------------------------------------------------------------------------*
*** Select entities Input...
INSLIST:  IF SLCT # '' THEN
             MFIELD = YES
             *** Go activate the Multi Hotkey...
             GOSUB LOAD.HKEYS
IN$$1:       INP TSLIST,15,12,20,SEL.CONV<1,SMV>,V_SEL.VALD<SMV>
             IF CHANGED THEN SLIST = TSLIST
          END ELSE
             SLIST = ''
          END
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INSLIST,INSLIST,INSLCT,INSLIST,INRFMT,INRFMT
*-------------------------------------------------------------------------*
INRFMT:   MFIELD = NO
          *** Need to make sure the Multi Hotkey isn't active anymore...
          GOSUB LOAD.HKEYS
IN$$4:    INP FRMT,19,13,8,V_'D:Internal':VM:'External',H_'SOE.DVR.OPEN.ORDERS~INRFMT'
          IF F12 THEN GOTO FINISH
          IF SLCT = "" THEN
             ON MOVE+1 GOTO INRFMT,INRFMT,INSLCT,INRFMT,INRFMT,INRFMT
          END ELSE
             ON MOVE+1 GOTO INRFMT,INRFMT,INSLIST,INRFMT,INRFMT,INRFMT
          END
*-------------------------------------------------------------------------*
SUBS:     ON OPTION GOTO DOIT,DOIT,DOIT,FSEL,MULTI
*-------------------------------------------------------------------------*
FSEL:     FILTER.INPUT 'S',FITEM
          RETURN
*-------------------------------------------------------------------------*
DOIT:
          IF OPTION = 4 THEN GOTO FSEL
          IF BRCHS='' THEN PRINT BELL:; RETURN TO INBR
          IF NUM(SD) AND NUM(ED) THEN
             IF SD > ED THEN
                ERR.MESS 1,1,BELL:" Start Date Must be Before End Date"
                RETURN TO INSD
             END
          END

***
          IF FRMT = 'Internal' THEN
             IF OPTION=1 OR OPTION=2 THEN
                PH.COST.AUTH.CHECK COST.TYPE
                IF F12 THEN RETURN TO INRFMT
                IF NOT(COST.TYPE) THEN PRINT BELL:; RETURN TO INRFMT
                END
          END

          IF FRMT = 'External' THEN
             COST.TYPE=3
          END
***
          IF SLCT = "Price Line" THEN
             PL.LIST = SLIST
          END ELSE
             PN.LIST = SLIST
          END

          PH.EXE 'SOE.PHR.OPEN.ORDERS.BETA',BRCHS,BR,SD,ED,DTYP,DET,SORT,CN,BIDS,WRI,PL.LIST,FRMT,FITEM,COST.TYPE,PN.LIST
          IF F12 THEN RETURN
          RETURN TO FINISH
*-------------------------------------------------------------------------*
MULTI:    * This is a window for inputting Multiple Selection

          BEGIN CASE
          CASE SLCT = 'Price Line'
             PHYS.PLINE.SELECT SLIST
             PL.LIST = SLIST
          CASE 1
             MTITLE = 'Multiple ':SLCT
IN$$5:       INP.MULTI SLIST,99,'L',SEL.VALD<SMV>,SEL.CONV<1,SMV>,MTITLE,FCODE<1,SMV>
          END CASE

          IF DCOUNT(SLIST,VM) > 1 THEN
             PSLIST = '*Multi*'
          END ELSE
             PSLIST = SLIST
          END

          PRINT @(15,12):PSLIST "L#20"

          RETURN
*-------------------------------------------------------------------------*
LOAD.HKEYS: *** Re-load the Hotkeys

          MENU.CLEAR

          MENU.LOAD  2,15,5,1,'P'
          MENU.LOAD 10,15,4,1,'H'
          MENU.LOAD 17,15,4,1,'O'
          MENU.LOAD 24,15,4,1,'S'
          *** Determine whether the Multi Hotkey should be active...
          IF MFIELD THEN
             MENU.LOAD 2,17,5,1,'M'
          END ELSE
             MENU.LOAD ,,,,
          END

          RETURN
*-------------------------------------------------------------------------*
FINISH:   WINDOW.CLOSE
          RETURN
!TSMITH~02/03/12~09:34
