          SUBROUTINE (PASSER)
** Version# 19.0002 - 03/15/2010 - 06:40pm - SMITJR - eclipse
*** V19.0002 Change - Custom Coding CUSTOM - 03/15/2010 - SMITJR - eclipse
** Copied from BP PURCH.DVR.PROD.SUM Version# 19 - 11/05/2002 - 01:18pm - AAROND - develop

*-------------------------------------------------------------------------*
*** Subroutine: PURCH.DVR.PROD.SUM
*-------------------------------------------------------------------------*
*** Description: For each product selected for the report, the Product
*** Purchases Summary Report lists the quantity and dollar amount of each
*** product purchased during a designated period of time.
*-------------------------------------------------------------------------*
*** Parameters:
***       PASSER - Not Used                                           (IN)
*-------------------------------------------------------------------------*
*** Common:
***       DRPT$  - Set to report name                                (OUT)
*-------------------------------------------------------------------------*
*** Notes:
*-------------------------------------------------------------------------*


          SCREEN

          DRPT$      = 'Product Purchase Summary Report'
          REQ.FLDS   = ''
          SD         = ''
          ED         = ''
          BRCHS      = ''
          CCN        = ''
          SL.TYP     = ''
          SLIST    = ''
          PN         = ''
          TYP        = ''
          SORTBY     = 'Vendor'
          OPT        = 'Detail'
          TERR.OK    = YES
          FITEM      = ''
          VCSGN      = 'Include'
          INCL.DIRS  = 'Exclude'
          INCL.RETS  = 'Include'
          SLCT       = ''
          FCODE      = ''

          SEL.LIST       = 'Buy Line'
          SEL.VALD       = 'S:VERF.BLNE.ID'
          SEL.CONV       = ''
          SEL.LIST<1,2>  = 'Buy Group'
          SEL.VALD<2>    = 'PRICE-GRP,1'
          SEL.LIST<1,3>  = 'Price Line'
          SEL.VALD<3>    = 'PRICE.LINE'
          SEL.LIST<1,4>  = 'Sell Group'
          SEL.VALD<4>    = 'PRICE-GRP,1'
          SEL.LIST<1,5>  = 'Product'
          SEL.VALD<5>    = 'S:VERF.PRD.ID'
          SEL.CONV<1,5>  = 'TPRODUCT;X;1;1'
          FCODE<1,5>     = 'PNLIST'
          SEL.LIST<1,6>  = 'Char Pipe Category'
          SEL.VALD<6>    = 'PRODUCT,63'

          INCLUDE.OPTS = 'D:,Include,Exclude,Only'

          VALID.TYPS = 'D:,Stock,Defective,Over Shipment,'
          VALID.TYPS := 'Review,Display,Tagged'

          GOSUB LOAD.HOTKEYS
*-------------------------------------------------------------------------*
INBR:     INP.BR 16,3,10,BR,NAME,BRCHS,TERR.OK
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INBR,INBR,INBR,INBR,INSD,INSD
*-------------------------------------------------------------------------*
INSD:     INP SD,16,4,10,'VD4/'
          IF F12 THEN GOTO FINISH
          IF ED = '' THEN
             ED = SD
             PRINT @(16,4):OCONV(ED,'D4/')
          END
          ON MOVE+1 GOTO INSD,INSD,INBR,INSD,INED,INED
*-------------------------------------------------------------------------*
INED:     INP ED,16,5,10,'VD4/'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INED,INED,INSD,INED,INSLCT,INSLCT
*-------------------------------------------------------------------------*
INSLCT:   INP SLCT,16,6,20,V_'D:':SEL.LIST
          PRINT @(3,7):SLCT "L#11"
          IF F12 THEN GOTO FINISH

          IF CHANGED THEN
             SLIST = ''
             PRINT @(16,7):SPACE(10)
          END

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

          *** Go load our hotkeys...
          GOSUB LOAD.HOTKEYS

          ON MOVE+1 GOTO INSLCT,INSLCT,INED,INSLCT,INSLIST,INSLIST
*-------------------------------------------------------------------------*
INSLIST:  IF SLCT # '' THEN
IN$$1:       INP TSLIST,16,7,22,SEL.CONV<1,SMV>,V_SEL.VALD<SMV>
             IF CHANGED THEN SLIST = TSLIST
             IF F12 THEN GOTO FINISH
          END ELSE SLIST = ''
          ON MOVE+1 GOTO INSLIST,INSLIST,INSLCT,INSLIST,INSORT,INSORT
*-------------------------------------------------------------------------*
INSORT:   INP SORTBY,16,8,20,V_'D:,Vendor,Product,Writer,Buy Line,Price Line,Buy Group,Sell Group,Vendor by Price Line'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INSORT,INSORT,INSLIST,INSORT,INOPT,INOPT
*-------------------------------------------------------------------------*
INOPT:    INP OPT,28,9,10,V_'D:Summary':VM:'Detail'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INOPT,INOPT,INSORT,INOPT,INTYP,INTYP
*-------------------------------------------------------------------------*
INTYP:    INP TYP,28,10,13,'MCU',V_VALID.TYPS
          IF F12 THEN GOTO FINISH
          BEGIN CASE
          CASE TYP = 'STOCK'
             TYP = 'S'
          CASE TYP = 'DEFECTIVE'
             TYP = 'F'
          CASE TYP = 'OVER SHIPMENT'
             TYP = 'O'
          CASE TYP = 'REVIEW'
             TYP = 'R'
          CASE TYP = 'DISPLAY'
             TYP = 'L'
          CASE TYP = 'TAGGED'
             TYP = 'T'
          END CASE
          ON MOVE+1 GOTO INTYP,INTYP,INOPT,INTYP,INCCN,INCCN
*-------------------------------------------------------------------------*
INCCN:    INP CCN,28,11,28,'TENTITY;X;9;9',V_'S:VERF.VEN.SF'
          IF F12 THEN GOTO FINISH
          ON MOVE+1 GOTO INCCN,INCCN,INTYP,INCCN,INDIR,INDIR
*-------------------------------------------------------------------------*
*** Directs hotkey
INDIR:    INP DIRS,28,12,7,V_INCLUDE.OPTS
          IF F12 THEN GOTO FINISH
          IF DIRS # INCL.DIRS THEN
             INCL.DIRS = DIRS
          END
          ON MOVE+1 GOTO INDIR,INDIR,INCCN,INDIR,INRET,INRET
*-------------------------------------------------------------------------*
*** Returns
INRET:    INP RETS,28,13,7,V_INCLUDE.OPTS
          IF F12 THEN GOTO FINISH
          IF RETS # INCL.RETS THEN
             INCL.RETS = RETS
          END
          ON MOVE+1 GOTO INRET,INRET,INDIR,INRET,INVCSN,INVCSN
*-------------------------------------------------------------------------*
INVCSN:   INP A,39,14,7,V_INCLUDE.OPTS
          IF F12 THEN GOTO FINISH
          IF A # VCSGN THEN
             VCSGN = A
          END
          ON MOVE+1 GOTO INVCSN,INVCSN,INRET,INVCSN,INVCSN,INVCSN
*-------------------------------------------------------------------------*
FSEL:     FILTER.INPUT "P",FITEM
          RETURN
*-------------------------------------------------------------------------*
MULTI:    * This is a window for inputting Multiple Selection

          BEGIN CASE
          CASE SLCT = 'Price Line'
             PHYS.PLINE.SELECT SLIST
          CASE SLCT = 'Buy Line'
             PHYS.BLINE.SELECT 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 @(16,7):PSLIST "L#22"

          RETURN
*-------------------------------------------------------------------------*
SUBS:     IF OPTION = 4 THEN GOTO FSEL
          IF OPTION = 5 THEN GOTO MULTI

          IF NUM(SD) THEN
             IF SD+0   < 1  THEN REQ.FLDS<-1> = 'Start Date'
          END
          IF NUM(ED) THEN
             IF ED+0   < 1  THEN REQ.FLDS<-1> = 'End Date'
          END
          IF SORTBY    = '' THEN REQ.FLDS<-1> = 'Sortby'
          IF OPT       = '' THEN REQ.FLDS<-1> = 'Detail/Summary'
          IF INCL.DIRS = '' THEN REQ.FLDS<-1> = 'Directs'
          IF VCSGN     = '' THEN REQ.FLDS<-1> = 'Vendor Consignment'
          IF INCL.RETS = '' THEN REQ.FLDS<-1> = 'Returns'

          IF REQ.FLDS # '' THEN
             ERR.MESS 8,3,BELL:'Missing Required Fields(s): ':AM:REQ.FLDS
IN$$2:       INPNO A,,,0
             BEGIN CASE
             CASE REQ.FLDS<1> = 'Start Date'
                REQ.FLDS = ''
                RETURN TO INSD
             CASE REQ.FLDS<1> = 'End Date'
                REQ.FLDS = ''
                RETURN TO INED
             CASE REQ.FLDS<1> = 'Sortby'
                REQ.FLDS = ''
                RETURN TO INSORT
             CASE REQ.FLDS<1> = 'Detail/Summary'
                REQ.FLDS = ''
                RETURN TO INOPT
             CASE REQ.FLDS<1> = 'Directs'
                REQ.FLDS = ''
                RETURN TO INDIR
             CASE REQ.FLDS<1> = 'Vendor Consignment'
                REQ.FLDS = ''
                RETURN TO INVCSN
             END CASE
          END

          IF NUM(SD) AND NUM(ED) THEN
             IF SD > ED THEN
                MESS 5,1,BELL:' Start date must be before end date'
                RETURN TO INSD
             END
          END

          IF BRCHS='' THEN PRINT BELL:; RETURN TO INBR

          PH.EXE 'PURCH.PHR.PROD.SUM.BETA',BRCHS,BR,SD,ED,SLCT,SLIST,TYP,SORTBY,OPT,FITEM,VCSGN,CCN,INCL.DIRS,INCL.RETS

          IF F12 THEN RETURN

          RETURN TO FINISH
*-------------------------------------------------------------------------*
LOAD.HOTKEYS:   *
          MENU.CLEAR
          MENU.LOAD  2,16,3,1,'P'
          MENU.LOAD 10,16,4,1,'H'
          MENU.LOAD 17,16,4,1,'O'
          MENU.LOAD 24,16,4,1,'S'
          IF SLCT THEN
             MENU.LOAD 31,16,11,1,'M'
          END ELSE
             MENU.LOAD ,,,,
          END
          RETURN
*-------------------------------------------------------------------------*
FINISH:   WINDOW.CLOSE
          RETURN
!SMITJR~03/15/10~18:40
