Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
b07b408e
Commit
b07b408e
authored
Dec 21, 2016
by
Skia
🤘
Browse files
Fix statements
parent
f6d34baf
Pipeline
#572
passed with stage
in 2 minutes and 40 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
accounting/templates/accounting/journal_statement_nature.jinja
View file @
b07b408e
...
...
@@ -5,7 +5,7 @@
{%
endblock
%}
{%
macro
display_tables
(
dict
)
%}
<h
5
>
{%
trans
%}
Credit
{%
endtrans
%}
</h
5
>
<h
6
>
{%
trans
%}
Credit
{%
endtrans
%}
</h
6
>
<table>
<thead>
<tr>
...
...
@@ -24,7 +24,7 @@
</table>
{%
trans
%}
Total:
{%
endtrans
%}{{
dict
[
'CREDIT_sum'
]
}}
<h
5
>
{%
trans
%}
Debit
{%
endtrans
%}
</h
5
>
<h
6
>
{%
trans
%}
Debit
{%
endtrans
%}
</h
6
>
<table>
<thead>
<tr>
...
...
@@ -48,7 +48,7 @@
<h3>
{%
trans
%}
Statement by nature:
{%
endtrans
%}
{{
object.name
}}
</h3>
{%
for
k
,
v
in
statement.items
()
%}
<h4>
{{
k
}}
</h4>
<h4
style=
"background: lightblue; padding: 4px;"
>
{{
k
}}
:
{{
v
[
'CREDIT_sum'
]
-
v
[
'DEBIT_sum'
]
}}
</h4>
{{
display_tables
(
v
)
}}
<hr>
{%
endfor
%}
...
...
accounting/templates/accounting/journal_statement_person.jinja
View file @
b07b408e
...
...
@@ -22,8 +22,10 @@
<tr>
{%
if
key.target_type
==
"OTHER"
%}
<td>
{{
o.target_label
}}
</td>
{%
el
se
%}
{%
el
if
key
%}
<td><a
href=
"
{{
key.get_absolute_url
()
}}
"
>
{{
key.get_display_name
()
}}
</a></td>
{%
else
%}
<td></td>
{%
endif
%}
<td>
{{
credit_statement
[
key
]
}}
</td>
</tr>
...
...
@@ -48,8 +50,10 @@
<tr>
{%
if
key.target_type
==
"OTHER"
%}
<td>
{{
o.target_label
}}
</td>
{%
el
se
%}
{%
el
if
key
%}
<td><a
href=
"
{{
key.get_absolute_url
()
}}
"
>
{{
key.get_display_name
()
}}
</a></td>
{%
else
%}
<td></td>
{%
endif
%}
<td>
{{
debit_statement
[
key
]
}}
</td>
</tr>
...
...
accounting/views.py
View file @
b07b408e
...
...
@@ -483,12 +483,14 @@ class JournalNatureStatementView(JournalTabsMixin, CanViewMixin, DetailView):
ret
=
collections
.
OrderedDict
()
statement
=
collections
.
OrderedDict
()
total_sum
=
0
for
at
in
AccountingType
.
objects
.
order_by
(
'label'
).
all
():
for
s
at
in
[
None
]
+
list
(
Simplified
AccountingType
.
objects
.
order_by
(
'label'
).
all
()
)
:
sum
=
queryset
.
filter
(
accounting_type__movement_type
=
movement_type
,
accounting_type__code__startswith
=
at
.
code
).
aggregate
(
amount_sum
=
Sum
(
'amount'
))[
'amount_sum'
]
simpleaccounting_type
=
sat
).
aggregate
(
amount_sum
=
Sum
(
'amount'
))[
'amount_sum'
]
if
sat
:
sat
=
sat
.
label
else
:
sat
=
""
if
sum
:
total_sum
+=
sum
statement
[
at
.
label
]
=
sum
statement
[
s
at
]
=
sum
ret
[
movement_type
]
=
statement
ret
[
movement_type
+
"_sum"
]
=
total_sum
return
ret
...
...
@@ -532,8 +534,9 @@ class JournalPersonStatementView(JournalTabsMixin, CanViewMixin, DetailView):
target_id
=
target_id
,
target_type
=
target_type
).
aggregate
(
amount_sum
=
Sum
(
'amount'
))[
'amount_sum'
]
def
statement
(
self
,
movement_type
):
statement
=
{}
for
op
in
Operation
.
objects
.
filter
(
accounting_type__movement_type
=
movement_type
):
statement
=
collections
.
OrderedDict
()
for
op
in
self
.
object
.
operations
.
filter
(
accounting_type__movement_type
=
movement_type
).
order_by
(
'target_type'
,
'target_id'
).
distinct
():
statement
[
op
.
target
]
=
self
.
sum_by_target
(
op
.
target_id
,
op
.
target_type
,
movement_type
)
return
statement
...
...
@@ -563,7 +566,7 @@ class JournalAccountingStatementView(JournalTabsMixin, CanViewMixin, DetailView)
for
at
in
AccountingType
.
objects
.
order_by
(
'code'
).
all
():
sum_by_type
=
self
.
object
.
operations
.
filter
(
accounting_type__code__startswith
=
at
.
code
).
aggregate
(
amount_sum
=
Sum
(
'amount'
))[
'amount_sum'
]
if
sum_by_type
!=
0
:
if
sum_by_type
:
statement
[
at
]
=
sum_by_type
return
statement
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment