USP_FINANCIALTRANSACTIONLINEITEM_REVERSE
Creates a reversal for a given line item.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@FINANCIALTRANSACTIONLINEITEMID | uniqueidentifier | IN | |
@CHANGEAGENTID | uniqueidentifier | IN | |
@REVERSALLINEITEMID | uniqueidentifier | INOUT |
Definition
Copy
CREATE procedure dbo.USP_FINANCIALTRANSACTIONLINEITEM_REVERSE
(
@FINANCIALTRANSACTIONLINEITEMID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@REVERSALLINEITEMID uniqueidentifier = null output
)
as
begin
set nocount on;
declare @CURRENTDATE as datetime = getdate();
-- Recreate these as line items
declare @LINEITEMIDS UDT_GENERICID;
insert into @LINEITEMIDS
select @FINANCIALTRANSACTIONLINEITEMID as ID;
declare @REVERSALS table ( ORIGINALID uniqueidentifier, REVERSALID uniqueidentifier);
-- Call the bulk reversal create
insert into @REVERSALS exec dbo.USP_FINANCIALTRANSACTIONLINEITEMS_REVERSE @LINEITEMIDS, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE, 1;
-- Get the new value for the reversal ID
select @REVERSALLINEITEMID = REVERSALID
from @REVERSALS
return 0;
end