'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 ctgplanpath ctgpath
public   #m_band1 #m_band2 #m_band3 #m_band4 #m_band5 #m_band6 mobfone
public   band1_UCL  band2_UCL  band3_UCL  band4_UCL  band5_UCL  band6_UCL
public   adhoc_F3  adhoc_F5 adhoc_F6 adhoc_F7 adhoc_F8 vat_mu #marginall


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
' 	scr=13

  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 "setenv $drive is:"&str($drive)
' 	fgp=10

	fgp=1
	bgp=15
' message "fgp) is:"&str(fgp)
' message "bgp) is:"&str(bgp)
  	$drive=$drive|":\"					' message "setenv $drive is:"&str($drive)
  	lpath        = "c:\SW2K_NEW\programs\lib\"       'function library path
  	cpath        = "c:\SW2K_NEW\programs\"           'executable code path
 	ctgpath  = $drive|"reports\ctg_tkts\"     'stores Cutting Tickets
  	ctgplanpath  = "V:\Ctgplans\"     'stores Cutting Plans
  	cplpath      = $drive|"reports\cpl_reps\"     'stores CPL reports
  	dly_pstgpath = $drive|"reports\dly_pstg\"     'stores DLY_PSTG reports
  	gdsoutpath   = $drive|"reports\goodsout\"     'stores GOODSOUT reports
  	statemntpath = $drive|"reports\statemnt\"     'stores statements
  	invpath      = $drive|"reports\invoices\"     'stores invoices
  	X_path       = "C:\SW2000\Xtal_data\"             'data for Crystal reports
  	Xreppath     = "C:\SW2000\XReports\"               '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
' message "IPATH is:"&str(ipath)
  	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
   	scr=15
  	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 DavidC Richard Paul Scott"	  ' spaces within names MUST be Alt-255
  	phone      = "###-###-####"
  	mobfone   = "#####-######"
  	resref     = "[RrSsWwFfPpTtXxYy]U\R{####}"
  	apptres    = "[RrSsWwFfPpTtXxYy]U\P{####}"
  	remnant_mu = .75                     ' markup/sqmtr on remnants to cover comm'n
  	vatrate    = 20.0
  	cr_warn    = 50
  	#margin_A  = 0.30                       ' under 30% NOT passed; 30-35%
  	#margin_B  = 0.35                       ' 35-50% passed
  	#margin_C  = 0.50                       ' 50-65% passed but reported
  	#margin_D  = 0.65                       ' over 65% NOT passed
  	#maxleft   = 5.00                       ' limits for stock to
  	#minleft   = 0.60                       ' be left on roll
  	#resvndays = 3                          ' nr of days reservations are active for
  	#conv_f2m  = 3.280840

  	#m_band1 = .50    ' margin for Band 1
  	#m_band2 = .45
  	#m_band3 = .40
  	#m_band4 = .32
  	#m_band5 = .30
  	#m_band6 = .28

  	band1_UCL=50      ' upper cost limit for Band 1
  	band2_UCL=137.50
  	band3_UCL=300
  	band4_UCL=680
  	band5_UCL=1750
  	band6_UCL=2880

  	adhoc_F3=1.75
  	adhoc_F5=2
  	adhoc_F6=1.92
  	adhoc_F7=1.92
  	adhoc_F8=1.75
  	vat_mu = 1+(vatrate/100)
  	#marginall = .01   ' ie 1%

END FUNCTION' setenv()


function clearenv()
unlock module public
clear public
unlock module public[]
clear public[]
end function ' clearenv()

