Contributions ========================== .. py:function:: model.GetBundleHeader(date, now, *bundletype) :return: a new BundleHeader object :rtype: BundleHeader :param date date: date associated the bundle, typically the Sunday of the week :param date now: when the bundle was posted :param int bundletype: the BundleHeaderTypeId \*optional, defaults to the id for ChecksAndCash .. py:function:: model.FinishBundle(header) :param BundleHeader header: Sums the totals of items in the bundle, and submits the changes. .. py:function:: model.AddContributionDetail(date, fundid, amount, checkno, routing, account, *contributiontype) :rtype: BundleDetail :return: the new BundleDetail object :param date date: Contribution date :param int fundid: :param str amount: Amount of the gift, a string that can contain $ and commas and be properly parsed as number :param str checkno: :param str routing: the bank routing number on the check :param str account: the account number on the check :param int contributiontype: 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. .. py:function:: model.FirstFundId() :return: 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. .. py:function:: model.DeleteContribution(cid) .. py:function:: model.FetchOrCreateFund(description) .. py:function:: model.ResolveFundId(fundName) .. py:function:: model.ResolveFund(name) .. py:function:: model.MoveFundIdToExistingFundId(fromid, toid, *name) .. py:function:: model.MoveFundIdToNewFundId(fromid, toid, *name) .. py:function:: model.CreateContributionTag(name, dyndata) :return: the string representing the JSON string of the parameters used for the search :rtype: JSON string :param str name: the name of the tag. Take care to use a common prefix and unique names. :param DynamicData dyndata: 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. .. py:function:: model.CreateContributionTagFromSql(name, dyndata, sql) :return: the string representing the JSON string of the SQL parameters used for the search. :rtype: JSON string :param str name: the name of the tag. Take care to use a common prefix and unique names. :param DynamicData dyndata: the DynamicData object that contains some parameters :param str sql: 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. .. py:function:: model.DeleteContributionTags(namelike) :param str namelike: a name for a tag or multiple tags to delete if using a wildcard ``%``. Deletes ContributionTags that match.