Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
86e3c09b
Commit
86e3c09b
authored
Jan 05, 2017
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add benefit on sellings view
parent
a90a5539
Pipeline
#683
passed with stage
in 3 minutes and 17 seconds
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
275 additions
and
233 deletions
+275
-233
club/templates/club/club_sellings.jinja
club/templates/club/club_sellings.jinja
+2
-1
club/views.py
club/views.py
+10
-1
locale/fr/LC_MESSAGES/django.po
locale/fr/LC_MESSAGES/django.po
+263
-231
No files found.
club/templates/club/club_sellings.jinja
View file @
86e3c09b
...
...
@@ -11,7 +11,8 @@
</form>
<p>
{%
trans
%}
Quantity:
{%
endtrans
%}{{
total_quantity
}}
{%
trans
%}
units
{%
endtrans
%}
<br/>
{%
trans
%}
Total:
{%
endtrans
%}{{
total
}}
€
{%
trans
%}
Total:
{%
endtrans
%}{{
total
}}
€
<br/>
{%
trans
%}
Benefit:
{%
endtrans
%}{{
benefit
}}
€
</p>
<table>
<thead>
...
...
club/views.py
View file @
86e3c09b
...
...
@@ -203,6 +203,7 @@ class ClubSellingView(ClubTabsMixin, CanEditMixin, DetailView):
kwargs
[
'result'
]
=
qs
.
all
().
order_by
(
'-id'
)
kwargs
[
'total'
]
=
sum
([
s
.
quantity
*
s
.
unit_price
for
s
in
qs
.
all
()])
kwargs
[
'total_quantity'
]
=
sum
([
s
.
quantity
for
s
in
qs
.
all
()])
kwargs
[
'benefit'
]
=
kwargs
[
'total'
]
-
sum
([
s
.
product
.
purchase_price
for
s
in
qs
.
exclude
(
product
=
None
)])
else
:
kwargs
[
'result'
]
=
qs
[:
0
]
kwargs
[
'form'
]
=
form
...
...
@@ -222,8 +223,11 @@ class ClubSellingCSVView(ClubSellingView):
kwargs
=
self
.
get_context_data
(
**
kwargs
)
writer
=
csv
.
writer
(
response
,
delimiter
=
";"
,
lineterminator
=
'
\n
'
,
quoting
=
csv
.
QUOTE_ALL
)
writer
.
writerow
([
_t
(
'Quantity'
),
kwargs
[
'total_quantity'
]])
writer
.
writerow
([
_t
(
'Total'
),
kwargs
[
'total'
]])
writer
.
writerow
([
_t
(
'Benefit'
),
kwargs
[
'benefit'
]])
writer
.
writerow
([
_t
(
'Date'
),
_t
(
'Counter'
),
_t
(
'Barman'
),
_t
(
'Customer'
),
_t
(
'Label'
),
_t
(
'Quantity'
),
_t
(
'Total'
),
_t
(
'Payment method'
)])
_t
(
'Quantity'
),
_t
(
'Total'
),
_t
(
'Payment method'
)
,
_t
(
'Selling price'
),
_t
(
'Purchase price'
),
_t
(
'Benefit'
)
])
for
o
in
kwargs
[
'result'
]:
row
=
[
o
.
date
,
o
.
counter
]
if
o
.
seller
:
...
...
@@ -234,6 +238,11 @@ class ClubSellingCSVView(ClubSellingView):
else
:
row
.
append
(
''
)
row
=
row
+
[
o
.
label
,
o
.
quantity
,
o
.
quantity
*
o
.
unit_price
,
o
.
get_payment_method_display
()]
if
o
.
product
:
row
.
append
(
o
.
product
.
selling_price
)
row
.
append
(
o
.
product
.
purchase_price
)
row
.
append
(
o
.
product
.
selling_price
-
o
.
product
.
purchase_price
)
else
:
row
=
row
+
[
''
,
''
,
''
]
writer
.
writerow
(
row
)
return
response
...
...
locale/fr/LC_MESSAGES/django.po
View file @
86e3c09b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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