Skip to content

Instantly share code, notes, and snippets.

@hkouns
hkouns / ActiveAttender_noContacts
Created March 15, 2016 02:11
ActiveAttender_noContacts
# just to follow the pattern of using a table to print the report
# for this one a table is not really necessary but we use it anyway for a pattern
fmt0 = '<td><B>{0}</B></td>'
fmt1 = '<td>{0}</td>'
fmt2 = '{0}<br/>'
fmt3 = '<td>{0}/{1}</td>'
# define a shorthand function to make it easy to test for null or empty string
def HasValue(value):
# Constants
#---------------------------------------------------
StartingDate = "'1/4/15'" # Start date for contributions. Notice single quotes are important inside double quotes
EndDateOffset = '-7' #offset in days from current date to be used as endpoint. (example: '-7' would place the end date on this day last week)
#Column Header for Row 0 containing Dates
col0label = "{id: 'Date', label: 'Date', type: 'date'}"
#Column Headers for Row 1-10 value columns
GivingUnits = '''
DECLARE
@startdt DATETIME
, @enddt DATETIME
, @campusid INT = 0
, @pledges INT = 0
, @nontaxded INT = 0
, @includeUnclosed INT = 1;
SET @enddt = GETDATE();
@hkouns
hkouns / RoughVitalStatsTrend
Created February 22, 2016 15:28
Very Rough
import datetime
class AttendTrend(object):
pass
class ContributionTrend(object):
pass
Data.AttendTrendList = []
Data.ContributionTrendList = []
@hkouns
hkouns / Data Verify Test
Created January 4, 2016 21:57
Testing handlebars solution to DataVerification Report
import datetime
D1 = datetime.date.today()
sqlscript = '''
SELECT
p.PeopleId,
p.FamilyId,
p.Name2,
p.FirstName,
p.PreferredName,
GivingUnits = '''
DECLARE
@startdt DATETIME
, @enddt DATETIME
, @campusid INT = 0
, @pledges INT = 0
, @nontaxded INT = 0
, @includeUnclosed INT = 1;
SET @enddt = GETDATE();
@hkouns
hkouns / gist:a1040d8d55391607da5e
Created December 16, 2015 17:03
Script for Testing Handlebars Helpers
GivingUnits = '''
DECLARE
@startdt DATETIME
, @enddt DATETIME
, @campusid INT = 0
, @pledges INT = 0
, @nontaxded INT = 0
, @includeUnclosed INT = 1;
SET @enddt = GETDATE();
DECLARE
@startdt DATETIME = '1/1/15'
, @enddt DATETIME = '12/1/15'
, @campusid INT = 0
, @pledges INT = 0
, @nontaxded INT = 0
, @includeUnclosed INT = 1
;WITH givers AS (
SELECT
sqlpeople = q.QuerySqltoList('GivingUnits',"")
print '<html>'
print '<head>'
print '<style>'
print 'table, th, td {'
print ' border: 1px solid black;'
print '}'
print 'th, td {'
template = '''
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
th, td {
padding: 2px;