FUNCTION ChooseBranch(cy,cx,n)
local dy #b_nr popstr i x
  vloadif(dpath|"branches.vws")
  if n=0 ' use all branhes
    order change key "[Br_Init]"
    popstr = "All"
  elseif n=1  ' use Profit Centres only
    data query execute "profitcn.dfq" index "pc-1.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' ³ [Profit_Centre]="Y"                                                ³
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
    order sort now dictionary "pc-2.idx" fields "[SalesAnalysis]" ascending
    popstr = blank
  end if
  #b_nr = records                      'message "#b_nr is:"&str(#b_nr)
  for i = 1 to #b_nr
    popstr = popstr&[Br_KA]            'message "popstr is:"&str(popstr)
    data goto record next
  end for
  vunloadif("branches.vws")
  dy = @if((cy+#b_nr+2)>22,22,cy+#b_nr+2)  'message "dy) is:"&str(dy)
  x = popuplist(cy,cx,dy,popstr,"",1,0)    '  x = popuplist(cy,cx,23,popstr,"",1,0)
  if x = -1
    return (-1)
  else
    return (ptstr)
  end if
END FUNCTION ' ChooseBranch(cy,cx)


FUNCTION ChooseShop($b)
  case $b
    when "C"
'       $shop_init = "C"
'       $SHOP_NAME = "Clapham"
      return "Clapham"
    when "F"
'       $shop_init = "F"
'       $SHOP_NAME = "Fulham"
      return "Clapham"
    when "P"
'       $shop_init = "P"
'       $SHOP_NAME = "Putney"
      return "Clapham"
    when "R"
'       $shop_init = "R"
'       $SHOP_NAME = "Raynes"
      return "Clapham"
    when "S"
'       $shop_init = "S"
'       $SHOP_NAME = "Sheen"
      return "Clapham"
    when "T"
'       $shop_init = "T"
'       $SHOP_NAME = "Trade"
      return "Clapham"
    when "W"
'       $shop_init = "W"
'       $SHOP_NAME = "Warehouse"
      return "Clapham"
  end case
END FUNCTION 'ChooseShop()
