USP_DATAFORMTEMPLATE_EDITLOAD_REVENUEGLDISTRIBUTIONADJUST
The load procedure used by the edit dataform template "Posted Revenue GL Distribution Edit Form"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter used to load the fields defined on the form. |
@DATALOADED | bit | INOUT | Output parameter indicating whether or not data was actually loaded. |
@GLDISTRIBUTION | xml | INOUT | Revenue GL distribution |
@REVENUEAMOUNT | money | INOUT | Revenue amount |
@ADJUSTMENTDATE | datetime | INOUT | Adjusted Date |
@ADJUSTMENTPOSTDATE | datetime | INOUT | Adjusted Post Date |
@ADJUSTMENTPOSTSTATUSCODE | tinyint | INOUT | Post Status Code |
@ADJUSTMENTREASON | nvarchar(300) | INOUT | Adjustment reason |
@TSLONG | bigint | INOUT | Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_REVENUEGLDISTRIBUTIONADJUST
(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@GLDISTRIBUTION xml = null output,
@REVENUEAMOUNT money = null output,
@ADJUSTMENTDATE datetime = null output,
@ADJUSTMENTPOSTDATE datetime = null output,
@ADJUSTMENTPOSTSTATUSCODE tinyint = null output,
@ADJUSTMENTREASON nvarchar(300) = null output,
@TSLONG bigint = 0 output
)
AS
BEGIN
set nocount on;
set @DATALOADED = 0;
set @TSLONG = 0;
select @ADJUSTMENTDATE = getdate(),
@ADJUSTMENTPOSTDATE = getdate(),
@ADJUSTMENTPOSTSTATUSCODE = 0;
select
@ADJUSTMENTDATE = ADJUSTMENT.DATE,
@ADJUSTMENTPOSTDATE = ADJUSTMENT.POSTDATE,
@ADJUSTMENTPOSTSTATUSCODE = 1,
@ADJUSTMENTREASON = REASON
from dbo.ADJUSTMENT
where REVENUEID = @ID and ADJUSTMENT.POSTSTATUSCODE = 1
select @GLDISTRIBUTION = dbo.UFN_REVENUE_GETGLDISTRIBUTION_TOITEMLISTXML(@ID)
select @REVENUEAMOUNT = sum(AMOUNT) from dbo.REVENUE where REVENUE.ID = @ID
if @REVENUEAMOUNT is not null
begin
set @DATALOADED = 1
select @TSLONG = max(tslong) from dbo.REVENUEGLDISTRIBUTION where REVENUEID = @ID
end
return 0;
END