          SUBROUTINE (AMT,RANGE,AVN,BRCHS,SD,ED)
** Version# 2 - 12/31/1996 - 01:24am - STEELI - develop
*---------Date Ranges
*         1 = User Defined Date Range
*         2 = MTD Date Range
*         3 = YTD Date Range
*         4 = Fiscal MTD Date Range
*         5 = Fiscal YTD Date Range

*---------AVN Definition
*         1 = Sales
*         2 = Gross Profit
*         3 = Gross Profit Percentage
*         4 = Cost of Goods Sold

          DICT.DATE.GET RANGE,BRCHS,SD,ED
          CN.ID = @ID:VM:"1"

          GET.SLS.AMT CN.ID,SD,ED,BRCHS,SLS,GP

          BEGIN CASE
*--------Sales amt
          CASE AVN=1; AMT = SLS
*--------Gross Profit amt
          CASE AVN=2; AMT = GP
*--------Gross Profit Percent
          CASE AVN=3
             IF SLS+0=0 THEN AMT=0 ELSE
                AMT = ICONV(100*GP/SLS,"MR1")
                IF AMT>1000 THEN AMT=1000 ELSE IF AMT<-1000 THEN AMT=-1000
                END
*--------Cost of Goods Sold
          CASE AVN=4; AMT = SLS - GP
          END CASE

          RETURN
!STEELI~12/31/96~01:24
