UFN_INVOICE_GETSTATUS
Returns the status of an invoice
Return
Return Type |
---|
nvarchar(50) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@HOLDPAYMENT | int | IN | |
@BALANCE | money | IN | |
@AMOUNT | money | IN |
Definition
Copy
create function dbo.UFN_INVOICE_GETSTATUS(
@HOLDPAYMENT as int,
@BALANCE as money,
@AMOUNT as money
)
returns nvarchar(50)
with execute as caller
as begin
-- do work here and return a value
declare @STATUS nvarchar(50)
select @STATUS = case
when @HOLDPAYMENT = 1 then 'On hold' -- 1
when @BALANCE = 0 then 'Paid' -- 2
when @AMOUNT>@BALANCE then 'Partially paid' -- 3
else 'Unpaid' end -- 4
return @STATUS
end