Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calculate() {
- var avgDays = _self.data.ales / 100 * 14 + 30 * (1 - (_self.data.ales || 0) / 100),
- batches = 360 / avgDays,
- annualCapacity = batches * _self.data.fermentCapacity,
- barrelsKegged = annualCapacity * (_self.data.kegged / 100) * (_self.data.turnover / 52),
- halfSplit = Math.ceil(barrelsKegged * ((_self.data.half || 0) / 100) * 2),
- sixthSplit = Math.ceil(barrelsKegged * ((_self.data.sixth || 0) / 100) * 6),
- quarterSplit = Math.ceil(barrelsKegged * (1 - ((_self.data.half || 0) / 100 + (_self.data.sixth || 0) / 100)) * 4),
- totalKegs = halfSplit + quarterSplit + sixthSplit;
- _self.totals = {
- half: halfSplit || 0,
- quarter: quarterSplit || 0,
- sixth: sixthSplit || 0,
- total: totalKegs || 0
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement