function CHOICE.ORDER.TAKER given STATION.ID
''
'' AUTHOR: Steve Bailey
'' CREATED: 7-25-90
'' DESCRIPTION:
''    This function returns with the least busy order taker that is closest to
''    the current workstation
''

define STATION.ID as an integer variable
define MY.CHOICE as an integer variable

let STATION.ID = STATION.ID

for each ORDER.TAKER, 
    with N.X.ORDER.TAKER(ORDER.TAKER) eq 0, find the first case

if found
    let MY.CHOICE = ORDER.TAKER
else
    for each ORDER.TAKER, compute MY.CHOICE as the 
        minimum(ORDER.TAKER) of N.Q.ORDER.TAKER(ORDER.TAKER)
always

return with MY.CHOICE
end
