'BLDINDEX - maintenance program for rebuilding all product related indices

' ipath = L:\INDEX


external   vloadif() vunloadif() messbox() fentrybox() sch scw cpath dpath
external   bpopdb() progress() fgp bgp scr popuplist() fgi bgi remove()
external   progtag() prpath ipath spath sipath makeidx()

' external   path sch scw progress() fgp bgp remove()
' external   progtag() bgi fgi makeidx() sipath


public     ptstr prodcode suppcode $itemtype dsa psa $ccwidx $ccwcode #prec

global     mess1 ItemtypeIndex() OneItemtype() s1 s2 s3 x AllItemtype() s4 s5 s6
global     CCW_Code() Collections() Suppliers() i suppname PISuppInv()


MAIN
' quiet off
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
  single-step off

' sipath=\indices\supp_inv\" 'updates to show latest GdsRcvd for checking to invoices
' pipath=\indices\os_purch\" 'updates for Goods to be received
' ipath =\index\"            'index path for sundry idx's
  while true
    s1 = "ÿÿÿÿITEMTYPES"
    s2 = "ÿSUPPLIER'SÿRANGE"                   'will show latest Gds Rcvd
    s3 = "ÿÿO/SÿPURCHASES"                     'will show latest
    s4 = "ÿÿÿÿCCWÿCodes"
    s5 = "ÿÿTradeÿAccounts"
    s6 = "Supplier'sÿInvoices"                'will show latest Gds Rcvd
    x = popuplist(8,30,15,s1&s2&s3&s4&s5&s6,"",1,0)
    if x = -1
      exit while
    end if
    if ptstr = s1
      ItemtypeIndex()
    elseif ptstr = s2
      execute "one_rnge.rf3" in-memory     'select ONE supplier only
    elseif ptstr = s3                  'OS_PURCHASE
      execute "one_supp.rf3" in-memory     'select ONE supplier only
    elseif ptstr = s4
      CCW_Code()
    elseif ptstr = s5
      Collections()
    elseif ptstr = s6                  'OS_PURCHASE
      PISuppInv()
    end if
  end while

  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
  file unload all
  smartpoke $_ins 1
'   transfer cpath|"pm_menu.psl" in-memory
END MAIN
