Contributions

model.AddContribution(date, fundid, amount, checkno, description, peopleid)
Parameters:
  • date (date) – Contribution date

  • fundid (int) – Fund ID

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

  • checkno (str) – Check number

  • description (str) – Description of the contribution

  • peopleid (int) – People ID of the contributor

Returns:

the new BundleDetail object

Return type:

BundleDetail

Creates a new Contribution record and a corresponding BundleDetail record.

model.AddContribution(date, fundid, amount, checkno, description, peopleid, contributionTypeId)
Parameters:
  • date (date) – Contribution date

  • fundid (int) – Fund ID

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

  • checkno (str) – Check number

  • description (str) – Description of the contribution

  • peopleid (int) – People ID of the contributor

  • contributionTypeId (int) – Contribution type ID

Returns:

the new BundleDetail object

Return type:

BundleDetail

Creates a new Contribution record and a corresponding BundleDetail record with a specific contribution type.

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.CloseBundle(header)
Parameters:

header (BundleHeader) – The bundle header to close

Returns:

True if the bundle was successfully closed, False otherwise

Return type:

bool

Closes a bundle, preventing further modifications.

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.DeleteContribution(cid)
Parameters:

cid (int) – The contribution ID to delete

Deletes a contribution and its associated bundle detail and contribution tags.

model.DeleteContributionTags(namelike)
Parameters:

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

Deletes ContributionTags that match.

model.FetchOrCreateFund(description)
Parameters:

description (str) – The description of the fund to fetch or create

Returns:

The fund object

Return type:

ContributionFund

Fetches an existing fund with the given description or creates a new one if it doesn’t exist.

model.FindBundleHeader(bundleType, referenceId)
Parameters:
  • bundleType (str) – Part of the Bundle Type Description (e.g. “Online”)

  • referenceId (str) – Reference ID for the bundle

Returns:

The first bundle to match the criteria given, or null if none exists

Return type:

BundleHeader

Finds an existing bundle header based on bundle type and reference ID.

model.FindBundleHeader(date, bundleType, referenceId, referenceIdType)
Parameters:
  • date (date) – Bundle Date (required)

  • bundleType (str) – Part of the Bundle Type Description (e.g. “Online”) (optional)

  • referenceId (str) – Reference ID for the bundle (optional)

  • referenceIdType (int) – Reference ID type (optional)

Returns:

The first bundle to match the criteria given, or null if none exists

Return type:

BundleHeader

Finds an existing bundle header based on date, bundle type, reference ID, and reference ID type.

model.FindContribution(peopleId, checkNo, metaInfo, fundId, amount, date)
Parameters:
  • peopleId (int) – People ID (optional)

  • checkNo (str) – Check number (optional)

  • metaInfo (str) – Meta information (optional)

  • fundId (int) – Fund ID (optional)

  • amount (decimal) – Contribution amount (optional)

  • date (date) – Contribution date (optional)

Returns:

The first contribution to match the criteria given, or null if none exists

Return type:

Contribution

Finds an existing contribution based on the provided criteria. At least one parameter should be provided.

model.FindOrCreateBundleHeader(date, bundleType, referenceId, referenceIdType)
Parameters:
  • date (date) – Bundle Date (required)

  • bundleType (str) – Part of the Bundle Type Description (e.g. “Online”) (optional)

  • referenceId (str) – Reference ID for the bundle (optional)

  • referenceIdType (int) – Reference ID type (optional)

Returns:

The first existing bundle to match the criteria given, or creates and returns a new one if none already exists

Return type:

BundleHeader

Finds an existing bundle header based on the provided criteria or creates a new one if none exists.

model.FinishBundle(header)
Parameters:

header (BundleHeader) –

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

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.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.MoveFundIdToExistingFundId(fromid, toid, *name)
Parameters:
  • fromid (int) – The source fund ID

  • toid (int) – The target fund ID

  • name (str) – Optional name for the target fund

Moves all contributions from one fund ID to an existing fund ID.

model.MoveFundIdToNewFundId(fromid, toid, *name)
Parameters:
  • fromid (int) – The source fund ID

  • toid (int) – The target fund ID (must not exist)

  • name (str) – Optional name for the new fund

Moves all contributions from one fund ID to a new fund ID.

model.QueryContributionIds(sql, declarations)
Parameters:
  • sql (str) – SQL query to execute

  • declarations (object) – Parameters to pass to the SQL query

Returns:

A list of contribution IDs

Return type:

IEnumerable<int>

Executes an SQL query and returns a list of contribution IDs.

model.ResolveFund(name)
Parameters:

name (str) – The name of the fund to resolve

Returns:

The fund object, or null if not found

Return type:

ContributionFund

Resolves a fund by name, returning the fund object if found.

model.ResolveFundId(fundName)
Parameters:

fundName (str) – The name or ID of the fund to resolve

Returns:

The fund ID

Return type:

int

Gets a valid fund ID for the fund name or fund ID specified. If it is not found, the first active fund ID is returned (usually 1).



Latest Update

3/28/2025