Skip to content

Instantly share code, notes, and snippets.

@hkouns
Created March 15, 2016 02:11
Show Gist options
  • Save hkouns/291e57d4d608124b8d78 to your computer and use it in GitHub Desktop.
Save hkouns/291e57d4d608124b8d78 to your computer and use it in GitHub Desktop.
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):
return value is not None and len(value) > 0
print '<h3><B>Active Attenders with no recent Contact</B></h3>'
print 'This report contains a list of those who are listed as Ative Attenders but have not had a Contact in over 365 days:</br>'
print '</br>'
print '<i>I would encourage you to follow up with those absent let and them know they are missed.</br>'
print '<table cellspacing="10"; style="maxwidth:500px;width:auto;display:table;text-align:left">'
# q is the instance of the QueryFunctions class that is passed in
people = q.QueryList2("ContactReport_ActiveAttend_NoContactfor365","name",True)
print '<tr><td><B>___________________________________</B></td><td><B>___________________________________</B></td><td><B>________________________________</B></td></tr>'
print '<tr><td><B>Name</B></td><td><B>Phone/Email</B></td><td><B>Mailing Address</B></td></tr>'
print '<tr><td><B>___________________________________</B></td><td><B>___________________________________</B></td><td><B>________________________________</B></td></tr>'
if (sum(1 for i in people) > 0):
for p in people:
print '<tr>'
if HasValue(p.TitleCode):
print fmt0.format(p.TitleCode + " " + p.Name)
else:
print fmt0.format(p.Name)
print '<td>'
if HasValue(p.HomePhone):
print fmt2.format(model.FmtPhone(p.HomePhone, "(h)"))
if HasValue(p.CellPhone):
print fmt2.format(model.FmtPhone(p.CellPhone, "(c)"))
if HasValue(p.EmailAddress):
print fmt2.format(p.EmailAddress)
print '</td>'
print '<td>'
if HasValue(p.PrimaryAddress):
print fmt2.format(p.PrimaryAddress)
if HasValue(p.CityStateZip5):
print fmt2.format(p.CityStateZip5)
print '</td></tr>'
print '<tr><td></br></td></tr>'
print '</table>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment