Query To Check GL Period Begining Balances with Previous Period Ending Balance(Compare period1_end_balance with period2_begin_balance)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
SELECT
    code.concatenated_segments,
    period1.begin_balance_dr period1_begin_dr,
    period1.begin_balance_cr period1_begin_cr,
    period1.period_net_dr period1_period_dr,
    period1.period_net_cr period1_period_cr,
    period1.begin_balance_dr + period1.period_net_dr period1_end_dr,
    period1.begin_balance_cr + period1.period_net_cr period1_end_cr,
    ( period1.begin_balance_dr + period1.period_net_dr ) - ( period1.begin_balance_cr + period1.period_net_cr ) period1_end_balance,
    period2.begin_balance_dr period2_begin_dr,
    period2.begin_balance_cr period2_begin_cr,
    period2.begin_balance_dr - period2.begin_balance_cr period2_begin_balance,
    period2.period_net_dr period2_period_dr,
    period2.period_net_cr period2_period_cr,
    period2.begin_balance_dr + period2.period_net_dr period2_end_dr,
    period2.begin_balance_cr + period2.period_net_cr period2_end_cr,
    ( period2.begin_balance_dr + period2.period_net_dr ) - ( period2.begin_balance_cr + period2.period_net_cr ) period2_end_balance
FROM
    gl_balances period1,
    gl_balances period2,
    gl_code_combinations_kfv code
WHERE        period1.ledger_id = 2021
    AND      period1.ledger_id = period2.ledger_id
    AND      period1.currency_code = period2.currency_code
    AND      period1.code_combination_id = period2.code_combination_id
    AND      period1.code_combination_id = code.code_combination_id
    AND      period1.currency_code = 'USD'
    AND      period1.actual_flag = 'A'
    AND      code.segment1 = '51'
    AND      period1.period_name = '11-2016'
    AND      period2.period_name = '12-2016'
    --and code.code_combination_id = 719953

Regards Yogesh

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s