Module List > Module DTA tables DTA10200
You are currently viewing the COMPANY database.
Change

COMPANY..DTA10200 Table Definition

(COMPANY..Transaction Analysis Codes)
select * from f_Dyn_GLExtractCC() 
IF OBJECT_ID (N'dbo.f_Dyn_GLExtractCC') IS NOT NULL 
    DROP FUNCTION dbo.f_Dyn_GLExtractCC 
GO 
CREATE FUNCTION dbo.f_Dyn_GLExtractCC() 
RETURNS @gl TABLE (JRNENTRY int, SEQNUMBR int, DEX_ROW_ID int, DTARef varchar(25), 
ACTINDX int, ACCT varchar(4), codeid varchar(25), LTD_AMT numeric(19,2), PTD_AMT numeric(19,2), 
OPENYEAR int, PERIODID int, GLAMT numeric(19,5), linetype varchar(3) ) 
  
AS 
begin 
declare @dtDate datetime 
declare @periodid int 
declare @YEAR1 int 
declare @currentPeriodDT as datetime 
declare @PeriodDT as datetime 
  
--initialize 
set @dtDate = GETDATE() 
  
--get the current period 
select @currentPeriodDT = max(s.PERIODDT) 
    from SY40100 s 
        where SERIES = 2 and ODESCTN = 'General Entry' 
            and PERIODID <> 0 and PERIODDT < @dtDate 
  
--get the period before the current period 
select @PeriodDT = MAX(PeriodDT) 
    from SY40100 
    where SERIES = 2 and ODESCTN = 'General Entry' and PERIODID <> 0 and PERIODDT < @currentPeriodDT 
  
--get the data from the period before the current period 
select @periodid = Periodid, @YEAR1 = year1 
    from SY40100 where PERIODDT = @perioddt; 
  
/* GL TRX */ 
insert into @gl (JRNENTRY, SEQNUMBR ,DEX_ROW_ID , DTARef , ACTINDX, ACCT, codeid,LTD_AMT, PTD_AMT , OPENYEAR , PERIODID , GLAMT, linetype) 
    select gt.JRNENTRY, gt.SEQNUMBR, gt.dex_row_id, dtaCC.dtaref , gt.actindx, left(g.ACTNUMBR_1,4) as ACCT, 
    dtaCC.codeid , convert(numeric(19,2),coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt)) as LTD_AMT, 
    convert(numeric(19,2),case when gt.PERIODID = @periodid then coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt) else 0 end)as PTD_AMT, 
    gt.OPENYEAR , gt.PERIODID , gt.debitamt - gt.crdtamnt as GLAMT, 'GL' 
        from GL20000 gt 
            join GL00100 g on gt.ACTINDX = g.ACTINDX 
            left join DTA10200 dtaCC on dtaCC.dtaref = dbo.f_GLDTAJoin(gt.DTA_Index, gt.ORTRXSRC) 
                and dtaCC.SEQNUMBR = gt.SEQNUMBR and dtaCC.groupid = 'CC' 
        where gt.PERIODID <= @periodid 
            and LEFT (gt.ORTRXSRC,5) in ('glrev', 'gltrx',''
            and gt.OPENYEAR = @YEAR1 
union all 
/* SOP */ 
select gt.JRNENTRY, gt.SEQNUMBR, gt.dex_row_id, dtaCC.dtaref as DTARefTP, gt.actindx, left(g.ACTNUMBR_1,4) as ACCT, 
dtaCC.codeid , convert(numeric(19,2),coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt)) as LTD_AMT, 
convert(numeric(19,2),case when gt.PERIODID = @periodid then coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt) else 0 end)as PTD_AMT, 
gt.OPENYEAR , gt.PERIODID , gt.debitamt - gt.crdtamnt as GLAMT, 'SOP' 
    from GL20000 gt 
        join GL00100 g on gt.ACTINDX = g.ACTINDX 
        left join DTA10200 dtaCC on dtaCC.DOCNUMBR = gt.ORDOCNUM 
            and dtaCC.RMDTYPAL = gt.ORTRXTYP 
            and dtaCC.SEQNUMBR = gt.OrigSeqNum and dtaCC.groupid = 'CC' 
    where gt.PERIODID <= @periodid 
        and LEFT (gt.ORTRXSRC,5) in ('SLSTE'
        and gt.OPENYEAR = @YEAR1 
union all 
/* Payables */ 
select gt.JRNENTRY, gt.SEQNUMBR, gt.dex_row_id, dtaCC.dtaref as DTARefTP, gt.actindx, left(g.ACTNUMBR_1,4) as ACCT, dtaCC.codeid , 
convert(numeric(19,2),coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt)) as LTD_AMT, convert(numeric(19,2),
case when gt.PERIODID = @periodid then coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt) else 0 end)as PTD_AMT, 
gt.OPENYEAR , gt.PERIODID , gt.debitamt - gt.crdtamnt as GLAMT, 'PM' 
    from GL20000 gt 
        join GL00100 g on gt.ACTINDX = g.ACTINDX 
        left join DTA10200 dtaCC on dtaCC.DOCNUMBR = gt.ORCTRNUM 
            and dtaCC.SEQNUMBR = gt.OrigSeqNum 
            and gt.ORTRXTYP <> 6 
            and dtaCC.groupid = 'CC' 
    where gt.PERIODID <= @periodid 
        and LEFT (gt.ORTRXSRC,5) in ('PMCHK', 'PMPAY','PMTRX','PMVPY'
        and gt.OPENYEAR = @YEAR1 
union all 
/* POP */ 
select gt.JRNENTRY, gt.SEQNUMBR, gt.dex_row_id, dtaCC.dtaref as DTARefTP, gt.actindx, left(g.ACTNUMBR_1,4) as ACCT, 
dtaCC.codeid , convert(numeric(19,2),coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt)) as LTD_AMT, 
convert(numeric(19,2),case when gt.PERIODID = @periodid then coalesce(dtaCC.CODEAMT, gt.debitamt - gt.crdtamnt) else 0 end)as PTD_AMT, 
gt.OPENYEAR , gt.PERIODID , gt.debitamt - gt.crdtamnt as GLAMT, 'POP' 
    from GL20000 gt 
        join GL00100 g on gt.ACTINDX = g.ACTINDX 
        left join DTA10200 dtaCC on dtaCC.DOCNUMBR = gt.ORCTRNUM 
            and dtaCC.SEQNUMBR = gt.OrigSeqNum 
            and dtaCC.groupid = 'CC' 
    where gt.PERIODID <= @periodid 
        and LEFT (gt.ORTRXSRC,5) in ('POIVC', 'RECVG'
        and gt.OPENYEAR = @YEAR1 
RETURN 
end 
GO
 

4Penny.net

Field Definitions:

What is the 'source' column?

 Column NameData Type
Default Value
 Source
DTASERIES smallint
0
This is an...(more) Join Now
DTAREF char(25)
''
This is a ...(more) Join Now
ACTINDX int
0
This is a ...(more) Join Now
join ... more text available
SEQNUMBR int
0
This is a ...(more) Join Now
GROUPID char(15)
''
This is an...(more) Join Now
CODEID char(15)
''
This is an...(more) Join Now
DOCNUMBR char(21)
''
This is a ...(more) Join Now
RMDTYPAL smallint
0
This is an...(more) Join Now
POSTDESC char(51)
''
This is a ...(more) Join Now
DTAQNTY numeric(19,5)
0.00
This is th...(more) Join Now
CODEAMT numeric(19,5)
0.00
This is th...(more) Join Now
TRXDATE datetime
'1/1/1900'
This is th...(more) Join Now
DEX_ROW_ID int
auto number (1,1)
Unique ide...(more) Join Now
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3