SELECT (oi.qty * (1 - oi.discount) * oi.sellprice) AS linetotal,
bg.description AS buchungsgruppe,
CASE WHEN COALESCE(e.name, '') = '' THEN e.login ELSE e.name END AS salesman,
SELECT (oi.qty * (1 - oi.discount) * oi.sellprice) AS linetotal,
bg.description AS buchungsgruppe,
CASE WHEN COALESCE(e.name, '') = '' THEN e.login ELSE e.name END AS salesman,