REVENUESPLITGIFTAIDREFUND

Stores Gift Aid refund information for each revenue split.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
ORIGINALTAXCLAIMNUMBER nvarchar(10) Default = '' Original Tax Claim Number
REFUNDTAXCLAIMNUMBER nvarchar(10) Default = '' Refund Tax Claim Number
DATEREFUNDED datetime yes The date the refund was generated
REFUNDSOURCECODE tinyint Default = 0 The source of this refund.
DATEADDED datetime Default = getdate() Indicates the date this record was added.
DATECHANGED datetime Default = getdate() Indicates the date this record was last changed.
TS timestamp Timestamp.
TSLONG bigint (Computed) yes CONVERT(bigint, TS) Numeric representation of the timestamp.
REASON nvarchar(255) Default = '' Reason refunded.
ORIGINALBASETAXCLAIMAMOUNT money Default = 0 Base Tax Claim Amount
ORIGINALTRANSITIONALTAXCLAIMAMOUNT money Default = 0 Transitional Tax Claim Amount
INCLUDETRANSITIONALAMOUNTCODE tinyint Default = 0 Indicates whether transitional amount is included in TAXCLAIMAMOUNT.
ORIGINALGIFTAMOUNT money Default = 0 Stores the original gift amount to handle cases where the application amounts are changed after a manual refund or sparking an adjustment refund.
ORIGINALCHARITYCLAIMREFERENCENUMBER nvarchar(20) Default = '' The Charity Claim Reference Number under which the original application was claimed.
ORIGINALGIFTDATE datetime yes The date of the original payment when it was refunded.
INCLUDETRANSITIONALAMOUNT nvarchar(48) (Computed) yes CASE [INCLUDETRANSITIONALAMOUNTCODE] WHEN 0 THEN N'Calculate whether to include in tax claim amount' WHEN 1 THEN N'Include in tax claim amount' WHEN 2 THEN N'Exclude from tax claim amount' END Provides a translation for the 'INCLUDETRANSITIONALAMOUNTCODE' field.
ORIGINALCLAIMEDASSPONSORSHIP bit Default = 0 If the original application was claimed as a sponsorship.
ORIGINALTRANSACTIONBASETAXCLAIMAMOUNT money Default = 0 The amount of the original Gift Aid revenue split in transaction currency.
ORIGINALTRANSACTIONTRANSITIONALTAXCLAIMAMOUNT money Default = 0 The amount of the original transitional tax claim in transaction currency.
ORIGINALORGANIZATIONBASETAXCLAIMAMOUNT money Default = 0 The amount of the original tax claim in organization currency.
ORIGINALORGANIZATIONTRANSITIONALTAXCLAIMAMOUNT money Default = 0 The amount of the original transitional tax claim in organization currency.
ORIGINALTRANSACTIONGIFTAMOUNT money Default = 0 Stores the original gift amount to handle cases where the application amounts are changed after a manual refund or sparking an adjustment refund, in transaction currency.
ORIGINALORGANIZATIONGIFTAMOUNT money Default = 0 Stores the original gift amount to handle cases where the application amounts are changed after a manual refund or sparking an adjustment refund, in organization currency.
REFUNDSOURCE nvarchar(38) (Computed) yes CASE [REFUNDSOURCECODE] WHEN 0 THEN N'Eligibility changed' WHEN 1 THEN N'Manually refunded' WHEN 2 THEN N'Application adjusted' WHEN 3 THEN N'Application deleted' WHEN 4 THEN N'Charity claim reference number changed' END
ORIGINALTAXCLAIMAMOUNT money (Computed) yes case when ORIGINALTRANSITIONALTAXCLAIMAMOUNT = 0 then ORIGINALBASETAXCLAIMAMOUNT when dbo.UFN_REVENUESPLITGIFTAID_TRANSITIONALREFLIEFEXPIRED(ID, INCLUDETRANSITIONALAMOUNTCODE) = 0 then ORIGINALBASETAXCLAIMAMOUNT + ORIGINALTRANSITIONALTAXCLAIMAMOUNT else ORIGINALBASETAXCLAIMAMOUNT end
ORIGINALTRANSACTIONTAXCLAIMAMOUNT money (Computed) yes case when ORIGINALTRANSACTIONTRANSITIONALTAXCLAIMAMOUNT = 0 then ORIGINALTRANSACTIONBASETAXCLAIMAMOUNT when dbo.UFN_REVENUESPLITGIFTAID_TRANSITIONALREFLIEFEXPIRED(ID, INCLUDETRANSITIONALAMOUNTCODE) = 0 then ORIGINALTRANSACTIONBASETAXCLAIMAMOUNT + ORIGINALTRANSACTIONTRANSITIONALTAXCLAIMAMOUNT else ORIGINALTRANSACTIONBASETAXCLAIMAMOUNT end
ORIGINALORGANIZATIONTAXCLAIMAMOUNT money (Computed) yes case when ORIGINALORGANIZATIONTRANSITIONALTAXCLAIMAMOUNT = 0 then ORIGINALORGANIZATIONBASETAXCLAIMAMOUNT when dbo.UFN_REVENUESPLITGIFTAID_TRANSITIONALREFLIEFEXPIRED(ID, INCLUDETRANSITIONALAMOUNTCODE) = 0 then ORIGINALORGANIZATIONBASETAXCLAIMAMOUNT + ORIGINALORGANIZATIONTRANSITIONALTAXCLAIMAMOUNT else ORIGINALORGANIZATIONBASETAXCLAIMAMOUNT end

Foreign Keys

Foreign Key Field Type Null Notes Description
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
REVENUESPLITID uniqueidentifier yes FINANCIALTRANSACTIONLINEITEM.ID FK to REVENUESPLIT
PENDINGR68STATUSID uniqueidentifier yes BUSINESSPROCESSSTATUS.ID The business process status id for the R68 process which has an un-committed claim for this revenue application.
CONSTITUENTID uniqueidentifier yes CONSTITUENT.LOCALID The constituent responsible for the original donation. This field is only used for refunds based on deleted revenue applications.
ORIGINALTRANSACTIONCURRENCYID uniqueidentifier yes CURRENCY.ID The transaction currency associated with this revenue.
ORIGINALORGANIZATIONEXCHANGERATEID uniqueidentifier yes CURRENCYEXCHANGERATE.ID The exchange rate used to convert to original organization amount.
ORIGINALBASECURRENCYID uniqueidentifier yes CURRENCY.ID The base currency associated with this revenue.
ORIGINALBASEEXCHANGERATEID uniqueidentifier yes CURRENCYEXCHANGERATE.ID The exchange rate used to convert from transaction amount to amount.

Indexes

Index Name Fields Unique Primary Clustered
IX_REVENUESPLITGIFTAIDREFUND_CONSTITUENTID CONSTITUENTID
IX_REVENUESPLITGIFTAIDREFUND_DATEADDED DATEADDED yes
IX_REVENUESPLITGIFTAIDREFUND_DATECHANGED DATECHANGED
IX_REVENUESPLITGIFTAIDREFUND_ORIGINALCHARITYCLAIMREFERENCENUMBER ORIGINALCHARITYCLAIMREFERENCENUMBER
IX_REVENUESPLITGIFTAIDREFUND_ORIGINALTAXCLAIMNUMBER ORIGINALTAXCLAIMNUMBER
IX_REVENUESPLITGIFTAIDREFUND_PENDINGR68STATUSID PENDINGR68STATUSID
IX_REVENUESPLITGIFTAIDREFUND_REFUNDTAXCLAIMNUMBER REFUNDTAXCLAIMNUMBER
IX_REVENUESPLITGIFTAIDREFUND_REVENUESPLITID REVENUESPLITID
PK_REVENUESPLITGIFTAIDREFUND ID yes yes

Triggers

Trigger Name Description
TR_REVENUESPLITGIFTAIDREFUND_AUDIT_UPDATE
TR_REVENUESPLITGIFTAIDREFUND_AUDIT_DELETE
TR_REVENUESPLITGIFTAIDREFUND_INSERTUPDATE_CURRENCY