FUNCTION ChooseBranches(cy,cx,n)
local dy popstr i x j #b_nr
  vloadif(dpath|"branches.vws")
  data query execute "profitcn.dfq" index "pc-1.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' ³ [Profit_Centre]="Y"                                                ³
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  order sort now dictionary "pc-2.idx" fields "[SalesAnalysis]" ascending
  popstr = blank
'   #b_nr = records                      'message "#b_nr is:"&str(#b_nr)

' message "areas is:"&str(areas)
  #b_nr=len(areas)
  for j=1 to len(areas)
    data goto record first
    while record<=records
      if [Br_Init] ! mid(areas,j,1)
        popstr = popstr&[Br_KA]        'message "popstr is:"&str(popstr)
        exit while
      else
        data goto record next
      end if
    end while
  end for
  vunloadif("branches.vws")

' message "popstr is:"&str(popstr)
  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
    $shop_name = ptstr
    $shop = upper(left($shop_name,1))  '
  end if
END FUNCTION ' ChooseBranches(cy,cx)
