USP_DATAFORMTEMPLATE_ADD_CONTROLACCOUNT

The save procedure used by the add dataform template "Subsidiary Ledger Account Add Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@CONTEXTID uniqueidentifier IN Input parameter indicating the context ID for the record being added.
@SUBSIDIARYID uniqueidentifier IN
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@DATAELEMENTS xml IN Data elements
@ALLOWEDIT bit IN Allow accounts to be edited on transactions.
@ALLOWOTHERSUBSIDIARY bit IN Allow accounts to be used as the control accounts on other subsidiary ledgers.
@ALLOWJOURNALENTRY bit IN Allow accounts to be used in Journal Entry.

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_CONTROLACCOUNT (
  @ID uniqueidentifier output,
  @CONTEXTID uniqueidentifier,
  @SUBSIDIARYID uniqueidentifier,
  @CHANGEAGENTID uniqueidentifier = null,
  @DATAELEMENTS xml = null,
  @ALLOWEDIT bit = 0,
  @ALLOWOTHERSUBSIDIARY bit = 0,
  @ALLOWJOURNALENTRY bit = 0
)
as
    set nocount on;

    if @CHANGEAGENTID is null  
        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

    declare @CURRENTDATE datetime
    set @CURRENTDATE = getdate()

  if @ID is null
    set @ID = newid()

    begin try
    exec dbo.USP_CONTROLACCOUNT_VALIDATE @ID, @DATAELEMENTS, @ALLOWJOURNALENTRY, 1, null
    exec dbo.USP_CONTROLACCOUNT_SAVE @SUBSIDIARYID, @ID, @CHANGEAGENTID, @CURRENTDATE, @DATAELEMENTS, @ALLOWEDIT, @ALLOWOTHERSUBSIDIARY, @ALLOWJOURNALENTRY, 1
  end try
    begin catch
        exec dbo.USP_RAISE_ERROR
        return 1
    end catch
return 0;