move budget calculation logic from view to services