'CHCKNAME - shows Supplier's name for carpet given ours or vice versa

external  dpath popuplist() bpopdb() Background() cpath vloadif() fgp bbd

public    ptstr

global    x ProcessChoice() ReturnToMenu() gn


MAIN
single-step off
gn=getenv("ComputerName")
message "gn is:"&str(gn)



  Background()
  while true
    x = popuplist(9,30,13,"Find˙Supplier's˙name Find˙Mr˙Carpet's˙name","",1,0)
    if x = -1
      exit while
    end if
    if ptstr = "Find˙Supplier's˙name"
      ProcessChoice("S")
    else
      ProcessChoice("M")
    end if
  end while

  ReturnToMenu()

END MAIN


FUNCTION ReturnToMenu()
  Background()
  file unload all
  transfer cpath|"pm_menu.psl" in-memory
END FUNCTION ' ReturnToMenu()


FUNCTION ProcessChoice(n)
local y2
  vloadif(dpath|"prodseln.vw")
  while true
    if n = "S"                         'Supplier
      order change physical
      data query execute "not_del" index "cn.idx"
      order sort now dictionary "ProdSupp.idx" fields "[Product_Supplier]" ascending
      y2 = format(" Scroll to find - F3 to search ","M72")
      screen print 21 5 fgp bbd y2
      x = bpopdb("prodseln",4,"i","[Product_Supplier]","L35","[Product_MRC]","L35","[Name]",7,3,20,80,"",0)
' message "ptstr is:"&str(ptstr)
      y2 = format(" Supplier is"&ptstr&"- press any key to continue ","M72")
      screen print 21 5 fgp bbd y2
inchar
    else
      order change physical
      data query execute "not_del" index "cn.idx"
      order sort now dictionary "ProdMRC.idx" fields "[Product_MRC]" ascending
    y2 = format(" Scroll to find - F3 to search ","M72")
    screen print 21 5 fgp bbd y2
      x = bpopdb("prodseln",4,"i","[Product_MRC]","L35","[Product_Supplier]","L35","[Product_Code]",7,3,20,80,"",0)
message "ptstr is:"&str(ptstr)
    end if
  end while
END FUNCTION ' ProcessChoice()



' data query execute "not_del" index "cn"
' order sort now dictionary "ProdMRC" fields "[Product_MRC]" ascending
