'SETENV   - sets environment & variables

external $drive

public   setenv()             '  sets/resets SmartWare II environment
public   clearenv()           ' clears environment set by setenv()

public   cpath dpath ipath lpath upath reqnpath spath tpath uname uconn userv
public   fgs bgs fge bge fgp bgp fgi bgi fgd bgd sch scw scc scr psa dsa
public   currview currlib pmscn pmexe pmsel pmlast ptstr ptval shopmask rbd
public   reqnmask city userid shoplist nr5 nr6 nr8 apath rollmask workers
public   jobnr phone vatrate #margin_A #margin_B #margin_C #margin_D fdp bbd
public   resref ucount #maxleft #minleft BUpath #resvndays shopname pipath
public   prpath #conv_f2m shopstring adpath dly_pstgpath sipath statemntpath
public   cplpath apptres invpath cr_warn gdsoutpath ftrpaytpath remnant_mu
public   ulist[1,5] ptary[1] X_path Xreppath


function setenv()
  uname      = NULL                        'user name
  uconn      = 0                           'network user connection #
  userv      = NULL                        'network server name
  ucount     = 0                           'number of network users
  currview   = NULL                        'current active view
  currlib    = NULL                        'function libraries currently loaded
  smartpoke $_clst 15        ' bg
  smartpoke $_cler 79        ' bg 4 times 16 plus fg 15
'   smartpoke $_clbg           ' bg 4 times 16 plus fg 15
'   smartpoke $_cldp           ' bg 4 times 16 plus fg 15
  smartpoke $_cled 11        ' bg 4 times 16 plus fg 15
'   smartpoke $_clhp           ' bg 4 times 16 plus fg 15
'   smartpoke $_clip           ' bg 4 times 16 plus fg 15
  smartpoke $_clis 112       ' bg 4 times 16 plus fg 15
  smartpoke $_clpl 31           ' bg 4 times 16 plus fg 15
'   smartpoke $_cler 79        ' bg 4 times 16 plus fg 15
'   smartpoke $_cler 79        ' bg 4 times 16 plus fg 15

  fgs        = fgstandard                  'Smartware II
  bgs        = bgstandard                  '    standard
  fge        = fgerror                    '         screen
  bge        = bgerror                    '              color
  fgp        = fgpleasing                 '                   assignments
  bgp        = bgpleasing                 '
  fgi        = fginvpleasing              '
  bgi        = bginvpleasing              '
  fgd        = fgediting                  '
  bgd        = bgediting                  '
' message "$drive) is:"&str($drive)
  lpath        = "c:\SW45\progs\lib\"       'function library path
  cpath        = "c:\SW45\progs\"           'executable code path
  cplpath      = "C:\reports\cpl_reps\"     'stores CPL reports
  dly_pstgpath = "C:\reports\dly_pstg\"     'stores DLY_PSTG reports
  gdsoutpath   = "C:\reports\goodsout\"     'stores GOODSOUT reports
  statemntpath = "C:\reports\statemnt\"     'stores statements
  invpath      = "C:\reports\invoices\"     'stores invoices
  X_path     = $drive|"Xtal_data\"             'data for Crystal reports
  Xreppath   = $drive|"Reports\"               'Crystal reports
  adpath     = $drive|"Indices\aged_drs\"      'confirmation lists sent to shops
  sipath     = $drive|"Indices\supp_inv\"      'index path for price lists
  pipath     = $drive|"Indices\os_purch\"      'index path for O/S purch's
  ipath      = $drive|"Indices\"                  'index path for sundry idx's
  reqnpath   = $drive|"Indices\job_reqs\"      'index path for REQUSN's
  spath      = $drive|"Indices\stk_idx\"               'index path for stock carpets
  dpath      = $drive|"data\"                  'data path
  apath      = $drive|"data\"                  'archive data path
  BUpath     = $drive|":\dump"                   'storage data path for archiving
  prpath     = $drive|"Indices\supprnge\"      'index path for price lists
  ftrpaytpath= $drive|"Indices\ftr_payt\"      'index path for fitter's payments
  upath      = path(defpath)|""            'user home directory
  tpath      = path(defpath)|""            'temp path
  fdp	     = 7
  bbd        = 1
  rbd	     = 4
  sch        = scrheight                  'used by screen display functions
  scw        = scrwidth                   'used by screen display functions
  scr        = int(sch/2)                 'center row
  scc        = int(scw/2)                 'center column
  psa        = NULL                       'prior screen area (under last msg box)
  dsa        = NULL                       'display screen area (actual msg box)
  pmscn      = NULL                       'popmenu pulldown screen area
  pmexe      = NULL                       'popmenu pm_menu.psl execute call
  pmsel      = NULL                       'popmenu pm_menu.psl select item
  pmlast     = 1                          'internal pm_menu() option pointer
  ptstr      = NULL                       'general Pop-Tools string return var
  ptval      = BLANK                      'general Pop-Tools value return var
  redimension  ulist[1,5]
  redimension  ptary[1]
  lock both public
  lock module public[]
  shopmask = "[RrSsWwFfPpTtYyXx]U*4#{#}"
  shopname   = ""
  shopstring = "Fulham Putney Raynes Sheen Trade Warehouse"
  shoplist   = "F P R S T W"
  reqnmask   = "[RrSsWwFfPpTtXxYy]U{#####}\-*2#"
  city       = "*20{[A-Za-z\ ]U}"
  rollmask   = "*5#\/*2#"
  nr5        = "*5{[1234567890.\-]}"
  nr6        = "*6{[1234567890.\-]}"
  nr8        = "*8{[1234567890.\-]}"
  workers    = "DavidG DCoopr TerryB Nick"	  ' spaces within names MUST be Alt-255
  phone      = "###-###-####"
  resref     = "[RrSsWwFfPpTtXxYy]U\R{####}"
  apptres    = "[RrSsWwFfPpTtXxYy]U\P{####}"
  remnant_mu = .75                     ' markup/sqmtr on remnants to cover comm'n
  vatrate    = 17.5
  cr_warn    = 50
  #margin_A  = 0.25
  #margin_B  = 0.3
  #margin_C  = 0.4
  #margin_D  = 0.55
  #maxleft   = 4.00                       ' limits for stock to
  #minleft   = 0.90                       ' be left on roll
  #resvndays = 3                          ' nr of days reservations are active for
  #conv_f2m  = 3.280840
END FUNCTION' setenv()

function clearenv()
unlock module public
clear public
unlock module public[]
clear public[]
end function ' clearenv()
