GL Trial Balance Query: Difference between revisions

From KeystoneIntranet
Jump to navigation Jump to search
Intra>User
m (1 revision imported)
 
m (1 revision imported)
 

Latest revision as of 12:58, 14 July 2023


select GL_Account Account,Description Name,
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') Cur_Pd_Amt,
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date <= :PD_End_Date and gta.trANS_type<>'B') End_Amt
from gltacct ga 
where ga.account_type='B' 
group by gl_account,Description
union 
select GL_Account Account,Description Name,
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') Pd_Amt,
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date between :yr_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') End_Amt
from gltacct ga 
where ga.account_type='I'
group by gl_account,Description

With Begin Amt column:

select GL_Account Account,Description Name,
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date <:PD_beg_Date and gta.trANS_type<>'B') "Begin Amt",
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') "Current",
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date <= :PD_End_Date and gta.trANS_type<>'B') "Ending Amt"
from gltacct ga 
where ga.account_type='B' 
group by gl_account,Description
union 
select GL_Account Account,Description Name,
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date between :yr_Beg_Date and (-1 + :PD_beg_Date) and gta.trANS_type<>'B') BeginAmt,

(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') Pd_Amt,
(select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account 
and gta.trx_date between :yr_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') End_Amt
from gltacct ga 
where ga.account_type='I'
group by gl_account,Description


Most Excellent Queries