#Rachel rallies for Red Deer

The Roundup for February 23, 2019

{# ANDP TWIG - UDPATED 2019-02-06 #} {# BASIC CALCULATIONS #} {% set giftsAllTime = contribution.contributions %} {% set averageGift = sum(column(giftsAllTime, 'transaction_amt'))/max(1, giftsAllTime|length) %} {% set highestGift = column(giftsAllTime, 'transaction_amt')| sort | reverse %} {% set lastGiftDate = contribution.contributions | sort_by("transaction_dt") | last.transaction_dt %} {% set lastGift = contribution.contributions | sort_by("transaction_dt") | last.transaction_amt %} {# ASK CALCULATION FOR 2019 - UPDATE THIS IN 2020! #} {% set total2019Gifts = cons_field.value('2019_total_donated') | replace({ '$':'',',':'' }) %} {% set total2019Rcpt = cons_field.value('2019_total_receiptable') | replace({ '$':'',',':'' }) %} {% set askMAX = cons_field.value('2019_max_gift') | replace({ '$':'',',':'' }) %} {% set askMIN = 5 %} {% set askCAP = (4000 - total2019Gifts) %} {% set ask = cons_field.value('2019_75pct_of_max') | replace({ '$':'',',':'' }) %} {% set ask = min(askCAP, ask) %} {% set ask = max(5, ask) %} {% set askPASS = max(100,ask) %} {% set askMajD = askCAP | replace({ '$':'',',':'' }) %} {% set askMajD = min(askCAP, askMajD) %} {% set askMajD = max(5, askMajD) %} {% set askPASSMajD = max(100,askMajD) %} {% set ask2018 = cons_field.value('2018_total_receiptable') | replace({ '$':'',',':'' }) %} {% set ask2018 = min(askCAP, ask2018) %} {% set ask2018 = max(5, ask2018) %} {% set askPASS2018 = max(100,ask2018) %} {# VALUES YOU CAN USE IN EMAIL AND TOKENS #} {% set askEN = ask|round(0,'floor')|number_format %} {% set askpassURL = askPASS|round(0,'floor') %} {% set askMajDEN = askMajD|round(0,'floor')|number_format %} {% set askpassMajDURL = askPASSMajD|round(0,'floor') %} {% set ask2018EN = ask2018|round(0,'floor')|number_format %} {% set askpass2018URL = askPASS2018|round(0,'floor') %} {% set maxEN = askMAX|round(0,'floor')|number_format %} {% set ytdEN = total2019Gifts|round(0,'floor')|number_format %} {% set total2019GiftsEN = total2019Gifts|round(0,'floor')|number_format %} {% set total2019RcptEN = total2019Rcpt|round(0,'floor')|number_format %} {% set lastEN = lastGift|round(0,'floor')|number_format %} {% set lastGiftDateEN = lastGiftDate | date("Y-m-d") %} {# TAX VALUES #} {% set totalAfterAsk = total2019Rcpt + ask %} {% if totalAfterAsk <= 200 %} {% set tier1 = totalAfterAsk %} {% set taxBackAfterAsk = (tier1 * 0.75) %} {% elseif totalAfterAsk <= 1100 %} {% set tier1 = 200 %} {% set tier2 = totalAfterAsk - tier1 %} {% set taxBackAfterAsk = (tier1 * 0.75) + (tier2 * 0.5) %} {% elseif totalAfterAsk <= 2300 %} {% set tier1 = 200 %} {% set tier2 = 900 %} {% set tier3 = totalAfterAsk - (tier1 + tier2) %} {% set taxBackAfterAsk = (tier1 * 0.75) + (tier2 * 0.5) + (tier3 * 0.33333) %} {% elseif totalAfterAsk > 2300 %} {% set taxBackAfterAsk = 1000 %} {% endif %} {% set taxBackOnAsk = (ask * 0.75) %} {% set taxBackAfterEN = taxBackAfterAsk|round(0,'floor')|number_format(0)|replace({ ('.00'): '' }) %} {% set taxBackEN = taxBackOnAsk|number_format(2)|replace({ ('.00'): '' }) %} {% set taxCostOnAsk = ask - taxBackOnAsk %} {% set taxCostEN = taxCostOnAsk|number_format(2)|replace({ ('.00'): '' }) %} {% set taxCostAfterAsk = totalAfterAsk - taxBackAfterAsk %} {% set taxCostAfterEN = taxCostAfterAsk|number_format(2)|replace({ ('.00'): '' }) %} {# TEST OUTPUT #} {# 2019 total: {{ total2019GiftsEN }} 2019 total: {{ total2019GiftsEN }} 2019 rcpt: {{ total2019RcptEN }} 2019 max: {{ maxEN }} Ask cap: {{ askCAP }} Ask: {{ askEN }} After ask: {{ totalAfterAsk }} Tax back after ask: {{ taxBackAfterEN }} #}