Created
May 20, 2016 15:07
-
-
Save maxehmookau/b13e3d3887317236d82dc79346d01b4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VAT_RATE = 20.0 | |
# Public: Get the total amount for an invoice taking additional users in to | |
# account. | |
# | |
# Params | |
# ex_vat - if true, subtract 20% from amount | |
# | |
# Returns a number | |
def total_amount(ex_vat = false) | |
if number_of_permitted_users <= BASE_PERMITTED_USERS | |
total = instance.subscription_amount | |
else | |
total = instance.subscription_amount + (number_of_permitted_users - BASE_PERMITTED_USERS) * ADDITIONAL_USERS_EACH | |
end | |
if ex_vat | |
return total * (1 - (VAT_RATE / 100.0)) | |
else | |
return total | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment