UFN_REVENUE_YTDRECEIPTAMOUNT
Returns the total receipt amount value for the year to date.
Return
| Return Type |
|---|
| money |
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_REVENUE_YTDRECEIPTAMOUNT(@CONSTITUENTID uniqueidentifier)
returns money
with execute as caller
as
begin
declare @YTDAMOUNT money;
select
@YTDAMOUNT = sum(coalesce(REVENUE.RECEIPTAMOUNT,0))
from
dbo.REVENUE
where
REVENUE.TYPECODE not in(1,2,3) and REVENUE.CONSTITUENTID = @CONSTITUENTID and year(REVENUE.DATE) = year(getdate()) and REVENUE.DATE <= getdate();
if @YTDAMOUNT is null
set @YTDAMOUNT = 0;
return @YTDAMOUNT;
end