UFN_PAYMENTTERM_DUEDAYS_DESCRIPTION
Gets a user friendly description for the due days
Return
Return Type |
---|
nvarchar(30) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PAYMENTDUECODE | smallint | IN | |
@DAYSDUE | smallint | IN | |
@DAYOFMONTHDUE | smallint | IN | |
@MONTHDUECODE | smallint | IN |
Definition
Copy
create function dbo.UFN_PAYMENTTERM_DUEDAYS_DESCRIPTION(
@PAYMENTDUECODE smallint = null
,@DAYSDUE smallint = null
,@DAYOFMONTHDUE smallint = null
,@MONTHDUECODE smallint = null
)
returns nvarchar(30)
with execute as caller
as begin
declare @DESC nvarchar(30);
if @PAYMENTDUECODE=0
begin
set @DESC = CONVERT(nvarchar,@DAYSDUE);
if @DAYSDUE = 1
set @DESC = @DESC + + ' day';
else
set @DESC = @DESC + + ' days';
end
else
begin
declare @MONTHDESC nvarchar(10);
if @MONTHDUECODE = 0
set @MONTHDESC = 'current';
else
set @MONTHDESC = 'next';
set @DESC = dbo.UFN_DAYOFMONTH_DESCRIPTION(@DAYOFMONTHDUE) + ' of the ' + @MONTHDESC + ' month';
end;
return @DESC;
end