UFN_GLACCOUNT_GETACCOUNTSFROMPARAMETERS_2

Returns a table of debit and credit accounts based on an input table of mapping parameters

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@InputTable UDT_MAPPEDVALUESFORGETACCOUNTS_2 IN

Definition

Copy


    CREATE function [dbo].[UFN_GLACCOUNT_GETACCOUNTSFROMPARAMETERS_2] (@InputTable UDT_MAPPEDVALUESFORGETACCOUNTS_2 readonly)
    returns @OutputTable table (ID uniqueidentifier, DEBITGLACCOUNTSID uniqueidentifier, DEBITGLACCOUNTNUMBER varchar(100), CREDITGLACCOUNTSID uniqueidentifier, CREDITGLACCOUNTNUMBER varchar(100), ACCOUNTNUMBERERROR tinyint)    
    --ACCOUNTNUMBERERROR = 0, no error; 1, AccountCode; 2, Segments; 3, Account does not exist

    as
    begin

      declare @SegmentValues UDT_GLACCOUNT_SEGMENTVALUES;
      insert into @SegmentValues
      select s.ID, s.PDAccountStructureID, s.PDAccountSegmentValueID, s.TransactionType, s.SegType
      from UFN_GLACCOUNT_GETSEGMENTWORKTABLE(@InputTable) s

      insert into @OutputTable
      select ID, DEBITGLACCOUNTSID, DEBITGLACCOUNTNUMBER, CREDITGLACCOUNTSID, CREDITGLACCOUNTNUMBER, ACCOUNTNUMBERERROR
      from dbo.UFN_GLACCOUNT_GETACCOUNTSFROMPARAMETERS_3(@InputTable, @SegmentValues);

      return;

    end