Rachel makes resources rally

The Roundup for December 14, 2018

 

{# ANDP TWIG - UDPATED 2019-12-07 #} {# 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 2018 - UPDATE THIS IN 2019! #} {% set total2018Gifts = cons_field.value('2018_total_donated') | replace({ '$':'',',':'' }) %} {% set total2018Rcpt = cons_field.value('2018_total_receiptable') | replace({ '$':'',',':'' }) %} {% set askMAX = cons_field.value('2018_max_gift') | replace({ '$':'',',':'' }) %} {% set askMIN = 5 %} {% set askCAP = (4000 - total2018Gifts) %} {% set ask = cons_field.value('2018_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 ask2017 = cons_field.value('2017_total_receiptable') | replace({ '$':'',',':'' }) %} {% set ask2017 = min(askCAP, ask2017) %} {% set ask2017 = max(5, ask2017) %} {% set askPASS2017 = max(100,ask2017) %} {# 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 ask2017EN = ask2017|round(0,'floor')|number_format %} {% set askpass2017URL = askPASS2017|round(0,'floor') %} {% set maxEN = askMAX|round(0,'floor')|number_format %} {% set ytdEN = total2018Gifts|round(0,'floor')|number_format %} {% set total2018GiftsEN = total2018Gifts|round(0,'floor')|number_format %} {% set total2018RcptEN = total2018Rcpt|round(0,'floor')|number_format %} {% set lastEN = lastGift|round(0,'floor')|number_format %} {% set lastGiftDateEN = lastGiftDate | date("Y-m-d") %} {# TAX VALUES #} {% set totalAfterAsk = total2018Rcpt + 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 #} {# 2018 total: {{ total2018GiftsEN }} 2018 total: {{ total2018GiftsEN }} 2018 rcpt: {{ total2018RcptEN }} 2018 max: {{ maxEN }} Ask cap: {{ askCAP }} Ask: {{ askEN }} After ask: {{ totalAfterAsk }} Tax back after ask: {{ taxBackAfterEN }} #}