pharmacy calculation