835.2.288
by ferdinand
[ADD] missing file |
1 |
select account_id,p.name , period_id,journal_id,sum(debit-credit) |
2 |
from account_move_line l,account_period p |
|
3 |
where p.id=l.period_id and l.state='valid' |
|
4 |
group by account_id,period_id,journal_id,p.name |
|
5 |
order by account_id,period_id,journal_id; |
|
6 |
||
7 |
||
8 |
create view chricar_deloite_compare |
|
9 |
as
|
|
10 |
select account_id,p.name , period_id,sum(debit-credit) as bal11, 0 as bal12, 0 as bal7 |
|
11 |
from account_move_line l,account_period p |
|
12 |
where p.id=l.period_id and l.state='valid' and journal_id = 11 |
|
13 |
group by account_id,period_id,p.name |
|
14 |
union
|
|
15 |
select account_id,p.name , period_id,0 as bal11,-sum(debit-credit) as bal12, 0 as bal7 |
|
16 |
from account_move_line l,account_period p |
|
17 |
where p.id=l.period_id and l.state='valid' and journal_id = 12 |
|
18 |
group by account_id,period_id,p.name |
|
19 |
||
20 |
union
|
|
21 |
select account_id,p.name , period_id,0 as bal11,0 as bal12,sum(debit-credit) as bal7 |
|
22 |
from account_move_line l,account_period p |
|
23 |
where p.id=l.period_id and l.state='valid' and journal_id = 7 |
|
24 |
group by account_id,period_id,p.name |
|
25 |
order by account_id,period_id |
|
26 |
;
|
|
27 |
||
28 |
select account_id,a.name, c.name , period_id, sum(bal11) as bal11,sum(bal12) as bal12,sum(bal7) as bal7, sum(bal7-bal11) as Diff |
|
29 |
from chricar_deloite_compare c, account_account a |
|
30 |
where a.id = c.account_id |
|
31 |
and c.name like '2012%' |
|
32 |
-- and c.name not in ('201201','201202','201203','201204')
|
|
33 |
group by account_id,a.name,c.name , period_id |
|
34 |
having (sum(bal7) !=0 and ( sum(bal11) !=0 or sum(bal12) !=0)) |
|
35 |
and (sum(bal7) != sum(bal11)) |
|
36 |
;
|
|
37 |
||
38 |
select account_id,a.name, c.name , period_id, sum(bal11) as bal11,sum(bal12) as bal12,sum(bal7) as bal7 |
|
39 |
from chricar_deloite_compare c, account_account a |
|
40 |
where a.id = c.account_id |
|
41 |
and c.name like '2012%' |
|
42 |
and c.name not in ('201201','201202','201203','201204') |
|
43 |
group by account_id,a.name,c.name , period_id |
|
44 |
having (sum(bal7) != sum(bal11)) |
|
45 |
;
|