USP_DATAFORMTEMPLATE_EDITLOAD_COMPLETEDORDER_PATRON
The load procedure used by the edit dataform template "Completed Order Patron Edit Data 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. |
@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. |
@CONSTITUENTID | uniqueidentifier | INOUT | Patron |
@SAMEASPATRON | bit | INOUT | |
@CREATEADJUSTMENT | bit | INOUT | |
@ADJUSTMENTREASONCODEID | uniqueidentifier | INOUT | Reason |
@PREVIOUSCONSTITUENTID | uniqueidentifier | INOUT |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_COMPLETEDORDER_PATRON
(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@TSLONG bigint = 0 output,
@CONSTITUENTID uniqueidentifier = null output,
@SAMEASPATRON bit = null output,
@CREATEADJUSTMENT bit = null output,
@ADJUSTMENTREASONCODEID uniqueidentifier = null output,
@PREVIOUSCONSTITUENTID uniqueidentifier = null output
)
as
set nocount on;
set @DATALOADED = 0
set @TSLONG = 0
declare @CONSTITUENCYAVAILABLESEGMENTID uniqueidentifier
select
@CONSTITUENCYAVAILABLESEGMENTID = ID
from dbo.PDACCOUNTTABLESAVAILABLEFORSEGMENT
where TABLEID = 'A299FF27-A88C-4286-B59A-F818E50538DC'
if exists(
select 1 from dbo.PDACCOUNTSTRUCTURE
where PDACCOUNTTABLESAVAILABLEFORSEGMENTID = @CONSTITUENCYAVAILABLESEGMENTID
) and exists(
select 1 from dbo.SALESORDERPAYMENT with (nolock)
inner join dbo.REVENUEPOSTED
on REVENUEPOSTED.ID = SALESORDERPAYMENT.PAYMENTID
where SALESORDERPAYMENT.SALESORDERID = @ID
) set @CREATEADJUSTMENT = 1
else
set @CREATEADJUSTMENT = 0
select
@DATALOADED = 1,
@TSLONG = TSLONG,
@CONSTITUENTID = CONSTITUENTID,
@SAMEASPATRON = SAMEASPATRON
from dbo.SALESORDER with (nolock)
where ID = @ID
set @PREVIOUSCONSTITUENTID = @CONSTITUENTID
return 0;