USP_INVOICE_HOLDPAYMENT
Executes the "Invoice: Hold Payment" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being updated. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the update. |
Definition
Copy
CREATE procedure dbo.USP_INVOICE_HOLDPAYMENT
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as begin
if exists(select DISBURSEMENTPROCESS.ID
from dbo.DISBURSEMENTPROCESS
where DISBURSEMENTPROCESS.ID = (select DISBURSEMENTPROCESSID from dbo.INVOICE where INVOICE.ID = @ID))
begin
raiserror('An invoice that is being processed cannot be placed on hold.', 13, 1);
return 0;
end
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
update dbo.INVOICE
set HOLDPAYMENT = 1
,CHANGEDBYID = @CHANGEAGENTID
,DATECHANGED = @CURRENTDATE
from dbo.INVOICE I
where I.ID = @ID
return 0;
end