When you enter foreign item code, the quantity you enter for it will be the number of units of the main item that will be used for billing. The foreign item code represents a means of bulk billing (qty > 1) or alias billing name (qty = 1).
Your suggestion for grouping items dropdown box by stock_id instead of by item_code would mean that the user must remember the stock_id for each item_code wanted which may not be feasible. The replacement of the i.description with s.description will render both descriptions the same and would make for ambiguity in selection.