seperated bill calculation function