Created
December 2, 2011 02:52
-
-
Save hzlzh/1421494 to your computer and use it in GitHub Desktop.
Discount function of TextMate
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
pluralise_licenses: function() { | |
var qty = Math.abs($("input_quantity").value); | |
if (qty == 1) { | |
$("license_pluralism").innerHTML = 'license (' + this.price(39) + ')' | |
} else if (qty > 1) { | |
var discount = 0; | |
if (qty >= 15) { discount = 30 } | |
else if (qty >= 10) { discount = 25 } | |
else if (qty >= 4) { discount = 20 } | |
var eur = Math.round(qty * 39 * (100 - discount) / 100); | |
$("license_pluralism").innerHTML = 'licenses (' + this.price(eur) + ')' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment