Contributions

model.GetBundleHeader(date, now, *bundletype)
Returns:

a new BundleHeader object

Return type:

BundleHeader

Parameters:
  • date (date) – date associated the bundle, typically the Sunday of the week

  • now (date) – when the bundle was posted

  • bundletype (int) – the BundleHeaderTypeId *optional, defaults to the id for ChecksAndCash

model.FinishBundle(header)
Parameters:

header (BundleHeader) –

Sums the totals of items in the bundle, and submits the changes.

model.AddContributionDetail(date, fundid, amount, checkno, routing, account, *contributiontype)
Return type:

BundleDetail

Returns:

the new BundleDetail object

Parameters:
  • date (date) – Contribution date

  • fundid (int) –

  • amount (str) – Amount of the gift, a string that can contain $ and commas and be properly parsed as number

  • checkno (str) –

  • routing (str) – the bank routing number on the check

  • account (str) – the account number on the check

  • contributiontype (int) – the ContributionTypeId *optional, defaults to the id for tax-deductible contribution

This function is a particular purpose function for importing contributions from an external source. The function creates a new Contribution record and a corresponding BundleDetail record. The routing number and account number from a check are stored with the contribution. This way, when a person is associated with the contribution, the combined routing/account value becomes a unique identifier used to look up the person for future checks with the same routing/account value.

The routing number and check numbers can be from a check or another source. These can be any unique identifier possible to associate with a person. A | (pipe character) is used to concatenate the two values together. Only one of the two numbers is required to have a value.

model.FirstFundId()
Returns:

the lowest numbered fundid of active contribution funds.

The function is intended to return default fundid. Only use this if the algorithm returns the church’s default, general giving or tithing fund.

model.DeleteContribution(cid)
model.FetchOrCreateFund(description)
model.ResolveFundId(fundName)
model.ResolveFund(name)
model.MoveFundIdToExistingFundId(fromid, toid, *name)
model.MoveFundIdToNewFundId(fromid, toid, *name)
model.CreateContributionTag(name, dyndata)
Returns:

the string representing the JSON string of the parameters used for the search

Return type:

JSON string

Parameters:
  • name (str) – the name of the tag. Take care to use a common prefix and unique names.

  • dyndata (DynamicData) – the DynamicData object that contains all the parameters used for the search

The ContributionTags table is used to cache sets of contributions so that dashboard reports can run swiftly. This function creates a tag of the contributions matching the given parameters in dyndata.

The search parameters are as follows. All parameters are optional unless Required is indicated.

MinDate

Indicates the earliest date for a contribution. This is required.

MaxDate

The most recent date for a contribution (includes gifts made on that day). Required

CampusId

Matches contributions posted to that campus (use the integer id, not the name of the campus).

NonTaxDed

Optional. Can be one of three integer values: 0 = tax deductible (default), 1 = not tax deductible, -1 = either.

BundleTypes

The description of the BundleType. Can contain one or more separated by commas (no extra spaces around the comma)

FundIds

The comma separated string of one or more fundids. Includes only contributions that are to one of the fundids in the list. If the string starts with ‘<>’ then the search excludes any contributions with a fundid in the list.

ContributionDesc

A string to match the contribution description (notes). The SQL wild card, %, can be used to do partial matches. Includes only contributions that match the description. If the string starts with ‘<>’ then the search excludes any contribution where the description matches the string.

TransactionDesc

A string to match the online transaction description. Includes only online contributions that match the description in the Transaction record. If the string starts with ‘<>’ then the search excludes any contribution that matches the Transaction record.

Source

If the value is 1, then only mobile transactions are included. Otherwise, if the value is 0, then only non-mobile transactions are included. If not specified, then both mobile and non-mobile are included.

ContributionTags

A string that matches the name of a ContributionTag. Includes only contributions that are in a matching ContributionTag. If the string starts with ‘<>’, then the search excludes contributions in a matching ContributionTag.

FromAmount

Includes contributions with an amount greater than or equal (>=) the FromAmount.

ToAmount

Includes contributions with an amount less than (<) the ToAmount.

This function first deletes the ContributionTags of the given name starting over again. You can add dyndata.AddToTag = 1 to dyndata if you want to preserve existing Tags of this name.

model.CreateContributionTagFromSql(name, dyndata, sql)
Returns:

the string representing the JSON string of the SQL parameters used for the search.

Return type:

JSON string

Parameters:
  • name (str) – the name of the tag. Take care to use a common prefix and unique names.

  • dyndata (DynamicData) – the DynamicData object that contains some parameters

  • sql (str) – the SQL code used to identify the contributions

This function works for the same purpose as CreateContributionTag above however, uses SQL to generate a list of ids instead of Contributions2SearchIds. The dyndata contains named arguments passed as parameters to the SQL to so the parameters can be used for whatever purpose you have within the SQL.

Two additional metadata arguments are available for use. One is called Priority to save along with the ContributionTags. The other is called AddToTag to indicate whether the Tag should be overwritten or appended.

With this function, if the options for CreateContributionTag are not sufficient, the SQL approach can be used to supplement the capability to create ContributionTags.

model.DeleteContributionTags(namelike)
Parameters:

namelike (str) – a name for a tag or multiple tags to delete if using a wildcard %.

Deletes ContributionTags that match.